hpeOneView.resources.security package
Submodules
hpeOneView.resources.security.certificate_rabbitmq module
- class hpeOneView.resources.security.certificate_rabbitmq.CertificateRabbitMQ(con)[source]
Bases:
object
- URI = '/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
hpeOneView.resources.security.certificates_server module
- class hpeOneView.resources.security.certificates_server.CertificatesServer(connection, data=None)[source]
Bases:
Resource
The Certificates Servers resource provides REST APIs for configuration of device or server certificates for the appliance to establish SSL communication with other managed network entities.
Import, Update and Delete APIs are asynchronous and GET API is synchronous.
- URI = '/rest/certificates'
- create(data=None, timeout=-1)[source]
Makes a POST request to create a server certificate resource.
- Parameters
data – Fields passed to create the resource.
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
Created certificate resource.
hpeOneView.resources.security.login_details module
hpeOneView.resources.security.roles module
- class hpeOneView.resources.security.roles.Roles(con)[source]
Bases:
object
Roles API client.
- RESOURCES_PATH = '/resources'
- URI = '/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='', sort='')[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
hpeOneView.resources.security.users module
- class hpeOneView.resources.security.users.Users(connection, data=None)[source]
Bases:
Resource
Users API client.
- URI = '/rest/users'
- add_role_to_userName(username, data)[source]
Add roles to a given user name
- Parameters
username (str) – userName of the user
data (list) – roles to be added
- Returns
User
- Return type
dict object
- change_password(resource)[source]
Change one’s own password
- Parameters
resource (dict) – Object to change password
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.
- create_multiple_user(data)[source]
Create a multiple user
- Agrs:
data (list): multiple user
- Returns
User
- Return type
dict object
- delete_multiple_user(data)[source]
Delete the multiple users
- Parameters
data (list) – List of users to be deleted
- Returns
None
- get_by_userName(name)[source]
Gets a complete json body for username
- Parameters
name (str) – userName of the user
- Returns
User
- Return type
dict object
- get_role_associated_with_userName(userName)[source]
Gets a user by userName.
- Parameters
name (str) – userName of the user.
- Returns
User
- Return type
dict object
- get_user_by_role(rolename)[source]
Gets all the users associated with this role
- Parameters
rolename (str) – rolename of the user
- Returns
User
- Return type
list
- remove_role_from_username(username, data)[source]
Removes a specified role from the username
- Parameters
username (str) – username of the user
data (str/list) – list role to be removed from user
- Returns
boolean
- update(data=None, timeout=-1, custom_headers=None, force=False)[source]
Makes a PUT request to update a resource when a request body is required.
- Parameters
data (dict) – Data to update the resource.
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.
custom_headers – Allows to add custom HTTP headers.
force – Force the update operation.
- Returns
A dict with the updated resource data.
- update_role_to_userName(username, data)[source]
Update roles to a given user name
- Agrs:
username (str): username of the user data (list): roles to be updated
- Returns
User
- Return type
dict
- validate_full_name(full_name, timeout=-1)[source]
Verifies if a fullName is already in use.
- Parameters
full_name (str) – 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 (str) – 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.