def __init__(self, **kwargs): """Initialize a new client for the Keystone v2.0 API.""" if not kwargs.get('session'): warnings.warn( 'Constructing an instance of the ' 'keystoneclient.v2_0.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) super(Client, self).__init__(**kwargs) self.certificates = certificates.CertificatesManager(self._adapter) self.endpoints = endpoints.EndpointManager(self._adapter) self.extensions = extensions.ExtensionManager(self._adapter) self.roles = roles.RoleManager(self._adapter) self.services = services.ServiceManager(self._adapter) self.tokens = tokens.TokenManager(self._adapter) self.users = users.UserManager(self._adapter, self.roles) self.tenants = tenants.TenantManager(self._adapter, self.roles, self.users) # extensions self.ec2 = ec2.CredentialsManager(self._adapter) # DEPRECATED: if session is passed then we go to the new behaviour of # authenticating on the first required call. if not kwargs.get('session') and self.management_url is None: self.authenticate()
def __init__(self, *args, **kwargs): super(V2IdentityClient, self).__init__(*args, **kwargs) self.endpoints = v2endpoints.EndpointManager(self) self.roles = v2roles.RoleManager(self) self.services = v2services.ServiceManager(self) self.tenants = v2tenants.TenantManager(self) self.tokens = v2tokens.TokenManager(self) self.users = v2users.UserManager(self)
def __init__(self, http_client, **kwargs): """ Initialize a new client for the Keystone v2.0 API. """ super(IdentityAdminClient, self).__init__(http_client) self.endpoints = endpoints.EndpointManager(self) self.roles = roles.RoleManager(self) self.services = services.ServiceManager(self) self.tenants = tenants.TenantManager(self) self.tokens = tokens.TokenManager(self) self.users = users.UserManager(self) # extensions self.ec2 = ec2.CredentialsManager(self)
def __init__(self, endpoint=None, **kwargs): """ Initialize a new client for the Keystone v2.0 API. """ super(Client, self).__init__(endpoint=endpoint, **kwargs) self.roles = roles.RoleManager(self) self.services = services.ServiceManager(self) self.tenants = tenants.TenantManager(self) self.tokens = tokens.TokenManager(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 is None: self.authenticate() else: self.management_url = endpoint
def __init__(self, **kwargs): """ Initialize a new client for the Keystone v2.0 API. """ super(Client, self).__init__(**kwargs) self.endpoints = endpoints.EndpointManager(self) self.roles = roles.RoleManager(self) self.services = services.ServiceManager(self) self.tenants = tenants.TenantManager(self) self.tokens = tokens.TokenManager(self) self.users = users.UserManager(self) # extensions self.ec2 = ec2.CredentialsManager(self) if self.management_url is None: self.authenticate()
def __init__(self, **kwargs): """Initialize a new client for the Keystone v2.0 API.""" super(Client, self).__init__(**kwargs) self.endpoints = endpoints.EndpointManager(self) self.roles = roles.RoleManager(self) self.services = services.ServiceManager(self) self.tenants = tenants.TenantManager(self) self.tokens = tokens.TokenManager(self) self.users = users.UserManager(self) # extensions self.ec2 = ec2.CredentialsManager(self) # DEPRECATED: if session is passed then we go to the new behaviour of # authenticating on the first required call. if not kwargs.get('session') and self.management_url is None: self.authenticate()
def test_find_resource(self): body = {"roles": [{"name": 'entity_one'}, {"name": 'entity_one_1'}]} request_resp = requests.Response() request_resp.headers['x-openstack-request-id'] = TEST_REQUEST_ID get_mock = self.useFixture( fixtures.MockPatchObject( self.client, 'get', autospec=True, side_effect=[exceptions.NotFound, (request_resp, body)])).mock mgr = roles.RoleManager(self.client) mgr.resource_class = roles.Role response = base_utils.find_resource(mgr, 'entity_one') get_mock.assert_called_with('/OS-KSADM/roles') self.assertEqual(response.request_ids[0], TEST_REQUEST_ID)
def __init__(self, **kwargs): """Initialize a new client for the Keystone v2.0 API.""" if not kwargs.get('session'): warnings.warn( 'Constructing an instance of the ' 'keystoneclient.v2_0.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) # NOTE(knasim-wrs): As per US76645, the Keystone adminURL # is no longer an internal address since it needs to be # accessible via remote Openstack client. Things get # complicated with HTTPS where the internal keystone client # gets this adminURL and cannot connect to Keystone server # as it cannot verify the SSL certificate. # We will check for this condition here, if OS_ENDPOINT_TYPE # is not publicURL then this is an internal access scenario and # Keystone client will be set to SSL insecure mode if os.environ.get('OS_ENDPOINT_TYPE') == 'internalURL': kwargs['insecure'] = True # disable verbose insecurity warnings urllib3_disable_warnings(InsecureRequestWarning) super(Client, self).__init__(**kwargs) self.certificates = certificates.CertificatesManager(self._adapter) self.endpoints = endpoints.EndpointManager(self._adapter) self.extensions = extensions.ExtensionManager(self._adapter) self.roles = roles.RoleManager(self._adapter) self.services = services.ServiceManager(self._adapter) self.tokens = tokens.TokenManager(self._adapter) self.users = users.UserManager(self._adapter, self.roles) self.tenants = tenants.TenantManager(self._adapter, self.roles, self.users) # extensions self.ec2 = ec2.CredentialsManager(self._adapter) # DEPRECATED: if session is passed then we go to the new behaviour of # authenticating on the first required call. if not kwargs.get('session') and self.management_url is None: self.authenticate()
def setUp(self): self.m = mox.Mox() self.fc = fakes.FakeClient() self.fc.users = users.UserManager(None) self.fc.roles = roles.RoleManager(None) self.fc.ec2 = ec2.CredentialsManager(None) self.m.StubOutWithMock(user.User, 'keystone') self.m.StubOutWithMock(user.AccessKey, 'keystone') self.m.StubOutWithMock(self.fc.users, 'create') self.m.StubOutWithMock(self.fc.users, 'get') self.m.StubOutWithMock(self.fc.users, 'delete') self.m.StubOutWithMock(self.fc.users, 'list') self.m.StubOutWithMock(self.fc.roles, 'list') self.m.StubOutWithMock(self.fc.roles, 'add_user_role') self.m.StubOutWithMock(self.fc.ec2, 'create') self.m.StubOutWithMock(self.fc.ec2, 'get') self.m.StubOutWithMock(self.fc.ec2, 'delete') self.m.StubOutWithMock(eventlet, 'sleep') config.register_engine_opts() cfg.CONF.set_default('heat_stack_user_role', 'stack_user_role')