docstring
stringlengths
52
499
function
stringlengths
67
35.2k
__index_level_0__
int64
52.6k
1.16M
Updates the QoS aggregated configuration for the logical interconnect. Args: qos_configuration: QOS configuration. timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView, just ...
def update_qos_aggregated_configuration(self, qos_configuration, timeout=-1): uri = "{}{}".format(self.data["uri"], self.QOS_AGGREGATED_CONFIGURATION) return self._helper.update(qos_configuration, uri=uri, timeout=timeout)
495,206
Download archived logs of the OS Volume. Args: name: Name of the OS Volume. file_path (str): Destination file path. Returns: bool: Indicates if the resource was successfully downloaded.
def download_archive(self, name, file_path): uri = self.URI + "/archive/" + name return self._client.download(uri, file_path)
495,211
Get storage details of an OS Volume. Args: id_or_uri: ID or URI of the OS Volume. Returns: dict: Storage details
def get_storage(self, id_or_uri): uri = self.URI + "/{}/storage".format(extract_id_from_uri(id_or_uri)) return self._client.get(uri)
495,212
Retrieves the topology information for the rack resource specified by ID or URI. Args: id_or_uri: Can be either the resource ID or the resource URI. Return: dict: Device topology.
def get_device_topology(self, id_or_uri): uri = self._client.build_uri(id_or_uri) + "/deviceTopology" return self._client.get(uri)
495,213
Gets a Managed SAN by name. Args: name: Name of the Managed SAN Returns: dict: Managed SAN.
def get_by_name(self, name): managed_sans = self.get_all() result = [x for x in managed_sans if x['name'] == name] resource = result[0] if result else None if resource: resource = self.new(self._connection, resource) return resource
495,219
Creates an endpoints CSV file for a SAN. Args: 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: dict: Endpoint CSV File Response...
def create_endpoints_csv_file(self, timeout=-1): uri = "{}/endpoints/".format(self.data["uri"]) return self._helper.do_post(uri, {}, timeout, None)
495,221
Creates an unexpected zoning report for a SAN. Args: 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: list: A list of FCIssueRes...
def create_issues_report(self, timeout=-1): uri = "{}/issues/".format(self.data["uri"]) return self._helper.create_report(uri, timeout)
495,222
Deletes SNMPv1 trap forwarding destination based on {Id}. Args: id_or_uri: dict object to delete 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. ...
def delete(self, id_or_uri, timeout=-1): return self._client.delete(id_or_uri, timeout=timeout)
495,228
Edit an IPv4 Range. Args: information (dict): Information to update. 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: dict: Updat...
def update(self, information, timeout=-1): return self._client.update(information, timeout=timeout)
495,229
Wait for task execution and return associated resource. Args: task: task dict timeout: timeout in seconds Returns: Associated resource when creating or updating; True when deleting.
def wait_for_task(self, task, timeout=-1): self.__wait_task_completion(task, timeout) task = self.get(task) logger.debug("Waiting for task. Percentage complete: " + str(task.get('computedPercentComplete'))) logger.debug("Waiting for task. Task state: " + str(task.get('taskStat...
495,230
Waits until the task is completed and returns the task resource. Args: task: TaskResource timeout: Timeout in seconds Returns: dict: TaskResource
def get_completed_task(self, task, timeout=-1): self.__wait_task_completion(task, timeout) return self.get(task)
495,231
Retrieve a resource associated with a task. Args: task: task dict Returns: tuple: task (updated), the entity found (dict)
def get_associated_resource(self, task): if not task: raise HPOneViewUnknownType(MSG_INVALID_TASK) if task['category'] != 'tasks' and task['category'] != 'backups': # it is an error if type is not in obj, so let the except flow raise HPOneViewUnknownType(MS...
495,235
Updates the remote server configuration and the automatic backup schedule for backup. Args: config (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 w...
def update_config(self, config, timeout=-1): return self._client.update(config, uri=self.URI + "/config", timeout=timeout)
495,236
Saves a backup of the appliance to a previously-configured remote location. Args: save_uri (dict): The URI for saving the backup to a previously configured location. timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operatio...
def update_remote_archive(self, save_uri, timeout=-1): return self._client.update_with_zero_body(uri=save_uri, timeout=timeout)
495,237
Gets a list of associated ethernet networks of an uplink set. Args: id_or_uri: Can be either the uplink set id or the uplink set uri. Returns: list: Associated ethernet networks.
def get_ethernet_networks(self): network_uris = self.data.get('networkUris') networks = [] if network_uris: for uri in network_uris: networks.append(self._ethernet_networks.get_by_uri(uri)) return networks
495,239
Gets an index resource by URI. Args: uri: The resource URI. Returns: dict: The index resource.
def get(self, uri): uri = self.URI + uri return self._client.get(uri)
495,245
Generates a self signed certificate or an internal CA signed certificate for RabbitMQ clients. Args: information (dict): Information to generate the certificate for RabbitMQ clients. timeout: Timeout in seconds. Wait for task completion by default. The timeout does not a...
def generate(self, information, timeout=-1): return self._client.create(information, timeout=timeout)
495,256
Retrieves the public and private key pair associated with the specified alias name. Args: alias_name: Key pair associated with the RabbitMQ Returns: dict: RabbitMQ certificate
def get_key_pair(self, alias_name): uri = self.URI + "/keypair/" + alias_name return self._client.get(uri)
495,257
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. Args: alias_name: Key pair associated with the RabbitMQ key_format: Valid key fo...
def get_keys(self, alias_name, key_format): uri = self.URI + "/keys/" + alias_name + "?format=" + key_format return self._client.get(uri)
495,258
Validates an ID pool. Args: id_or_uri: ID or URI of range. ids_pools (list): List of Id Pools. Returns: dict: A dict containing a list with IDs.
def validate_id_pool(self, id_or_uri, ids_pools): uri = self._client.build_uri(id_or_uri) + "/validate?idList=" + "&idList=".join(ids_pools) return self._client.get(uri)
495,259
Generates and returns a random range. Args: id_or_uri: ID or URI of range. Returns: dict: A dict containing a list with IDs.
def generate(self, id_or_uri): uri = self._client.build_uri(id_or_uri) + "/generate" return self._client.get(uri)
495,260
Retrieves a collection of all storage systems that is applicable to this storage volume template. Args: id_or_uri: Can be either the power device id or the uri Returns: list: Storage systems.
def get_compatible_systems(self, id_or_uri): uri = self._client.build_uri(id_or_uri) + "/compatible-systems" return self._client.get(uri)
495,263
Adds a volume that already exists in the Storage system Args: 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 i...
def add_from_existing(self, resource, timeout=-1): uri = self.URI + "/from-existing" return self._client.create(resource, uri=uri, timeout=timeout)
495,264
Creates a snapshot for the specified volume. Args: volume_id_or_uri: Can be either the volume ID or the volume URI. snapshot (dict): Object to create. timeout: Timeout in seconds. Wait for task completion by default. The timeou...
def create_snapshot(self, volume_id_or_uri, snapshot, timeout=-1): uri = self.__build_volume_snapshot_uri(volume_id_or_uri) return self._client.create(snapshot, uri=uri, timeout=timeout, default_values=self.DEFAULT_VALUES_SNAPSHOT)
495,269
Gets a snapshot of a volume. Args: volume_id_or_uri: Can be either the volume ID or the volume URI. It is optional if it is passed a snapshot URI, but required if it passed a snapshot ID. snapshot_id_or_uri: Can be either the snapshot ID o...
def get_snapshot(self, snapshot_id_or_uri, volume_id_or_uri=None): uri = self.__build_volume_snapshot_uri(volume_id_or_uri, snapshot_id_or_uri) return self._client.get(uri)
495,270
Gets all snapshots that match the filter. The search is case-insensitive. Args: volume_id_or_uri: Can be either the volume id or the volume uri. field: Field name to filter. value: Value to filter. Returns: list: Snapshots
def get_snapshot_by(self, volume_id_or_uri, field, value): uri = self.__build_volume_snapshot_uri(volume_id_or_uri) return self._client.get_by(field, value, uri=uri)
495,271
Removes extra presentations from a specified volume on the storage system. Args: volume_id_or_uri: Can be either the volume id or the volume uri. timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in...
def repair(self, volume_id_or_uri, timeout=-1): data = { "type": "ExtraManagedStorageVolumePaths", "resourceUri": self._client.build_uri(volume_id_or_uri) } custom_headers = {'Accept-Language': 'en_US'} uri = self.URI + '/repair' return self._clie...
495,273
Reapplies the appliance's configuration on the enclosure. This includes running the same configure steps that were performed as part of the enclosure add. Args: timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneV...
def update_configuration(self, timeout=-1): uri = "{}/configuration".format(self.data['uri']) return self.update_with_zero_body(uri=uri, timeout=timeout)
495,277
Sets the calibrated max power of an unmanaged or unsupported enclosure. Args: configuration: Configuration 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. ...
def update_environmental_configuration(self, configuration, timeout=-1): uri = '{}/environmentalConfiguration'.format(self.data['uri']) return self._helper.do_put(uri, configuration, timeout, None)
495,280
Builds the SSO (Single Sign-On) URL parameters for the specified enclosure. This allows the user to log in to the enclosure without providing credentials. This API is currently only supported by C7000 enclosures. Args: role: Role Returns: SSO (Single Sign-On) URL parame...
def get_sso(self, role): uri = "{}/sso?role={}".format(self.data['uri'], role) return self._helper.do_get(uri)
495,281
Creates a Certificate Signing Request (CSR) for an enclosure. Args: csr_data: Dictionary with csr details. bay_number: OA from which the CSR should be generated. Returns: Enclosure.
def generate_csr(self, csr_data, bay_number=None): uri = "{}/https/certificaterequest".format(self.data['uri']) if bay_number: uri += "?bayNumber=%d" % (bay_number) headers = {'Content-Type': 'application/json'} return self._helper.do_post(uri, csr_data, -1, heade...
495,282
Get an enclosure's Certificate Signing Request (CSR) that was generated by previous POST to the same URI. Args: bay_number: OA to retrieve the previously generated CSR. Returns: dict
def get_csr(self, bay_number=None): uri = "{}/https/certificaterequest".format(self.data['uri']) if bay_number: uri += "?bayNumber=%d" % (bay_number) return self._helper.do_get(uri)
495,283
Imports a signed server certificate into the enclosure. Args: certificate_data: Dictionary with Signed certificate and type. bay_number: OA to which the signed certificate will be imported. Returns: Enclosure.
def import_certificate(self, certificate_data, bay_number=None): uri = "{}/https/certificaterequest".format(self.data['uri']) if bay_number: uri += "?bayNumber=%d" % (bay_number) headers = {'Content-Type': 'application/json'} return self._helper.do_put(uri, certifi...
495,284
Gets a Scope by name. Args: name: Name of the Scope Returns: dict: Scope.
def get_by_name(self, name): scopes = self._client.get_all() result = [x for x in scopes if x['name'] == name] return result[0] if result else None
495,288
Creates a scope. Args: 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: dict: Crea...
def create(self, resource, timeout=-1): return self._client.create(resource, timeout=timeout, default_values=self.DEFAULT_VALUES)
495,289
Deletes a Scope. Args: resource: dict object to delete 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: bool: Ind...
def delete(self, resource, timeout=-1): if type(resource) is dict: headers = {'If-Match': resource.get('eTag', '*')} else: headers = {'If-Match': '*'} return self._client.delete(resource, timeout=timeout, custom_headers=headers)
495,290
Creates a Golden Image resource from the deployed OS Volume as per the attributes specified. Args: resource (dict): Object to create. timeout: Timeout in seconds. Waits for task completion by default. The timeout does not abort the operation in OneView, i...
def create(self, resource, timeout=-1): data = self.__default_values.copy() data.update(resource) return self._client.create(data, timeout=timeout)
495,302
Adds a Golden Image resource from the file that is uploaded from a local drive. Only the .zip format file can be used for the upload. Args: file_path (str): File name to upload. golden_image_info (dict): Golden Image information. Returns: dict: Golden Image.
def upload(self, file_path, golden_image_info): uri = "{0}?name={1}&description={2}".format(self.URI, quote(golden_image_info.get('name', '')), quote(golden_image_info.get('description', ''))) ...
495,303
Download the details of the Golden Image capture logs, which has been archived based on the specific attribute ID. Args: id_or_uri: ID or URI of the Golden Image. file_path (str): File name to save the archive. Returns: bool: Success.
def download_archive(self, id_or_uri, file_path): uri = self.URI + "/archive/" + extract_id_from_uri(id_or_uri) return self._client.download(uri, file_path)
495,304
Updates the specified alert resource. Args: resource (dict): Object to update. 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: d...
def update(self, resource, id_or_uri=None, timeout=-1): uri = resource.pop('uri', None) if not uri: if not id_or_uri: raise ValueError("URI was not provided") uri = self._client.build_uri(id_or_uri) return self._client.update(resource=resource, ur...
495,305
Deletes alert change log by alert ID or URI. Args: id_or_uri: alert ID or URI.
def delete_alert_change_log(self, id_or_uri): uri = self.URI + "/AlertChangeLog/" + extract_id_from_uri(id_or_uri) resource = { "uri": uri } self._client.delete(resource)
495,306
Retrieves the URL to launch a Single Sign-On (SSO) session for the iLO web interface. If the server hardware is unsupported, the resulting URL will not use SSO and the iLO web interface will prompt for credentials. This is not supported on G7/iLO3 or earlier servers. Args: ip: IP ad...
def get_ilo_sso_url(self, ip=None): uri = "{}/iloSsoUrl".format(self.data["uri"]) if ip: uri = "{}?ip={}".format(uri, ip) return self._helper.do_get(uri)
495,311
Generates a Single Sign-On (SSO) session for the iLO Java Applet console and returns the URL to launch it. If the server hardware is unmanaged or unsupported, the resulting URL will not use SSO and the iLO Java Applet will prompt for credentials. This is not supported on G7/iLO3 or earlier servers. ...
def get_java_remote_console_url(self, ip=None): uri = "{}/javaRemoteConsoleUrl".format(self.data["uri"]) if ip: uri = "{}?ip={}".format(uri, ip) return self._helper.do_get(uri)
495,314
Updates the iLO firmware on a physical server to a minimum ILO firmware version required by OneView to manage the server. Args: timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView; it just stop...
def update_mp_firware_version(self, timeout=-1): uri = "{}/mpFirmwareVersion".format(self.data["uri"]) return self._helper.do_put(uri, None, timeout, None)
495,315
Updates a Logical Switch. Args: 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: d...
def update(self, resource, timeout=-1): self.__set_default_values(resource) uri = self._client.build_uri(resource['logicalSwitch']['uri']) return self._client.update(resource, uri=uri, timeout=timeout)
495,318
The Refresh action reclaims the top-of-rack switches in a logical switch. Args: id_or_uri: Can be either the Logical Switch ID or URI timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation ...
def refresh(self, id_or_uri, timeout=-1): uri = self._client.build_uri(id_or_uri) + "/refresh" return self._client.update_with_zero_body(uri, timeout=timeout)
495,319
Initiates a migration of an enclosure specified by the ID or URI of a migration report. Args: id_or_uri: ID or URI of the migration report. timeout: Timeout in seconds. Waits for task completion by default. The timeout does not abort the task in OneView; just stops wai...
def migrate(self, id_or_uri, timeout=-1): # create the special payload to tell the VC Migration Manager to migrate the VC domain migrationInformation = { 'migrationState': 'Migrated', 'type': 'migratable-vc-domains', 'category': 'migratable-vc-domains' ...
495,326
Gets all the labels for the specified resource Args: resource_uri: The resource URI Returns: dict: Resource Labels
def get_by_resource(self, resource_uri): uri = self.URI + self.RESOURCES_PATH + '/' + resource_uri return self._client.get(id_or_uri=uri)
495,327
Set all the labels for a resource. Args: resource: The object containing the resource URI and a list of labels Returns: dict: Resource Labels
def create(self, resource): uri = self.URI + self.RESOURCES_PATH return self._client.create(resource=resource, uri=uri)
495,328
Delete all the labels for a resource. Args: resource (dict): Object to delete. 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.
def delete(self, resource, timeout=-1): self._client.delete(resource=resource, timeout=timeout)
495,329
Updates a User. Args: 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: dict: Updat...
def update(self, resource, timeout=-1): return self._client.update(resource, timeout=timeout, default_values=self.DEFAULT_VALUES, uri=self.URI)
495,330
Gets all Users that match the filter. The search is case-insensitive. Args: field: Field name to filter. Accepted values: 'name', 'userName', 'role' value: Value to filter. Returns: list: A list of Users.
def get_by(self, field, value): if field == 'userName' or field == 'name': return self._client.get(self.URI + '/' + value) elif field == 'role': value = value.replace(" ", "%20") return self._client.get(self.URI + '/roles/users/' + value)['members'] e...
495,331
Verifies if a userName is already in use. Args: 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 compl...
def validate_user_name(self, user_name, timeout=-1): uri = self.URI + '/validateLoginName/' + user_name return self._client.create_with_zero_body(uri=uri, timeout=timeout)
495,332
Verifies if a fullName is already in use. Args: 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 compl...
def validate_full_name(self, full_name, timeout=-1): uri = self.URI + '/validateUserName/' + full_name return self._client.create_with_zero_body(uri=uri, timeout=timeout)
495,333
Gets the power state (on, off or unknown) of the specified power delivery device that supports power control. The device must be an HP Intelligent Outlet. Args: id_or_uri: Can be either the power device id or the uri Returns: str: The power state
def get_power_state(self, id_or_uri): uri = self._client.build_uri(id_or_uri) + "/powerState" return self._client.get(uri)
495,335
Sets the power state of the specified power delivery device. The device must be an HP Intelligent Outlet. Args: id_or_uri: Can be either the power device id or the uri power_state: {"powerState":"On|Off"} Returns: str: The power state
def update_power_state(self, id_or_uri, power_state): uri = self._client.build_uri(id_or_uri) + "/powerState" return self._client.update(power_state, uri)
495,336
Refreshes a given intelligent power delivery device. Args: id_or_uri: Can be either the power device id or the uri refresh_state_data: Power device refresh request Returns: str: The power state
def update_refresh_state(self, id_or_uri, refresh_state_data): uri = self._client.build_uri(id_or_uri) + "/refreshState" return self._client.update(refresh_state_data, uri=uri)
495,337
Retrieves the unit identification (UID) state (on, off, unknown) of the specified power outlet or extension bar resource. The device must be an HP iPDU component with a locator light (HP Intelligent Load Segment, HP AC Module, HP Intelligent Outlet Bar, or HP Intelligent Outlet). Args: ...
def get_uid_state(self, id_or_uri): uri = self._client.build_uri(id_or_uri) + "/uidState" return self._client.get(uri)
495,339
Sets the unit identification (UID) light state of the specified power delivery device. The device must be an HP iPDU component with a locator light (HP Intelligent Load Segment, HP AC Module, HP Intelligent Outlet Bar, or HP Intelligent Outlet) Args: id_or_uri: Can b...
def update_uid_state(self, id_or_uri, refresh_state_data): uri = self._client.build_uri(id_or_uri) + "/uidState" return self._client.update(refresh_state_data, uri)
495,340
Gets the build plans details os teh selected plan script as per the selected attributes. Args: id: ID of the Plan Script. Returns: array of build plans
def get_usedby_and_readonly(self, id): uri = self.URI + "/" + id + "/usedby/readonly" return self._client.get(uri)
495,343
Retrieves facts about Server Profiles and Server Profile Templates that are using Deployment Plan based on the ID or URI provided. Args: id_or_uri: ID or URI of the Deployment Plan. Returns: dict: Server Profiles and Server Profile Templates
def get_osdp(self, id_or_uri): uri = self._client.build_subresource_uri(resource_id_or_uri=id_or_uri, subresource_path="osdp") return self._client.get(uri)
495,345
Updates server profile template. Args: data: 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. force: Force the update ...
def update(self, data=None, timeout=-1, force=''): uri = self.data['uri'] resource = deepcopy(self.data) resource.update(data) # Removes related fields to serverHardware in case of unassign if resource.get('serverHardwareUri') is None: resource.pop('enclosu...
495,347
Updates the configuration script of the enclosure-group with the specified URI. Args: id_or_uri: Resource id or resource uri. script_body: Configuration script. Returns: dict: Updated enclosure group.
def update_script(self, script_body): uri = "{}/script".format(self.data['uri']) return self._helper.update(script_body, uri=uri)
495,360
Removes extra presentations from a specified server profile. Args: resource (dict): Object to create timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView; it just stops waiti...
def remove_extra_presentations(self, resource, timeout=-1): uri = self.URI + "/repair" custom_headers = {'Accept-Language': 'en_US'} return self._client.create(resource, uri=uri, timeout=timeout, custom_headers=custom_headers)
495,361
Gets all paths or a specific attachment path for the specified volume attachment. Args: id_or_uri: Can be either the volume attachment id or the volume attachment uri. path_id_or_uri: Can be either the path id or the path uri. Returns: dict: Paths.
def get_paths(self, id_or_uri, path_id_or_uri=''): if path_id_or_uri: uri = self._client.build_uri(path_id_or_uri) if "/paths" not in uri: uri = self._client.build_uri( id_or_uri) + "/paths" + "/" + path_id_or_uri else: ur...
495,362
Get the details for the backup from an Artifact Bundle. Args: id_or_uri: ID or URI of the Artifact Bundle. Returns: Dict: Backup for an Artifacts Bundle.
def get_backup(self, id_or_uri): uri = self.BACKUPS_PATH + '/' + extract_id_from_uri(id_or_uri) return self._client.get(id_or_uri=uri)
495,363
Downloads an archive for the Artifact Bundle. Args: id_or_uri: ID or URI of the Artifact Bundle. file_path(str): Destination file path. Returns: bool: Successfully downloaded.
def download_archive_artifact_bundle(self, id_or_uri, file_path): uri = self.BACKUP_ARCHIVE_PATH + '/' + extract_id_from_uri(id_or_uri) return self._client.download(uri, file_path)
495,364
Download the Artifact Bundle. Args: id_or_uri: ID or URI of the Artifact Bundle. file_path(str): Destination file path. Returns: bool: Successfully downloaded.
def download_artifact_bundle(self, id_or_uri, file_path): uri = self.DOWNLOAD_PATH + '/' + extract_id_from_uri(id_or_uri) return self._client.download(uri, file_path)
495,365
Restore an Artifact Bundle from a backup file. Args: file_path (str): The File Path to restore the Artifact Bundle. deployment_groups_id_or_uri: ID or URI of the Deployment Groups. Returns: dict: Deployment group.
def upload_backup_bundle_from_file(self, file_path, deployment_groups_id_or_uri): deployment_groups_uri = deployment_groups_id_or_uri if self.DEPLOYMENT_GROUPS_URI not in deployment_groups_id_or_uri: deployment_groups_uri = self.DEPLOYMENT_GROUPS_URI + deployment_groups_id_or_uri ...
495,367
Updates only name for the Artifact Bundle. Args: resource (dict): Object to update. timeout: Timeout in seconds. Waits for task completion by default. The timeout does not abort the operation in OneView, it just stops waiting for its completion. ...
def update(self, resource, timeout=-1): return self._client.update(resource, timeout=timeout, default_values=self.DEFAULT_VALUES)
495,368
Extracts the existing bundle on the appliance and creates all the artifacts. Args: resource (dict): Artifact Bundle to extract. timeout: Timeout in seconds. Waits for task completion by default. The timeout does not abort the operation in OneView, it just...
def extract_bundle(self, resource, timeout=-1): return self._client.update(resource, timeout=timeout, custom_headers={"Content-Type": "text/plain"})
495,369
Extracts the existing backup bundle on the appliance and creates all the artifacts. Args: resource (dict): Deployment Group to extract. timeout: Timeout in seconds. Waits for task completion by default. The timeout does not abort the operation in OneView,...
def extract_backup_bundle(self, resource, timeout=-1): return self._client.update(resource, uri=self.BACKUP_ARCHIVE_PATH, timeout=timeout)
495,370
Stops creation of the selected Artifact Bundle. Args: id_or_uri: ID or URI of the Artifact Bundle. task_uri: Task URI associated with the Artifact Bundle. Returns: string:
def stop_artifact_creation(self, id_or_uri, task_uri): data = { "taskUri": task_uri } uri = self.URI + '/' + extract_id_from_uri(id_or_uri) + self.STOP_CREATION_PATH return self._client.update(data, uri=uri)
495,371
Returns a description of the environmental configuration (supported feature set, calibrated minimum & maximum power, location & dimensions, ...) of the resource. Args: id_or_uri: Can be either the Unmanaged Device id or the uri Returns: dict: ...
def get_environmental_configuration(self, id_or_uri): uri = self._client.build_uri(id_or_uri) + "/environmentalConfiguration" return self._client.get(uri)
495,372
Updates the configuration script of the logical enclosure and on all enclosures in the logical enclosure with the specified ID. Args: information: Updated script. timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation ...
def update_script(self, information, timeout=-1): uri = "{}/script".format(self.data["uri"]) return self._helper.update(information, uri=uri, timeout=timeout)
495,375
Use this action to make a logical enclosure consistent with the enclosure group when the logical enclosure is in the Inconsistent state. Args: timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView; it just stops...
def update_from_group(self, data=None, timeout=-1): uri = "{}/updateFromGroup".format(self.data["uri"]) return self._helper.update(data, uri, timeout=timeout)
495,377
Creates bulk Ethernet networks. Args: resource (dict): Specifications to create in bulk. 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. ...
def create_bulk(self, resource, timeout=-1): uri = self.URI + '/bulk' default_values = self._get_default_values(self.BULK_DEFAULT_VALUES) updated_data = self._helper.update_resource_fields(resource, default_values) self._helper.create(updated_data, uri=uri, timeout=timeout) ...
495,379
Gets the URIs of profiles which are using an Ethernet network. Args: id_or_uri: Can be either the logical interconnect group id or the logical interconnect group uri Returns: list: URIs of the associated profiles.
def get_associated_profiles(self): uri = "{}/associatedProfiles".format(self.data['uri']) return self._helper.do_get(uri)
495,382
Updates a copy of resource1 with resource2 values and returns the merged dictionary. Args: resource1: original resource resource2: resource to update resource1 Returns: dict: merged resource
def merge_resources(resource1, resource2): merged = resource1.copy() merged.update(resource2) return merged
495,384
Generate a new list where each item of original resource_list will be merged with the default_values. Args: resource_list: list with items to be merged default_values: properties to be merged with each item list. If the item already contains some property the original value will be main...
def merge_default_values(resource_list, default_values): def merge_item(resource): return merge_resources(default_values, resource) return lmap(merge_item, resource_list)
495,385
Transforms a list into a dictionary, putting values as keys Args: id: Returns: dict: dictionary built
def transform_list_to_dict(list): ret = {} for value in list: if isinstance(value, dict): ret.update(value) else: ret[str(value)] = True return ret
495,386
Retrieves data from OneView and updates resource object. Args: update_data: Flag to update resource data when it is required.
def ensure_resource_data(self, update_data=False): # Check for unique identifier in the resource data if not any(key in self.data for key in self.UNIQUE_IDENTIFIERS): raise exceptions.HPOneViewMissingUniqueIdentifiers(MISSING_UNIQUE_IDENTIFIERS) # Returns if data update is ...
495,390
Makes a POST request to create a resource when a request body is required. Args: data: Additional fields can be passed to create the resource. uri: Resouce uri timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation ...
def create(self, data=None, uri=None, timeout=-1, custom_headers=None, force=False): if not data: data = {} default_values = self._get_default_values() data = self._helper.update_resource_fields(data, default_values) logger.debug('Create (uri = %s, resource = %s)' ...
495,391
Deletes current resource. Args: timeout: Timeout in seconds. custom_headers: Allows to set custom http headers. force: Flag to force the operation.
def delete(self, timeout=-1, custom_headers=None, force=False): uri = self.data['uri'] logger.debug("Delete resource (uri = %s)" % (str(uri))) return self._helper.delete(uri, timeout=timeout, custom_headers=custom_headers, force=force)
495,392
Get the resource by passing a field and its value. Note: This function uses get_all passing a filter.The search is case-insensitive. Args: field: Field name to filter. value: Value to filter. Returns: dict
def get_by(self, field, value): if not field: logger.exception(RESOURCE_CLIENT_INVALID_FIELD) raise ValueError(RESOURCE_CLIENT_INVALID_FIELD) filter = "\"{0}='{1}'\"".format(field, value) results = self.get_all(filter=filter) # Workaround when the OneVi...
495,394
Retrieves a resource by its name. Args: name: Resource name. Returns: Resource object or None if resource does not exist.
def get_by_name(self, name): result = self.get_by("name", name) if result: data = result[0] new_resource = self.new(self._connection, data) else: new_resource = None return new_resource
495,395
Retrieves a resource by its URI Args: uri: URI of the resource Returns: Resource object
def get_by_uri(self, uri): self._helper.validate_resource_uri(uri) data = self._helper.do_get(uri) if data: new_resource = self.new(self._connection, data) else: new_resource = None return new_resource
495,396
Makes a POST request to create a resource when a request body is required. Args: data: Additional fields can be passed to create the resource. uri: Resouce uri timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation ...
def create(self, data=None, uri=None, timeout=-1, custom_headers=None, force=False): if not uri: uri = self._base_uri if force: uri += '?force={}'.format(force) logger.debug('Create (uri = %s, resource = %s)' % (uri, str(data))) return self.do_post(uri...
495,402
Deletes current resource. Args: force: Flag to delete the resource forcefully, default is False. timeout: Timeout in seconds. custom_headers: Allows to set custom http headers.
def delete(self, uri, force=False, timeout=-1, custom_headers=None): if force: uri += '?force=True' logger.debug("Delete resource (uri = %s)" % (str(uri))) task, body = self._connection.delete(uri, custom_headers=custom_headers) if not task: # 204 NO C...
495,403
Creates a report and returns the output. Args: uri: URI 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: list:
def create_report(self, uri, timeout=-1): logger.debug('Creating Report (uri = %s)'.format(uri)) task, _ = self._connection.post(uri, {}) if not task: raise exceptions.HPOneViewException(RESOURCE_CLIENT_TASK_EXPECTED) task = self._task_monitor.get_completed_task(ta...
495,405
Retrieves a collection of resources. Use this function when the 'start' and 'count' parameters are not allowed in the GET call. Otherwise, use get_all instead. Optional filtering criteria may be specified. Args: filter (list or str): General filter/query string. ...
def get_collection(self, uri=None, filter='', path=''): if not uri: uri = self._base_uri if filter: filter = self.make_query_filter(filter) filter = "?" + filter[1:] uri = "{uri}{path}{filter}".format(uri=uri, path=path, filter=filter) logge...
495,406
Helps to build the URI from resource id and validate the URI. Args: id_or_uri: ID/URI of the resource. Returns: Returns a valid resource URI
def build_uri(self, id_or_uri): if not id_or_uri: logger.exception(RESOURCE_CLIENT_INVALID_ID) raise ValueError(RESOURCE_CLIENT_INVALID_ID) if "/" in id_or_uri: self.validate_resource_uri(id_or_uri) return id_or_uri else: retu...
495,409
Helps to build a URI with resource path and its sub resource path. Args: resoure_id_or_uri: ID/URI of the main resource. subresource_id__or_uri: ID/URI of the sub resource. subresource_path: Sub resource path to be added with the URI. Returns: Returns UR...
def build_subresource_uri(self, resource_id_or_uri=None, subresource_id_or_uri=None, subresource_path=''): if subresource_id_or_uri and "/" in subresource_id_or_uri: return subresource_id_or_uri else: if not resource_id_or_uri: raise exceptions.HPOneViewV...
495,410
Update resource data with new fields. Args: data: resource data data_to_update: dict of data to update resource data Returnes: Returnes dict
def update_resource_fields(self, data, data_to_add): for key, value in data_to_add.items(): if not data.get(key): data[key] = value return data
495,412
Helps to make get requests Args: uri: URI of the resource Returns: Returns: Returns the resource data
def do_get(self, uri): self.validate_resource_uri(uri) return self._connection.get(uri)
495,414
Helps to make post requests. Args: uri: URI of the resource. resource: Resource data to post. timeout: Time out for the request in seconds. cutom_headers: Allows to add custom http headers. Returns: Retunrs Task object.
def do_post(self, uri, resource, timeout, custom_headers): self.validate_resource_uri(uri) task, entity = self._connection.post(uri, resource, custom_headers=custom_headers) if not task: return entity return self._task_monitor.wait_for_task(task, timeout)
495,415
Helps to make put requests. Args: uri: URI of the resource timeout: Time out for the request in seconds. custom_headers: Allows to set custom http headers. Retuns: Returns Task object
def do_put(self, uri, resource, timeout, custom_headers): self.validate_resource_uri(uri) task, body = self._connection.put(uri, resource, custom_headers=custom_headers) if not task: return body return self._task_monitor.wait_for_task(task, timeout)
495,416
Update resource data with new fields. Args: data: resource data data_to_update: dict of data to update resource data Returnes: Returnes dict
def add_new_fields(data, data_to_add): for key, value in data_to_add.items(): if not data.get(key): data[key] = value return data
495,417
Uses the PATCH to update a resource. Only one operation can be performed in each PATCH call. Args: body (list): Patch request body timeout (int): Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in OneView; it jus...
def patch_request(self, uri, body, custom_headers=None, timeout=-1): logger.debug('Patch resource (uri = %s, data = %s)' % (uri, body)) if not custom_headers: custom_headers = {} if self._connection._apiVersion >= 300 and 'Content-Type' not in custom_headers: c...
495,419
Downloads the contents of the requested URI to a stream. Args: uri: URI file_path: File path destination Returns: bool: Indicates if the file was successfully downloaded.
def download(self, uri, file_path): with open(file_path, 'wb') as file: return self._connection.download_to_stream(file, uri)
495,420