123 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
		
		
			
		
	
	
			123 lines
		
	
	
		
			2.0 KiB
		
	
	
	
		
			Markdown
		
	
	
	
	
	
|   | # Roles API
 | ||
|  | 
 | ||
|  | ## Get available policies list [GET /v3/security/policies]
 | ||
|  | > Get available devops policies
 | ||
|  | 
 | ||
|  | ### Request
 | ||
|  |   * Method: GET | ||
|  |   * Headers: | ||
|  |     *  Accept: application/json | ||
|  | 
 | ||
|  | ### Response
 | ||
|  | **Status: 200** | ||
|  |   * Headers: | ||
|  |     *  Content-Type: application/json | ||
|  |   * Body: | ||
|  | ```json | ||
|  |     [ | ||
|  |       { | ||
|  |         "id" : "policy_id", | ||
|  |         "description" : "policy description", | ||
|  |         "dependencies": ["policy_id"] | ||
|  |       } | ||
|  |     ] | ||
|  | ``` | ||
|  | 
 | ||
|  | ## Get roles list [GET /v3/security/roles]
 | ||
|  | > Get roles list
 | ||
|  | 
 | ||
|  | ### Request
 | ||
|  |   * Method: GET | ||
|  |   * Headers: | ||
|  |     *  Accept: application/json | ||
|  | 
 | ||
|  | ### Response
 | ||
|  | **Status: 200** | ||
|  |   * Headers: | ||
|  |     *  Content-Type: application/json | ||
|  |   * Body: | ||
|  | ```json | ||
|  |     [ | ||
|  |       { | ||
|  |         "id" : "role_id", | ||
|  |         "name" : "role name", | ||
|  |         "description" : "role description", | ||
|  |         "policies": ["policy_id"] | ||
|  |       } | ||
|  |     ] | ||
|  | ``` | ||
|  | 
 | ||
|  | ## Create role [POST /v3/security/role]
 | ||
|  | > Create new role
 | ||
|  | 
 | ||
|  | ### Request
 | ||
|  |   * Method: POST | ||
|  |   * Headers: | ||
|  |     *  Accept: application/json | ||
|  |     *  Content-Type: application/json | ||
|  |   * Body: | ||
|  | ```json | ||
|  | { | ||
|  |     "name" : "role name", | ||
|  |     "description" : "role description", | ||
|  |     "policies": ["policy_id"] | ||
|  | } | ||
|  | ``` | ||
|  | 
 | ||
|  | ### Response
 | ||
|  | **Status: 201** | ||
|  |   * Headers: | ||
|  |     *  Content-Type: application/json | ||
|  |   * Body: | ||
|  | ```json | ||
|  | { | ||
|  |     "id" : "role_id", | ||
|  |     "message" : "Created" | ||
|  | } | ||
|  | ``` | ||
|  | 
 | ||
|  | ## Show role [GET /v3/security/role/:role_id]
 | ||
|  | > Show role with id ':role_id'
 | ||
|  | 
 | ||
|  | ### Request
 | ||
|  |   * Method: GET | ||
|  |   * Headers: | ||
|  |     *  Accept: application/json | ||
|  |   * Params: | ||
|  |     * :role_id - role id  | ||
|  | 
 | ||
|  | ### Response
 | ||
|  | **Status: 200** | ||
|  |   * Headers: | ||
|  |     *  Content-Type: application/json | ||
|  |   * Body: | ||
|  | ```json | ||
|  | { | ||
|  |     "id" : "role_id", | ||
|  |     "name" : "role name", | ||
|  |     "description" : "role description", | ||
|  |     "policies": ["policy_id"] | ||
|  | } | ||
|  | ``` | ||
|  | 
 | ||
|  | ## Delete role [DELETE /v3/security/role/:role_id]
 | ||
|  | > Delete role with id ':role_id'
 | ||
|  | 
 | ||
|  | ### Request
 | ||
|  |   * Method: DELETE | ||
|  |   * Headers: | ||
|  |     *  Accept: application/json | ||
|  |   * Params: | ||
|  |     * :role_id - role id  | ||
|  | 
 | ||
|  | ### Response
 | ||
|  | **Status: 200** | ||
|  |   * Headers: | ||
|  |     *  Content-Type: application/json | ||
|  |   * Body: | ||
|  | ```json | ||
|  | { | ||
|  |     "id" : "role_id", | ||
|  |     "message" : "Deleted" | ||
|  | } | ||
|  | ``` |