def __init__(self, **kwargs): """Initialize a new client for the Keystone v3 API.""" super(Client, self).__init__(**kwargs) self.credentials = credentials.CredentialManager(self) self.endpoint_filter = endpoint_filter.EndpointFilterManager(self) self.endpoints = endpoints.EndpointManager(self) self.domains = domains.DomainManager(self) self.federation = federation.FederationManager(self) self.groups = groups.GroupManager(self) self.oauth1 = oauth1.create_oauth_manager(self) self.policies = policies.PolicyManager(self) self.projects = projects.ProjectManager(self) self.regions = regions.RegionManager(self) self.role_assignments = role_assignments.RoleAssignmentManager(self) self.roles = roles.RoleManager(self) self.services = services.ServiceManager(self) self.tokens = tokens.TokenManager(self) self.trusts = trusts.TrustManager(self) self.users = users.UserManager(self) # DEPRECATED: if session is passed then we go to the new behaviour of # authenticating on the first required call. if 'session' not in kwargs and self.management_url is None: self.authenticate()
def __init__(self, *args, **kwargs): super(V3IdentityClient, self).__init__(*args, **kwargs) self.credentials = v3credentials.CredentialManager(self) self.endpoints = v3endpoints.EndpointManager(self) self.domains = v3domains.DomainManager(self) self.groups = v3groups.GroupManager(self) self.policies = v3policies.PolicyManager(self) self.projects = v3projects.ProjectManager(self) self.roles = v3roles.RoleManager(self) self.services = v3services.ServiceManager(self) self.users = v3users.UserManager(self) self.trusts = v3trusts.TrustManager(self)
def __init__(self, **kwargs): """Initialize a new client for the Keystone v3 API.""" super(Client, self).__init__(**kwargs) self.version = 'v3' self.credentials = credentials.CredentialManager(self) self.endpoints = endpoints.EndpointManager(self) self.domains = domains.DomainManager(self) self.groups = groups.GroupManager(self) self.policies = policies.PolicyManager(self) self.projects = projects.ProjectManager(self) self.roles = roles.RoleManager(self) self.services = services.ServiceManager(self) self.users = users.UserManager(self)
def __init__(self, **kwargs): """Initialize a new client for the Keystone v3 API.""" super(Client, self).__init__(**kwargs) if not kwargs.get('session'): warnings.warn( 'Constructing an instance of the ' 'keystoneclient.v3.client.Client class without a session is ' 'deprecated as of the 1.7.0 release and may be removed in ' 'the 2.0.0 release.', DeprecationWarning) self.access_rules = (access_rules.AccessRuleManager(self._adapter)) self.application_credentials = ( application_credentials.ApplicationCredentialManager( self._adapter)) self.auth = auth.AuthManager(self._adapter) self.credentials = credentials.CredentialManager(self._adapter) self.ec2 = ec2.EC2Manager(self._adapter) self.endpoint_filter = endpoint_filter.EndpointFilterManager( self._adapter) self.endpoint_groups = endpoint_groups.EndpointGroupManager( self._adapter) self.endpoint_policy = endpoint_policy.EndpointPolicyManager( self._adapter) self.endpoints = endpoints.EndpointManager(self._adapter) self.domain_configs = domain_configs.DomainConfigManager(self._adapter) self.domains = domains.DomainManager(self._adapter) self.federation = federation.FederationManager(self._adapter) self.groups = groups.GroupManager(self._adapter) self.limits = limits.LimitManager(self._adapter) self.oauth1 = oauth1.create_oauth_manager(self._adapter) self.policies = policies.PolicyManager(self._adapter) self.projects = projects.ProjectManager(self._adapter) self.registered_limits = registered_limits.RegisteredLimitManager( self._adapter) self.regions = regions.RegionManager(self._adapter) self.role_assignments = (role_assignments.RoleAssignmentManager( self._adapter)) self.roles = roles.RoleManager(self._adapter) self.inference_rules = roles.InferenceRuleManager(self._adapter) self.services = services.ServiceManager(self._adapter) self.simple_cert = simple_cert.SimpleCertManager(self._adapter) self.tokens = tokens.TokenManager(self._adapter) self.trusts = trusts.TrustManager(self._adapter) self.users = users.UserManager(self._adapter) # DEPRECATED: if session is passed then we go to the new behaviour of # authenticating on the first required call. if 'session' not in kwargs and self.management_url is None: self.authenticate()
def __init__(self, **kwargs): """Initialize a new client for the Keystone v3 API.""" super(Client, self).__init__(**kwargs) self.credentials = credentials.CredentialManager(self) self.endpoints = endpoints.EndpointManager(self) self.domains = domains.DomainManager(self) self.groups = groups.GroupManager(self) self.policies = policies.PolicyManager(self) self.projects = projects.ProjectManager(self) self.roles = roles.RoleManager(self) self.services = services.ServiceManager(self) self.users = users.UserManager(self) self.trusts = trusts.TrustManager(self) if self.management_url is None: self.authenticate()
def __init__(self, **kwargs): """Initialize a new client for the Keystone v3 API.""" # NOTE(Roxana Gherle): Keystone V3 APIs has no admin versus public # distinction. They are both going through the same endpoint, so # set a public default here instead of picking up an admin default in # httpclient.HTTPClient kwargs.setdefault('interface', 'public') super(Client, self).__init__(**kwargs) if not kwargs.get('session'): warnings.warn( 'Constructing an instance of the ' 'keystoneclient.v3.client.Client class without a session is ' 'deprecated as of the 1.7.0 release and may be removed in ' 'the 2.0.0 release.', DeprecationWarning) self.auth = auth.AuthManager(self._adapter) self.credentials = credentials.CredentialManager(self._adapter) self.ec2 = ec2.EC2Manager(self._adapter) self.endpoint_filter = endpoint_filter.EndpointFilterManager( self._adapter) self.endpoint_policy = endpoint_policy.EndpointPolicyManager( self._adapter) self.endpoints = endpoints.EndpointManager(self._adapter) self.domains = domains.DomainManager(self._adapter) self.federation = federation.FederationManager(self._adapter) self.groups = groups.GroupManager(self._adapter) self.oauth1 = oauth1.create_oauth_manager(self._adapter) self.policies = policies.PolicyManager(self._adapter) self.projects = projects.ProjectManager(self._adapter) self.regions = regions.RegionManager(self._adapter) self.role_assignments = ( role_assignments.RoleAssignmentManager(self._adapter)) self.roles = roles.RoleManager(self._adapter) self.services = services.ServiceManager(self._adapter) self.simple_cert = simple_cert.SimpleCertManager(self._adapter) self.tokens = tokens.TokenManager(self._adapter) self.trusts = trusts.TrustManager(self._adapter) self.users = users.UserManager(self._adapter) # DEPRECATED: if session is passed then we go to the new behaviour of # authenticating on the first required call. if 'session' not in kwargs and self.management_url is None: self.authenticate()
def __init__(self, endpoint=None, **kwargs): """ Initialize a new client for the Keystone v2.0 API. """ super(Client, self).__init__(endpoint=endpoint, **kwargs) self.credentials = credentials.CredentialManager(self) self.endpoints = endpoints.EndpointManager(self) self.domains = domains.DomainManager(self) self.policies = policies.PolicyManager(self) self.projects = projects.ProjectManager(self) self.roles = roles.RoleManager(self) self.services = services.ServiceManager(self) self.users = users.UserManager(self) # NOTE(gabriel): If we have a pre-defined endpoint then we can # get away with lazy auth. Otherwise auth immediately. if endpoint: self.management_url = endpoint else: self.authenticate()
def __init__(self, **kwargs): """Initialize a new client for the Keystone v3 API.""" super(Client, self).__init__(**kwargs) self.credentials = credentials.CredentialManager(self._adapter) self.endpoint_filter = endpoint_filter.EndpointFilterManager( self._adapter) self.endpoint_policy = endpoint_policy.EndpointPolicyManager( self._adapter) self.endpoints = endpoints.EndpointManager(self._adapter) self.domains = domains.DomainManager(self._adapter) self.federation = federation.FederationManager(self._adapter) self.groups = groups.GroupManager(self._adapter) self.oauth1 = oauth1.create_oauth_manager(self._adapter) # TODO(garcianavalon) document this self.endpoint_groups = endpoint_filter.EndpointGroupFilterManager( self._adapter) self.fiware_roles = fiware_roles.FiwareRolesManager(self) self.oauth2 = oauth2.create_oauth_manager(self) self.user_registration = user_registration.UserRegistrationManager( self) self.two_factor = two_factor.TwoFactorManager(self) self.policies = policies.PolicyManager(self._adapter) self.projects = projects.ProjectManager(self._adapter) self.regions = regions.RegionManager(self._adapter) self.role_assignments = (role_assignments.RoleAssignmentManager( self._adapter)) self.roles = roles.RoleManager(self._adapter) self.services = services.ServiceManager(self._adapter) self.tokens = tokens.TokenManager(self._adapter) self.trusts = trusts.TrustManager(self._adapter) self.users = users.UserManager(self._adapter) # DEPRECATED: if session is passed then we go to the new behaviour of # authenticating on the first required call. if 'session' not in kwargs and self.management_url is None: self.authenticate()
self.user = None def get_admin_role(manager): for role in manager.list(): if role.name == "Admin": return role if __name__ == '__main__': reset=False keystone = client.Client(user_domain_name='Default', username=os.environ['OS_USERNAME'], password=os.environ['OS_PASSWORD'], project_domain_name='Default', project_name='admin', auth_url=os.environ['OS_AUTH_URL']) domain_manager = domains.DomainManager(keystone) project_manager = projects.ProjectManager(keystone) user_manager = users.UserManager(keystone) role_manager = roles.RoleManager(keystone) barbican_domain=BarbicanDomain(domain_manager, reset=reset) barbican_project=BarbicanProject(project_manager, barbican_domain.domain.id, reset=reset) barbican_user=BarbicanUser(user_manager, barbican_domain.domain.id, reset=reset) admin_role=get_admin_role(role_manager) role_manager.grant(admin_role.id, user=barbican_user.user.id, project=barbican_project.project.id) print "Domain ID: " + barbican_domain.domain.id print "Project ID: " + barbican_project.project.id