Пример #1
0
class OSAuth1API(ks_flask.APIBase):
    _name = 'OS-OAUTH1'
    _import_name = __name__
    _api_url_prefix = '/OS-OAUTH1'
    resources = [ConsumerResource]
    resource_mapping = [
        ks_flask.construct_resource_map(
            resource=RequestTokenResource,
            url='/request_token',
            resource_kwargs={},
            rel='request_tokens',
            resource_relation_func=_build_resource_relation),
        ks_flask.construct_resource_map(
            resource=AccessTokenResource,
            url='/access_token',
            rel='access_tokens',
            resource_kwargs={},
            resource_relation_func=_build_resource_relation),
        ks_flask.construct_resource_map(
            resource=AuthorizeResource,
            url='/authorize/<string:request_token_id>',
            resource_kwargs={},
            rel='authorize_request_token',
            resource_relation_func=_build_resource_relation,
            path_vars={
                'request_token_id':
                _build_parameter_relation(parameter_name='request_token_id')
            })
    ]
Пример #2
0
class PolicyAPI(ks_flask.APIBase):
    _name = 'policy'
    _import_name = __name__
    resources = [PolicyResource]
    resource_mapping = [
        ks_flask.construct_resource_map(
            resource=EndpointPolicyResource,
            url='/policies/<string:policy_id>/OS-ENDPOINT-POLICY/endpoints',
            resource_kwargs={},
            rel='policy_endpoints',
            path_vars={'policy_id': json_home.Parameters.POLICY_ID},
            resource_relation_func=_resource_rel_func
        ),
        ks_flask.construct_resource_map(
            resource=EndpointPolicyAssociations,
            url=('/policies/<string:policy_id>/OS-ENDPOINT-POLICY/'
                 'endpoints/<string:endpoint_id>'),
            resource_kwargs={},
            rel='endpoint_policy_association',
            path_vars={
                'policy_id': json_home.Parameters.POLICY_ID,
                'endpoint_id': json_home.Parameters.ENDPOINT_ID
            },
            resource_relation_func=_resource_rel_func
        ),
        ks_flask.construct_resource_map(
            resource=ServicePolicyAssociations,
            url=('/policies/<string:policy_id>/OS-ENDPOINT-POLICY/'
                 'services/<string:service_id>'),
            resource_kwargs={},
            rel='service_policy_association',
            path_vars={
                'policy_id': json_home.Parameters.POLICY_ID,
                'service_id': json_home.Parameters.SERVICE_ID
            },
            resource_relation_func=_resource_rel_func
        ),
        ks_flask.construct_resource_map(
            resource=ServiceRegionPolicyAssociations,
            url=('/policies/<string:policy_id>/OS-ENDPOINT-POLICY/'
                 'services/<string:service_id>/regions/<string:region_id>'),
            resource_kwargs={},
            rel='region_and_service_policy_association',
            path_vars={
                'policy_id': json_home.Parameters.POLICY_ID,
                'service_id': json_home.Parameters.SERVICE_ID,
                'region_id': json_home.Parameters.REGION_ID
            },
            resource_relation_func=_resource_rel_func
        )
    ]
Пример #3
0
class AuthFederationAPI(ks_flask.APIBase):
    _name = 'auth/OS-FEDERATION'
    _import_name = __name__
    resources = []
    resource_mapping = [
        ks_flask.construct_resource_map(
            resource=AuthFederationSaml2Resource,
            url='/auth/OS-FEDERATION/saml2',
            resource_kwargs={},
            resource_relation_func=(
                json_home_relations.os_federation_resource_rel_func),
            rel='saml2'
        ),
        ks_flask.construct_resource_map(
            resource=AuthFederationSaml2ECPResource,
            url='/auth/OS-FEDERATION/saml2/ecp',
            resource_kwargs={},
            resource_relation_func=(
                json_home_relations.os_federation_resource_rel_func),
            rel='ecp'
        ),
        ks_flask.construct_resource_map(
            resource=AuthFederationWebSSOResource,
            url='/auth/OS-FEDERATION/websso/<string:protocol_id>',
            resource_kwargs={},
            rel='websso',
            resource_relation_func=(
                json_home_relations.os_federation_resource_rel_func),
            path_vars={
                'protocol_id': (
                    json_home_relations.os_federation_parameter_rel_func(
                        parameter_name='protocol_id'))}
        ),
        ks_flask.construct_resource_map(
            resource=AuthFederationWebSSOIDPsResource,
            url=('/auth/OS-FEDERATION/identity_providers/<string:idp_id>/'
                 'protocols/<string:protocol_id>/websso'),
            resource_kwargs={},
            rel='identity_providers_websso',
            resource_relation_func=(
                json_home_relations.os_federation_resource_rel_func),
            path_vars={
                'idp_id': (
                    json_home_relations.os_federation_parameter_rel_func(
                        parameter_name='idp_id')),
                'protocol_id': (
                    json_home_relations.os_federation_parameter_rel_func(
                        parameter_name='protocol_id'))}
        )
    ]
Пример #4
0
class SPasswordAPI(ks_flask.APIBase):
    _name = 'spassword'
    _import_name = __name__
    api_url_prefix = '/'
    resources = [SPasswordUserResource]

    resource_mapping = [
        ks_flask.construct_resource_map(
            resource=SPasswordScimUserResource,
            url='/OS-SCIM/Users/<string:user_id>',
            resource_kwargs={},
            rel='spassword-user-scim',
            path_vars={'user_id': json_home.Parameters.USER_ID}),
        ks_flask.construct_resource_map(
            resource=SPasswordUserPasswordResource,
            url='/users/<string:user_id>/password',
            resource_kwargs={},
            rel='user_change_password',
            path_vars={'user_id': json_home.Parameters.USER_ID}),
        ks_flask.construct_resource_map(
            resource=SPasswordRecoverResource,
            url='/users/<string:user_id>/recover_password',
            resource_kwargs={},
            rel='recover_password',
            path_vars={'user_id': json_home.Parameters.USER_ID}),
        ks_flask.construct_resource_map(
            resource=SPasswordModifySndfaResource,
            url='/users/<string:user_id>/sndfa',
            resource_kwargs={},
            rel='sndfa',
            path_vars={'user_id': json_home.Parameters.USER_ID}),
        ks_flask.construct_resource_map(
            resource=SPasswordCheckSndfaResource,
            url='/users/<string:user_id>/sndfa/<string:code>',
            resource_kwargs={},
            rel='sndfa',
            path_vars={'user_id': json_home.Parameters.USER_ID}),
        ks_flask.construct_resource_map(
            resource=SPasswordAskCheckEmailResource,
            url='/users/<string:user_id>/checkemail',
            resource_kwargs={},
            rel='email',
            path_vars={'user_id': json_home.Parameters.USER_ID}),
        ks_flask.construct_resource_map(
            resource=SPasswordCheckEmailResource,
            url='/users/<string:user_id>/checkemail/<string:code>',
            resource_kwargs={},
            rel='email',
            path_vars={'user_id': json_home.Parameters.USER_ID}),
        ks_flask.construct_resource_map(
            resource=SPasswordUserProjectRolesResource,
            url='/users/<string:user_id>/project_roles',
            resource_kwargs={},
            rel='get_project_roles',
            path_vars={'user_id': json_home.Parameters.USER_ID})
    ]
Пример #5
0
class SimpleCertAPI(ks_flask.APIBase):
    _name = 'OS-SIMPLE-CERT'
    _import_name = __name__
    resources = []
    resource_mapping = [
        ks_flask.construct_resource_map(
            resource=SimpleCertCAResource,
            url='/OS-SIMPLE-CERT/ca',
            resource_kwargs={},
            rel='ca_certificate',
            resource_relation_func=_build_resource_relation),
        ks_flask.construct_resource_map(
            resource=SimpleCertListResource,
            url='/OS-SIMPLE-CERT/certificates',
            resource_kwargs={},
            rel='certificates',
            resource_relation_func=_build_resource_relation),
    ]
Пример #6
0
class RoleInferencesAPI(ks_flask.APIBase):
    _name = 'role_inferences'
    _import_name = __name__
    resources = []
    resource_mapping = [
        ks_flask.construct_resource_map(resource=RoleInferencesResource,
                                        url='/role_inferences',
                                        resource_kwargs={},
                                        rel='role_inferences')
    ]
class AccessRulesConfigAPI(ks_flask.APIBase):
    _name = 'access_rules_config'
    _import_name = __name__
    resources = []
    resource_mapping = [
        ks_flask.construct_resource_map(resource=AccessRulesConfigResource,
                                        url='/access_rules_config',
                                        resource_kwargs={},
                                        rel='access_rules_config')
    ]
Пример #8
0
class RoleAssignmentsAPI(ks_flask.APIBase):
    _name = 'role_assignments'
    _import_name = __name__
    resources = []
    resource_mapping = [
        ks_flask.construct_resource_map(resource=RoleAssignmentsResource,
                                        url='/role_assignments',
                                        resource_kwargs={},
                                        rel='role_assignments')
    ]
Пример #9
0
class GroupAPI(ks_flask.APIBase):
    _name = 'groups'
    _import_name = __name__
    resources = [GroupsResource]
    resource_mapping = [
        ks_flask.construct_resource_map(
            resource=GroupUsersResource,
            url='/groups/<string:group_id>/users',
            resource_kwargs={},
            rel='group_users',
            path_vars={'group_id': json_home.Parameters.GROUP_ID}),
        ks_flask.construct_resource_map(
            resource=UserGroupCRUDResource,
            url='/groups/<string:group_id>/users/<string:user_id>',
            resource_kwargs={},
            rel='group_user',
            path_vars={
                'group_id': json_home.Parameters.GROUP_ID,
                'user_id': json_home.Parameters.USER_ID})
    ]
Пример #10
0
class LimitsAPI(ks_flask.APIBase):
    _name = 'limits'
    _import_name = __name__
    resources = [LimitsResource]
    resource_mapping = [
        ks_flask.construct_resource_map(resource=LimitModelResource,
                                        resource_kwargs={},
                                        url='/limits/model',
                                        rel='limit_model',
                                        status=json_home.Status.EXPERIMENTAL)
    ]
Пример #11
0
class RoleAPI(ks_flask.APIBase):
    _name = 'roles'
    _import_name = __name__
    resources = [RoleResource]
    resource_mapping = [
        ks_flask.construct_resource_map(
            resource=RoleImplicationListResource,
            url='/roles/<string:prior_role_id>/implies',
            resource_kwargs={},
            rel='implied_roles',
            path_vars={'prior_role_id': json_home.Parameters.ROLE_ID}),
        ks_flask.construct_resource_map(
            resource=RoleImplicationResource,
            resource_kwargs={},
            url=('/roles/<string:prior_role_id>/'
                 'implies/<string:implied_role_id>'),
            rel='implied_role',
            path_vars={
                'prior_role_id': json_home.Parameters.ROLE_ID,
                'implied_role_id': json_home.Parameters.ROLE_ID})
    ]
Пример #12
0
class AuthAPI(ks_flask.APIBase):
    _name = 'auth'
    _import_name = __name__
    resources = []
    resource_mapping = [
        ks_flask.construct_resource_map(
            resource=AuthProjectsResource,
            url='/auth/projects',
            alternate_urls=[dict(
                url='/OS-FEDERATION/projects',
                json_home=ks_flask.construct_json_home_data(
                    rel='projects',
                    resource_relation_func=(
                        json_home_relations.os_federation_resource_rel_func)
                )
            )],

            rel='auth_projects',
            resource_kwargs={}
        ),
        ks_flask.construct_resource_map(
            resource=AuthDomainsResource,
            url='/auth/domains',
            alternate_urls=[dict(
                url='/OS-FEDERATION/domains',
                json_home=ks_flask.construct_json_home_data(
                    rel='domains',
                    resource_relation_func=(
                        json_home_relations.os_federation_resource_rel_func)
                )
            )],
            rel='auth_domains',
            resource_kwargs={},
        ),
        ks_flask.construct_resource_map(
            resource=AuthSystemResource,
            url='/auth/system',
            resource_kwargs={},
            rel='auth_system'
        ),
        ks_flask.construct_resource_map(
            resource=AuthCatalogResource,
            url='/auth/catalog',
            resource_kwargs={},
            rel='auth_catalog'
        ),
        ks_flask.construct_resource_map(
            resource=AuthTokenOSPKIResource,
            url='/auth/tokens/OS-PKI/revoked',
            resource_kwargs={},
            rel='revocations',
            resource_relation_func=json_home_relations.os_pki_resource_rel_func
        ),
        ks_flask.construct_resource_map(
            resource=AuthTokenResource,
            url='/auth/tokens',
            resource_kwargs={},
            rel='auth_tokens'
        )
    ]
Пример #13
0
class EndpointAPI(ks_flask.APIBase):
    _name = 'endpoints'
    _import_name = __name__
    resources = [EndpointResource]
    resource_mapping = [
        ks_flask.construct_resource_map(
            resource=EndpointPolicyEndpointResource,
            url='/endpoints/<string:endpoint_id>/OS-ENDPOINT-POLICY/policy',
            resource_kwargs={},
            rel='endpoint_policy',
            resource_relation_func=_resource_rel_func,
            path_vars={'endpoint_id': json_home.Parameters.ENDPOINT_ID})
    ]
Пример #14
0
class EC2TokensAPI(ks_flask.APIBase):
    _name = 'ec2tokens'
    _import_name = __name__
    resources = []
    resource_mapping = [
        ks_flask.construct_resource_map(
            resource=EC2TokensResource,
            url='/ec2tokens',
            resource_kwargs={},
            rel='ec2tokens',
            resource_relation_func=(
                json_home_relations.os_ec2_resource_rel_func))
    ]
Пример #15
0
class OSRevokeAPI(ks_flask.APIBase):
    _name = 'events'
    _import_name = __name__
    _api_url_prefix = '/OS-REVOKE'
    resources = []
    resource_mapping = [
        ks_flask.construct_resource_map(
            resource=OSRevokeResource,
            url='/events',
            resource_kwargs={},
            rel='events',
            resource_relation_func=_build_resource_relation)
    ]
Пример #16
0
class S3Api(ks_flask.APIBase):
    _name = 's3tokens'
    _import_name = __name__
    resources = []
    resource_mapping = [
        ks_flask.construct_resource_map(
            resource=S3Resource,
            url='/s3tokens',
            resource_kwargs={},
            rel='s3tokens',
            resource_relation_func=(
                json_home_relations.s3_token_resource_rel_func))
    ]
Пример #17
0
class TrustAPI(ks_flask.APIBase):
    _name = 'trusts'
    _import_name = __name__
    resources = [TrustResource]
    resource_mapping = [
        ks_flask.construct_resource_map(
            resource=RolesForTrustListResource,
            url='/trusts/<string:trust_id>/roles',
            resource_kwargs={},
            rel='trust_roles',
            path_vars={'trust_id': TRUST_ID_PARAMETER_RELATION},
            resource_relation_func=_build_resource_relation),
        ks_flask.construct_resource_map(
            resource=RoleForTrustResource,
            url='/trusts/<string:trust_id>/roles/<string:role_id>',
            resource_kwargs={},
            rel='trust_role',
            path_vars={
                'trust_id': TRUST_ID_PARAMETER_RELATION,
                'role_id': json_home.Parameters.ROLE_ID
            },
            resource_relation_func=_build_resource_relation),
    ]
    _api_url_prefix = '/OS-TRUST'
Пример #18
0
class SystemAPI(ks_flask.APIBase):
    _name = 'system'
    _import_name = __name__
    resources = []
    resource_mapping = [
        ks_flask.construct_resource_map(
            resource=SystemUsersListResource,
            url='/system/users/<string:user_id>/roles',
            resource_kwargs={},
            rel='system_user_roles',
            path_vars={'user_id': json_home.Parameters.USER_ID}),
        ks_flask.construct_resource_map(
            resource=SystemUsersResource,
            url='/system/users/<string:user_id>/roles/<string:role_id>',
            resource_kwargs={},
            rel='system_user_role',
            path_vars={
                'role_id': json_home.Parameters.ROLE_ID,
                'user_id': json_home.Parameters.USER_ID
            }),
        ks_flask.construct_resource_map(
            resource=SystemGroupsRolesListResource,
            url='/system/groups/<string:group_id>/roles',
            resource_kwargs={},
            rel='system_group_roles',
            path_vars={'group_id': json_home.Parameters.GROUP_ID}),
        ks_flask.construct_resource_map(
            resource=SystemGroupsRolestResource,
            url='/system/groups/<string:group_id>/roles/<string:role_id>',
            resource_kwargs={},
            rel='system_group_role',
            path_vars={
                'role_id': json_home.Parameters.ROLE_ID,
                'group_id': json_home.Parameters.GROUP_ID
            })
    ]
Пример #19
0
class OSFederationIdentityProvidersProtocolsAPI(ks_flask.APIBase):
    _name = 'protocols'
    _import_name = __name__
    resources = []
    resource_mapping = [
        ks_flask.construct_resource_map(
            resource=IDPProtocolsCRUDResource,
            url=('/OS-FEDERATION/identity_providers/<string:idp_id>/protocols/'
                 '<string:protocol_id>'),
            resource_kwargs={},
            rel='identity_provider_protocol',
            resource_relation_func=_build_resource_relation,
            path_vars={
                'idp_id': IDP_ID_PARAMETER_RELATION,
                'protocol_id': PROTOCOL_ID_PARAMETER_RELATION
            }),
        ks_flask.construct_resource_map(
            resource=IDPProtocolsListResource,
            url='/OS-FEDERATION/identity_providers/<string:idp_id>/protocols',
            resource_kwargs={},
            rel='identity_provider_protocols',
            resource_relation_func=_build_resource_relation,
            path_vars={'idp_id': IDP_ID_PARAMETER_RELATION}),
    ]
Пример #20
0
class OSFederationAPI(ks_flask.APIBase):
    _name = 'OS-FEDERATION'
    _import_name = __name__
    _api_url_prefix = '/OS-FEDERATION'
    resources = []
    resource_mapping = [
        ks_flask.construct_resource_map(
            resource=SAML2MetadataResource,
            url='/saml2/metadata',
            resource_kwargs={},
            rel='metadata',
            resource_relation_func=_build_resource_relation),
        ks_flask.construct_resource_map(
            resource=OSFederationAuthResource,
            url=('/identity_providers/<string:idp_id>/protocols/'
                 '<string:protocol_id>/auth'),
            resource_kwargs={},
            rel='identity_provider_protocol_auth',
            resource_relation_func=_build_resource_relation,
            path_vars={
                'idp_id': IDP_ID_PARAMETER_RELATION,
                'protocol_id': PROTOCOL_ID_PARAMETER_RELATION
            }),
    ]
Пример #21
0
class UserAPI(ks_flask.APIBase):
    _name = 'users'
    _import_name = __name__
    resources = [UserResource]
    resource_mapping = [
        ks_flask.construct_resource_map(
            resource=UserChangePasswordResource,
            url='/users/<string:user_id>/password',
            resource_kwargs={},
            rel='user_change_password',
            path_vars={'user_id': json_home.Parameters.USER_ID}),
        ks_flask.construct_resource_map(
            resource=UserGroupsResource,
            url='/users/<string:user_id>/groups',
            resource_kwargs={},
            rel='user_groups',
            path_vars={'user_id': json_home.Parameters.USER_ID}),
        ks_flask.construct_resource_map(
            resource=UserProjectsResource,
            url='/users/<string:user_id>/projects',
            resource_kwargs={},
            rel='user_projects',
            path_vars={'user_id': json_home.Parameters.USER_ID}),
        ks_flask.construct_resource_map(
            resource=UserOSEC2CredentialsResourceListCreate,
            url='/users/<string:user_id>/credentials/OS-EC2',
            resource_kwargs={},
            rel='user_credentials',
            resource_relation_func=(
                json_home_relations.os_ec2_resource_rel_func),
            path_vars={'user_id': json_home.Parameters.USER_ID}),
        ks_flask.construct_resource_map(
            resource=UserOSEC2CredentialsResourceGetDelete,
            url=('/users/<string:user_id>/credentials/OS-EC2/'
                 '<string:credential_id>'),
            resource_kwargs={},
            rel='user_credential',
            resource_relation_func=(
                json_home_relations.os_ec2_resource_rel_func),
            path_vars={
                'credential_id':
                json_home.build_v3_parameter_relation('credential_id'),
                'user_id':
                json_home.Parameters.USER_ID
            }),
        ks_flask.construct_resource_map(
            resource=OAuth1ListAccessTokensResource,
            url='/users/<string:user_id>/OS-OAUTH1/access_tokens',
            resource_kwargs={},
            rel='user_access_tokens',
            resource_relation_func=(
                json_home_relations.os_oauth1_resource_rel_func),
            path_vars={'user_id': json_home.Parameters.USER_ID}),
        ks_flask.construct_resource_map(
            resource=OAuth1AccessTokenCRUDResource,
            url=('/users/<string:user_id>/OS-OAUTH1/'
                 'access_tokens/<string:access_token_id>'),
            resource_kwargs={},
            rel='user_access_token',
            resource_relation_func=(
                json_home_relations.os_oauth1_resource_rel_func),
            path_vars={
                'access_token_id': ACCESS_TOKEN_ID_PARAMETER_RELATION,
                'user_id': json_home.Parameters.USER_ID
            }),
        ks_flask.construct_resource_map(
            resource=OAuth1AccessTokenRoleListResource,
            url=('/users/<string:user_id>/OS-OAUTH1/access_tokens/'
                 '<string:access_token_id>/roles'),
            resource_kwargs={},
            rel='user_access_token_roles',
            resource_relation_func=(
                json_home_relations.os_oauth1_resource_rel_func),
            path_vars={
                'access_token_id': ACCESS_TOKEN_ID_PARAMETER_RELATION,
                'user_id': json_home.Parameters.USER_ID
            }),
        ks_flask.construct_resource_map(
            resource=OAuth1AccessTokenRoleResource,
            url=('/users/<string:user_id>/OS-OAUTH1/access_tokens/'
                 '<string:access_token_id>/roles/<string:role_id>'),
            resource_kwargs={},
            rel='user_access_token_role',
            resource_relation_func=(
                json_home_relations.os_oauth1_resource_rel_func),
            path_vars={
                'access_token_id': ACCESS_TOKEN_ID_PARAMETER_RELATION,
                'role_id': json_home.Parameters.ROLE_ID,
                'user_id': json_home.Parameters.USER_ID
            }),
        ks_flask.construct_resource_map(
            resource=UserAppCredListCreateResource,
            url='/users/<string:user_id>/application_credentials',
            resource_kwargs={},
            rel='application_credentials',
            path_vars={'user_id': json_home.Parameters.USER_ID}),
        ks_flask.construct_resource_map(
            resource=UserAppCredGetDeleteResource,
            url=('/users/<string:user_id>/application_credentials/'
                 '<string:application_credential_id>'),
            resource_kwargs={},
            rel='application_credential',
            path_vars={
                'user_id':
                json_home.Parameters.USER_ID,
                'application_credential_id':
                json_home.Parameters.APPLICATION_CRED_ID
            })
    ]
Пример #22
0
class ProjectAPI(ks_flask.APIBase):
    _name = 'projects'
    _import_name = __name__
    resources = [ProjectResource]
    resource_mapping = [
        ks_flask.construct_resource_map(
            resource=ProjectTagsResource,
            url='/projects/<string:project_id>/tags',
            resource_kwargs={},
            rel='project_tags',
            path_vars={
                'project_id': json_home.Parameters.PROJECT_ID}
        ),
        ks_flask.construct_resource_map(
            resource=ProjectTagResource,
            url='/projects/<string:project_id>/tags/<string:value>',
            resource_kwargs={},
            rel='project_tags',
            path_vars={
                'project_id': json_home.Parameters.PROJECT_ID,
                'value': json_home.Parameters.TAG_VALUE}
        ),
        ks_flask.construct_resource_map(
            resource=ProjectUserGrantResource,
            url=('/projects/<string:project_id>/users/<string:user_id>/'
                 'roles/<string:role_id>'),
            resource_kwargs={},
            rel='project_user_role',
            path_vars={
                'project_id': json_home.Parameters.PROJECT_ID,
                'user_id': json_home.Parameters.USER_ID,
                'role_id': json_home.Parameters.ROLE_ID
            },
        ),
        ks_flask.construct_resource_map(
            resource=ProjectUserListGrantResource,
            url='/projects/<string:project_id>/users/<string:user_id>/roles',
            resource_kwargs={},
            rel='project_user_roles',
            path_vars={
                'project_id': json_home.Parameters.PROJECT_ID,
                'user_id': json_home.Parameters.USER_ID
            }
        ),
        ks_flask.construct_resource_map(
            resource=ProjectGroupGrantResource,
            url=('/projects/<string:project_id>/groups/<string:group_id>/'
                 'roles/<string:role_id>'),
            resource_kwargs={},
            rel='project_group_role',
            path_vars={
                'project_id': json_home.Parameters.PROJECT_ID,
                'group_id': json_home.Parameters.GROUP_ID,
                'role_id': json_home.Parameters.ROLE_ID
            },
        ),
        ks_flask.construct_resource_map(
            resource=ProjectGroupListGrantResource,
            url='/projects/<string:project_id>/groups/<string:group_id>/roles',
            resource_kwargs={},
            rel='project_group_roles',
            path_vars={
                'project_id': json_home.Parameters.PROJECT_ID,
                'group_id': json_home.Parameters.GROUP_ID
            },
        ),
    ]
Пример #23
0
class OSInheritAPI(ks_flask.APIBase):
    _name = "OS-INHERIT"
    _import_name = __name__
    _api_url_prefix = '/OS-INHERIT'
    resources = []
    resource_mapping = [
        ks_flask.construct_resource_map(
            resource=OSInheritDomainGroupRolesResource,
            url=('/domains/<string:domain_id>/groups/<string:group_id>/roles'
                 '/<string:role_id>/inherited_to_projects'),
            resource_kwargs={},
            rel='domain_group_role_inherited_to_projects',
            resource_relation_func=_build_resource_relation,
            path_vars={
                'domain_id': json_home.Parameters.DOMAIN_ID,
                'group_id': json_home.Parameters.GROUP_ID,
                'role_id': json_home.Parameters.ROLE_ID}),
        ks_flask.construct_resource_map(
            resource=OSInheritDomainGroupRolesListResource,
            url=('/domains/<string:domain_id>/groups/<string:group_id>/roles'
                 '/inherited_to_projects'),
            resource_kwargs={},
            rel='domain_group_roles_inherited_to_projects',
            resource_relation_func=_build_resource_relation,
            path_vars={
                'domain_id': json_home.Parameters.DOMAIN_ID,
                'group_id': json_home.Parameters.GROUP_ID}),
        ks_flask.construct_resource_map(
            resource=OSInheritDomainUserRolesResource,
            url=('/domains/<string:domain_id>/users/<string:user_id>/roles'
                 '/<string:role_id>/inherited_to_projects'),
            resource_kwargs={},
            rel='domain_user_role_inherited_to_projects',
            resource_relation_func=_build_resource_relation,
            path_vars={
                'domain_id': json_home.Parameters.DOMAIN_ID,
                'user_id': json_home.Parameters.USER_ID,
                'role_id': json_home.Parameters.ROLE_ID}),
        ks_flask.construct_resource_map(
            resource=OSInheritDomainUserRolesListResource,
            url=('/domains/<string:domain_id>/users/<string:user_id>/roles'
                 '/inherited_to_projects'),
            resource_kwargs={},
            rel='domain_user_roles_inherited_to_projects',
            resource_relation_func=_build_resource_relation,
            path_vars={
                'domain_id': json_home.Parameters.DOMAIN_ID,
                'user_id': json_home.Parameters.USER_ID}),
        ks_flask.construct_resource_map(
            resource=OSInheritProjectUserResource,
            url=('projects/<string:project_id>/users/<string:user_id>/roles'
                 '/<string:role_id>/inherited_to_projects'),
            resource_kwargs={},
            rel='project_user_role_inherited_to_projects',
            resource_relation_func=_build_resource_relation,
            path_vars={
                'project_id': json_home.Parameters.PROJECT_ID,
                'user_id': json_home.Parameters.USER_ID,
                'role_id': json_home.Parameters.ROLE_ID}),
        ks_flask.construct_resource_map(
            resource=OSInheritProjectGroupResource,
            url=('projects/<string:project_id>/groups/<string:group_id>/roles'
                 '/<string:role_id>/inherited_to_projects'),
            resource_kwargs={},
            rel='project_group_role_inherited_to_projects',
            resource_relation_func=_build_resource_relation,
            path_vars={
                'project_id': json_home.Parameters.PROJECT_ID,
                'group_id': json_home.Parameters.GROUP_ID,
                'role_id': json_home.Parameters.ROLE_ID})
    ]
Пример #24
0
class EPFilterAPI(ks_flask.APIBase):
    _name = 'OS-EP-FILTER'
    _import_name = __name__
    _api_url_prefix = '/OS-EP-FILTER'
    resources = [EndpointGroupsResource]
    resource_mapping = [
        ks_flask.construct_resource_map(
            resource=EPFilterEndpointProjectsResource,
            url='/endpoints/<string:endpoint_id>/projects',
            resource_kwargs={},
            rel='endpoint_projects',
            resource_relation_func=_build_resource_relation,
            path_vars={
                'endpoint_id': json_home.Parameters.ENDPOINT_ID
            }),
        ks_flask.construct_resource_map(
            resource=EPFilterProjectsEndpointsResource,
            url='/projects/<string:project_id>/endpoints/<string:endpoint_id>',
            resource_kwargs={},
            rel='project_endpoint',
            resource_relation_func=_build_resource_relation,
            path_vars={
                'endpoint_id': json_home.Parameters.ENDPOINT_ID,
                'project_id': json_home.Parameters.PROJECT_ID}),
        ks_flask.construct_resource_map(
            resource=EPFilterProjectEndpointsListResource,
            url='/projects/<string:project_id>/endpoints',
            resource_kwargs={},
            rel='project_endpoints',
            resource_relation_func=_build_resource_relation,
            path_vars={'project_id': json_home.Parameters.PROJECT_ID}),
        ks_flask.construct_resource_map(
            resource=EndpointFilterProjectEndpointGroupsListResource,
            url='/projects/<string:project_id>/endpoint_groups',
            resource_kwargs={},
            rel='project_endpoint_groups',
            resource_relation_func=_build_resource_relation,
            path_vars={'project_id': json_home.Parameters.PROJECT_ID}),
        ks_flask.construct_resource_map(
            resource=EndpointFilterEPGroupsEndpoints,
            url='/endpoint_groups/<string:endpoint_group_id>/endpoints',
            resource_kwargs={},
            rel='endpoints_in_endpoint_group',
            resource_relation_func=_build_resource_relation,
            path_vars={
                'endpoint_group_id': _ENDPOINT_GROUP_PARAMETER_RELATION}),
        ks_flask.construct_resource_map(
            resource=EndpointFilterEPGroupsProjects,
            url='/endpoint_groups/<string:endpoint_group_id>/projects',
            resource_kwargs={},
            rel='projects_associated_with_endpoint_group',
            resource_relation_func=_build_resource_relation,
            path_vars={
                'endpoint_group_id': _ENDPOINT_GROUP_PARAMETER_RELATION}),
        ks_flask.construct_resource_map(
            resource=EPFilterGroupsProjectsResource,
            url=('/endpoint_groups/<string:endpoint_group_id>/projects/'
                 '<string:project_id>'),
            resource_kwargs={},
            rel='endpoint_group_to_project_association',
            resource_relation_func=_build_resource_relation,
            path_vars={'project_id': json_home.Parameters.PROJECT_ID,
                       'endpoint_group_id': _ENDPOINT_GROUP_PARAMETER_RELATION
                       }),
    ]
Пример #25
0
class DomainAPI(ks_flask.APIBase):
    CONFIG_GROUP = json_home.build_v3_parameter_relation('config_group')
    CONFIG_OPTION = json_home.build_v3_parameter_relation('config_option')
    _name = 'domains'
    _import_name = __name__
    resources = [DomainResource]
    resource_mapping = [
        ks_flask.construct_resource_map(
            resource=DomainConfigResource,
            url=('/domains/<string:domain_id>/config'),
            resource_kwargs={},
            rel='domain_config',
            path_vars={
                'domain_id': json_home.Parameters.DOMAIN_ID}),
        ks_flask.construct_resource_map(
            resource=DomainConfigGroupResource,
            url='/domains/<string:domain_id>/config/<string:group>',
            resource_kwargs={},
            rel='domain_config_group',
            path_vars={
                'domain_id': json_home.Parameters.DOMAIN_ID,
                'group': CONFIG_GROUP}),
        ks_flask.construct_resource_map(
            resource=DomainConfigOptionResource,
            url=('/domains/<string:domain_id>/config/<string:group>'
                 '/<string:option>'),
            resource_kwargs={},
            rel='domain_config_option',
            path_vars={
                'domain_id': json_home.Parameters.DOMAIN_ID,
                'group': CONFIG_GROUP,
                'option': CONFIG_OPTION}),
        ks_flask.construct_resource_map(
            resource=DefaultConfigResource,
            url=('/domains/config/default'),
            resource_kwargs={},
            rel='domain_config_default',
            path_vars={}),
        ks_flask.construct_resource_map(
            resource=DefaultConfigGroupResource,
            url='/domains/config/<string:group>/default',
            resource_kwargs={},
            rel='domain_config_default_group',
            path_vars={
                'group': CONFIG_GROUP}),
        ks_flask.construct_resource_map(
            resource=DefaultConfigOptionResource,
            url=('/domains/config/<string:group>'
                 '/<string:option>/default'),
            resource_kwargs={},
            rel='domain_config_default_option',
            path_vars={
                'group': CONFIG_GROUP,
                'option': CONFIG_OPTION}),
        ks_flask.construct_resource_map(
            resource=DomainUserListResource,
            url=('/domains/<string:domain_id>/users'
                 '/<string:user_id>/roles'),
            resource_kwargs={},
            rel='domain_user_roles',
            path_vars={
                'domain_id': json_home.Parameters.DOMAIN_ID,
                'user_id': json_home.Parameters.USER_ID,
            }),
        ks_flask.construct_resource_map(
            resource=DomainUserResource,
            url=('/domains/<string:domain_id>/users'
                 '/<string:user_id>/roles/<string:role_id>'),
            resource_kwargs={},
            rel='domain_user_role',
            path_vars={
                'domain_id': json_home.Parameters.DOMAIN_ID,
                'user_id': json_home.Parameters.USER_ID,
                'role_id': json_home.Parameters.ROLE_ID
            }),
        ks_flask.construct_resource_map(
            resource=DomainGroupListResource,
            url=('/domains/<string:domain_id>/groups'
                 '/<string:group_id>/roles'),
            resource_kwargs={},
            rel='domain_group_roles',
            path_vars={
                'domain_id': json_home.Parameters.DOMAIN_ID,
                'group_id': json_home.Parameters.GROUP_ID,
            }),
        ks_flask.construct_resource_map(
            resource=DomainGroupResource,
            url=('/domains/<string:domain_id>/groups'
                 '/<string:group_id>/roles/<string:role_id>'),
            resource_kwargs={},
            rel='domain_group_role',
            path_vars={
                'domain_id': json_home.Parameters.DOMAIN_ID,
                'group_id': json_home.Parameters.GROUP_ID,
                'role_id': json_home.Parameters.ROLE_ID
            })
    ]