pass
+class MethodType(Enum):
+ POST = 'post'
+ PUT = 'put'
+
+
def isnamedtuple(o):
return isinstance(o, tuple) and hasattr(o, '_asdict') and hasattr(o, '_fields')
import logging
-from enum import Enum
from errno import EINVAL
from typing import List, NamedTuple, Optional
from . import APIDoc, APIRouter, CRUDCollectionMethod, CRUDEndpoint, \
EndpointDoc, RESTController, SecretStr
from ._crud import ArrayHorizontalContainer, CRUDMeta, Form, FormField, \
- FormTaskInfo, Icon, SelectionType, TableAction, Validator, \
+ FormTaskInfo, Icon, MethodType, SelectionType, TableAction, Validator, \
VerticalContainer
logger = logging.getLogger("controllers.ceph_users")
cap: str
-class MethodType(Enum):
- POST = 'post'
- PUT = 'put'
-
-
class CephUserEndpoints:
@staticmethod
def _run_auth_command(command: str, *args, **kwargs):
from . import APIDoc, APIRouter, BaseController, CRUDCollectionMethod, \
CRUDEndpoint, Endpoint, EndpointDoc, ReadPermission, RESTController, \
UIRouter, allow_empty_body
-from ._crud import CRUDMeta, Form, FormField, FormTaskInfo, Icon, TableAction, \
- Validator, VerticalContainer
+from ._crud import CRUDMeta, Form, FormField, FormTaskInfo, Icon, MethodType, \
+ TableAction, Validator, VerticalContainer
from ._version import APIVersion
logger = logging.getLogger("controllers.rgw")
field_type='textarea',
validators=[Validator.JSON]),
])
-create_role_form = Form(path='/rgw/user/roles/create',
+create_role_form = Form(path='/rgw/roles/create',
root_container=create_container,
task_info=FormTaskInfo("IAM RGW Role '{role_name}' created successfully",
- ['role_name']))
+ ['role_name']),
+ method_type=MethodType.POST.value)
@CRUDEndpoint(
- router=APIRouter('/rgw/user/roles', Scope.RGW),
+ router=APIRouter('/rgw/roles', Scope.RGW),
doc=APIDoc("List of RGW roles", "RGW"),
actions=[
TableAction(name='Create', permission='create', icon=Icon.ADD.value,
- routerLink='/rgw/user/roles/create')
+ routerLink='/rgw/roles/create')
],
forms=[create_role_form],
permissions=[Scope.CONFIG_OPT],
--- /dev/null
+import { RolesPageHelper } from './roles.po';
+
+describe('RGW roles page', () => {
+ const roles = new RolesPageHelper();
+
+ beforeEach(() => {
+ cy.login();
+ roles.navigateTo();
+ });
+
+ describe('Create, Edit & Delete rgw roles', () => {
+ it('should create rgw roles', () => {
+ roles.navigateTo('create');
+ roles.create('testRole', '/', '{}');
+ roles.navigateTo();
+ roles.checkExist('testRole', true);
+ });
+ });
+});
--- /dev/null
+import { PageHelper } from '../page-helper.po';
+
+const pages = {
+ index: { url: '#/rgw/roles', id: 'cd-crud-table' },
+ create: { url: '#/rgw/roles/create', id: 'cd-crud-form' }
+};
+
+export class RolesPageHelper extends PageHelper {
+ pages = pages;
+
+ columnIndex = {
+ roleName: 2,
+ path: 3,
+ arn: 4
+ };
+
+ @PageHelper.restrictTo(pages.create.url)
+ create(name: string, path: string, policyDocument: string) {
+ cy.get('#formly_3_string_role_name_0').type(name);
+ cy.get('#formly_3_textarea_role_assume_policy_doc_2').type(policyDocument);
+ cy.get('#formly_3_string_role_path_1').type(path);
+ cy.get("[aria-label='Create Role']").should('exist').click();
+ cy.get('cd-crud-table').should('exist');
+ }
+
+ @PageHelper.restrictTo(pages.index.url)
+ checkExist(name: string, exist: boolean) {
+ this.getTableCell(this.columnIndex.roleName, name).should(($elements) => {
+ const roleName = $elements.map((_, el) => el.textContent).get();
+ if (exist) {
+ expect(roleName).to.include(name);
+ } else {
+ expect(roleName).to.not.include(name);
+ }
+ });
+ }
+}
path: 'roles',
data: {
breadcrumbs: 'Roles',
- resource: 'api.rgw.user.roles@1.0',
+ resource: 'api.rgw.roles@1.0',
tabs: [
{
name: 'Users',
- jwt: []
tags:
- RgwDaemon
+ /api/rgw/roles:
+ get:
+ parameters: []
+ responses:
+ '200':
+ content:
+ application/vnd.ceph.api.v1.0+json:
+ type: object
+ description: OK
+ '400':
+ description: Operation exception. Please check the response body for details.
+ '401':
+ description: Unauthenticated access. Please login first.
+ '403':
+ description: Unauthorized access. Please check your permissions.
+ '500':
+ description: Unexpected error. Please check the response body for the stack
+ trace.
+ security:
+ - jwt: []
+ summary: List RGW roles
+ tags:
+ - RGW
+ post:
+ parameters: []
+ requestBody:
+ content:
+ application/json:
+ schema:
+ properties:
+ role_assume_policy_doc:
+ default: ''
+ type: string
+ role_name:
+ default: ''
+ type: string
+ role_path:
+ default: ''
+ type: string
+ type: object
+ responses:
+ '201':
+ content:
+ application/vnd.ceph.api.v1.0+json:
+ type: object
+ description: Resource created.
+ '202':
+ content:
+ application/vnd.ceph.api.v1.0+json:
+ type: object
+ description: Operation is still executing. Please check the task queue.
+ '400':
+ description: Operation exception. Please check the response body for details.
+ '401':
+ description: Unauthenticated access. Please login first.
+ '403':
+ description: Unauthorized access. Please check your permissions.
+ '500':
+ description: Unexpected error. Please check the response body for the stack
+ trace.
+ security:
+ - jwt: []
+ summary: Create Ceph User
+ tags:
+ - RGW
/api/rgw/site:
get:
parameters:
- jwt: []
tags:
- RgwUser
- /api/rgw/user/roles:
- get:
- parameters: []
- responses:
- '200':
- content:
- application/vnd.ceph.api.v1.0+json:
- type: object
- description: OK
- '400':
- description: Operation exception. Please check the response body for details.
- '401':
- description: Unauthenticated access. Please login first.
- '403':
- description: Unauthorized access. Please check your permissions.
- '500':
- description: Unexpected error. Please check the response body for the stack
- trace.
- security:
- - jwt: []
- summary: List RGW roles
- tags:
- - RGW
- post:
- parameters: []
- requestBody:
- content:
- application/json:
- schema:
- properties:
- role_assume_policy_doc:
- default: ''
- type: string
- role_name:
- default: ''
- type: string
- role_path:
- default: ''
- type: string
- type: object
- responses:
- '201':
- content:
- application/vnd.ceph.api.v1.0+json:
- type: object
- description: Resource created.
- '202':
- content:
- application/vnd.ceph.api.v1.0+json:
- type: object
- description: Operation is still executing. Please check the task queue.
- '400':
- description: Operation exception. Please check the response body for details.
- '401':
- description: Unauthenticated access. Please login first.
- '403':
- description: Unauthorized access. Please check your permissions.
- '500':
- description: Unexpected error. Please check the response body for the stack
- trace.
- security:
- - jwt: []
- summary: Create Ceph User
- tags:
- - RGW
/api/rgw/user/{uid}:
delete:
parameters: