hpOneView.resources.security package

Submodules

hpOneView.resources.security.certificate_authority module

class hpOneView.resources.security.certificate_authority.CertificateAuthority(con)[source]

Bases: object

Certificate Authority API client.

URI = u'/rest/certificates/ca'
delete(alias_name, timeout=-1)[source]

Revokes a certificate signed by the internal CA. If client certificate to be revoked is RabbitMQ_readonly, then the internal CA root certificate, RabbitMQ client certificate and RabbitMQ server certificate will be regenerated. This will invalidate the previous version of RabbitMQ client certificate and the RabbitMQ server will be restarted to read the latest certificates.

Parameters:
  • alias_name (str) – Alias name.
  • timeout – Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView, just stop waiting for its completion.
get()[source]

Retrieves the certificate of the internal CA in the form of a string.

Returns:The Internal CA Certificate.
Return type:str
get_crl()[source]

Retrieves the contents of the CRL file maintained by the internal CA; in Base-64 encoded format, in the form of a string.

Returns:The Certificate Revocation List
Return type:str

hpOneView.resources.security.certificate_rabbitmq module

class hpOneView.resources.security.certificate_rabbitmq.CertificateRabbitMQ(con)[source]

Bases: object

URI = u'/rest/certificates/client/rabbitmq'
generate(information, timeout=-1)[source]

Generates a self signed certificate or an internal CA signed certificate for RabbitMQ clients.

Parameters:
  • information (dict) – Information to generate the certificate for RabbitMQ clients.
  • timeout – Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView; it just stops waiting for its completion.
Returns:

RabbitMQ certificate generated

Return type:

dict

get(alias_name)[source]

Retrieves the base-64 encoded certificate associated with the RabbitMQ user.

Parameters:alias_name – Key pair associated with the RabbitMQ
Returns:RabbitMQ certificate
Return type:dict
get_key_pair(alias_name)[source]

Retrieves the public and private key pair associated with the specified alias name.

Parameters:alias_name – Key pair associated with the RabbitMQ
Returns:RabbitMQ certificate
Return type:dict
get_keys(alias_name, key_format)[source]

Retrieves the contents of PKCS12 file in the format specified. This PKCS12 formatted file contains both the certificate as well as the key file data. Valid key formats are Base64 and PKCS12.

Parameters:
  • alias_name – Key pair associated with the RabbitMQ
  • key_format – Valid key formats are Base64 and PKCS12.
Returns:

RabbitMQ certificate

Return type:

dict

hpOneView.resources.security.login_details module

class hpOneView.resources.security.login_details.LoginDetails(con)[source]

Bases: object

list login details.

URI = u'/rest/logindetails'
get_login_details()[source]

List the login details

Returns:login details.
Return type:dict

hpOneView.resources.security.roles module

class hpOneView.resources.security.roles.Roles(con)[source]

Bases: object

Roles API client.

RESOURCES_PATH = u'/resources'
URI = u'/rest/roles'
get(name_or_uri)[source]

Get the role by its URI or Name.

Parameters:name_or_uri – Can be either the Name or the URI.
Returns:Role
Return type:dict
get_all(start=0, count=-1, filter=u'', sort=u'')[source]

Gets a list of roles based on optional sorting and filtering and is constrained by start and count parameters.

Parameters:
  • start – The first item to return, using 0-based indexing. If not specified, the default is 0 - start with the first available item.
  • count – The number of resources to return. A count of -1 requests all items. The actual number of items in the response might differ from the requested count if the sum of start and count exceeds the total number of items.
  • filter (list or str) – A general filter/query string to narrow the list of items returned. The default is no filter; all resources are returned.
  • sort – The sort order of the returned data set. By default, the sort order is based on create time with the oldest entry first.
Returns:

A list of roles.

Return type:

list

hpOneView.resources.security.users module

class hpOneView.resources.security.users.Users(con)[source]

Bases: object

Users API client.

DEFAULT_VALUES = {u'200': {u'type': u'UserAndRoles'}, u'300': {u'type': u'UserAndRoles'}, u'500': {u'type': u'UserAndRoles'}}
URI = u'/rest/users'
create(resource, timeout=-1)[source]

Creates a User.

Parameters:
  • resource (dict) – Object to create.
  • timeout – Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView, just stop waiting for its completion.
Returns:

Created resource.

Return type:

dict

delete(resource, force=False, timeout=-1)[source]

Deletes a User.

Parameters:
  • resource – dict object to delete
  • force – If set to true, the operation completes despite any problems with network connectivity or errors on the resource itself. The default is false.
  • timeout – Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView; it just stops waiting for its completion.
Returns:

Indicates if the resource was successfully deleted.

Return type:

bool

get_all(start=0, count=-1, filter=u'', sort=u'')[source]

Gets a paginated collection of Users. The collection is based on optional sorting and filtering and is constrained by start and count parameters.

Parameters:
  • start – The first item to return, using 0-based indexing. If not specified, the default is 0 - start with the first available item.
  • count

    The number of resources to return. A count of -1 requests all items.

    The actual number of items in the response might differ from the requested count if the sum of start and count exceeds the total number of items.

  • filter (list or str) – A general filter/query string to narrow the list of items returned. The default is no filter; all resources are returned.
  • sort – The sort order of the returned data set. By default, the sort order is based on create time with the oldest entry first.
Returns:

A list of Users.

Return type:

list

get_by(field, value)[source]

Gets all Users that match the filter.

The search is case-insensitive.

Parameters:
  • field – Field name to filter. Accepted values: ‘name’, ‘userName’, ‘role’
  • value – Value to filter.
Returns:

A list of Users.

Return type:

list

update(resource, timeout=-1)[source]

Updates a User.

Parameters:
  • resource (dict) – Object to update.
  • timeout – Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView, just stop waiting for its completion.
Returns:

Updated resource.

Return type:

dict

validate_full_name(full_name, timeout=-1)[source]

Verifies if a fullName is already in use.

Parameters:
  • full_name – The fullName to be verified.
  • timeout – Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView, just stops waiting for its completion.

Returns: True if full name is in use, False if it is not.

validate_user_name(user_name, timeout=-1)[source]

Verifies if a userName is already in use.

Parameters:
  • user_name – The userName to be verified.
  • timeout – Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView, just stops waiting for its completion.

Returns: True if user name is in use, False if it is not.

Module contents