Identity API v2

For details on how to use identity, see Using OpenStack Identity

The Identity v2 Class

The identity high-level interface is available through the identity member of a Connection object. The identity member will only be added if the service is detected.

Extension Operations

class openstack.identity.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
extensions()

Retrieve a generator of extensions

Returns

A generator of extension instances.

Return type

Extension

get_extension(extension)

Get a single extension

Parameters

extension – The value can be the ID of an extension or a Extension instance.

Returns

One Extension

Raises

ResourceNotFound when no extension can be found.

User Operations

class openstack.identity.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
create_user(**attrs)

Create a new user from attributes

Parameters

attrs (dict) – Keyword arguments which will be used to create a User, comprised of the properties on the User class.

Returns

The results of user creation

Return type

User

delete_user(user, ignore_missing=True)

Delete a user

Parameters
  • user – The value can be either the ID of a user or a User instance.

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the user does not exist. When set to True, no exception will be set when attempting to delete a nonexistent user.

Returns

None

find_user(name_or_id, ignore_missing=True)

Find a single user

Parameters
  • name_or_id – The name or ID of a user.

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the resource does not exist. When set to True, None will be returned when attempting to find a nonexistent resource.

Returns

One User or None

get_user(user)

Get a single user

Parameters

user – The value can be the ID of a user or a User instance.

Returns

One User

Raises

ResourceNotFound when no resource can be found.

users(**query)

Retrieve a generator of users

Parameters

query (kwargs) – Optional query parameters to be sent to limit the resources being returned.

Returns

A generator of user instances.

Return type

User

update_user(user, **attrs)

Update a user

Parameters
  • user – Either the ID of a user or a User instance.

  • attrs – The attributes to update on the user represented by user.

Returns

The updated user

Return type

User

Role Operations

class openstack.identity.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
create_role(**attrs)

Create a new role from attributes

Parameters

attrs (dict) – Keyword arguments which will be used to create a Role, comprised of the properties on the Role class.

Returns

The results of role creation

Return type

Role

delete_role(role, ignore_missing=True)

Delete a role

Parameters
  • role – The value can be either the ID of a role or a Role instance.

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the role does not exist. When set to True, no exception will be set when attempting to delete a nonexistent role.

Returns

None

find_role(name_or_id, ignore_missing=True)

Find a single role

Parameters
  • name_or_id – The name or ID of a role.

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the resource does not exist. When set to True, None will be returned when attempting to find a nonexistent resource.

Returns

One Role or None

get_role(role)

Get a single role

Parameters

role – The value can be the ID of a role or a Role instance.

Returns

One Role

Raises

ResourceNotFound when no resource can be found.

roles(**query)

Retrieve a generator of roles

Parameters

query (kwargs) – Optional query parameters to be sent to limit the resources being returned.

Returns

A generator of role instances.

Return type

Role

update_role(role, **attrs)

Update a role

Parameters
  • role – Either the ID of a role or a Role instance.

  • attrs – The attributes to update on the role represented by role.

Returns

The updated role

Return type

Role

Tenant Operations

class openstack.identity.v2._proxy.Proxy(session, statsd_client=None, statsd_prefix=None, prometheus_counter=None, prometheus_histogram=None, influxdb_config=None, influxdb_client=None, *args, **kwargs)
create_tenant(**attrs)

Create a new tenant from attributes

Parameters

attrs (dict) – Keyword arguments which will be used to create a Tenant, comprised of the properties on the Tenant class.

Returns

The results of tenant creation

Return type

Tenant

delete_tenant(tenant, ignore_missing=True)

Delete a tenant

Parameters
  • tenant – The value can be either the ID of a tenant or a Tenant instance.

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the tenant does not exist. When set to True, no exception will be set when attempting to delete a nonexistent tenant.

Returns

None

find_tenant(name_or_id, ignore_missing=True)

Find a single tenant

Parameters
  • name_or_id – The name or ID of a tenant.

  • ignore_missing (bool) – When set to False ResourceNotFound will be raised when the resource does not exist. When set to True, None will be returned when attempting to find a nonexistent resource.

Returns

One Tenant or None

get_tenant(tenant)

Get a single tenant

Parameters

tenant – The value can be the ID of a tenant or a Tenant instance.

Returns

One Tenant

Raises

ResourceNotFound when no resource can be found.

tenants(**query)

Retrieve a generator of tenants

Parameters

query (kwargs) – Optional query parameters to be sent to limit the resources being returned.

Returns

A generator of tenant instances.

Return type

Tenant

update_tenant(tenant, **attrs)

Update a tenant

Parameters
  • tenant – Either the ID of a tenant or a Tenant instance.

  • attrs – The attributes to update on the tenant represented by tenant.

Returns

The updated tenant

Return type

Tenant