id
int32
0
252k
repo
stringlengths
7
55
path
stringlengths
4
127
func_name
stringlengths
1
88
original_string
stringlengths
75
19.8k
language
stringclasses
1 value
code
stringlengths
75
19.8k
code_tokens
list
docstring
stringlengths
3
17.3k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
87
242
18,600
HewlettPackard/python-hpOneView
hpOneView/resources/servers/enclosures.py
Enclosures.get_by_hostname
def get_by_hostname(self, hostname): """Get enclosure by it's hostname""" def filter_by_hostname(hostname, enclosure): is_primary_ip = ('activeOaPreferredIP' in enclosure and enclosure['activeOaPreferredIP'] == hostname) is_standby_ip = ('standbyOaPreferredIP' in enclosure and enclosure['standbyOaPreferredIP'] == hostname) return is_primary_ip or is_standby_ip enclosures = self.get_all() result = [x for x in enclosures if filter_by_hostname(hostname, x)] if result: new_resource = self.new(self._connection, result[0]) else: new_resource = None return new_resource
python
def get_by_hostname(self, hostname): """Get enclosure by it's hostname""" def filter_by_hostname(hostname, enclosure): is_primary_ip = ('activeOaPreferredIP' in enclosure and enclosure['activeOaPreferredIP'] == hostname) is_standby_ip = ('standbyOaPreferredIP' in enclosure and enclosure['standbyOaPreferredIP'] == hostname) return is_primary_ip or is_standby_ip enclosures = self.get_all() result = [x for x in enclosures if filter_by_hostname(hostname, x)] if result: new_resource = self.new(self._connection, result[0]) else: new_resource = None return new_resource
[ "def", "get_by_hostname", "(", "self", ",", "hostname", ")", ":", "def", "filter_by_hostname", "(", "hostname", ",", "enclosure", ")", ":", "is_primary_ip", "=", "(", "'activeOaPreferredIP'", "in", "enclosure", "and", "enclosure", "[", "'activeOaPreferredIP'", "]", "==", "hostname", ")", "is_standby_ip", "=", "(", "'standbyOaPreferredIP'", "in", "enclosure", "and", "enclosure", "[", "'standbyOaPreferredIP'", "]", "==", "hostname", ")", "return", "is_primary_ip", "or", "is_standby_ip", "enclosures", "=", "self", ".", "get_all", "(", ")", "result", "=", "[", "x", "for", "x", "in", "enclosures", "if", "filter_by_hostname", "(", "hostname", ",", "x", ")", "]", "if", "result", ":", "new_resource", "=", "self", ".", "new", "(", "self", ".", "_connection", ",", "result", "[", "0", "]", ")", "else", ":", "new_resource", "=", "None", "return", "new_resource" ]
Get enclosure by it's hostname
[ "Get", "enclosure", "by", "it", "s", "hostname" ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/enclosures.py#L121-L136
18,601
HewlettPackard/python-hpOneView
hpOneView/resources/servers/enclosures.py
Enclosures.update_environmental_configuration
def update_environmental_configuration(self, configuration, timeout=-1): """ 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. Returns: Settings that describe the environmental configuration. """ uri = '{}/environmentalConfiguration'.format(self.data['uri']) return self._helper.do_put(uri, configuration, timeout, None)
python
def update_environmental_configuration(self, configuration, timeout=-1): """ 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. Returns: Settings that describe the environmental configuration. """ uri = '{}/environmentalConfiguration'.format(self.data['uri']) return self._helper.do_put(uri, configuration, timeout, None)
[ "def", "update_environmental_configuration", "(", "self", ",", "configuration", ",", "timeout", "=", "-", "1", ")", ":", "uri", "=", "'{}/environmentalConfiguration'", ".", "format", "(", "self", ".", "data", "[", "'uri'", "]", ")", "return", "self", ".", "_helper", ".", "do_put", "(", "uri", ",", "configuration", ",", "timeout", ",", "None", ")" ]
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. Returns: Settings that describe the environmental configuration.
[ "Sets", "the", "calibrated", "max", "power", "of", "an", "unmanaged", "or", "unsupported", "enclosure", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/enclosures.py#L151-L164
18,602
HewlettPackard/python-hpOneView
hpOneView/resources/servers/enclosures.py
Enclosures.import_certificate
def import_certificate(self, certificate_data, bay_number=None): """ 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. """ 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, certificate_data, -1, headers)
python
def import_certificate(self, certificate_data, bay_number=None): """ 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. """ 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, certificate_data, -1, headers)
[ "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", ",", "certificate_data", ",", "-", "1", ",", "headers", ")" ]
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.
[ "Imports", "a", "signed", "server", "certificate", "into", "the", "enclosure", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/enclosures.py#L251-L268
18,603
HewlettPackard/python-hpOneView
hpOneView/resources/security/certificate_authority.py
CertificateAuthority.delete
def delete(self, alias_name, timeout=-1): """ 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. Args: 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. """ uri = self.URI + "/" + alias_name return self._client.delete(uri, timeout=timeout)
python
def delete(self, alias_name, timeout=-1): """ 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. Args: 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. """ uri = self.URI + "/" + alias_name return self._client.delete(uri, timeout=timeout)
[ "def", "delete", "(", "self", ",", "alias_name", ",", "timeout", "=", "-", "1", ")", ":", "uri", "=", "self", ".", "URI", "+", "\"/\"", "+", "alias_name", "return", "self", ".", "_client", ".", "delete", "(", "uri", ",", "timeout", "=", "timeout", ")" ]
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. Args: 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.
[ "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", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/security/certificate_authority.py#L67-L81
18,604
HewlettPackard/python-hpOneView
hpOneView/resources/settings/scopes.py
Scopes.get_by_name
def get_by_name(self, name): """ Gets a Scope by name. Args: name: Name of the Scope Returns: dict: Scope. """ scopes = self._client.get_all() result = [x for x in scopes if x['name'] == name] return result[0] if result else None
python
def get_by_name(self, name): """ Gets a Scope by name. Args: name: Name of the Scope Returns: dict: Scope. """ scopes = self._client.get_all() result = [x for x in scopes if x['name'] == name] return result[0] if result else None
[ "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" ]
Gets a Scope by name. Args: name: Name of the Scope Returns: dict: Scope.
[ "Gets", "a", "Scope", "by", "name", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/settings/scopes.py#L95-L107
18,605
HewlettPackard/python-hpOneView
hpOneView/resources/settings/scopes.py
Scopes.create
def create(self, resource, timeout=-1): """ 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: Created scope. """ return self._client.create(resource, timeout=timeout, default_values=self.DEFAULT_VALUES)
python
def create(self, resource, timeout=-1): """ 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: Created scope. """ return self._client.create(resource, timeout=timeout, default_values=self.DEFAULT_VALUES)
[ "def", "create", "(", "self", ",", "resource", ",", "timeout", "=", "-", "1", ")", ":", "return", "self", ".", "_client", ".", "create", "(", "resource", ",", "timeout", "=", "timeout", ",", "default_values", "=", "self", ".", "DEFAULT_VALUES", ")" ]
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: Created scope.
[ "Creates", "a", "scope", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/settings/scopes.py#L109-L123
18,606
HewlettPackard/python-hpOneView
hpOneView/resources/settings/scopes.py
Scopes.delete
def delete(self, resource, timeout=-1): """ 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: Indicates if the resource was successfully deleted. """ 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)
python
def delete(self, resource, timeout=-1): """ 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: Indicates if the resource was successfully deleted. """ 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)
[ "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", ")" ]
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: Indicates if the resource was successfully deleted.
[ "Deletes", "a", "Scope", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/settings/scopes.py#L143-L161
18,607
HewlettPackard/python-hpOneView
hpOneView/resources/settings/scopes.py
Scopes.update_resource_assignments
def update_resource_assignments(self, id_or_uri, resource_assignments, timeout=-1): """ Modifies scope membership by adding or removing resource assignments. Args: id_or_uri: Can be either the resource ID or the resource URI. resource_assignments (dict): A dict object with a list of resource URIs to be added and a list of resource URIs to be removed. 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: Updated resource. """ uri = self._client.build_uri(id_or_uri) + "/resource-assignments" headers = {'Content-Type': 'application/json'} return self._client.patch_request(uri, resource_assignments, timeout=timeout, custom_headers=headers)
python
def update_resource_assignments(self, id_or_uri, resource_assignments, timeout=-1): """ Modifies scope membership by adding or removing resource assignments. Args: id_or_uri: Can be either the resource ID or the resource URI. resource_assignments (dict): A dict object with a list of resource URIs to be added and a list of resource URIs to be removed. 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: Updated resource. """ uri = self._client.build_uri(id_or_uri) + "/resource-assignments" headers = {'Content-Type': 'application/json'} return self._client.patch_request(uri, resource_assignments, timeout=timeout, custom_headers=headers)
[ "def", "update_resource_assignments", "(", "self", ",", "id_or_uri", ",", "resource_assignments", ",", "timeout", "=", "-", "1", ")", ":", "uri", "=", "self", ".", "_client", ".", "build_uri", "(", "id_or_uri", ")", "+", "\"/resource-assignments\"", "headers", "=", "{", "'Content-Type'", ":", "'application/json'", "}", "return", "self", ".", "_client", ".", "patch_request", "(", "uri", ",", "resource_assignments", ",", "timeout", "=", "timeout", ",", "custom_headers", "=", "headers", ")" ]
Modifies scope membership by adding or removing resource assignments. Args: id_or_uri: Can be either the resource ID or the resource URI. resource_assignments (dict): A dict object with a list of resource URIs to be added and a list of resource URIs to be removed. 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: Updated resource.
[ "Modifies", "scope", "membership", "by", "adding", "or", "removing", "resource", "assignments", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/settings/scopes.py#L163-L181
18,608
HewlettPackard/python-hpOneView
hpOneView/image_streamer/image_streamer_client.py
ImageStreamerClient.golden_images
def golden_images(self): """ Gets the Golden Images API client. Returns: GoldenImages: """ if not self.__golden_images: self.__golden_images = GoldenImages(self.__connection) return self.__golden_images
python
def golden_images(self): """ Gets the Golden Images API client. Returns: GoldenImages: """ if not self.__golden_images: self.__golden_images = GoldenImages(self.__connection) return self.__golden_images
[ "def", "golden_images", "(", "self", ")", ":", "if", "not", "self", ".", "__golden_images", ":", "self", ".", "__golden_images", "=", "GoldenImages", "(", "self", ".", "__connection", ")", "return", "self", ".", "__golden_images" ]
Gets the Golden Images API client. Returns: GoldenImages:
[ "Gets", "the", "Golden", "Images", "API", "client", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/image_streamer_client.py#L69-L78
18,609
HewlettPackard/python-hpOneView
hpOneView/image_streamer/image_streamer_client.py
ImageStreamerClient.plan_scripts
def plan_scripts(self): """ Gets the Plan Scripts API client. Returns: PlanScripts: """ if not self.__plan_scripts: self.__plan_scripts = PlanScripts(self.__connection) return self.__plan_scripts
python
def plan_scripts(self): """ Gets the Plan Scripts API client. Returns: PlanScripts: """ if not self.__plan_scripts: self.__plan_scripts = PlanScripts(self.__connection) return self.__plan_scripts
[ "def", "plan_scripts", "(", "self", ")", ":", "if", "not", "self", ".", "__plan_scripts", ":", "self", ".", "__plan_scripts", "=", "PlanScripts", "(", "self", ".", "__connection", ")", "return", "self", ".", "__plan_scripts" ]
Gets the Plan Scripts API client. Returns: PlanScripts:
[ "Gets", "the", "Plan", "Scripts", "API", "client", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/image_streamer_client.py#L81-L90
18,610
HewlettPackard/python-hpOneView
hpOneView/image_streamer/image_streamer_client.py
ImageStreamerClient.build_plans
def build_plans(self): """ Gets the Build Plans API client. Returns: BuildPlans: """ if not self.__build_plans: self.__build_plans = BuildPlans(self.__connection) return self.__build_plans
python
def build_plans(self): """ Gets the Build Plans API client. Returns: BuildPlans: """ if not self.__build_plans: self.__build_plans = BuildPlans(self.__connection) return self.__build_plans
[ "def", "build_plans", "(", "self", ")", ":", "if", "not", "self", ".", "__build_plans", ":", "self", ".", "__build_plans", "=", "BuildPlans", "(", "self", ".", "__connection", ")", "return", "self", ".", "__build_plans" ]
Gets the Build Plans API client. Returns: BuildPlans:
[ "Gets", "the", "Build", "Plans", "API", "client", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/image_streamer_client.py#L93-L102
18,611
HewlettPackard/python-hpOneView
hpOneView/image_streamer/image_streamer_client.py
ImageStreamerClient.os_volumes
def os_volumes(self): """ Gets the OS Volumes API client. Returns: OsVolumes: """ if not self.__os_volumes: self.__os_volumes = OsVolumes(self.__connection) return self.__os_volumes
python
def os_volumes(self): """ Gets the OS Volumes API client. Returns: OsVolumes: """ if not self.__os_volumes: self.__os_volumes = OsVolumes(self.__connection) return self.__os_volumes
[ "def", "os_volumes", "(", "self", ")", ":", "if", "not", "self", ".", "__os_volumes", ":", "self", ".", "__os_volumes", "=", "OsVolumes", "(", "self", ".", "__connection", ")", "return", "self", ".", "__os_volumes" ]
Gets the OS Volumes API client. Returns: OsVolumes:
[ "Gets", "the", "OS", "Volumes", "API", "client", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/image_streamer_client.py#L105-L114
18,612
HewlettPackard/python-hpOneView
hpOneView/image_streamer/image_streamer_client.py
ImageStreamerClient.deployment_plans
def deployment_plans(self): """ Gets the Deployment Plans API client. Returns: DeploymentPlans: """ if not self.__deployment_plans: self.__deployment_plans = DeploymentPlans(self.__connection) return self.__deployment_plans
python
def deployment_plans(self): """ Gets the Deployment Plans API client. Returns: DeploymentPlans: """ if not self.__deployment_plans: self.__deployment_plans = DeploymentPlans(self.__connection) return self.__deployment_plans
[ "def", "deployment_plans", "(", "self", ")", ":", "if", "not", "self", ".", "__deployment_plans", ":", "self", ".", "__deployment_plans", "=", "DeploymentPlans", "(", "self", ".", "__connection", ")", "return", "self", ".", "__deployment_plans" ]
Gets the Deployment Plans API client. Returns: DeploymentPlans:
[ "Gets", "the", "Deployment", "Plans", "API", "client", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/image_streamer_client.py#L117-L126
18,613
HewlettPackard/python-hpOneView
hpOneView/image_streamer/image_streamer_client.py
ImageStreamerClient.artifact_bundles
def artifact_bundles(self): """ Gets the Artifact Bundles API client. Returns: ArtifactBundles: """ if not self.__artifact_bundles: self.__artifact_bundles = ArtifactBundles(self.__connection) return self.__artifact_bundles
python
def artifact_bundles(self): """ Gets the Artifact Bundles API client. Returns: ArtifactBundles: """ if not self.__artifact_bundles: self.__artifact_bundles = ArtifactBundles(self.__connection) return self.__artifact_bundles
[ "def", "artifact_bundles", "(", "self", ")", ":", "if", "not", "self", ".", "__artifact_bundles", ":", "self", ".", "__artifact_bundles", "=", "ArtifactBundles", "(", "self", ".", "__connection", ")", "return", "self", ".", "__artifact_bundles" ]
Gets the Artifact Bundles API client. Returns: ArtifactBundles:
[ "Gets", "the", "Artifact", "Bundles", "API", "client", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/image_streamer_client.py#L129-L138
18,614
HewlettPackard/python-hpOneView
hpOneView/image_streamer/image_streamer_client.py
ImageStreamerClient.deployment_groups
def deployment_groups(self): """ Gets the Deployment Groups API client. Returns: DeploymentGroups: """ if not self.__deployment_groups: self.__deployment_groups = DeploymentGroups(self.__connection) return self.__deployment_groups
python
def deployment_groups(self): """ Gets the Deployment Groups API client. Returns: DeploymentGroups: """ if not self.__deployment_groups: self.__deployment_groups = DeploymentGroups(self.__connection) return self.__deployment_groups
[ "def", "deployment_groups", "(", "self", ")", ":", "if", "not", "self", ".", "__deployment_groups", ":", "self", ".", "__deployment_groups", "=", "DeploymentGroups", "(", "self", ".", "__connection", ")", "return", "self", ".", "__deployment_groups" ]
Gets the Deployment Groups API client. Returns: DeploymentGroups:
[ "Gets", "the", "Deployment", "Groups", "API", "client", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/image_streamer_client.py#L141-L150
18,615
HewlettPackard/python-hpOneView
hpOneView/image_streamer/resources/golden_images.py
GoldenImages.create
def create(self, resource, timeout=-1): """ 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, it just stops waiting for its completion. Returns: dict: Golden Image created. """ data = self.__default_values.copy() data.update(resource) return self._client.create(data, timeout=timeout)
python
def create(self, resource, timeout=-1): """ 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, it just stops waiting for its completion. Returns: dict: Golden Image created. """ data = self.__default_values.copy() data.update(resource) return self._client.create(data, timeout=timeout)
[ "def", "create", "(", "self", ",", "resource", ",", "timeout", "=", "-", "1", ")", ":", "data", "=", "self", ".", "__default_values", ".", "copy", "(", ")", "data", ".", "update", "(", "resource", ")", "return", "self", ".", "_client", ".", "create", "(", "data", ",", "timeout", "=", "timeout", ")" ]
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, it just stops waiting for its completion. Returns: dict: Golden Image created.
[ "Creates", "a", "Golden", "Image", "resource", "from", "the", "deployed", "OS", "Volume", "as", "per", "the", "attributes", "specified", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/resources/golden_images.py#L73-L88
18,616
HewlettPackard/python-hpOneView
hpOneView/image_streamer/resources/golden_images.py
GoldenImages.upload
def upload(self, file_path, golden_image_info): """ 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. """ uri = "{0}?name={1}&description={2}".format(self.URI, quote(golden_image_info.get('name', '')), quote(golden_image_info.get('description', ''))) return self._client.upload(file_path, uri)
python
def upload(self, file_path, golden_image_info): """ 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. """ uri = "{0}?name={1}&description={2}".format(self.URI, quote(golden_image_info.get('name', '')), quote(golden_image_info.get('description', ''))) return self._client.upload(file_path, uri)
[ "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'", ",", "''", ")", ")", ")", "return", "self", ".", "_client", ".", "upload", "(", "file_path", ",", "uri", ")" ]
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.
[ "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", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/resources/golden_images.py#L90-L106
18,617
HewlettPackard/python-hpOneView
hpOneView/image_streamer/resources/golden_images.py
GoldenImages.download_archive
def download_archive(self, id_or_uri, file_path): """ 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. """ uri = self.URI + "/archive/" + extract_id_from_uri(id_or_uri) return self._client.download(uri, file_path)
python
def download_archive(self, id_or_uri, file_path): """ 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. """ uri = self.URI + "/archive/" + extract_id_from_uri(id_or_uri) return self._client.download(uri, file_path)
[ "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", ")" ]
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.
[ "Download", "the", "details", "of", "the", "Golden", "Image", "capture", "logs", "which", "has", "been", "archived", "based", "on", "the", "specific", "attribute", "ID", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/resources/golden_images.py#L108-L121
18,618
HewlettPackard/python-hpOneView
hpOneView/resources/activity/alerts.py
Alerts.update
def update(self, resource, id_or_uri=None, timeout=-1): """ 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: dict: Updated alert. """ 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, uri=uri, timeout=timeout)
python
def update(self, resource, id_or_uri=None, timeout=-1): """ 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: dict: Updated alert. """ 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, uri=uri, timeout=timeout)
[ "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", ",", "uri", "=", "uri", ",", "timeout", "=", "timeout", ")" ]
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: dict: Updated alert.
[ "Updates", "the", "specified", "alert", "resource", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/activity/alerts.py#L135-L152
18,619
HewlettPackard/python-hpOneView
hpOneView/resources/activity/alerts.py
Alerts.delete_alert_change_log
def delete_alert_change_log(self, id_or_uri): """ Deletes alert change log by alert ID or URI. Args: id_or_uri: alert ID or URI. """ uri = self.URI + "/AlertChangeLog/" + extract_id_from_uri(id_or_uri) resource = { "uri": uri } self._client.delete(resource)
python
def delete_alert_change_log(self, id_or_uri): """ Deletes alert change log by alert ID or URI. Args: id_or_uri: alert ID or URI. """ uri = self.URI + "/AlertChangeLog/" + extract_id_from_uri(id_or_uri) resource = { "uri": uri } self._client.delete(resource)
[ "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", ")" ]
Deletes alert change log by alert ID or URI. Args: id_or_uri: alert ID or URI.
[ "Deletes", "alert", "change", "log", "by", "alert", "ID", "or", "URI", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/activity/alerts.py#L154-L165
18,620
HewlettPackard/python-hpOneView
hpOneView/resources/servers/server_hardware.py
ServerHardware.add_multiple_servers
def add_multiple_servers(self, information, timeout=-1): """ Adds multiple rack-mount servers for management by the appliance. This API initiates the asynchronous addition of supported server models. Note: Servers in an enclosure are added by adding the enclosure resource. This is only supported on appliances that support rack-mounted servers. This is only supported for api version 600 Args: information (dict): Objects to create 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: Created rack-mount servers. """ uri = "{}/discovery".format(self.URI) return self.create(information, uri=uri, timeout=timeout)
python
def add_multiple_servers(self, information, timeout=-1): """ Adds multiple rack-mount servers for management by the appliance. This API initiates the asynchronous addition of supported server models. Note: Servers in an enclosure are added by adding the enclosure resource. This is only supported on appliances that support rack-mounted servers. This is only supported for api version 600 Args: information (dict): Objects to create 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: Created rack-mount servers. """ uri = "{}/discovery".format(self.URI) return self.create(information, uri=uri, timeout=timeout)
[ "def", "add_multiple_servers", "(", "self", ",", "information", ",", "timeout", "=", "-", "1", ")", ":", "uri", "=", "\"{}/discovery\"", ".", "format", "(", "self", ".", "URI", ")", "return", "self", ".", "create", "(", "information", ",", "uri", "=", "uri", ",", "timeout", "=", "timeout", ")" ]
Adds multiple rack-mount servers for management by the appliance. This API initiates the asynchronous addition of supported server models. Note: Servers in an enclosure are added by adding the enclosure resource. This is only supported on appliances that support rack-mounted servers. This is only supported for api version 600 Args: information (dict): Objects to create 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: Created rack-mount servers.
[ "Adds", "multiple", "rack", "-", "mount", "servers", "for", "management", "by", "the", "appliance", ".", "This", "API", "initiates", "the", "asynchronous", "addition", "of", "supported", "server", "models", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/server_hardware.py#L68-L87
18,621
HewlettPackard/python-hpOneView
hpOneView/resources/servers/server_hardware.py
ServerHardware.get_firmware
def get_firmware(self): """ Get the firmware inventory of a server. Note: This method is available for API version 300 or later. Returns: dict: Server Hardware firmware. """ uri = "{}/firmware".format(self.data["uri"]) return self._helper.do_get(uri)
python
def get_firmware(self): """ Get the firmware inventory of a server. Note: This method is available for API version 300 or later. Returns: dict: Server Hardware firmware. """ uri = "{}/firmware".format(self.data["uri"]) return self._helper.do_get(uri)
[ "def", "get_firmware", "(", "self", ")", ":", "uri", "=", "\"{}/firmware\"", ".", "format", "(", "self", ".", "data", "[", "\"uri\"", "]", ")", "return", "self", ".", "_helper", ".", "do_get", "(", "uri", ")" ]
Get the firmware inventory of a server. Note: This method is available for API version 300 or later. Returns: dict: Server Hardware firmware.
[ "Get", "the", "firmware", "inventory", "of", "a", "server", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/server_hardware.py#L199-L210
18,622
HewlettPackard/python-hpOneView
hpOneView/resources/servers/server_hardware.py
ServerHardware.update_mp_firware_version
def update_mp_firware_version(self, timeout=-1): """ 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 stops waiting for its completion. Returns: Resource """ uri = "{}/mpFirmwareVersion".format(self.data["uri"]) return self._helper.do_put(uri, None, timeout, None)
python
def update_mp_firware_version(self, timeout=-1): """ 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 stops waiting for its completion. Returns: Resource """ uri = "{}/mpFirmwareVersion".format(self.data["uri"]) return self._helper.do_put(uri, None, timeout, None)
[ "def", "update_mp_firware_version", "(", "self", ",", "timeout", "=", "-", "1", ")", ":", "uri", "=", "\"{}/mpFirmwareVersion\"", ".", "format", "(", "self", ".", "data", "[", "\"uri\"", "]", ")", "return", "self", ".", "_helper", ".", "do_put", "(", "uri", ",", "None", ",", "timeout", ",", "None", ")" ]
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 stops waiting for its completion. Returns: Resource
[ "Updates", "the", "iLO", "firmware", "on", "a", "physical", "server", "to", "a", "minimum", "ILO", "firmware", "version", "required", "by", "OneView", "to", "manage", "the", "server", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/server_hardware.py#L233-L246
18,623
HewlettPackard/python-hpOneView
hpOneView/resources/servers/server_hardware.py
ServerHardware.get_physical_server_hardware
def get_physical_server_hardware(self): """ Information describing an 'SDX' partition including a list of physical server blades represented by a server hardware. Used with SDX enclosures only. Returns: Resource """ uri = "{}/physicalServerHardware".format(self.data["uri"]) return self._helper.do_get(uri)
python
def get_physical_server_hardware(self): """ Information describing an 'SDX' partition including a list of physical server blades represented by a server hardware. Used with SDX enclosures only. Returns: Resource """ uri = "{}/physicalServerHardware".format(self.data["uri"]) return self._helper.do_get(uri)
[ "def", "get_physical_server_hardware", "(", "self", ")", ":", "uri", "=", "\"{}/physicalServerHardware\"", ".", "format", "(", "self", ".", "data", "[", "\"uri\"", "]", ")", "return", "self", ".", "_helper", ".", "do_get", "(", "uri", ")" ]
Information describing an 'SDX' partition including a list of physical server blades represented by a server hardware. Used with SDX enclosures only. Returns: Resource
[ "Information", "describing", "an", "SDX", "partition", "including", "a", "list", "of", "physical", "server", "blades", "represented", "by", "a", "server", "hardware", ".", "Used", "with", "SDX", "enclosures", "only", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/server_hardware.py#L302-L311
18,624
HewlettPackard/python-hpOneView
hpOneView/resources/networking/logical_switches.py
LogicalSwitches.update
def update(self, resource, timeout=-1): """ 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: dict: Updated resource. """ self.__set_default_values(resource) uri = self._client.build_uri(resource['logicalSwitch']['uri']) return self._client.update(resource, uri=uri, timeout=timeout)
python
def update(self, resource, timeout=-1): """ 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: dict: Updated resource. """ self.__set_default_values(resource) uri = self._client.build_uri(resource['logicalSwitch']['uri']) return self._client.update(resource, uri=uri, timeout=timeout)
[ "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", ")" ]
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: dict: Updated resource.
[ "Updates", "a", "Logical", "Switch", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_switches.py#L130-L145
18,625
HewlettPackard/python-hpOneView
hpOneView/resources/networking/logical_switches.py
LogicalSwitches.refresh
def refresh(self, id_or_uri, timeout=-1): """ 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 in OneView, just stop waiting for its completion. Returns: dict: The Logical Switch """ uri = self._client.build_uri(id_or_uri) + "/refresh" return self._client.update_with_zero_body(uri, timeout=timeout)
python
def refresh(self, id_or_uri, timeout=-1): """ 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 in OneView, just stop waiting for its completion. Returns: dict: The Logical Switch """ uri = self._client.build_uri(id_or_uri) + "/refresh" return self._client.update_with_zero_body(uri, timeout=timeout)
[ "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", ")" ]
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 in OneView, just stop waiting for its completion. Returns: dict: The Logical Switch
[ "The", "Refresh", "action", "reclaims", "the", "top", "-", "of", "-", "rack", "switches", "in", "a", "logical", "switch", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_switches.py#L162-L177
18,626
HewlettPackard/python-hpOneView
hpOneView/resources/networking/logical_switches.py
LogicalSwitches.patch
def patch(self, id_or_uri, operation, path, value, timeout=-1): """ Uses the PATCH to update a resource for a given logical switch group. Only one operation can be performed in each PATCH call. Args: id_or_uri: Can be either the resource ID or the resource URI. operation: Patch operation path: Path value: Value 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: Updated resource. """ return self._client.patch(id_or_uri, operation, path, value, timeout=timeout)
python
def patch(self, id_or_uri, operation, path, value, timeout=-1): """ Uses the PATCH to update a resource for a given logical switch group. Only one operation can be performed in each PATCH call. Args: id_or_uri: Can be either the resource ID or the resource URI. operation: Patch operation path: Path value: Value 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: Updated resource. """ return self._client.patch(id_or_uri, operation, path, value, timeout=timeout)
[ "def", "patch", "(", "self", ",", "id_or_uri", ",", "operation", ",", "path", ",", "value", ",", "timeout", "=", "-", "1", ")", ":", "return", "self", ".", "_client", ".", "patch", "(", "id_or_uri", ",", "operation", ",", "path", ",", "value", ",", "timeout", "=", "timeout", ")" ]
Uses the PATCH to update a resource for a given logical switch group. Only one operation can be performed in each PATCH call. Args: id_or_uri: Can be either the resource ID or the resource URI. operation: Patch operation path: Path value: Value 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: Updated resource.
[ "Uses", "the", "PATCH", "to", "update", "a", "resource", "for", "a", "given", "logical", "switch", "group", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_switches.py#L179-L196
18,627
HewlettPackard/python-hpOneView
hpOneView/resources/servers/migratable_vc_domains.py
MigratableVcDomains.migrate
def migrate(self, id_or_uri, timeout=-1): """ 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 waiting for its completion. Returns: dict: a migration report. """ # 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' } # call build_uri manually since .update(...) doesn't do it and the URI is not to be included in the body when # requesting a migration complete_uri = self._client.build_uri(id_or_uri) return self._client.update(migrationInformation, uri=complete_uri, timeout=timeout)
python
def migrate(self, id_or_uri, timeout=-1): """ 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 waiting for its completion. Returns: dict: a migration report. """ # 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' } # call build_uri manually since .update(...) doesn't do it and the URI is not to be included in the body when # requesting a migration complete_uri = self._client.build_uri(id_or_uri) return self._client.update(migrationInformation, uri=complete_uri, timeout=timeout)
[ "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'", "}", "# call build_uri manually since .update(...) doesn't do it and the URI is not to be included in the body when", "# requesting a migration", "complete_uri", "=", "self", ".", "_client", ".", "build_uri", "(", "id_or_uri", ")", "return", "self", ".", "_client", ".", "update", "(", "migrationInformation", ",", "uri", "=", "complete_uri", ",", "timeout", "=", "timeout", ")" ]
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 waiting for its completion. Returns: dict: a migration report.
[ "Initiates", "a", "migration", "of", "an", "enclosure", "specified", "by", "the", "ID", "or", "URI", "of", "a", "migration", "report", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/migratable_vc_domains.py#L95-L118
18,628
HewlettPackard/python-hpOneView
hpOneView/resources/search/labels.py
Labels.get_by_resource
def get_by_resource(self, resource_uri): """ Gets all the labels for the specified resource Args: resource_uri: The resource URI Returns: dict: Resource Labels """ uri = self.URI + self.RESOURCES_PATH + '/' + resource_uri return self._client.get(id_or_uri=uri)
python
def get_by_resource(self, resource_uri): """ Gets all the labels for the specified resource Args: resource_uri: The resource URI Returns: dict: Resource Labels """ uri = self.URI + self.RESOURCES_PATH + '/' + resource_uri return self._client.get(id_or_uri=uri)
[ "def", "get_by_resource", "(", "self", ",", "resource_uri", ")", ":", "uri", "=", "self", ".", "URI", "+", "self", ".", "RESOURCES_PATH", "+", "'/'", "+", "resource_uri", "return", "self", ".", "_client", ".", "get", "(", "id_or_uri", "=", "uri", ")" ]
Gets all the labels for the specified resource Args: resource_uri: The resource URI Returns: dict: Resource Labels
[ "Gets", "all", "the", "labels", "for", "the", "specified", "resource" ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/search/labels.py#L87-L98
18,629
HewlettPackard/python-hpOneView
hpOneView/resources/search/labels.py
Labels.create
def create(self, resource): """ Set all the labels for a resource. Args: resource: The object containing the resource URI and a list of labels Returns: dict: Resource Labels """ uri = self.URI + self.RESOURCES_PATH return self._client.create(resource=resource, uri=uri)
python
def create(self, resource): """ Set all the labels for a resource. Args: resource: The object containing the resource URI and a list of labels Returns: dict: Resource Labels """ uri = self.URI + self.RESOURCES_PATH return self._client.create(resource=resource, uri=uri)
[ "def", "create", "(", "self", ",", "resource", ")", ":", "uri", "=", "self", ".", "URI", "+", "self", ".", "RESOURCES_PATH", "return", "self", ".", "_client", ".", "create", "(", "resource", "=", "resource", ",", "uri", "=", "uri", ")" ]
Set all the labels for a resource. Args: resource: The object containing the resource URI and a list of labels Returns: dict: Resource Labels
[ "Set", "all", "the", "labels", "for", "a", "resource", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/search/labels.py#L100-L111
18,630
HewlettPackard/python-hpOneView
hpOneView/resources/search/labels.py
Labels.delete
def delete(self, resource, timeout=-1): """ 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. """ self._client.delete(resource=resource, timeout=timeout)
python
def delete(self, resource, timeout=-1): """ 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. """ self._client.delete(resource=resource, timeout=timeout)
[ "def", "delete", "(", "self", ",", "resource", ",", "timeout", "=", "-", "1", ")", ":", "self", ".", "_client", ".", "delete", "(", "resource", "=", "resource", ",", "timeout", "=", "timeout", ")" ]
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.
[ "Delete", "all", "the", "labels", "for", "a", "resource", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/search/labels.py#L125-L135
18,631
HewlettPackard/python-hpOneView
hpOneView/resources/security/users.py
Users.update
def update(self, resource, timeout=-1): """ 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: Updated resource. """ return self._client.update(resource, timeout=timeout, default_values=self.DEFAULT_VALUES, uri=self.URI)
python
def update(self, resource, timeout=-1): """ 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: Updated resource. """ return self._client.update(resource, timeout=timeout, default_values=self.DEFAULT_VALUES, uri=self.URI)
[ "def", "update", "(", "self", ",", "resource", ",", "timeout", "=", "-", "1", ")", ":", "return", "self", ".", "_client", ".", "update", "(", "resource", ",", "timeout", "=", "timeout", ",", "default_values", "=", "self", ".", "DEFAULT_VALUES", ",", "uri", "=", "self", ".", "URI", ")" ]
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: Updated resource.
[ "Updates", "a", "User", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/security/users.py#L116-L130
18,632
HewlettPackard/python-hpOneView
hpOneView/resources/security/users.py
Users.get_by
def get_by(self, field, value): """ 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. """ 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'] else: raise HPOneViewException('Only userName, name and role can be queried for this resource.')
python
def get_by(self, field, value): """ 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. """ 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'] else: raise HPOneViewException('Only userName, name and role can be queried for this resource.')
[ "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'", "]", "else", ":", "raise", "HPOneViewException", "(", "'Only userName, name and role can be queried for this resource.'", ")" ]
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.
[ "Gets", "all", "Users", "that", "match", "the", "filter", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/security/users.py#L132-L151
18,633
HewlettPackard/python-hpOneView
hpOneView/resources/security/users.py
Users.validate_user_name
def validate_user_name(self, user_name, timeout=-1): """ 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 completion. Returns: True if user name is in use, False if it is not. """ uri = self.URI + '/validateLoginName/' + user_name return self._client.create_with_zero_body(uri=uri, timeout=timeout)
python
def validate_user_name(self, user_name, timeout=-1): """ 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 completion. Returns: True if user name is in use, False if it is not. """ uri = self.URI + '/validateLoginName/' + user_name return self._client.create_with_zero_body(uri=uri, timeout=timeout)
[ "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", ")" ]
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 completion. Returns: True if user name is in use, False if it is not.
[ "Verifies", "if", "a", "userName", "is", "already", "in", "use", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/security/users.py#L153-L167
18,634
HewlettPackard/python-hpOneView
hpOneView/resources/security/users.py
Users.validate_full_name
def validate_full_name(self, full_name, timeout=-1): """ 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 completion. Returns: True if full name is in use, False if it is not. """ uri = self.URI + '/validateUserName/' + full_name return self._client.create_with_zero_body(uri=uri, timeout=timeout)
python
def validate_full_name(self, full_name, timeout=-1): """ 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 completion. Returns: True if full name is in use, False if it is not. """ uri = self.URI + '/validateUserName/' + full_name return self._client.create_with_zero_body(uri=uri, timeout=timeout)
[ "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", ")" ]
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 completion. Returns: True if full name is in use, False if it is not.
[ "Verifies", "if", "a", "fullName", "is", "already", "in", "use", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/security/users.py#L169-L183
18,635
HewlettPackard/python-hpOneView
hpOneView/resources/facilities/power_devices.py
PowerDevices.add_ipdu
def add_ipdu(self, information, timeout=-1): """ Add an HP iPDU and bring all components under management by discovery of its management module. Bring the management module under exclusive management by the appliance, configure any management or data collection settings, and create a private set of administrative credentials to enable ongoing communication and management of the iPDU. Use "force" to claim the device, even if claimed by another management appliance Args: resource: power device information 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: added power device. """ uri = self.URI + "/discover" return self._client.create(information, uri=uri, timeout=timeout)
python
def add_ipdu(self, information, timeout=-1): """ Add an HP iPDU and bring all components under management by discovery of its management module. Bring the management module under exclusive management by the appliance, configure any management or data collection settings, and create a private set of administrative credentials to enable ongoing communication and management of the iPDU. Use "force" to claim the device, even if claimed by another management appliance Args: resource: power device information 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: added power device. """ uri = self.URI + "/discover" return self._client.create(information, uri=uri, timeout=timeout)
[ "def", "add_ipdu", "(", "self", ",", "information", ",", "timeout", "=", "-", "1", ")", ":", "uri", "=", "self", ".", "URI", "+", "\"/discover\"", "return", "self", ".", "_client", ".", "create", "(", "information", ",", "uri", "=", "uri", ",", "timeout", "=", "timeout", ")" ]
Add an HP iPDU and bring all components under management by discovery of its management module. Bring the management module under exclusive management by the appliance, configure any management or data collection settings, and create a private set of administrative credentials to enable ongoing communication and management of the iPDU. Use "force" to claim the device, even if claimed by another management appliance Args: resource: power device information 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: added power device.
[ "Add", "an", "HP", "iPDU", "and", "bring", "all", "components", "under", "management", "by", "discovery", "of", "its", "management", "module", ".", "Bring", "the", "management", "module", "under", "exclusive", "management", "by", "the", "appliance", "configure", "any", "management", "or", "data", "collection", "settings", "and", "create", "a", "private", "set", "of", "administrative", "credentials", "to", "enable", "ongoing", "communication", "and", "management", "of", "the", "iPDU", ".", "Use", "force", "to", "claim", "the", "device", "even", "if", "claimed", "by", "another", "management", "appliance" ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/facilities/power_devices.py#L126-L142
18,636
HewlettPackard/python-hpOneView
hpOneView/resources/facilities/power_devices.py
PowerDevices.update_power_state
def update_power_state(self, id_or_uri, power_state): """ 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 """ uri = self._client.build_uri(id_or_uri) + "/powerState" return self._client.update(power_state, uri)
python
def update_power_state(self, id_or_uri, power_state): """ 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 """ uri = self._client.build_uri(id_or_uri) + "/powerState" return self._client.update(power_state, uri)
[ "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", ")" ]
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
[ "Sets", "the", "power", "state", "of", "the", "specified", "power", "delivery", "device", ".", "The", "device", "must", "be", "an", "HP", "Intelligent", "Outlet", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/facilities/power_devices.py#L176-L190
18,637
HewlettPackard/python-hpOneView
hpOneView/resources/facilities/power_devices.py
PowerDevices.update_refresh_state
def update_refresh_state(self, id_or_uri, refresh_state_data): """ 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 """ uri = self._client.build_uri(id_or_uri) + "/refreshState" return self._client.update(refresh_state_data, uri=uri)
python
def update_refresh_state(self, id_or_uri, refresh_state_data): """ 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 """ uri = self._client.build_uri(id_or_uri) + "/refreshState" return self._client.update(refresh_state_data, uri=uri)
[ "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", ")" ]
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
[ "Refreshes", "a", "given", "intelligent", "power", "delivery", "device", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/facilities/power_devices.py#L192-L206
18,638
HewlettPackard/python-hpOneView
hpOneView/resources/facilities/power_devices.py
PowerDevices.get_utilization
def get_utilization(self, id_or_uri, fields=None, filter=None, refresh=False, view=None): """ Retrieves historical utilization data for the specified metrics and time span. The device must be a component of an HPE iPDU. Args: id_or_uri: The power device id or the resource uri fields: Name of the metric(s) to be retrieved in the format METRIC[,METRIC]...If unspecified, all metrics supported are returned. Power delivery devices support the following utilization metrics: * AveragePower Average power consumption in Watts during this sample interval. * PeakPower Peak power consumption in Watts during this sample interval. filter (list or str): Filters should be in the format: FILTER_NAME=VALUE[,FILTER_NAME=VALUE]... For Example: 'startDate=2016-05-30T11:20:44.541Z,endDate=2016-05-30T19:20:44.541Z' startDate: Start date of requested starting time range in ISO 8601 format. If omitted, the startDate is determined by the endDate minus 24 hours. endDate: End date of requested starting time range in ISO 8601 format. When omitted the endDate includes the latest data sample available. If an excessive number of samples would otherwise be returned, the results will be segmented. The caller is responsible for comparing the returned sliceStartTime with the requested startTime in the response. If the sliceStartTime is greater than the oldestSampleTime and the requested start time, the caller is responsible for repeating the request with endTime set to sliceStartTime to obtain the next segment. This process is repeated until the full data set is retrieved. If the resource has no data, the UtilizationData is still returned, but will contain no samples and sliceStartTime/sliceEndTime will be equal. oldestSampleTime/newestSampleTime will still be set appropriately (null if no data is available). If the filter does not happen to overlap the data that a resource does have, then the metric history service will return null sample values for any missing samples. refresh: Specifies that if necessary, an additional request will be queued to obtain the most recent utilization data from the enclosure. The response will not include any refreshed data. To track the availability of the newly collected data, monitor the TaskResource identified by the refreshTaskUri property in the response. If null, no refresh was queued. view: Specifies the resolution interval length of the samples to be retrieved. This is reflected in the resolution in the returned response. Utilization data is automatically purged to stay within storage space constraints. Supported views are listed below: native (DEFAULT) Resolution of the samples returned will be one sample for each 5-minute time period. This is the default view and matches the resolution of the data returned by the enclosure. Samples at this resolution are retained up to one year. hour Resolution of the samples returned will be one sample for each 60-minute time period. Samples are calculated by averaging the available 5-minute data samples that occurred within the hour, except for PeakPower which is calculated by reporting the peak observed 5-minute sample value data during the hour. Samples at this resolution are retained up to three years. day Resolution of the samples returned will be one sample for each 24-hour time period. One day is a 24-hour period that starts at midnight GMT regardless of the time zone in which the appliance or client is located. Samples are calculated by averaging the available 5-minute data samples that occurred during the day, except for PeakPower which is calculated by reporting the peak observed 5-minute sample value data during the day. Samples at this resolution are retained up to three years. Returns: dict: Utilization data """ return self._client.get_utilization(id_or_uri, fields, filter, refresh, view)
python
def get_utilization(self, id_or_uri, fields=None, filter=None, refresh=False, view=None): """ Retrieves historical utilization data for the specified metrics and time span. The device must be a component of an HPE iPDU. Args: id_or_uri: The power device id or the resource uri fields: Name of the metric(s) to be retrieved in the format METRIC[,METRIC]...If unspecified, all metrics supported are returned. Power delivery devices support the following utilization metrics: * AveragePower Average power consumption in Watts during this sample interval. * PeakPower Peak power consumption in Watts during this sample interval. filter (list or str): Filters should be in the format: FILTER_NAME=VALUE[,FILTER_NAME=VALUE]... For Example: 'startDate=2016-05-30T11:20:44.541Z,endDate=2016-05-30T19:20:44.541Z' startDate: Start date of requested starting time range in ISO 8601 format. If omitted, the startDate is determined by the endDate minus 24 hours. endDate: End date of requested starting time range in ISO 8601 format. When omitted the endDate includes the latest data sample available. If an excessive number of samples would otherwise be returned, the results will be segmented. The caller is responsible for comparing the returned sliceStartTime with the requested startTime in the response. If the sliceStartTime is greater than the oldestSampleTime and the requested start time, the caller is responsible for repeating the request with endTime set to sliceStartTime to obtain the next segment. This process is repeated until the full data set is retrieved. If the resource has no data, the UtilizationData is still returned, but will contain no samples and sliceStartTime/sliceEndTime will be equal. oldestSampleTime/newestSampleTime will still be set appropriately (null if no data is available). If the filter does not happen to overlap the data that a resource does have, then the metric history service will return null sample values for any missing samples. refresh: Specifies that if necessary, an additional request will be queued to obtain the most recent utilization data from the enclosure. The response will not include any refreshed data. To track the availability of the newly collected data, monitor the TaskResource identified by the refreshTaskUri property in the response. If null, no refresh was queued. view: Specifies the resolution interval length of the samples to be retrieved. This is reflected in the resolution in the returned response. Utilization data is automatically purged to stay within storage space constraints. Supported views are listed below: native (DEFAULT) Resolution of the samples returned will be one sample for each 5-minute time period. This is the default view and matches the resolution of the data returned by the enclosure. Samples at this resolution are retained up to one year. hour Resolution of the samples returned will be one sample for each 60-minute time period. Samples are calculated by averaging the available 5-minute data samples that occurred within the hour, except for PeakPower which is calculated by reporting the peak observed 5-minute sample value data during the hour. Samples at this resolution are retained up to three years. day Resolution of the samples returned will be one sample for each 24-hour time period. One day is a 24-hour period that starts at midnight GMT regardless of the time zone in which the appliance or client is located. Samples are calculated by averaging the available 5-minute data samples that occurred during the day, except for PeakPower which is calculated by reporting the peak observed 5-minute sample value data during the day. Samples at this resolution are retained up to three years. Returns: dict: Utilization data """ return self._client.get_utilization(id_or_uri, fields, filter, refresh, view)
[ "def", "get_utilization", "(", "self", ",", "id_or_uri", ",", "fields", "=", "None", ",", "filter", "=", "None", ",", "refresh", "=", "False", ",", "view", "=", "None", ")", ":", "return", "self", ".", "_client", ".", "get_utilization", "(", "id_or_uri", ",", "fields", ",", "filter", ",", "refresh", ",", "view", ")" ]
Retrieves historical utilization data for the specified metrics and time span. The device must be a component of an HPE iPDU. Args: id_or_uri: The power device id or the resource uri fields: Name of the metric(s) to be retrieved in the format METRIC[,METRIC]...If unspecified, all metrics supported are returned. Power delivery devices support the following utilization metrics: * AveragePower Average power consumption in Watts during this sample interval. * PeakPower Peak power consumption in Watts during this sample interval. filter (list or str): Filters should be in the format: FILTER_NAME=VALUE[,FILTER_NAME=VALUE]... For Example: 'startDate=2016-05-30T11:20:44.541Z,endDate=2016-05-30T19:20:44.541Z' startDate: Start date of requested starting time range in ISO 8601 format. If omitted, the startDate is determined by the endDate minus 24 hours. endDate: End date of requested starting time range in ISO 8601 format. When omitted the endDate includes the latest data sample available. If an excessive number of samples would otherwise be returned, the results will be segmented. The caller is responsible for comparing the returned sliceStartTime with the requested startTime in the response. If the sliceStartTime is greater than the oldestSampleTime and the requested start time, the caller is responsible for repeating the request with endTime set to sliceStartTime to obtain the next segment. This process is repeated until the full data set is retrieved. If the resource has no data, the UtilizationData is still returned, but will contain no samples and sliceStartTime/sliceEndTime will be equal. oldestSampleTime/newestSampleTime will still be set appropriately (null if no data is available). If the filter does not happen to overlap the data that a resource does have, then the metric history service will return null sample values for any missing samples. refresh: Specifies that if necessary, an additional request will be queued to obtain the most recent utilization data from the enclosure. The response will not include any refreshed data. To track the availability of the newly collected data, monitor the TaskResource identified by the refreshTaskUri property in the response. If null, no refresh was queued. view: Specifies the resolution interval length of the samples to be retrieved. This is reflected in the resolution in the returned response. Utilization data is automatically purged to stay within storage space constraints. Supported views are listed below: native (DEFAULT) Resolution of the samples returned will be one sample for each 5-minute time period. This is the default view and matches the resolution of the data returned by the enclosure. Samples at this resolution are retained up to one year. hour Resolution of the samples returned will be one sample for each 60-minute time period. Samples are calculated by averaging the available 5-minute data samples that occurred within the hour, except for PeakPower which is calculated by reporting the peak observed 5-minute sample value data during the hour. Samples at this resolution are retained up to three years. day Resolution of the samples returned will be one sample for each 24-hour time period. One day is a 24-hour period that starts at midnight GMT regardless of the time zone in which the appliance or client is located. Samples are calculated by averaging the available 5-minute data samples that occurred during the day, except for PeakPower which is calculated by reporting the peak observed 5-minute sample value data during the day. Samples at this resolution are retained up to three years. Returns: dict: Utilization data
[ "Retrieves", "historical", "utilization", "data", "for", "the", "specified", "metrics", "and", "time", "span", ".", "The", "device", "must", "be", "a", "component", "of", "an", "HPE", "iPDU", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/facilities/power_devices.py#L261-L333
18,639
HewlettPackard/python-hpOneView
hpOneView/image_streamer/resources/plan_scripts.py
PlanScripts.retrieve_differences
def retrieve_differences(self, id_or_uri, content, timeout=-1): """ Retrieves the modified contents of the selected Plan Script according to the provided content object, as per the selected attributes. Args: id_or_uri: ID or URI of the Plan Script. content (str): Plan Script content. 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. Returns: dict: Script differences. """ uri = self.URI + "/differences/" + extract_id_from_uri(id_or_uri) return self._client.create(content, uri=uri, timeout=timeout)
python
def retrieve_differences(self, id_or_uri, content, timeout=-1): """ Retrieves the modified contents of the selected Plan Script according to the provided content object, as per the selected attributes. Args: id_or_uri: ID or URI of the Plan Script. content (str): Plan Script content. 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. Returns: dict: Script differences. """ uri = self.URI + "/differences/" + extract_id_from_uri(id_or_uri) return self._client.create(content, uri=uri, timeout=timeout)
[ "def", "retrieve_differences", "(", "self", ",", "id_or_uri", ",", "content", ",", "timeout", "=", "-", "1", ")", ":", "uri", "=", "self", ".", "URI", "+", "\"/differences/\"", "+", "extract_id_from_uri", "(", "id_or_uri", ")", "return", "self", ".", "_client", ".", "create", "(", "content", ",", "uri", "=", "uri", ",", "timeout", "=", "timeout", ")" ]
Retrieves the modified contents of the selected Plan Script according to the provided content object, as per the selected attributes. Args: id_or_uri: ID or URI of the Plan Script. content (str): Plan Script content. 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. Returns: dict: Script differences.
[ "Retrieves", "the", "modified", "contents", "of", "the", "selected", "Plan", "Script", "according", "to", "the", "provided", "content", "object", "as", "per", "the", "selected", "attributes", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/resources/plan_scripts.py#L154-L170
18,640
HewlettPackard/python-hpOneView
hpOneView/image_streamer/resources/plan_scripts.py
PlanScripts.get_usedby_and_readonly
def get_usedby_and_readonly(self, id): """ 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 """ uri = self.URI + "/" + id + "/usedby/readonly" return self._client.get(uri)
python
def get_usedby_and_readonly(self, id): """ 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 """ uri = self.URI + "/" + id + "/usedby/readonly" return self._client.get(uri)
[ "def", "get_usedby_and_readonly", "(", "self", ",", "id", ")", ":", "uri", "=", "self", ".", "URI", "+", "\"/\"", "+", "id", "+", "\"/usedby/readonly\"", "return", "self", ".", "_client", ".", "get", "(", "uri", ")" ]
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
[ "Gets", "the", "build", "plans", "details", "os", "teh", "selected", "plan", "script", "as", "per", "the", "selected", "attributes", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/resources/plan_scripts.py#L172-L183
18,641
HewlettPackard/python-hpOneView
hpOneView/image_streamer/resources/deployment_plans.py
DeploymentPlans.get_osdp
def get_osdp(self, id_or_uri): """ 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 """ uri = self._client.build_subresource_uri(resource_id_or_uri=id_or_uri, subresource_path="osdp") return self._client.get(uri)
python
def get_osdp(self, id_or_uri): """ 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 """ uri = self._client.build_subresource_uri(resource_id_or_uri=id_or_uri, subresource_path="osdp") return self._client.get(uri)
[ "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", ")" ]
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
[ "Retrieves", "facts", "about", "Server", "Profiles", "and", "Server", "Profile", "Templates", "that", "are", "using", "Deployment", "Plan", "based", "on", "the", "ID", "or", "URI", "provided", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/resources/deployment_plans.py#L131-L142
18,642
HewlettPackard/python-hpOneView
hpOneView/resources/servers/server_profiles.py
ServerProfiles.get_compliance_preview
def get_compliance_preview(self): """ Gets the preview of manual and automatic updates required to make the server profile consistent with its template. Returns: dict: Server profile compliance preview. """ uri = '{}/compliance-preview'.format(self.data["uri"]) return self._helper.do_get(uri)
python
def get_compliance_preview(self): """ Gets the preview of manual and automatic updates required to make the server profile consistent with its template. Returns: dict: Server profile compliance preview. """ uri = '{}/compliance-preview'.format(self.data["uri"]) return self._helper.do_get(uri)
[ "def", "get_compliance_preview", "(", "self", ")", ":", "uri", "=", "'{}/compliance-preview'", ".", "format", "(", "self", ".", "data", "[", "\"uri\"", "]", ")", "return", "self", ".", "_helper", ".", "do_get", "(", "uri", ")" ]
Gets the preview of manual and automatic updates required to make the server profile consistent with its template. Returns: dict: Server profile compliance preview.
[ "Gets", "the", "preview", "of", "manual", "and", "automatic", "updates", "required", "to", "make", "the", "server", "profile", "consistent", "with", "its", "template", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/server_profiles.py#L138-L147
18,643
HewlettPackard/python-hpOneView
hpOneView/resources/servers/server_profiles.py
ServerProfiles.get_profile_ports
def get_profile_ports(self, **kwargs): """ Retrieves the port model associated with a server or server hardware type and enclosure group. Args: enclosureGroupUri (str): The URI of the enclosure group associated with the resource. serverHardwareTypeUri (str): The URI of the server hardware type associated with the resource. serverHardwareUri (str): The URI of the server hardware associated with the resource. Returns: dict: Profile port. """ uri = self._helper.build_uri_with_query_string(kwargs, '/profile-ports') return self._helper.do_get(uri)
python
def get_profile_ports(self, **kwargs): """ Retrieves the port model associated with a server or server hardware type and enclosure group. Args: enclosureGroupUri (str): The URI of the enclosure group associated with the resource. serverHardwareTypeUri (str): The URI of the server hardware type associated with the resource. serverHardwareUri (str): The URI of the server hardware associated with the resource. Returns: dict: Profile port. """ uri = self._helper.build_uri_with_query_string(kwargs, '/profile-ports') return self._helper.do_get(uri)
[ "def", "get_profile_ports", "(", "self", ",", "*", "*", "kwargs", ")", ":", "uri", "=", "self", ".", "_helper", ".", "build_uri_with_query_string", "(", "kwargs", ",", "'/profile-ports'", ")", "return", "self", ".", "_helper", ".", "do_get", "(", "uri", ")" ]
Retrieves the port model associated with a server or server hardware type and enclosure group. Args: enclosureGroupUri (str): The URI of the enclosure group associated with the resource. serverHardwareTypeUri (str): The URI of the server hardware type associated with the resource. serverHardwareUri (str): The URI of the server hardware associated with the resource. Returns: dict: Profile port.
[ "Retrieves", "the", "port", "model", "associated", "with", "a", "server", "or", "server", "hardware", "type", "and", "enclosure", "group", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/server_profiles.py#L149-L165
18,644
HewlettPackard/python-hpOneView
hpOneView/resources/servers/server_profiles.py
ServerProfiles.get_messages
def get_messages(self): """ Retrieves the error or status messages associated with the specified profile. Returns: dict: Server Profile Health. """ uri = '{}/messages'.format(self.data["uri"]) return self._helper.do_get(uri)
python
def get_messages(self): """ Retrieves the error or status messages associated with the specified profile. Returns: dict: Server Profile Health. """ uri = '{}/messages'.format(self.data["uri"]) return self._helper.do_get(uri)
[ "def", "get_messages", "(", "self", ")", ":", "uri", "=", "'{}/messages'", ".", "format", "(", "self", ".", "data", "[", "\"uri\"", "]", ")", "return", "self", ".", "_helper", ".", "do_get", "(", "uri", ")" ]
Retrieves the error or status messages associated with the specified profile. Returns: dict: Server Profile Health.
[ "Retrieves", "the", "error", "or", "status", "messages", "associated", "with", "the", "specified", "profile", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/server_profiles.py#L168-L176
18,645
HewlettPackard/python-hpOneView
hpOneView/resources/servers/server_profiles.py
ServerProfiles.get_available_networks
def get_available_networks(self, **kwargs): """ Retrieves the list of Ethernet networks, Fiber Channel networks, and network sets that are available to a server profile, along with their respective ports. Args: enclosureGroupUri (str): The URI of the enclosure group associated with the resource. functionType (str): The FunctionType (Ethernet or FibreChannel) to filter the list of networks returned. serverHardwareTypeUri (str): The URI of the server hardware type associated with the resource. serverHardwareUri (str): The URI of the server hardware associated with the resource. view (str): Returns a specific subset of the attributes of the resource or collection, by specifying the name of a predefined view. The default view is expand (show all attributes of the resource and all elements of collections of resources). Values: Ethernet Specifies that the connection is to an Ethernet network or a network set. FibreChannel Specifies that the connection is to a Fibre Channel network. profileUri (str): If the URI of the server profile is provided the list of available networks will include only networks that share a scope with the server profile. scopeUris (str): An expression to restrict the resources returned according to the scopes to which they are assigned Returns: list: Available networks. """ uri = self._helper.build_uri_with_query_string(kwargs, '/available-networks') return self._helper.do_get(uri)
python
def get_available_networks(self, **kwargs): """ Retrieves the list of Ethernet networks, Fiber Channel networks, and network sets that are available to a server profile, along with their respective ports. Args: enclosureGroupUri (str): The URI of the enclosure group associated with the resource. functionType (str): The FunctionType (Ethernet or FibreChannel) to filter the list of networks returned. serverHardwareTypeUri (str): The URI of the server hardware type associated with the resource. serverHardwareUri (str): The URI of the server hardware associated with the resource. view (str): Returns a specific subset of the attributes of the resource or collection, by specifying the name of a predefined view. The default view is expand (show all attributes of the resource and all elements of collections of resources). Values: Ethernet Specifies that the connection is to an Ethernet network or a network set. FibreChannel Specifies that the connection is to a Fibre Channel network. profileUri (str): If the URI of the server profile is provided the list of available networks will include only networks that share a scope with the server profile. scopeUris (str): An expression to restrict the resources returned according to the scopes to which they are assigned Returns: list: Available networks. """ uri = self._helper.build_uri_with_query_string(kwargs, '/available-networks') return self._helper.do_get(uri)
[ "def", "get_available_networks", "(", "self", ",", "*", "*", "kwargs", ")", ":", "uri", "=", "self", ".", "_helper", ".", "build_uri_with_query_string", "(", "kwargs", ",", "'/available-networks'", ")", "return", "self", ".", "_helper", ".", "do_get", "(", "uri", ")" ]
Retrieves the list of Ethernet networks, Fiber Channel networks, and network sets that are available to a server profile, along with their respective ports. Args: enclosureGroupUri (str): The URI of the enclosure group associated with the resource. functionType (str): The FunctionType (Ethernet or FibreChannel) to filter the list of networks returned. serverHardwareTypeUri (str): The URI of the server hardware type associated with the resource. serverHardwareUri (str): The URI of the server hardware associated with the resource. view (str): Returns a specific subset of the attributes of the resource or collection, by specifying the name of a predefined view. The default view is expand (show all attributes of the resource and all elements of collections of resources). Values: Ethernet Specifies that the connection is to an Ethernet network or a network set. FibreChannel Specifies that the connection is to a Fibre Channel network. profileUri (str): If the URI of the server profile is provided the list of available networks will include only networks that share a scope with the server profile. scopeUris (str): An expression to restrict the resources returned according to the scopes to which they are assigned Returns: list: Available networks.
[ "Retrieves", "the", "list", "of", "Ethernet", "networks", "Fiber", "Channel", "networks", "and", "network", "sets", "that", "are", "available", "to", "a", "server", "profile", "along", "with", "their", "respective", "ports", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/server_profiles.py#L205-L233
18,646
HewlettPackard/python-hpOneView
hpOneView/resources/servers/server_profiles.py
ServerProfiles.get_available_servers
def get_available_servers(self, **kwargs): """ Retrieves the list of available servers. Args: enclosureGroupUri (str): The URI of the enclosure group associated with the resource. serverHardwareTypeUri (str): The URI of the server hardware type associated with the resource. profileUri (str): The URI of the server profile resource. scopeUris (str): An expression to restrict the resources returned according to the scopes to which they are assigned. 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. Returns: list: Available servers. """ uri = self._helper.build_uri_with_query_string(kwargs, '/available-servers') return self._helper.do_get(uri)
python
def get_available_servers(self, **kwargs): """ Retrieves the list of available servers. Args: enclosureGroupUri (str): The URI of the enclosure group associated with the resource. serverHardwareTypeUri (str): The URI of the server hardware type associated with the resource. profileUri (str): The URI of the server profile resource. scopeUris (str): An expression to restrict the resources returned according to the scopes to which they are assigned. 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. Returns: list: Available servers. """ uri = self._helper.build_uri_with_query_string(kwargs, '/available-servers') return self._helper.do_get(uri)
[ "def", "get_available_servers", "(", "self", ",", "*", "*", "kwargs", ")", ":", "uri", "=", "self", ".", "_helper", ".", "build_uri_with_query_string", "(", "kwargs", ",", "'/available-servers'", ")", "return", "self", ".", "_helper", ".", "do_get", "(", "uri", ")" ]
Retrieves the list of available servers. Args: enclosureGroupUri (str): The URI of the enclosure group associated with the resource. serverHardwareTypeUri (str): The URI of the server hardware type associated with the resource. profileUri (str): The URI of the server profile resource. scopeUris (str): An expression to restrict the resources returned according to the scopes to which they are assigned. 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. Returns: list: Available servers.
[ "Retrieves", "the", "list", "of", "available", "servers", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/server_profiles.py#L235-L251
18,647
HewlettPackard/python-hpOneView
hpOneView/resources/servers/server_profiles.py
ServerProfiles.get_available_storage_system
def get_available_storage_system(self, **kwargs): """ Retrieves a specific storage system and its associated volumes available to the server profile based on the given server hardware type and enclosure group. Args: enclosureGroupUri (str): The URI of the enclosure group associated with the resource. serverHardwareTypeUri (str): The URI of the server hardware type associated with the resource. storageSystemId (str): The storage system ID associated with the resource. Returns: dict: Available storage system. """ uri = self._helper.build_uri_with_query_string(kwargs, '/available-storage-system') return self._helper.do_get(uri)
python
def get_available_storage_system(self, **kwargs): """ Retrieves a specific storage system and its associated volumes available to the server profile based on the given server hardware type and enclosure group. Args: enclosureGroupUri (str): The URI of the enclosure group associated with the resource. serverHardwareTypeUri (str): The URI of the server hardware type associated with the resource. storageSystemId (str): The storage system ID associated with the resource. Returns: dict: Available storage system. """ uri = self._helper.build_uri_with_query_string(kwargs, '/available-storage-system') return self._helper.do_get(uri)
[ "def", "get_available_storage_system", "(", "self", ",", "*", "*", "kwargs", ")", ":", "uri", "=", "self", ".", "_helper", ".", "build_uri_with_query_string", "(", "kwargs", ",", "'/available-storage-system'", ")", "return", "self", ".", "_helper", ".", "do_get", "(", "uri", ")" ]
Retrieves a specific storage system and its associated volumes available to the server profile based on the given server hardware type and enclosure group. Args: enclosureGroupUri (str): The URI of the enclosure group associated with the resource. serverHardwareTypeUri (str): The URI of the server hardware type associated with the resource. storageSystemId (str): The storage system ID associated with the resource. Returns: dict: Available storage system.
[ "Retrieves", "a", "specific", "storage", "system", "and", "its", "associated", "volumes", "available", "to", "the", "server", "profile", "based", "on", "the", "given", "server", "hardware", "type", "and", "enclosure", "group", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/server_profiles.py#L253-L270
18,648
HewlettPackard/python-hpOneView
hpOneView/resources/servers/server_profiles.py
ServerProfiles.get_available_storage_systems
def get_available_storage_systems(self, start=0, count=-1, filter='', sort='', **kwargs): """ Retrieves the list of the storage systems and their associated volumes available to the server profile based on the given server hardware type and enclosure group. Args: count: The number of resources to return. A count of -1 requests all items. The actual number of items in the response may differ from the requested count if the sum of start and count exceed the total number of items. start: The first item to return, using 0-based indexing. If not specified, the default is 0 - start with the first available item. 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. enclosureGroupUri (str): The URI of the enclosure group associated with the resource. serverHardwareTypeUri (str): The URI of the server hardware type associated with the resource. Returns: list: Available storage systems. """ uri = self._helper.build_uri_with_query_string(kwargs, '/available-storage-systems') return self._helper.get_all(start=start, count=count, filter=filter, sort=sort, uri=uri)
python
def get_available_storage_systems(self, start=0, count=-1, filter='', sort='', **kwargs): """ Retrieves the list of the storage systems and their associated volumes available to the server profile based on the given server hardware type and enclosure group. Args: count: The number of resources to return. A count of -1 requests all items. The actual number of items in the response may differ from the requested count if the sum of start and count exceed the total number of items. start: The first item to return, using 0-based indexing. If not specified, the default is 0 - start with the first available item. 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. enclosureGroupUri (str): The URI of the enclosure group associated with the resource. serverHardwareTypeUri (str): The URI of the server hardware type associated with the resource. Returns: list: Available storage systems. """ uri = self._helper.build_uri_with_query_string(kwargs, '/available-storage-systems') return self._helper.get_all(start=start, count=count, filter=filter, sort=sort, uri=uri)
[ "def", "get_available_storage_systems", "(", "self", ",", "start", "=", "0", ",", "count", "=", "-", "1", ",", "filter", "=", "''", ",", "sort", "=", "''", ",", "*", "*", "kwargs", ")", ":", "uri", "=", "self", ".", "_helper", ".", "build_uri_with_query_string", "(", "kwargs", ",", "'/available-storage-systems'", ")", "return", "self", ".", "_helper", ".", "get_all", "(", "start", "=", "start", ",", "count", "=", "count", ",", "filter", "=", "filter", ",", "sort", "=", "sort", ",", "uri", "=", "uri", ")" ]
Retrieves the list of the storage systems and their associated volumes available to the server profile based on the given server hardware type and enclosure group. Args: count: The number of resources to return. A count of -1 requests all items. The actual number of items in the response may differ from the requested count if the sum of start and count exceed the total number of items. start: The first item to return, using 0-based indexing. If not specified, the default is 0 - start with the first available item. 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. enclosureGroupUri (str): The URI of the enclosure group associated with the resource. serverHardwareTypeUri (str): The URI of the server hardware type associated with the resource. Returns: list: Available storage systems.
[ "Retrieves", "the", "list", "of", "the", "storage", "systems", "and", "their", "associated", "volumes", "available", "to", "the", "server", "profile", "based", "on", "the", "given", "server", "hardware", "type", "and", "enclosure", "group", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/server_profiles.py#L272-L300
18,649
HewlettPackard/python-hpOneView
hpOneView/resources/servers/server_profiles.py
ServerProfiles.get_available_targets
def get_available_targets(self, **kwargs): """ Retrieves a list of the target servers and empty device bays that are available for assignment to the server profile. Args: enclosureGroupUri (str): The URI of the enclosure group associated with the resource. serverHardwareTypeUri (str): The URI of the server hardware type associated with the resource. profileUri (str): The URI of the server profile associated with the resource. scopeUris (str): An expression to restrict the resources returned according to the scopes to which they are assigned. 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. Returns: list: List of available servers and bays. """ uri = self._helper.build_uri_with_query_string(kwargs, '/available-targets') return self._helper.do_get(uri)
python
def get_available_targets(self, **kwargs): """ Retrieves a list of the target servers and empty device bays that are available for assignment to the server profile. Args: enclosureGroupUri (str): The URI of the enclosure group associated with the resource. serverHardwareTypeUri (str): The URI of the server hardware type associated with the resource. profileUri (str): The URI of the server profile associated with the resource. scopeUris (str): An expression to restrict the resources returned according to the scopes to which they are assigned. 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. Returns: list: List of available servers and bays. """ uri = self._helper.build_uri_with_query_string(kwargs, '/available-targets') return self._helper.do_get(uri)
[ "def", "get_available_targets", "(", "self", ",", "*", "*", "kwargs", ")", ":", "uri", "=", "self", ".", "_helper", ".", "build_uri_with_query_string", "(", "kwargs", ",", "'/available-targets'", ")", "return", "self", ".", "_helper", ".", "do_get", "(", "uri", ")" ]
Retrieves a list of the target servers and empty device bays that are available for assignment to the server profile. Args: enclosureGroupUri (str): The URI of the enclosure group associated with the resource. serverHardwareTypeUri (str): The URI of the server hardware type associated with the resource. profileUri (str): The URI of the server profile associated with the resource. scopeUris (str): An expression to restrict the resources returned according to the scopes to which they are assigned. 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. Returns: list: List of available servers and bays.
[ "Retrieves", "a", "list", "of", "the", "target", "servers", "and", "empty", "device", "bays", "that", "are", "available", "for", "assignment", "to", "the", "server", "profile", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/server_profiles.py#L302-L320
18,650
HewlettPackard/python-hpOneView
hpOneView/resources/servers/server_profiles.py
ServerProfiles.get_new_profile_template
def get_new_profile_template(self): """ Retrieves the profile template for a given server profile. Returns: dict: Server profile template. """ uri = '{}/new-profile-template'.format(self.data["uri"]) return self._helper.do_get(uri)
python
def get_new_profile_template(self): """ Retrieves the profile template for a given server profile. Returns: dict: Server profile template. """ uri = '{}/new-profile-template'.format(self.data["uri"]) return self._helper.do_get(uri)
[ "def", "get_new_profile_template", "(", "self", ")", ":", "uri", "=", "'{}/new-profile-template'", ".", "format", "(", "self", ".", "data", "[", "\"uri\"", "]", ")", "return", "self", ".", "_helper", ".", "do_get", "(", "uri", ")" ]
Retrieves the profile template for a given server profile. Returns: dict: Server profile template.
[ "Retrieves", "the", "profile", "template", "for", "a", "given", "server", "profile", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/server_profiles.py#L323-L331
18,651
HewlettPackard/python-hpOneView
hpOneView/resources/servers/enclosure_groups.py
EnclosureGroups.update_script
def update_script(self, script_body): """ 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. """ uri = "{}/script".format(self.data['uri']) return self._helper.update(script_body, uri=uri)
python
def update_script(self, script_body): """ 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. """ uri = "{}/script".format(self.data['uri']) return self._helper.update(script_body, uri=uri)
[ "def", "update_script", "(", "self", ",", "script_body", ")", ":", "uri", "=", "\"{}/script\"", ".", "format", "(", "self", ".", "data", "[", "'uri'", "]", ")", "return", "self", ".", "_helper", ".", "update", "(", "script_body", ",", "uri", "=", "uri", ")" ]
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.
[ "Updates", "the", "configuration", "script", "of", "the", "enclosure", "-", "group", "with", "the", "specified", "URI", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/enclosure_groups.py#L94-L107
18,652
HewlettPackard/python-hpOneView
hpOneView/resources/storage/storage_volume_attachments.py
StorageVolumeAttachments.remove_extra_presentations
def remove_extra_presentations(self, resource, timeout=-1): """ 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 waiting for its completion. Returns: dict: Associated storage attachment resource. """ uri = self.URI + "/repair" custom_headers = {'Accept-Language': 'en_US'} return self._client.create(resource, uri=uri, timeout=timeout, custom_headers=custom_headers)
python
def remove_extra_presentations(self, resource, timeout=-1): """ 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 waiting for its completion. Returns: dict: Associated storage attachment resource. """ uri = self.URI + "/repair" custom_headers = {'Accept-Language': 'en_US'} return self._client.create(resource, uri=uri, timeout=timeout, custom_headers=custom_headers)
[ "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", ")" ]
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 waiting for its completion. Returns: dict: Associated storage attachment resource.
[ "Removes", "extra", "presentations", "from", "a", "specified", "server", "profile", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/storage_volume_attachments.py#L98-L113
18,653
HewlettPackard/python-hpOneView
hpOneView/resources/storage/storage_volume_attachments.py
StorageVolumeAttachments.get_paths
def get_paths(self, id_or_uri, path_id_or_uri=''): """ 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. """ 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: uri = self._client.build_uri(id_or_uri) + "/paths" return self._client.get(uri)
python
def get_paths(self, id_or_uri, path_id_or_uri=''): """ 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. """ 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: uri = self._client.build_uri(id_or_uri) + "/paths" return self._client.get(uri)
[ "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", ":", "uri", "=", "self", ".", "_client", ".", "build_uri", "(", "id_or_uri", ")", "+", "\"/paths\"", "return", "self", ".", "_client", ".", "get", "(", "uri", ")" ]
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.
[ "Gets", "all", "paths", "or", "a", "specific", "attachment", "path", "for", "the", "specified", "volume", "attachment", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/storage_volume_attachments.py#L115-L135
18,654
HewlettPackard/python-hpOneView
hpOneView/image_streamer/resources/artifact_bundles.py
ArtifactBundles.get_backup
def get_backup(self, id_or_uri): """ 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. """ uri = self.BACKUPS_PATH + '/' + extract_id_from_uri(id_or_uri) return self._client.get(id_or_uri=uri)
python
def get_backup(self, id_or_uri): """ 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. """ uri = self.BACKUPS_PATH + '/' + extract_id_from_uri(id_or_uri) return self._client.get(id_or_uri=uri)
[ "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", ")" ]
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.
[ "Get", "the", "details", "for", "the", "backup", "from", "an", "Artifact", "Bundle", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/resources/artifact_bundles.py#L129-L140
18,655
HewlettPackard/python-hpOneView
hpOneView/image_streamer/resources/artifact_bundles.py
ArtifactBundles.download_archive_artifact_bundle
def download_archive_artifact_bundle(self, id_or_uri, file_path): """ 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. """ uri = self.BACKUP_ARCHIVE_PATH + '/' + extract_id_from_uri(id_or_uri) return self._client.download(uri, file_path)
python
def download_archive_artifact_bundle(self, id_or_uri, file_path): """ 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. """ uri = self.BACKUP_ARCHIVE_PATH + '/' + extract_id_from_uri(id_or_uri) return self._client.download(uri, file_path)
[ "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", ")" ]
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.
[ "Downloads", "an", "archive", "for", "the", "Artifact", "Bundle", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/resources/artifact_bundles.py#L142-L155
18,656
HewlettPackard/python-hpOneView
hpOneView/image_streamer/resources/artifact_bundles.py
ArtifactBundles.download_artifact_bundle
def download_artifact_bundle(self, id_or_uri, file_path): """ 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. """ uri = self.DOWNLOAD_PATH + '/' + extract_id_from_uri(id_or_uri) return self._client.download(uri, file_path)
python
def download_artifact_bundle(self, id_or_uri, file_path): """ 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. """ uri = self.DOWNLOAD_PATH + '/' + extract_id_from_uri(id_or_uri) return self._client.download(uri, file_path)
[ "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", ")" ]
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.
[ "Download", "the", "Artifact", "Bundle", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/resources/artifact_bundles.py#L157-L169
18,657
HewlettPackard/python-hpOneView
hpOneView/image_streamer/resources/artifact_bundles.py
ArtifactBundles.create_backup
def create_backup(self, resource, timeout=-1): """ Creates a backup bundle with all the artifacts present on the appliance. At any given point only one backup bundle will exist on the appliance. Args: resource (dict): Deployment Group to create the backup. 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. Returns: dict: A Deployment Group associated with the Artifact Bundle backup. """ return self._client.create(resource, uri=self.BACKUPS_PATH, timeout=timeout)
python
def create_backup(self, resource, timeout=-1): """ Creates a backup bundle with all the artifacts present on the appliance. At any given point only one backup bundle will exist on the appliance. Args: resource (dict): Deployment Group to create the backup. 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. Returns: dict: A Deployment Group associated with the Artifact Bundle backup. """ return self._client.create(resource, uri=self.BACKUPS_PATH, timeout=timeout)
[ "def", "create_backup", "(", "self", ",", "resource", ",", "timeout", "=", "-", "1", ")", ":", "return", "self", ".", "_client", ".", "create", "(", "resource", ",", "uri", "=", "self", ".", "BACKUPS_PATH", ",", "timeout", "=", "timeout", ")" ]
Creates a backup bundle with all the artifacts present on the appliance. At any given point only one backup bundle will exist on the appliance. Args: resource (dict): Deployment Group to create the backup. 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. Returns: dict: A Deployment Group associated with the Artifact Bundle backup.
[ "Creates", "a", "backup", "bundle", "with", "all", "the", "artifacts", "present", "on", "the", "appliance", ".", "At", "any", "given", "point", "only", "one", "backup", "bundle", "will", "exist", "on", "the", "appliance", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/resources/artifact_bundles.py#L171-L185
18,658
HewlettPackard/python-hpOneView
hpOneView/image_streamer/resources/artifact_bundles.py
ArtifactBundles.upload_backup_bundle_from_file
def upload_backup_bundle_from_file(self, file_path, deployment_groups_id_or_uri): """ 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. """ 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 uri = self.BACKUP_ARCHIVE_PATH + "?deploymentGrpUri=" + deployment_groups_uri return self._client.upload(file_path, uri)
python
def upload_backup_bundle_from_file(self, file_path, deployment_groups_id_or_uri): """ 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. """ 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 uri = self.BACKUP_ARCHIVE_PATH + "?deploymentGrpUri=" + deployment_groups_uri return self._client.upload(file_path, uri)
[ "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", "uri", "=", "self", ".", "BACKUP_ARCHIVE_PATH", "+", "\"?deploymentGrpUri=\"", "+", "deployment_groups_uri", "return", "self", ".", "_client", ".", "upload", "(", "file_path", ",", "uri", ")" ]
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.
[ "Restore", "an", "Artifact", "Bundle", "from", "a", "backup", "file", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/resources/artifact_bundles.py#L199-L217
18,659
HewlettPackard/python-hpOneView
hpOneView/image_streamer/resources/artifact_bundles.py
ArtifactBundles.update
def update(self, resource, timeout=-1): """ 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. Returns: dict: Updated resource. """ return self._client.update(resource, timeout=timeout, default_values=self.DEFAULT_VALUES)
python
def update(self, resource, timeout=-1): """ 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. Returns: dict: Updated resource. """ return self._client.update(resource, timeout=timeout, default_values=self.DEFAULT_VALUES)
[ "def", "update", "(", "self", ",", "resource", ",", "timeout", "=", "-", "1", ")", ":", "return", "self", ".", "_client", ".", "update", "(", "resource", ",", "timeout", "=", "timeout", ",", "default_values", "=", "self", ".", "DEFAULT_VALUES", ")" ]
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. Returns: dict: Updated resource.
[ "Updates", "only", "name", "for", "the", "Artifact", "Bundle", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/resources/artifact_bundles.py#L250-L263
18,660
HewlettPackard/python-hpOneView
hpOneView/image_streamer/resources/artifact_bundles.py
ArtifactBundles.extract_bundle
def extract_bundle(self, resource, timeout=-1): """ 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 stops waiting for its completion. Returns: dict: The Artifact Bundle. """ return self._client.update(resource, timeout=timeout, custom_headers={"Content-Type": "text/plain"})
python
def extract_bundle(self, resource, timeout=-1): """ 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 stops waiting for its completion. Returns: dict: The Artifact Bundle. """ return self._client.update(resource, timeout=timeout, custom_headers={"Content-Type": "text/plain"})
[ "def", "extract_bundle", "(", "self", ",", "resource", ",", "timeout", "=", "-", "1", ")", ":", "return", "self", ".", "_client", ".", "update", "(", "resource", ",", "timeout", "=", "timeout", ",", "custom_headers", "=", "{", "\"Content-Type\"", ":", "\"text/plain\"", "}", ")" ]
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 stops waiting for its completion. Returns: dict: The Artifact Bundle.
[ "Extracts", "the", "existing", "bundle", "on", "the", "appliance", "and", "creates", "all", "the", "artifacts", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/resources/artifact_bundles.py#L265-L278
18,661
HewlettPackard/python-hpOneView
hpOneView/image_streamer/resources/artifact_bundles.py
ArtifactBundles.extract_backup_bundle
def extract_backup_bundle(self, resource, timeout=-1): """ 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, it just stops waiting for its completion. Returns: dict: A Deployment Group associated with the Artifact Bundle backup. """ return self._client.update(resource, uri=self.BACKUP_ARCHIVE_PATH, timeout=timeout)
python
def extract_backup_bundle(self, resource, timeout=-1): """ 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, it just stops waiting for its completion. Returns: dict: A Deployment Group associated with the Artifact Bundle backup. """ return self._client.update(resource, uri=self.BACKUP_ARCHIVE_PATH, timeout=timeout)
[ "def", "extract_backup_bundle", "(", "self", ",", "resource", ",", "timeout", "=", "-", "1", ")", ":", "return", "self", ".", "_client", ".", "update", "(", "resource", ",", "uri", "=", "self", ".", "BACKUP_ARCHIVE_PATH", ",", "timeout", "=", "timeout", ")" ]
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, it just stops waiting for its completion. Returns: dict: A Deployment Group associated with the Artifact Bundle backup.
[ "Extracts", "the", "existing", "backup", "bundle", "on", "the", "appliance", "and", "creates", "all", "the", "artifacts", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/resources/artifact_bundles.py#L280-L293
18,662
HewlettPackard/python-hpOneView
hpOneView/image_streamer/resources/artifact_bundles.py
ArtifactBundles.stop_artifact_creation
def stop_artifact_creation(self, id_or_uri, task_uri): """ 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: """ 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)
python
def stop_artifact_creation(self, id_or_uri, task_uri): """ 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: """ 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)
[ "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", ")" ]
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:
[ "Stops", "creation", "of", "the", "selected", "Artifact", "Bundle", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/resources/artifact_bundles.py#L295-L312
18,663
HewlettPackard/python-hpOneView
hpOneView/resources/servers/logical_enclosures.py
LogicalEnclosures.get_script
def get_script(self): """ Gets the configuration script of the logical enclosure by ID or URI. Return: str: Configuration script. """ uri = "{}/script".format(self.data["uri"]) return self._helper.do_get(uri)
python
def get_script(self): """ Gets the configuration script of the logical enclosure by ID or URI. Return: str: Configuration script. """ uri = "{}/script".format(self.data["uri"]) return self._helper.do_get(uri)
[ "def", "get_script", "(", "self", ")", ":", "uri", "=", "\"{}/script\"", ".", "format", "(", "self", ".", "data", "[", "\"uri\"", "]", ")", "return", "self", ".", "_helper", ".", "do_get", "(", "uri", ")" ]
Gets the configuration script of the logical enclosure by ID or URI. Return: str: Configuration script.
[ "Gets", "the", "configuration", "script", "of", "the", "logical", "enclosure", "by", "ID", "or", "URI", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/logical_enclosures.py#L97-L105
18,664
HewlettPackard/python-hpOneView
hpOneView/resources/servers/logical_enclosures.py
LogicalEnclosures.update_script
def update_script(self, information, timeout=-1): """ 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 in OneView; it just stops waiting for its completion. Return: Configuration script. """ uri = "{}/script".format(self.data["uri"]) return self._helper.update(information, uri=uri, timeout=timeout)
python
def update_script(self, information, timeout=-1): """ 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 in OneView; it just stops waiting for its completion. Return: Configuration script. """ uri = "{}/script".format(self.data["uri"]) return self._helper.update(information, uri=uri, timeout=timeout)
[ "def", "update_script", "(", "self", ",", "information", ",", "timeout", "=", "-", "1", ")", ":", "uri", "=", "\"{}/script\"", ".", "format", "(", "self", ".", "data", "[", "\"uri\"", "]", ")", "return", "self", ".", "_helper", ".", "update", "(", "information", ",", "uri", "=", "uri", ",", "timeout", "=", "timeout", ")" ]
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 in OneView; it just stops waiting for its completion. Return: Configuration script.
[ "Updates", "the", "configuration", "script", "of", "the", "logical", "enclosure", "and", "on", "all", "enclosures", "in", "the", "logical", "enclosure", "with", "the", "specified", "ID", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/logical_enclosures.py#L108-L122
18,665
HewlettPackard/python-hpOneView
hpOneView/resources/servers/logical_enclosures.py
LogicalEnclosures.generate_support_dump
def generate_support_dump(self, information, timeout=-1): """ Generates a support dump for the logical enclosure with the specified ID. A logical enclosure support dump includes content for logical interconnects associated with that logical enclosure. By default, it also contains appliance support dump content. Args: information (dict): Information to generate support dump. 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: Support dump. """ uri = "{}/support-dumps".format(self.data["uri"]) return self._helper.create(information, uri=uri, timeout=timeout)
python
def generate_support_dump(self, information, timeout=-1): """ Generates a support dump for the logical enclosure with the specified ID. A logical enclosure support dump includes content for logical interconnects associated with that logical enclosure. By default, it also contains appliance support dump content. Args: information (dict): Information to generate support dump. 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: Support dump. """ uri = "{}/support-dumps".format(self.data["uri"]) return self._helper.create(information, uri=uri, timeout=timeout)
[ "def", "generate_support_dump", "(", "self", ",", "information", ",", "timeout", "=", "-", "1", ")", ":", "uri", "=", "\"{}/support-dumps\"", ".", "format", "(", "self", ".", "data", "[", "\"uri\"", "]", ")", "return", "self", ".", "_helper", ".", "create", "(", "information", ",", "uri", "=", "uri", ",", "timeout", "=", "timeout", ")" ]
Generates a support dump for the logical enclosure with the specified ID. A logical enclosure support dump includes content for logical interconnects associated with that logical enclosure. By default, it also contains appliance support dump content. Args: information (dict): Information to generate support dump. 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: Support dump.
[ "Generates", "a", "support", "dump", "for", "the", "logical", "enclosure", "with", "the", "specified", "ID", ".", "A", "logical", "enclosure", "support", "dump", "includes", "content", "for", "logical", "interconnects", "associated", "with", "that", "logical", "enclosure", ".", "By", "default", "it", "also", "contains", "appliance", "support", "dump", "content", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/logical_enclosures.py#L125-L140
18,666
HewlettPackard/python-hpOneView
hpOneView/resources/servers/logical_enclosures.py
LogicalEnclosures.update_from_group
def update_from_group(self, data=None, timeout=-1): """ 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 waiting for its completion. Returns: dict: Logical enclosure. """ uri = "{}/updateFromGroup".format(self.data["uri"]) return self._helper.update(data, uri, timeout=timeout)
python
def update_from_group(self, data=None, timeout=-1): """ 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 waiting for its completion. Returns: dict: Logical enclosure. """ uri = "{}/updateFromGroup".format(self.data["uri"]) return self._helper.update(data, uri, timeout=timeout)
[ "def", "update_from_group", "(", "self", ",", "data", "=", "None", ",", "timeout", "=", "-", "1", ")", ":", "uri", "=", "\"{}/updateFromGroup\"", ".", "format", "(", "self", ".", "data", "[", "\"uri\"", "]", ")", "return", "self", ".", "_helper", ".", "update", "(", "data", ",", "uri", ",", "timeout", "=", "timeout", ")" ]
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 waiting for its completion. Returns: dict: Logical enclosure.
[ "Use", "this", "action", "to", "make", "a", "logical", "enclosure", "consistent", "with", "the", "enclosure", "group", "when", "the", "logical", "enclosure", "is", "in", "the", "Inconsistent", "state", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/logical_enclosures.py#L143-L156
18,667
HewlettPackard/python-hpOneView
hpOneView/resources/networking/ethernet_networks.py
EthernetNetworks.create_bulk
def create_bulk(self, resource, timeout=-1): """ 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. Returns: list: List of created Ethernet Networks. """ 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) return self.get_range(resource['namePrefix'], resource['vlanIdRange'])
python
def create_bulk(self, resource, timeout=-1): """ 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. Returns: list: List of created Ethernet Networks. """ 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) return self.get_range(resource['namePrefix'], resource['vlanIdRange'])
[ "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", ")", "return", "self", ".", "get_range", "(", "resource", "[", "'namePrefix'", "]", ",", "resource", "[", "'vlanIdRange'", "]", ")" ]
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. Returns: list: List of created Ethernet Networks.
[ "Creates", "bulk", "Ethernet", "networks", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/ethernet_networks.py#L63-L83
18,668
HewlettPackard/python-hpOneView
hpOneView/resources/networking/ethernet_networks.py
EthernetNetworks.get_range
def get_range(self, name_prefix, vlan_id_range): """ Gets a list of Ethernet Networks that match the 'given name_prefix' and the 'vlan_id_range'. Examples: >>> enet.get_range('Enet_name', '1-2,5') # The result contains the ethernet network with names: ['Enet_name_1', 'Enet_name_2', 'Enet_name_5'] >>> enet.get_range('Enet_name', '2') # The result contains the ethernet network with names: ['Enet_name_1', 'Enet_name_2'] Args: name_prefix: The Ethernet Network prefix vlan_id_range: A combination of values or ranges to be retrieved. For example, '1-10,50,51,500-700'. Returns: list: A list of Ethernet Networks. """ filter = '"\'name\' matches \'{}\_%\'"'.format(name_prefix) ethernet_networks = self.get_all(filter=filter, sort='vlanId:ascending') vlan_ids = self.dissociate_values_or_ranges(vlan_id_range) for net in ethernet_networks[:]: if int(net['vlanId']) not in vlan_ids: ethernet_networks.remove(net) return ethernet_networks
python
def get_range(self, name_prefix, vlan_id_range): """ Gets a list of Ethernet Networks that match the 'given name_prefix' and the 'vlan_id_range'. Examples: >>> enet.get_range('Enet_name', '1-2,5') # The result contains the ethernet network with names: ['Enet_name_1', 'Enet_name_2', 'Enet_name_5'] >>> enet.get_range('Enet_name', '2') # The result contains the ethernet network with names: ['Enet_name_1', 'Enet_name_2'] Args: name_prefix: The Ethernet Network prefix vlan_id_range: A combination of values or ranges to be retrieved. For example, '1-10,50,51,500-700'. Returns: list: A list of Ethernet Networks. """ filter = '"\'name\' matches \'{}\_%\'"'.format(name_prefix) ethernet_networks = self.get_all(filter=filter, sort='vlanId:ascending') vlan_ids = self.dissociate_values_or_ranges(vlan_id_range) for net in ethernet_networks[:]: if int(net['vlanId']) not in vlan_ids: ethernet_networks.remove(net) return ethernet_networks
[ "def", "get_range", "(", "self", ",", "name_prefix", ",", "vlan_id_range", ")", ":", "filter", "=", "'\"\\'name\\' matches \\'{}\\_%\\'\"'", ".", "format", "(", "name_prefix", ")", "ethernet_networks", "=", "self", ".", "get_all", "(", "filter", "=", "filter", ",", "sort", "=", "'vlanId:ascending'", ")", "vlan_ids", "=", "self", ".", "dissociate_values_or_ranges", "(", "vlan_id_range", ")", "for", "net", "in", "ethernet_networks", "[", ":", "]", ":", "if", "int", "(", "net", "[", "'vlanId'", "]", ")", "not", "in", "vlan_ids", ":", "ethernet_networks", ".", "remove", "(", "net", ")", "return", "ethernet_networks" ]
Gets a list of Ethernet Networks that match the 'given name_prefix' and the 'vlan_id_range'. Examples: >>> enet.get_range('Enet_name', '1-2,5') # The result contains the ethernet network with names: ['Enet_name_1', 'Enet_name_2', 'Enet_name_5'] >>> enet.get_range('Enet_name', '2') # The result contains the ethernet network with names: ['Enet_name_1', 'Enet_name_2'] Args: name_prefix: The Ethernet Network prefix vlan_id_range: A combination of values or ranges to be retrieved. For example, '1-10,50,51,500-700'. Returns: list: A list of Ethernet Networks.
[ "Gets", "a", "list", "of", "Ethernet", "Networks", "that", "match", "the", "given", "name_prefix", "and", "the", "vlan_id_range", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/ethernet_networks.py#L85-L114
18,669
HewlettPackard/python-hpOneView
hpOneView/resources/networking/ethernet_networks.py
EthernetNetworks.get_associated_profiles
def get_associated_profiles(self): """ 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. """ uri = "{}/associatedProfiles".format(self.data['uri']) return self._helper.do_get(uri)
python
def get_associated_profiles(self): """ 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. """ uri = "{}/associatedProfiles".format(self.data['uri']) return self._helper.do_get(uri)
[ "def", "get_associated_profiles", "(", "self", ")", ":", "uri", "=", "\"{}/associatedProfiles\"", ".", "format", "(", "self", ".", "data", "[", "'uri'", "]", ")", "return", "self", ".", "_helper", ".", "do_get", "(", "uri", ")" ]
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.
[ "Gets", "the", "URIs", "of", "profiles", "which", "are", "using", "an", "Ethernet", "network", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/ethernet_networks.py#L154-L166
18,670
HewlettPackard/python-hpOneView
hpOneView/resources/networking/ethernet_networks.py
EthernetNetworks.get_associated_uplink_groups
def get_associated_uplink_groups(self): """ Gets the uplink sets which are using an Ethernet network. Returns: list: URIs of the associated uplink sets. """ uri = "{}/associatedUplinkGroups".format(self.data['uri']) return self._helper.do_get(uri)
python
def get_associated_uplink_groups(self): """ Gets the uplink sets which are using an Ethernet network. Returns: list: URIs of the associated uplink sets. """ uri = "{}/associatedUplinkGroups".format(self.data['uri']) return self._helper.do_get(uri)
[ "def", "get_associated_uplink_groups", "(", "self", ")", ":", "uri", "=", "\"{}/associatedUplinkGroups\"", ".", "format", "(", "self", ".", "data", "[", "'uri'", "]", ")", "return", "self", ".", "_helper", ".", "do_get", "(", "uri", ")" ]
Gets the uplink sets which are using an Ethernet network. Returns: list: URIs of the associated uplink sets.
[ "Gets", "the", "uplink", "sets", "which", "are", "using", "an", "Ethernet", "network", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/ethernet_networks.py#L169-L178
18,671
HewlettPackard/python-hpOneView
hpOneView/resources/resource.py
merge_resources
def merge_resources(resource1, resource2): """ 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 """ merged = resource1.copy() merged.update(resource2) return merged
python
def merge_resources(resource1, resource2): """ 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 """ merged = resource1.copy() merged.update(resource2) return merged
[ "def", "merge_resources", "(", "resource1", ",", "resource2", ")", ":", "merged", "=", "resource1", ".", "copy", "(", ")", "merged", ".", "update", "(", "resource2", ")", "return", "merged" ]
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
[ "Updates", "a", "copy", "of", "resource1", "with", "resource2", "values", "and", "returns", "the", "merged", "dictionary", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L1737-L1750
18,672
HewlettPackard/python-hpOneView
hpOneView/resources/resource.py
merge_default_values
def merge_default_values(resource_list, default_values): """ 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 maintained. Returns: list: list containing each item merged with default_values """ def merge_item(resource): return merge_resources(default_values, resource) return lmap(merge_item, resource_list)
python
def merge_default_values(resource_list, default_values): """ 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 maintained. Returns: list: list containing each item merged with default_values """ def merge_item(resource): return merge_resources(default_values, resource) return lmap(merge_item, resource_list)
[ "def", "merge_default_values", "(", "resource_list", ",", "default_values", ")", ":", "def", "merge_item", "(", "resource", ")", ":", "return", "merge_resources", "(", "default_values", ",", "resource", ")", "return", "lmap", "(", "merge_item", ",", "resource_list", ")" ]
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 maintained. Returns: list: list containing each item merged with default_values
[ "Generate", "a", "new", "list", "where", "each", "item", "of", "original", "resource_list", "will", "be", "merged", "with", "the", "default_values", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L1753-L1769
18,673
HewlettPackard/python-hpOneView
hpOneView/resources/resource.py
Resource.ensure_resource_data
def ensure_resource_data(self, update_data=False): """Retrieves data from OneView and updates resource object. Args: update_data: Flag to update resource data when it is required. """ # 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 not required if not update_data: return resource_data = None if 'uri' in self.UNIQUE_IDENTIFIERS and self.data.get('uri'): resource_data = self._helper.do_get(self.data['uri']) else: for identifier in self.UNIQUE_IDENTIFIERS: identifier_value = self.data.get(identifier) if identifier_value: result = self.get_by(identifier, identifier_value) if result and isinstance(result, list): resource_data = result[0] break if resource_data: self.data.update(resource_data) else: raise exceptions.HPOneViewResourceNotFound(RESOURCE_DOES_NOT_EXIST)
python
def ensure_resource_data(self, update_data=False): """Retrieves data from OneView and updates resource object. Args: update_data: Flag to update resource data when it is required. """ # 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 not required if not update_data: return resource_data = None if 'uri' in self.UNIQUE_IDENTIFIERS and self.data.get('uri'): resource_data = self._helper.do_get(self.data['uri']) else: for identifier in self.UNIQUE_IDENTIFIERS: identifier_value = self.data.get(identifier) if identifier_value: result = self.get_by(identifier, identifier_value) if result and isinstance(result, list): resource_data = result[0] break if resource_data: self.data.update(resource_data) else: raise exceptions.HPOneViewResourceNotFound(RESOURCE_DOES_NOT_EXIST)
[ "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 not required", "if", "not", "update_data", ":", "return", "resource_data", "=", "None", "if", "'uri'", "in", "self", ".", "UNIQUE_IDENTIFIERS", "and", "self", ".", "data", ".", "get", "(", "'uri'", ")", ":", "resource_data", "=", "self", ".", "_helper", ".", "do_get", "(", "self", ".", "data", "[", "'uri'", "]", ")", "else", ":", "for", "identifier", "in", "self", ".", "UNIQUE_IDENTIFIERS", ":", "identifier_value", "=", "self", ".", "data", ".", "get", "(", "identifier", ")", "if", "identifier_value", ":", "result", "=", "self", ".", "get_by", "(", "identifier", ",", "identifier_value", ")", "if", "result", "and", "isinstance", "(", "result", ",", "list", ")", ":", "resource_data", "=", "result", "[", "0", "]", "break", "if", "resource_data", ":", "self", ".", "data", ".", "update", "(", "resource_data", ")", "else", ":", "raise", "exceptions", ".", "HPOneViewResourceNotFound", "(", "RESOURCE_DOES_NOT_EXIST", ")" ]
Retrieves data from OneView and updates resource object. Args: update_data: Flag to update resource data when it is required.
[ "Retrieves", "data", "from", "OneView", "and", "updates", "resource", "object", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L110-L141
18,674
HewlettPackard/python-hpOneView
hpOneView/resources/resource.py
Resource.get_by
def get_by(self, field, value): """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 """ 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 OneView filter does not work, it will filter again if "." not in field: # This filter only work for the first level results = [item for item in results if str(item.get(field, "")).lower() == value.lower()] return results
python
def get_by(self, field, value): """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 """ 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 OneView filter does not work, it will filter again if "." not in field: # This filter only work for the first level results = [item for item in results if str(item.get(field, "")).lower() == value.lower()] return results
[ "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 OneView filter does not work, it will filter again", "if", "\".\"", "not", "in", "field", ":", "# This filter only work for the first level", "results", "=", "[", "item", "for", "item", "in", "results", "if", "str", "(", "item", ".", "get", "(", "field", ",", "\"\"", ")", ")", ".", "lower", "(", ")", "==", "value", ".", "lower", "(", ")", "]", "return", "results" ]
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
[ "Get", "the", "resource", "by", "passing", "a", "field", "and", "its", "value", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L234-L259
18,675
HewlettPackard/python-hpOneView
hpOneView/resources/resource.py
Resource.get_by_name
def get_by_name(self, name): """Retrieves a resource by its name. Args: name: Resource name. Returns: Resource object or None if resource does not exist. """ 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
python
def get_by_name(self, name): """Retrieves a resource by its name. Args: name: Resource name. Returns: Resource object or None if resource does not exist. """ 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
[ "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" ]
Retrieves a resource by its name. Args: name: Resource name. Returns: Resource object or None if resource does not exist.
[ "Retrieves", "a", "resource", "by", "its", "name", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L261-L278
18,676
HewlettPackard/python-hpOneView
hpOneView/resources/resource.py
Resource.get_by_uri
def get_by_uri(self, uri): """Retrieves a resource by its URI Args: uri: URI of the resource Returns: Resource object """ 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
python
def get_by_uri(self, uri): """Retrieves a resource by its URI Args: uri: URI of the resource Returns: Resource object """ 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
[ "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" ]
Retrieves a resource by its URI Args: uri: URI of the resource Returns: Resource object
[ "Retrieves", "a", "resource", "by", "its", "URI" ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L280-L297
18,677
HewlettPackard/python-hpOneView
hpOneView/resources/resource.py
Resource._get_default_values
def _get_default_values(self, default_values=None): """Gets the default values set for a resource""" if not default_values: default_values = self.DEFAULT_VALUES if default_values: api_version = str(self._connection._apiVersion) values = default_values.get(api_version, {}).copy() else: values = {} return values
python
def _get_default_values(self, default_values=None): """Gets the default values set for a resource""" if not default_values: default_values = self.DEFAULT_VALUES if default_values: api_version = str(self._connection._apiVersion) values = default_values.get(api_version, {}).copy() else: values = {} return values
[ "def", "_get_default_values", "(", "self", ",", "default_values", "=", "None", ")", ":", "if", "not", "default_values", ":", "default_values", "=", "self", ".", "DEFAULT_VALUES", "if", "default_values", ":", "api_version", "=", "str", "(", "self", ".", "_connection", ".", "_apiVersion", ")", "values", "=", "default_values", ".", "get", "(", "api_version", ",", "{", "}", ")", ".", "copy", "(", ")", "else", ":", "values", "=", "{", "}", "return", "values" ]
Gets the default values set for a resource
[ "Gets", "the", "default", "values", "set", "for", "a", "resource" ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L299-L311
18,678
HewlettPackard/python-hpOneView
hpOneView/resources/resource.py
Resource._merge_default_values
def _merge_default_values(self): """Merge default values with resource data.""" values = self._get_default_values() for key, value in values.items(): if not self.data.get(key): self.data[key] = value
python
def _merge_default_values(self): """Merge default values with resource data.""" values = self._get_default_values() for key, value in values.items(): if not self.data.get(key): self.data[key] = value
[ "def", "_merge_default_values", "(", "self", ")", ":", "values", "=", "self", ".", "_get_default_values", "(", ")", "for", "key", ",", "value", "in", "values", ".", "items", "(", ")", ":", "if", "not", "self", ".", "data", ".", "get", "(", "key", ")", ":", "self", ".", "data", "[", "key", "]", "=", "value" ]
Merge default values with resource data.
[ "Merge", "default", "values", "with", "resource", "data", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L313-L318
18,679
HewlettPackard/python-hpOneView
hpOneView/resources/resource.py
ResourceHelper.create_report
def create_report(self, uri, timeout=-1): """ 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: """ 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(task, timeout) return task['taskOutput']
python
def create_report(self, uri, timeout=-1): """ 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: """ 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(task, timeout) return task['taskOutput']
[ "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", "(", "task", ",", "timeout", ")", "return", "task", "[", "'taskOutput'", "]" ]
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:
[ "Creates", "a", "report", "and", "returns", "the", "output", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L471-L492
18,680
HewlettPackard/python-hpOneView
hpOneView/resources/resource.py
ResourceHelper.build_query_uri
def build_query_uri(self, uri=None, start=0, count=-1, filter='', query='', sort='', view='', fields='', scope_uris=''): """Builds the URI from given parameters. More than one request can be send to get the items, regardless the query parameter 'count', because the actual number of items in the response might differ from the requested count. Some types of resource have a limited number of items returned on each call. For those resources, additional calls are made to the API to retrieve any other items matching the given filter. The actual number of items can also differ from the requested call if the requested number of items would take too long. The use of optional parameters for OneView 2.0 is described at: http://h17007.www1.hpe.com/docs/enterprise/servers/oneview2.0/cic-api/en/api-docs/current/index.html Note: Single quote - "'" - inside a query parameter is not supported by OneView API. Args: 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 (default). 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. query: A single query parameter can do what would take multiple parameters or multiple GET requests using filter. Use query for more complex queries. NOTE: This parameter is experimental for OneView 2.0. sort: The sort order of the returned data set. By default, the sort order is based on create time with the oldest entry first. view: Returns a specific subset of the attributes of the resource or collection by specifying the name of a predefined view. The default view is expand (show all attributes of the resource and all elements of the collections or resources). fields: Name of the fields. uri: A specific URI (optional) scope_uris: An expression to restrict the resources returned according to the scopes to which they are assigned. Returns: uri: The complete uri """ if filter: filter = self.make_query_filter(filter) if query: query = "&query=" + quote(query) if sort: sort = "&sort=" + quote(sort) if view: view = "&view=" + quote(view) if fields: fields = "&fields=" + quote(fields) if scope_uris: scope_uris = "&scopeUris=" + quote(scope_uris) path = uri if uri else self._base_uri self.validate_resource_uri(path) symbol = '?' if '?' not in path else '&' uri = "{0}{1}start={2}&count={3}{4}{5}{6}{7}{8}{9}".format(path, symbol, start, count, filter, query, sort, view, fields, scope_uris) return uri
python
def build_query_uri(self, uri=None, start=0, count=-1, filter='', query='', sort='', view='', fields='', scope_uris=''): """Builds the URI from given parameters. More than one request can be send to get the items, regardless the query parameter 'count', because the actual number of items in the response might differ from the requested count. Some types of resource have a limited number of items returned on each call. For those resources, additional calls are made to the API to retrieve any other items matching the given filter. The actual number of items can also differ from the requested call if the requested number of items would take too long. The use of optional parameters for OneView 2.0 is described at: http://h17007.www1.hpe.com/docs/enterprise/servers/oneview2.0/cic-api/en/api-docs/current/index.html Note: Single quote - "'" - inside a query parameter is not supported by OneView API. Args: 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 (default). 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. query: A single query parameter can do what would take multiple parameters or multiple GET requests using filter. Use query for more complex queries. NOTE: This parameter is experimental for OneView 2.0. sort: The sort order of the returned data set. By default, the sort order is based on create time with the oldest entry first. view: Returns a specific subset of the attributes of the resource or collection by specifying the name of a predefined view. The default view is expand (show all attributes of the resource and all elements of the collections or resources). fields: Name of the fields. uri: A specific URI (optional) scope_uris: An expression to restrict the resources returned according to the scopes to which they are assigned. Returns: uri: The complete uri """ if filter: filter = self.make_query_filter(filter) if query: query = "&query=" + quote(query) if sort: sort = "&sort=" + quote(sort) if view: view = "&view=" + quote(view) if fields: fields = "&fields=" + quote(fields) if scope_uris: scope_uris = "&scopeUris=" + quote(scope_uris) path = uri if uri else self._base_uri self.validate_resource_uri(path) symbol = '?' if '?' not in path else '&' uri = "{0}{1}start={2}&count={3}{4}{5}{6}{7}{8}{9}".format(path, symbol, start, count, filter, query, sort, view, fields, scope_uris) return uri
[ "def", "build_query_uri", "(", "self", ",", "uri", "=", "None", ",", "start", "=", "0", ",", "count", "=", "-", "1", ",", "filter", "=", "''", ",", "query", "=", "''", ",", "sort", "=", "''", ",", "view", "=", "''", ",", "fields", "=", "''", ",", "scope_uris", "=", "''", ")", ":", "if", "filter", ":", "filter", "=", "self", ".", "make_query_filter", "(", "filter", ")", "if", "query", ":", "query", "=", "\"&query=\"", "+", "quote", "(", "query", ")", "if", "sort", ":", "sort", "=", "\"&sort=\"", "+", "quote", "(", "sort", ")", "if", "view", ":", "view", "=", "\"&view=\"", "+", "quote", "(", "view", ")", "if", "fields", ":", "fields", "=", "\"&fields=\"", "+", "quote", "(", "fields", ")", "if", "scope_uris", ":", "scope_uris", "=", "\"&scopeUris=\"", "+", "quote", "(", "scope_uris", ")", "path", "=", "uri", "if", "uri", "else", "self", ".", "_base_uri", "self", ".", "validate_resource_uri", "(", "path", ")", "symbol", "=", "'?'", "if", "'?'", "not", "in", "path", "else", "'&'", "uri", "=", "\"{0}{1}start={2}&count={3}{4}{5}{6}{7}{8}{9}\"", ".", "format", "(", "path", ",", "symbol", ",", "start", ",", "count", ",", "filter", ",", "query", ",", "sort", ",", "view", ",", "fields", ",", "scope_uris", ")", "return", "uri" ]
Builds the URI from given parameters. More than one request can be send to get the items, regardless the query parameter 'count', because the actual number of items in the response might differ from the requested count. Some types of resource have a limited number of items returned on each call. For those resources, additional calls are made to the API to retrieve any other items matching the given filter. The actual number of items can also differ from the requested call if the requested number of items would take too long. The use of optional parameters for OneView 2.0 is described at: http://h17007.www1.hpe.com/docs/enterprise/servers/oneview2.0/cic-api/en/api-docs/current/index.html Note: Single quote - "'" - inside a query parameter is not supported by OneView API. Args: 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 (default). 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. query: A single query parameter can do what would take multiple parameters or multiple GET requests using filter. Use query for more complex queries. NOTE: This parameter is experimental for OneView 2.0. sort: The sort order of the returned data set. By default, the sort order is based on create time with the oldest entry first. view: Returns a specific subset of the attributes of the resource or collection by specifying the name of a predefined view. The default view is expand (show all attributes of the resource and all elements of the collections or resources). fields: Name of the fields. uri: A specific URI (optional) scope_uris: An expression to restrict the resources returned according to the scopes to which they are assigned. Returns: uri: The complete uri
[ "Builds", "the", "URI", "from", "given", "parameters", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L523-L585
18,681
HewlettPackard/python-hpOneView
hpOneView/resources/resource.py
ResourceHelper.build_uri
def build_uri(self, id_or_uri): """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 """ 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: return self._base_uri + "/" + id_or_uri
python
def build_uri(self, id_or_uri): """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 """ 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: return self._base_uri + "/" + id_or_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", ":", "return", "self", ".", "_base_uri", "+", "\"/\"", "+", "id_or_uri" ]
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
[ "Helps", "to", "build", "the", "URI", "from", "resource", "id", "and", "validate", "the", "URI", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L594-L611
18,682
HewlettPackard/python-hpOneView
hpOneView/resources/resource.py
ResourceHelper.build_subresource_uri
def build_subresource_uri(self, resource_id_or_uri=None, subresource_id_or_uri=None, subresource_path=''): """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 URI """ 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.HPOneViewValueError(RESOURCE_ID_OR_URI_REQUIRED) resource_uri = self.build_uri(resource_id_or_uri) uri = "{}/{}/{}".format(resource_uri, subresource_path, str(subresource_id_or_uri or '')) uri = uri.replace("//", "/") if uri.endswith("/"): uri = uri[:-1] return uri
python
def build_subresource_uri(self, resource_id_or_uri=None, subresource_id_or_uri=None, subresource_path=''): """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 URI """ 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.HPOneViewValueError(RESOURCE_ID_OR_URI_REQUIRED) resource_uri = self.build_uri(resource_id_or_uri) uri = "{}/{}/{}".format(resource_uri, subresource_path, str(subresource_id_or_uri or '')) uri = uri.replace("//", "/") if uri.endswith("/"): uri = uri[:-1] return uri
[ "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", ".", "HPOneViewValueError", "(", "RESOURCE_ID_OR_URI_REQUIRED", ")", "resource_uri", "=", "self", ".", "build_uri", "(", "resource_id_or_uri", ")", "uri", "=", "\"{}/{}/{}\"", ".", "format", "(", "resource_uri", ",", "subresource_path", ",", "str", "(", "subresource_id_or_uri", "or", "''", ")", ")", "uri", "=", "uri", ".", "replace", "(", "\"//\"", ",", "\"/\"", ")", "if", "uri", ".", "endswith", "(", "\"/\"", ")", ":", "uri", "=", "uri", "[", ":", "-", "1", "]", "return", "uri" ]
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 URI
[ "Helps", "to", "build", "a", "URI", "with", "resource", "path", "and", "its", "sub", "resource", "path", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L613-L638
18,683
HewlettPackard/python-hpOneView
hpOneView/resources/resource.py
ResourceHelper.validate_resource_uri
def validate_resource_uri(self, path): """Helper method to validate URI of the resource.""" if self._base_uri not in path: logger.exception('Get by uri : unrecognized uri: (%s)' % path) raise exceptions.HPOneViewUnknownType(UNRECOGNIZED_URI)
python
def validate_resource_uri(self, path): """Helper method to validate URI of the resource.""" if self._base_uri not in path: logger.exception('Get by uri : unrecognized uri: (%s)' % path) raise exceptions.HPOneViewUnknownType(UNRECOGNIZED_URI)
[ "def", "validate_resource_uri", "(", "self", ",", "path", ")", ":", "if", "self", ".", "_base_uri", "not", "in", "path", ":", "logger", ".", "exception", "(", "'Get by uri : unrecognized uri: (%s)'", "%", "path", ")", "raise", "exceptions", ".", "HPOneViewUnknownType", "(", "UNRECOGNIZED_URI", ")" ]
Helper method to validate URI of the resource.
[ "Helper", "method", "to", "validate", "URI", "of", "the", "resource", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L640-L644
18,684
HewlettPackard/python-hpOneView
hpOneView/resources/resource.py
ResourceHelper.do_requests_to_getall
def do_requests_to_getall(self, uri, requested_count): """Helps to make http request for get_all method. Note: This method will be checking for the pagination URI in the response and make request to pagination URI to get all the resources. """ items = [] while uri: logger.debug('Making HTTP request to get all resources. Uri: {0}'.format(uri)) response = self._connection.get(uri) members = self.get_members(response) items += members logger.debug("Response getAll: nextPageUri = {0}, members list length: {1}".format(uri, str(len(members)))) uri = self.get_next_page(response, items, requested_count) logger.debug('Total # of members found = {0}'.format(str(len(items)))) return items
python
def do_requests_to_getall(self, uri, requested_count): """Helps to make http request for get_all method. Note: This method will be checking for the pagination URI in the response and make request to pagination URI to get all the resources. """ items = [] while uri: logger.debug('Making HTTP request to get all resources. Uri: {0}'.format(uri)) response = self._connection.get(uri) members = self.get_members(response) items += members logger.debug("Response getAll: nextPageUri = {0}, members list length: {1}".format(uri, str(len(members)))) uri = self.get_next_page(response, items, requested_count) logger.debug('Total # of members found = {0}'.format(str(len(items)))) return items
[ "def", "do_requests_to_getall", "(", "self", ",", "uri", ",", "requested_count", ")", ":", "items", "=", "[", "]", "while", "uri", ":", "logger", ".", "debug", "(", "'Making HTTP request to get all resources. Uri: {0}'", ".", "format", "(", "uri", ")", ")", "response", "=", "self", ".", "_connection", ".", "get", "(", "uri", ")", "members", "=", "self", ".", "get_members", "(", "response", ")", "items", "+=", "members", "logger", ".", "debug", "(", "\"Response getAll: nextPageUri = {0}, members list length: {1}\"", ".", "format", "(", "uri", ",", "str", "(", "len", "(", "members", ")", ")", ")", ")", "uri", "=", "self", ".", "get_next_page", "(", "response", ",", "items", ",", "requested_count", ")", "logger", ".", "debug", "(", "'Total # of members found = {0}'", ".", "format", "(", "str", "(", "len", "(", "items", ")", ")", ")", ")", "return", "items" ]
Helps to make http request for get_all method. Note: This method will be checking for the pagination URI in the response and make request to pagination URI to get all the resources.
[ "Helps", "to", "make", "http", "request", "for", "get_all", "method", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L678-L697
18,685
HewlettPackard/python-hpOneView
hpOneView/resources/resource.py
ResourceHelper.do_get
def do_get(self, uri): """Helps to make get requests Args: uri: URI of the resource Returns: Returns: Returns the resource data """ self.validate_resource_uri(uri) return self._connection.get(uri)
python
def do_get(self, uri): """Helps to make get requests Args: uri: URI of the resource Returns: Returns: Returns the resource data """ self.validate_resource_uri(uri) return self._connection.get(uri)
[ "def", "do_get", "(", "self", ",", "uri", ")", ":", "self", ".", "validate_resource_uri", "(", "uri", ")", "return", "self", ".", "_connection", ".", "get", "(", "uri", ")" ]
Helps to make get requests Args: uri: URI of the resource Returns: Returns: Returns the resource data
[ "Helps", "to", "make", "get", "requests" ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L710-L720
18,686
HewlettPackard/python-hpOneView
hpOneView/resources/resource.py
ResourceHelper.do_post
def do_post(self, uri, resource, timeout, custom_headers): """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. """ 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)
python
def do_post(self, uri, resource, timeout, custom_headers): """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. """ 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)
[ "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", ")" ]
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.
[ "Helps", "to", "make", "post", "requests", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L722-L741
18,687
HewlettPackard/python-hpOneView
hpOneView/resources/resource.py
ResourceHelper.do_put
def do_put(self, uri, resource, timeout, custom_headers): """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 """ 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)
python
def do_put(self, uri, resource, timeout, custom_headers): """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 """ 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)
[ "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", ")" ]
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
[ "Helps", "to", "make", "put", "requests", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L743-L761
18,688
HewlettPackard/python-hpOneView
hpOneView/resources/resource.py
ResourceFileHandlerMixin.download
def download(self, uri, file_path): """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. """ with open(file_path, 'wb') as file: return self._connection.download_to_stream(file, uri)
python
def download(self, uri, file_path): """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. """ with open(file_path, 'wb') as file: return self._connection.download_to_stream(file, uri)
[ "def", "download", "(", "self", ",", "uri", ",", "file_path", ")", ":", "with", "open", "(", "file_path", ",", "'wb'", ")", "as", "file", ":", "return", "self", ".", "_connection", ".", "download_to_stream", "(", "file", ",", "uri", ")" ]
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.
[ "Downloads", "the", "contents", "of", "the", "requested", "URI", "to", "a", "stream", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L863-L874
18,689
HewlettPackard/python-hpOneView
hpOneView/resources/resource.py
ResourceClient.build_query_uri
def build_query_uri(self, start=0, count=-1, filter='', query='', sort='', view='', fields='', uri=None, scope_uris=''): """ Builds the URI given the parameters. More than one request can be send to get the items, regardless the query parameter 'count', because the actual number of items in the response might differ from the requested count. Some types of resource have a limited number of items returned on each call. For those resources, additional calls are made to the API to retrieve any other items matching the given filter. The actual number of items can also differ from the requested call if the requested number of items would take too long. The use of optional parameters for OneView 2.0 is described at: http://h17007.www1.hpe.com/docs/enterprise/servers/oneview2.0/cic-api/en/api-docs/current/index.html Note: Single quote - "'" - inside a query parameter is not supported by OneView API. Args: 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 (default). 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. query: A single query parameter can do what would take multiple parameters or multiple GET requests using filter. Use query for more complex queries. NOTE: This parameter is experimental for OneView 2.0. sort: The sort order of the returned data set. By default, the sort order is based on create time with the oldest entry first. view: Returns a specific subset of the attributes of the resource or collection by specifying the name of a predefined view. The default view is expand (show all attributes of the resource and all elements of the collections or resources). fields: Name of the fields. uri: A specific URI (optional) scope_uris: An expression to restrict the resources returned according to the scopes to which they are assigned. Returns: uri: The complete uri """ if filter: filter = self.__make_query_filter(filter) if query: query = "&query=" + quote(query) if sort: sort = "&sort=" + quote(sort) if view: view = "&view=" + quote(view) if fields: fields = "&fields=" + quote(fields) if scope_uris: scope_uris = "&scopeUris=" + quote(scope_uris) path = uri if uri else self._uri self.__validate_resource_uri(path) symbol = '?' if '?' not in path else '&' uri = "{0}{1}start={2}&count={3}{4}{5}{6}{7}{8}{9}".format(path, symbol, start, count, filter, query, sort, view, fields, scope_uris) return uri
python
def build_query_uri(self, start=0, count=-1, filter='', query='', sort='', view='', fields='', uri=None, scope_uris=''): """ Builds the URI given the parameters. More than one request can be send to get the items, regardless the query parameter 'count', because the actual number of items in the response might differ from the requested count. Some types of resource have a limited number of items returned on each call. For those resources, additional calls are made to the API to retrieve any other items matching the given filter. The actual number of items can also differ from the requested call if the requested number of items would take too long. The use of optional parameters for OneView 2.0 is described at: http://h17007.www1.hpe.com/docs/enterprise/servers/oneview2.0/cic-api/en/api-docs/current/index.html Note: Single quote - "'" - inside a query parameter is not supported by OneView API. Args: 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 (default). 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. query: A single query parameter can do what would take multiple parameters or multiple GET requests using filter. Use query for more complex queries. NOTE: This parameter is experimental for OneView 2.0. sort: The sort order of the returned data set. By default, the sort order is based on create time with the oldest entry first. view: Returns a specific subset of the attributes of the resource or collection by specifying the name of a predefined view. The default view is expand (show all attributes of the resource and all elements of the collections or resources). fields: Name of the fields. uri: A specific URI (optional) scope_uris: An expression to restrict the resources returned according to the scopes to which they are assigned. Returns: uri: The complete uri """ if filter: filter = self.__make_query_filter(filter) if query: query = "&query=" + quote(query) if sort: sort = "&sort=" + quote(sort) if view: view = "&view=" + quote(view) if fields: fields = "&fields=" + quote(fields) if scope_uris: scope_uris = "&scopeUris=" + quote(scope_uris) path = uri if uri else self._uri self.__validate_resource_uri(path) symbol = '?' if '?' not in path else '&' uri = "{0}{1}start={2}&count={3}{4}{5}{6}{7}{8}{9}".format(path, symbol, start, count, filter, query, sort, view, fields, scope_uris) return uri
[ "def", "build_query_uri", "(", "self", ",", "start", "=", "0", ",", "count", "=", "-", "1", ",", "filter", "=", "''", ",", "query", "=", "''", ",", "sort", "=", "''", ",", "view", "=", "''", ",", "fields", "=", "''", ",", "uri", "=", "None", ",", "scope_uris", "=", "''", ")", ":", "if", "filter", ":", "filter", "=", "self", ".", "__make_query_filter", "(", "filter", ")", "if", "query", ":", "query", "=", "\"&query=\"", "+", "quote", "(", "query", ")", "if", "sort", ":", "sort", "=", "\"&sort=\"", "+", "quote", "(", "sort", ")", "if", "view", ":", "view", "=", "\"&view=\"", "+", "quote", "(", "view", ")", "if", "fields", ":", "fields", "=", "\"&fields=\"", "+", "quote", "(", "fields", ")", "if", "scope_uris", ":", "scope_uris", "=", "\"&scopeUris=\"", "+", "quote", "(", "scope_uris", ")", "path", "=", "uri", "if", "uri", "else", "self", ".", "_uri", "self", ".", "__validate_resource_uri", "(", "path", ")", "symbol", "=", "'?'", "if", "'?'", "not", "in", "path", "else", "'&'", "uri", "=", "\"{0}{1}start={2}&count={3}{4}{5}{6}{7}{8}{9}\"", ".", "format", "(", "path", ",", "symbol", ",", "start", ",", "count", ",", "filter", ",", "query", ",", "sort", ",", "view", ",", "fields", ",", "scope_uris", ")", "return", "uri" ]
Builds the URI given the parameters. More than one request can be send to get the items, regardless the query parameter 'count', because the actual number of items in the response might differ from the requested count. Some types of resource have a limited number of items returned on each call. For those resources, additional calls are made to the API to retrieve any other items matching the given filter. The actual number of items can also differ from the requested call if the requested number of items would take too long. The use of optional parameters for OneView 2.0 is described at: http://h17007.www1.hpe.com/docs/enterprise/servers/oneview2.0/cic-api/en/api-docs/current/index.html Note: Single quote - "'" - inside a query parameter is not supported by OneView API. Args: 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 (default). 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. query: A single query parameter can do what would take multiple parameters or multiple GET requests using filter. Use query for more complex queries. NOTE: This parameter is experimental for OneView 2.0. sort: The sort order of the returned data set. By default, the sort order is based on create time with the oldest entry first. view: Returns a specific subset of the attributes of the resource or collection by specifying the name of a predefined view. The default view is expand (show all attributes of the resource and all elements of the collections or resources). fields: Name of the fields. uri: A specific URI (optional) scope_uris: An expression to restrict the resources returned according to the scopes to which they are assigned. Returns: uri: The complete uri
[ "Builds", "the", "URI", "given", "the", "parameters", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L1023-L1095
18,690
HewlettPackard/python-hpOneView
hpOneView/resources/resource.py
ResourceClient.upload
def upload(self, file_path, uri=None, timeout=-1): """ Makes a multipart request. Args: file_path: File to upload. uri: A specific URI (optional). 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: Response body. """ if not uri: uri = self._uri upload_file_name = os.path.basename(file_path) task, entity = self._connection.post_multipart_with_response_handling(uri, file_path, upload_file_name) if not task: return entity return self._task_monitor.wait_for_task(task, timeout)
python
def upload(self, file_path, uri=None, timeout=-1): """ Makes a multipart request. Args: file_path: File to upload. uri: A specific URI (optional). 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: Response body. """ if not uri: uri = self._uri upload_file_name = os.path.basename(file_path) task, entity = self._connection.post_multipart_with_response_handling(uri, file_path, upload_file_name) if not task: return entity return self._task_monitor.wait_for_task(task, timeout)
[ "def", "upload", "(", "self", ",", "file_path", ",", "uri", "=", "None", ",", "timeout", "=", "-", "1", ")", ":", "if", "not", "uri", ":", "uri", "=", "self", ".", "_uri", "upload_file_name", "=", "os", ".", "path", ".", "basename", "(", "file_path", ")", "task", ",", "entity", "=", "self", ".", "_connection", ".", "post_multipart_with_response_handling", "(", "uri", ",", "file_path", ",", "upload_file_name", ")", "if", "not", "task", ":", "return", "entity", "return", "self", ".", "_task_monitor", ".", "wait_for_task", "(", "task", ",", "timeout", ")" ]
Makes a multipart request. Args: file_path: File to upload. uri: A specific URI (optional). 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: Response body.
[ "Makes", "a", "multipart", "request", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L1376-L1401
18,691
HewlettPackard/python-hpOneView
hpOneView/resources/resource.py
ResourceClient.get_by
def get_by(self, field, value, uri=None): """ This function uses get_all passing a filter. The search is case-insensitive. Args: field: Field name to filter. value: Value to filter. uri: Resource uri. Returns: dict """ if not field: logger.exception(RESOURCE_CLIENT_INVALID_FIELD) raise ValueError(RESOURCE_CLIENT_INVALID_FIELD) if not uri: uri = self._uri self.__validate_resource_uri(uri) logger.debug('Get by (uri = %s, field = %s, value = %s)' % (uri, field, str(value))) filter = "\"{0}='{1}'\"".format(field, value) results = self.get_all(filter=filter, uri=uri) # Workaround when the OneView filter does not work, it will filter again if "." not in field: # This filter only work for the first level results = [item for item in results if str(item.get(field, '')).lower() == value.lower()] return results
python
def get_by(self, field, value, uri=None): """ This function uses get_all passing a filter. The search is case-insensitive. Args: field: Field name to filter. value: Value to filter. uri: Resource uri. Returns: dict """ if not field: logger.exception(RESOURCE_CLIENT_INVALID_FIELD) raise ValueError(RESOURCE_CLIENT_INVALID_FIELD) if not uri: uri = self._uri self.__validate_resource_uri(uri) logger.debug('Get by (uri = %s, field = %s, value = %s)' % (uri, field, str(value))) filter = "\"{0}='{1}'\"".format(field, value) results = self.get_all(filter=filter, uri=uri) # Workaround when the OneView filter does not work, it will filter again if "." not in field: # This filter only work for the first level results = [item for item in results if str(item.get(field, '')).lower() == value.lower()] return results
[ "def", "get_by", "(", "self", ",", "field", ",", "value", ",", "uri", "=", "None", ")", ":", "if", "not", "field", ":", "logger", ".", "exception", "(", "RESOURCE_CLIENT_INVALID_FIELD", ")", "raise", "ValueError", "(", "RESOURCE_CLIENT_INVALID_FIELD", ")", "if", "not", "uri", ":", "uri", "=", "self", ".", "_uri", "self", ".", "__validate_resource_uri", "(", "uri", ")", "logger", ".", "debug", "(", "'Get by (uri = %s, field = %s, value = %s)'", "%", "(", "uri", ",", "field", ",", "str", "(", "value", ")", ")", ")", "filter", "=", "\"\\\"{0}='{1}'\\\"\"", ".", "format", "(", "field", ",", "value", ")", "results", "=", "self", ".", "get_all", "(", "filter", "=", "filter", ",", "uri", "=", "uri", ")", "# Workaround when the OneView filter does not work, it will filter again", "if", "\".\"", "not", "in", "field", ":", "# This filter only work for the first level", "results", "=", "[", "item", "for", "item", "in", "results", "if", "str", "(", "item", ".", "get", "(", "field", ",", "''", ")", ")", ".", "lower", "(", ")", "==", "value", ".", "lower", "(", ")", "]", "return", "results" ]
This function uses get_all passing a filter. The search is case-insensitive. Args: field: Field name to filter. value: Value to filter. uri: Resource uri. Returns: dict
[ "This", "function", "uses", "get_all", "passing", "a", "filter", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L1457-L1490
18,692
HewlettPackard/python-hpOneView
hpOneView/resources/settings/firmware_drivers.py
FirmwareDrivers.get_by
def get_by(self, field, value): """ Gets the list of firmware baseline resources managed by the appliance. Optional parameters can be used to filter the list of resources returned. The search is case-insensitive. Args: field: Field name to filter. value: Value to filter. Returns: list: List of firmware baseline resources. """ firmwares = self.get_all() matches = [] for item in firmwares: if item.get(field) == value: matches.append(item) return matches
python
def get_by(self, field, value): """ Gets the list of firmware baseline resources managed by the appliance. Optional parameters can be used to filter the list of resources returned. The search is case-insensitive. Args: field: Field name to filter. value: Value to filter. Returns: list: List of firmware baseline resources. """ firmwares = self.get_all() matches = [] for item in firmwares: if item.get(field) == value: matches.append(item) return matches
[ "def", "get_by", "(", "self", ",", "field", ",", "value", ")", ":", "firmwares", "=", "self", ".", "get_all", "(", ")", "matches", "=", "[", "]", "for", "item", "in", "firmwares", ":", "if", "item", ".", "get", "(", "field", ")", "==", "value", ":", "matches", ".", "append", "(", "item", ")", "return", "matches" ]
Gets the list of firmware baseline resources managed by the appliance. Optional parameters can be used to filter the list of resources returned. The search is case-insensitive. Args: field: Field name to filter. value: Value to filter. Returns: list: List of firmware baseline resources.
[ "Gets", "the", "list", "of", "firmware", "baseline", "resources", "managed", "by", "the", "appliance", ".", "Optional", "parameters", "can", "be", "used", "to", "filter", "the", "list", "of", "resources", "returned", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/settings/firmware_drivers.py#L73-L92
18,693
HewlettPackard/python-hpOneView
hpOneView/resources/networking/interconnects.py
Interconnects.get_statistics
def get_statistics(self, id_or_uri, port_name=''): """ Gets the statistics from an interconnect. Args: id_or_uri: Can be either the interconnect id or the interconnect uri. port_name (str): A specific port name of an interconnect. Returns: dict: The statistics for the interconnect that matches id. """ uri = self._client.build_uri(id_or_uri) + "/statistics" if port_name: uri = uri + "/" + port_name return self._client.get(uri)
python
def get_statistics(self, id_or_uri, port_name=''): """ Gets the statistics from an interconnect. Args: id_or_uri: Can be either the interconnect id or the interconnect uri. port_name (str): A specific port name of an interconnect. Returns: dict: The statistics for the interconnect that matches id. """ uri = self._client.build_uri(id_or_uri) + "/statistics" if port_name: uri = uri + "/" + port_name return self._client.get(uri)
[ "def", "get_statistics", "(", "self", ",", "id_or_uri", ",", "port_name", "=", "''", ")", ":", "uri", "=", "self", ".", "_client", ".", "build_uri", "(", "id_or_uri", ")", "+", "\"/statistics\"", "if", "port_name", ":", "uri", "=", "uri", "+", "\"/\"", "+", "port_name", "return", "self", ".", "_client", ".", "get", "(", "uri", ")" ]
Gets the statistics from an interconnect. Args: id_or_uri: Can be either the interconnect id or the interconnect uri. port_name (str): A specific port name of an interconnect. Returns: dict: The statistics for the interconnect that matches id.
[ "Gets", "the", "statistics", "from", "an", "interconnect", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/interconnects.py#L75-L91
18,694
HewlettPackard/python-hpOneView
hpOneView/resources/networking/interconnects.py
Interconnects.get_subport_statistics
def get_subport_statistics(self, id_or_uri, port_name, subport_number): """ Gets the subport statistics on an interconnect. Args: id_or_uri: Can be either the interconnect id or the interconnect uri. port_name (str): A specific port name of an interconnect. subport_number (int): The subport. Returns: dict: The statistics for the interconnect that matches id, port_name, and subport_number. """ uri = self._client.build_uri(id_or_uri) + "/statistics/{0}/subport/{1}".format(port_name, subport_number) return self._client.get(uri)
python
def get_subport_statistics(self, id_or_uri, port_name, subport_number): """ Gets the subport statistics on an interconnect. Args: id_or_uri: Can be either the interconnect id or the interconnect uri. port_name (str): A specific port name of an interconnect. subport_number (int): The subport. Returns: dict: The statistics for the interconnect that matches id, port_name, and subport_number. """ uri = self._client.build_uri(id_or_uri) + "/statistics/{0}/subport/{1}".format(port_name, subport_number) return self._client.get(uri)
[ "def", "get_subport_statistics", "(", "self", ",", "id_or_uri", ",", "port_name", ",", "subport_number", ")", ":", "uri", "=", "self", ".", "_client", ".", "build_uri", "(", "id_or_uri", ")", "+", "\"/statistics/{0}/subport/{1}\"", ".", "format", "(", "port_name", ",", "subport_number", ")", "return", "self", ".", "_client", ".", "get", "(", "uri", ")" ]
Gets the subport statistics on an interconnect. Args: id_or_uri: Can be either the interconnect id or the interconnect uri. port_name (str): A specific port name of an interconnect. subport_number (int): The subport. Returns: dict: The statistics for the interconnect that matches id, port_name, and subport_number.
[ "Gets", "the", "subport", "statistics", "on", "an", "interconnect", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/interconnects.py#L93-L106
18,695
HewlettPackard/python-hpOneView
hpOneView/resources/networking/interconnects.py
Interconnects.get_name_servers
def get_name_servers(self, id_or_uri): """ Gets the named servers for an interconnect. Args: id_or_uri: Can be either the interconnect id or the interconnect uri. Returns: dict: the name servers for an interconnect. """ uri = self._client.build_uri(id_or_uri) + "/nameServers" return self._client.get(uri)
python
def get_name_servers(self, id_or_uri): """ Gets the named servers for an interconnect. Args: id_or_uri: Can be either the interconnect id or the interconnect uri. Returns: dict: the name servers for an interconnect. """ uri = self._client.build_uri(id_or_uri) + "/nameServers" return self._client.get(uri)
[ "def", "get_name_servers", "(", "self", ",", "id_or_uri", ")", ":", "uri", "=", "self", ".", "_client", ".", "build_uri", "(", "id_or_uri", ")", "+", "\"/nameServers\"", "return", "self", ".", "_client", ".", "get", "(", "uri", ")" ]
Gets the named servers for an interconnect. Args: id_or_uri: Can be either the interconnect id or the interconnect uri. Returns: dict: the name servers for an interconnect.
[ "Gets", "the", "named", "servers", "for", "an", "interconnect", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/interconnects.py#L108-L120
18,696
HewlettPackard/python-hpOneView
hpOneView/resources/networking/interconnects.py
Interconnects.update_port
def update_port(self, port_information, id_or_uri, timeout=-1): """ Updates an interconnect port. Args: id_or_uri: Can be either the interconnect id or the interconnect uri. port_information (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: dict: The interconnect. """ uri = self._client.build_uri(id_or_uri) + "/ports" return self._client.update(port_information, uri, timeout)
python
def update_port(self, port_information, id_or_uri, timeout=-1): """ Updates an interconnect port. Args: id_or_uri: Can be either the interconnect id or the interconnect uri. port_information (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: dict: The interconnect. """ uri = self._client.build_uri(id_or_uri) + "/ports" return self._client.update(port_information, uri, timeout)
[ "def", "update_port", "(", "self", ",", "port_information", ",", "id_or_uri", ",", "timeout", "=", "-", "1", ")", ":", "uri", "=", "self", ".", "_client", ".", "build_uri", "(", "id_or_uri", ")", "+", "\"/ports\"", "return", "self", ".", "_client", ".", "update", "(", "port_information", ",", "uri", ",", "timeout", ")" ]
Updates an interconnect port. Args: id_or_uri: Can be either the interconnect id or the interconnect uri. port_information (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: dict: The interconnect.
[ "Updates", "an", "interconnect", "port", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/interconnects.py#L186-L201
18,697
HewlettPackard/python-hpOneView
hpOneView/resources/networking/interconnects.py
Interconnects.update_ports
def update_ports(self, ports, id_or_uri, timeout=-1): """ Updates the interconnect ports. Args: id_or_uri: Can be either the interconnect id or the interconnect uri. ports (list): Ports 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: The interconnect. """ resources = merge_default_values(ports, {'type': 'port'}) uri = self._client.build_uri(id_or_uri) + "/update-ports" return self._client.update(resources, uri, timeout)
python
def update_ports(self, ports, id_or_uri, timeout=-1): """ Updates the interconnect ports. Args: id_or_uri: Can be either the interconnect id or the interconnect uri. ports (list): Ports 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: The interconnect. """ resources = merge_default_values(ports, {'type': 'port'}) uri = self._client.build_uri(id_or_uri) + "/update-ports" return self._client.update(resources, uri, timeout)
[ "def", "update_ports", "(", "self", ",", "ports", ",", "id_or_uri", ",", "timeout", "=", "-", "1", ")", ":", "resources", "=", "merge_default_values", "(", "ports", ",", "{", "'type'", ":", "'port'", "}", ")", "uri", "=", "self", ".", "_client", ".", "build_uri", "(", "id_or_uri", ")", "+", "\"/update-ports\"", "return", "self", ".", "_client", ".", "update", "(", "resources", ",", "uri", ",", "timeout", ")" ]
Updates the interconnect ports. Args: id_or_uri: Can be either the interconnect id or the interconnect uri. ports (list): Ports 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: The interconnect.
[ "Updates", "the", "interconnect", "ports", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/interconnects.py#L203-L220
18,698
HewlettPackard/python-hpOneView
hpOneView/resources/networking/interconnects.py
Interconnects.reset_port_protection
def reset_port_protection(self, id_or_uri, timeout=-1): """ Triggers a reset of port protection. Cause port protection to be reset on all the interconnects of the logical interconnect that matches ID. Args: id_or_uri: Can be either the interconnect id or the interconnect 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: dict: The interconnect. """ uri = self._client.build_uri(id_or_uri) + "/resetportprotection" return self._client.update_with_zero_body(uri, timeout)
python
def reset_port_protection(self, id_or_uri, timeout=-1): """ Triggers a reset of port protection. Cause port protection to be reset on all the interconnects of the logical interconnect that matches ID. Args: id_or_uri: Can be either the interconnect id or the interconnect 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: dict: The interconnect. """ uri = self._client.build_uri(id_or_uri) + "/resetportprotection" return self._client.update_with_zero_body(uri, timeout)
[ "def", "reset_port_protection", "(", "self", ",", "id_or_uri", ",", "timeout", "=", "-", "1", ")", ":", "uri", "=", "self", ".", "_client", ".", "build_uri", "(", "id_or_uri", ")", "+", "\"/resetportprotection\"", "return", "self", ".", "_client", ".", "update_with_zero_body", "(", "uri", ",", "timeout", ")" ]
Triggers a reset of port protection. Cause port protection to be reset on all the interconnects of the logical interconnect that matches ID. Args: id_or_uri: Can be either the interconnect id or the interconnect 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: dict: The interconnect.
[ "Triggers", "a", "reset", "of", "port", "protection", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/interconnects.py#L222-L238
18,699
HewlettPackard/python-hpOneView
hpOneView/resources/networking/interconnects.py
Interconnects.get_ports
def get_ports(self, id_or_uri, start=0, count=-1): """ Gets all interconnect ports. Args: id_or_uri: Can be either the interconnect id or the interconnect uri. 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. Returns: list: All interconnect ports. """ uri = self._client.build_subresource_uri(resource_id_or_uri=id_or_uri, subresource_path="ports") return self._client.get_all(start, count, uri=uri)
python
def get_ports(self, id_or_uri, start=0, count=-1): """ Gets all interconnect ports. Args: id_or_uri: Can be either the interconnect id or the interconnect uri. 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. Returns: list: All interconnect ports. """ uri = self._client.build_subresource_uri(resource_id_or_uri=id_or_uri, subresource_path="ports") return self._client.get_all(start, count, uri=uri)
[ "def", "get_ports", "(", "self", ",", "id_or_uri", ",", "start", "=", "0", ",", "count", "=", "-", "1", ")", ":", "uri", "=", "self", ".", "_client", ".", "build_subresource_uri", "(", "resource_id_or_uri", "=", "id_or_uri", ",", "subresource_path", "=", "\"ports\"", ")", "return", "self", ".", "_client", ".", "get_all", "(", "start", ",", "count", ",", "uri", "=", "uri", ")" ]
Gets all interconnect ports. Args: id_or_uri: Can be either the interconnect id or the interconnect uri. 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. Returns: list: All interconnect ports.
[ "Gets", "all", "interconnect", "ports", "." ]
3c6219723ef25e6e0c83d44a89007f89bc325b89
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/interconnects.py#L240-L258