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
sequencelengths 20
707
| docstring
stringlengths 3
17.3k
| docstring_tokens
sequencelengths 3
222
| sha
stringlengths 40
40
| url
stringlengths 87
242
| partition
stringclasses 1
value | idx
int64 0
252k
|
---|---|---|---|---|---|---|---|---|---|---|---|---|
HewlettPackard/python-hpOneView | hpOneView/resources/networking/logical_interconnects.py | LogicalInterconnects.update_ethernet_settings | def update_ethernet_settings(self, configuration, force=False, timeout=-1):
"""
Updates the Ethernet interconnect settings for the logical interconnect.
Args:
configuration: Ethernet interconnect settings.
force: If set to true, the operation completes despite any problems with network connectivity or errors
on the resource itself. The default is false.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Logical Interconnect.
"""
uri = "{}/ethernetSettings".format(self.data["uri"])
return self._helper.update(configuration, uri=uri, force=force, timeout=timeout) | python | def update_ethernet_settings(self, configuration, force=False, timeout=-1):
"""
Updates the Ethernet interconnect settings for the logical interconnect.
Args:
configuration: Ethernet interconnect settings.
force: If set to true, the operation completes despite any problems with network connectivity or errors
on the resource itself. The default is false.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Logical Interconnect.
"""
uri = "{}/ethernetSettings".format(self.data["uri"])
return self._helper.update(configuration, uri=uri, force=force, timeout=timeout) | [
"def",
"update_ethernet_settings",
"(",
"self",
",",
"configuration",
",",
"force",
"=",
"False",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"\"{}/ethernetSettings\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
")",
"return",
"self",
".",
"_helper",
".",
"update",
"(",
"configuration",
",",
"uri",
"=",
"uri",
",",
"force",
"=",
"force",
",",
"timeout",
"=",
"timeout",
")"
] | Updates the Ethernet interconnect settings for the logical interconnect.
Args:
configuration: Ethernet interconnect settings.
force: If set to true, the operation completes despite any problems with network connectivity or errors
on the resource itself. The default is false.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Logical Interconnect. | [
"Updates",
"the",
"Ethernet",
"interconnect",
"settings",
"for",
"the",
"logical",
"interconnect",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L153-L168 | train | 251,400 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/logical_interconnects.py | LogicalInterconnects.update_internal_networks | def update_internal_networks(self, network_uri_list, force=False, timeout=-1):
"""
Updates internal networks on the logical interconnect.
Args:
network_uri_list: List of Ethernet network uris.
force: If set to true, the operation completes despite any problems with network connectivity or errors
on the resource itself. The default is false.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Logical Interconnect.
"""
uri = "{}/internalNetworks".format(self.data["uri"])
return self._helper.update(network_uri_list, uri=uri, force=force, timeout=timeout) | python | def update_internal_networks(self, network_uri_list, force=False, timeout=-1):
"""
Updates internal networks on the logical interconnect.
Args:
network_uri_list: List of Ethernet network uris.
force: If set to true, the operation completes despite any problems with network connectivity or errors
on the resource itself. The default is false.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Logical Interconnect.
"""
uri = "{}/internalNetworks".format(self.data["uri"])
return self._helper.update(network_uri_list, uri=uri, force=force, timeout=timeout) | [
"def",
"update_internal_networks",
"(",
"self",
",",
"network_uri_list",
",",
"force",
"=",
"False",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"\"{}/internalNetworks\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
")",
"return",
"self",
".",
"_helper",
".",
"update",
"(",
"network_uri_list",
",",
"uri",
"=",
"uri",
",",
"force",
"=",
"force",
",",
"timeout",
"=",
"timeout",
")"
] | Updates internal networks on the logical interconnect.
Args:
network_uri_list: List of Ethernet network uris.
force: If set to true, the operation completes despite any problems with network connectivity or errors
on the resource itself. The default is false.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Logical Interconnect. | [
"Updates",
"internal",
"networks",
"on",
"the",
"logical",
"interconnect",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L171-L186 | train | 251,401 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/logical_interconnects.py | LogicalInterconnects.update_configuration | def update_configuration(self, timeout=-1):
"""
Asynchronously applies or re-applies the logical interconnect configuration to all managed interconnects.
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 Interconnect.
"""
uri = "{}/configuration".format(self.data["uri"])
return self._helper.update(None, uri=uri, timeout=timeout) | python | def update_configuration(self, timeout=-1):
"""
Asynchronously applies or re-applies the logical interconnect configuration to all managed interconnects.
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 Interconnect.
"""
uri = "{}/configuration".format(self.data["uri"])
return self._helper.update(None, uri=uri, timeout=timeout) | [
"def",
"update_configuration",
"(",
"self",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"\"{}/configuration\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
")",
"return",
"self",
".",
"_helper",
".",
"update",
"(",
"None",
",",
"uri",
"=",
"uri",
",",
"timeout",
"=",
"timeout",
")"
] | Asynchronously applies or re-applies the logical interconnect configuration to all managed interconnects.
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 Interconnect. | [
"Asynchronously",
"applies",
"or",
"re",
"-",
"applies",
"the",
"logical",
"interconnect",
"configuration",
"to",
"all",
"managed",
"interconnects",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L232-L244 | train | 251,402 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/logical_interconnects.py | LogicalInterconnects.get_snmp_configuration | def get_snmp_configuration(self):
"""
Gets the SNMP configuration for a logical interconnect.
Returns:
dict: SNMP configuration.
"""
uri = "{}{}".format(self.data["uri"], self.SNMP_CONFIGURATION_PATH)
return self._helper.do_get(uri) | python | def get_snmp_configuration(self):
"""
Gets the SNMP configuration for a logical interconnect.
Returns:
dict: SNMP configuration.
"""
uri = "{}{}".format(self.data["uri"], self.SNMP_CONFIGURATION_PATH)
return self._helper.do_get(uri) | [
"def",
"get_snmp_configuration",
"(",
"self",
")",
":",
"uri",
"=",
"\"{}{}\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
",",
"self",
".",
"SNMP_CONFIGURATION_PATH",
")",
"return",
"self",
".",
"_helper",
".",
"do_get",
"(",
"uri",
")"
] | Gets the SNMP configuration for a logical interconnect.
Returns:
dict: SNMP configuration. | [
"Gets",
"the",
"SNMP",
"configuration",
"for",
"a",
"logical",
"interconnect",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L247-L255 | train | 251,403 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/logical_interconnects.py | LogicalInterconnects.update_snmp_configuration | def update_snmp_configuration(self, configuration, timeout=-1):
"""
Updates the SNMP configuration of a logical interconnect. Changes to the SNMP configuration are asynchronously
applied to all managed interconnects.
Args:
configuration: snmp configuration.
Returns:
dict: The Logical Interconnect.
"""
data = configuration.copy()
if 'type' not in data:
data['type'] = 'snmp-configuration'
uri = "{}{}".format(self.data["uri"], self.SNMP_CONFIGURATION_PATH)
return self._helper.update(data, uri=uri, timeout=timeout) | python | def update_snmp_configuration(self, configuration, timeout=-1):
"""
Updates the SNMP configuration of a logical interconnect. Changes to the SNMP configuration are asynchronously
applied to all managed interconnects.
Args:
configuration: snmp configuration.
Returns:
dict: The Logical Interconnect.
"""
data = configuration.copy()
if 'type' not in data:
data['type'] = 'snmp-configuration'
uri = "{}{}".format(self.data["uri"], self.SNMP_CONFIGURATION_PATH)
return self._helper.update(data, uri=uri, timeout=timeout) | [
"def",
"update_snmp_configuration",
"(",
"self",
",",
"configuration",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"data",
"=",
"configuration",
".",
"copy",
"(",
")",
"if",
"'type'",
"not",
"in",
"data",
":",
"data",
"[",
"'type'",
"]",
"=",
"'snmp-configuration'",
"uri",
"=",
"\"{}{}\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
",",
"self",
".",
"SNMP_CONFIGURATION_PATH",
")",
"return",
"self",
".",
"_helper",
".",
"update",
"(",
"data",
",",
"uri",
"=",
"uri",
",",
"timeout",
"=",
"timeout",
")"
] | Updates the SNMP configuration of a logical interconnect. Changes to the SNMP configuration are asynchronously
applied to all managed interconnects.
Args:
configuration: snmp configuration.
Returns:
dict: The Logical Interconnect. | [
"Updates",
"the",
"SNMP",
"configuration",
"of",
"a",
"logical",
"interconnect",
".",
"Changes",
"to",
"the",
"SNMP",
"configuration",
"are",
"asynchronously",
"applied",
"to",
"all",
"managed",
"interconnects",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L258-L274 | train | 251,404 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/logical_interconnects.py | LogicalInterconnects.get_unassigned_ports | def get_unassigned_ports(self):
"""
Gets the collection ports from the member interconnects
which are eligible for assignment to an anlyzer port
Returns:
dict: Collection of ports
"""
uri = "{}/unassignedPortsForPortMonitor".format(self.data["uri"])
response = self._helper.do_get(uri)
return self._helper.get_members(response) | python | def get_unassigned_ports(self):
"""
Gets the collection ports from the member interconnects
which are eligible for assignment to an anlyzer port
Returns:
dict: Collection of ports
"""
uri = "{}/unassignedPortsForPortMonitor".format(self.data["uri"])
response = self._helper.do_get(uri)
return self._helper.get_members(response) | [
"def",
"get_unassigned_ports",
"(",
"self",
")",
":",
"uri",
"=",
"\"{}/unassignedPortsForPortMonitor\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
")",
"response",
"=",
"self",
".",
"_helper",
".",
"do_get",
"(",
"uri",
")",
"return",
"self",
".",
"_helper",
".",
"get_members",
"(",
"response",
")"
] | Gets the collection ports from the member interconnects
which are eligible for assignment to an anlyzer port
Returns:
dict: Collection of ports | [
"Gets",
"the",
"collection",
"ports",
"from",
"the",
"member",
"interconnects",
"which",
"are",
"eligible",
"for",
"assignment",
"to",
"an",
"anlyzer",
"port"
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L277-L288 | train | 251,405 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/logical_interconnects.py | LogicalInterconnects.get_port_monitor | def get_port_monitor(self):
"""
Gets the port monitor configuration of a logical interconnect.
Returns:
dict: The Logical Interconnect.
"""
uri = "{}{}".format(self.data["uri"], self.PORT_MONITOR_PATH)
return self._helper.do_get(uri) | python | def get_port_monitor(self):
"""
Gets the port monitor configuration of a logical interconnect.
Returns:
dict: The Logical Interconnect.
"""
uri = "{}{}".format(self.data["uri"], self.PORT_MONITOR_PATH)
return self._helper.do_get(uri) | [
"def",
"get_port_monitor",
"(",
"self",
")",
":",
"uri",
"=",
"\"{}{}\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
",",
"self",
".",
"PORT_MONITOR_PATH",
")",
"return",
"self",
".",
"_helper",
".",
"do_get",
"(",
"uri",
")"
] | Gets the port monitor configuration of a logical interconnect.
Returns:
dict: The Logical Interconnect. | [
"Gets",
"the",
"port",
"monitor",
"configuration",
"of",
"a",
"logical",
"interconnect",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L306-L314 | train | 251,406 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/logical_interconnects.py | LogicalInterconnects.update_port_monitor | def update_port_monitor(self, resource, timeout=-1):
"""
Updates the port monitor configuration of a logical interconnect.
Args:
resource: Port monitor configuration.
Returns:
dict: Port monitor configuration.
"""
data = resource.copy()
if 'type' not in data:
data['type'] = 'port-monitor'
uri = "{}{}".format(self.data["uri"], self.PORT_MONITOR_PATH)
return self._helper.update(data, uri=uri, timeout=timeout) | python | def update_port_monitor(self, resource, timeout=-1):
"""
Updates the port monitor configuration of a logical interconnect.
Args:
resource: Port monitor configuration.
Returns:
dict: Port monitor configuration.
"""
data = resource.copy()
if 'type' not in data:
data['type'] = 'port-monitor'
uri = "{}{}".format(self.data["uri"], self.PORT_MONITOR_PATH)
return self._helper.update(data, uri=uri, timeout=timeout) | [
"def",
"update_port_monitor",
"(",
"self",
",",
"resource",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"data",
"=",
"resource",
".",
"copy",
"(",
")",
"if",
"'type'",
"not",
"in",
"data",
":",
"data",
"[",
"'type'",
"]",
"=",
"'port-monitor'",
"uri",
"=",
"\"{}{}\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
",",
"self",
".",
"PORT_MONITOR_PATH",
")",
"return",
"self",
".",
"_helper",
".",
"update",
"(",
"data",
",",
"uri",
"=",
"uri",
",",
"timeout",
"=",
"timeout",
")"
] | Updates the port monitor configuration of a logical interconnect.
Args:
resource: Port monitor configuration.
Returns:
dict: Port monitor configuration. | [
"Updates",
"the",
"port",
"monitor",
"configuration",
"of",
"a",
"logical",
"interconnect",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L317-L332 | train | 251,407 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/logical_interconnects.py | LogicalInterconnects.create_interconnect | def create_interconnect(self, location_entries, timeout=-1):
"""
Creates an interconnect at the given location.
Warning:
It does not create the LOGICAL INTERCONNECT itself.
It will fail if no interconnect is already present on the specified position.
Args:
location_entries (dict): Dictionary with location entries.
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 interconnect.
"""
return self._helper.create(location_entries, uri=self.locations_uri, timeout=timeout) | python | def create_interconnect(self, location_entries, timeout=-1):
"""
Creates an interconnect at the given location.
Warning:
It does not create the LOGICAL INTERCONNECT itself.
It will fail if no interconnect is already present on the specified position.
Args:
location_entries (dict): Dictionary with location entries.
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 interconnect.
"""
return self._helper.create(location_entries, uri=self.locations_uri, timeout=timeout) | [
"def",
"create_interconnect",
"(",
"self",
",",
"location_entries",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"return",
"self",
".",
"_helper",
".",
"create",
"(",
"location_entries",
",",
"uri",
"=",
"self",
".",
"locations_uri",
",",
"timeout",
"=",
"timeout",
")"
] | Creates an interconnect at the given location.
Warning:
It does not create the LOGICAL INTERCONNECT itself.
It will fail if no interconnect is already present on the specified position.
Args:
location_entries (dict): Dictionary with location entries.
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 interconnect. | [
"Creates",
"an",
"interconnect",
"at",
"the",
"given",
"location",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L334-L351 | train | 251,408 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/logical_interconnects.py | LogicalInterconnects.delete_interconnect | def delete_interconnect(self, enclosure_uri, bay, timeout=-1):
"""
Deletes an interconnect from a location.
Warning:
This won't delete the LOGICAL INTERCONNECT itself and might cause inconsistency between the enclosure
and Logical Interconnect Group.
Args:
enclosure_uri: URI of the Enclosure
bay: Bay
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: Indicating if the interconnect was successfully deleted.
"""
uri = "{path}?location=Enclosure:{enclosure_uri},Bay:{bay}".format(path=self.LOCATIONS_PATH,
enclosure_uri=enclosure_uri,
bay=bay)
return self._helper.delete(uri, timeout=timeout) | python | def delete_interconnect(self, enclosure_uri, bay, timeout=-1):
"""
Deletes an interconnect from a location.
Warning:
This won't delete the LOGICAL INTERCONNECT itself and might cause inconsistency between the enclosure
and Logical Interconnect Group.
Args:
enclosure_uri: URI of the Enclosure
bay: Bay
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: Indicating if the interconnect was successfully deleted.
"""
uri = "{path}?location=Enclosure:{enclosure_uri},Bay:{bay}".format(path=self.LOCATIONS_PATH,
enclosure_uri=enclosure_uri,
bay=bay)
return self._helper.delete(uri, timeout=timeout) | [
"def",
"delete_interconnect",
"(",
"self",
",",
"enclosure_uri",
",",
"bay",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"\"{path}?location=Enclosure:{enclosure_uri},Bay:{bay}\"",
".",
"format",
"(",
"path",
"=",
"self",
".",
"LOCATIONS_PATH",
",",
"enclosure_uri",
"=",
"enclosure_uri",
",",
"bay",
"=",
"bay",
")",
"return",
"self",
".",
"_helper",
".",
"delete",
"(",
"uri",
",",
"timeout",
"=",
"timeout",
")"
] | Deletes an interconnect from a location.
Warning:
This won't delete the LOGICAL INTERCONNECT itself and might cause inconsistency between the enclosure
and Logical Interconnect Group.
Args:
enclosure_uri: URI of the Enclosure
bay: Bay
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: Indicating if the interconnect was successfully deleted. | [
"Deletes",
"an",
"interconnect",
"from",
"a",
"location",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L353-L374 | train | 251,409 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/logical_interconnects.py | LogicalInterconnects.get_firmware | def get_firmware(self):
"""
Gets the installed firmware for a logical interconnect.
Returns:
dict: LIFirmware.
"""
firmware_uri = self._helper.build_subresource_uri(self.data["uri"], subresource_path=self.FIRMWARE_PATH)
return self._helper.do_get(firmware_uri) | python | def get_firmware(self):
"""
Gets the installed firmware for a logical interconnect.
Returns:
dict: LIFirmware.
"""
firmware_uri = self._helper.build_subresource_uri(self.data["uri"], subresource_path=self.FIRMWARE_PATH)
return self._helper.do_get(firmware_uri) | [
"def",
"get_firmware",
"(",
"self",
")",
":",
"firmware_uri",
"=",
"self",
".",
"_helper",
".",
"build_subresource_uri",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
",",
"subresource_path",
"=",
"self",
".",
"FIRMWARE_PATH",
")",
"return",
"self",
".",
"_helper",
".",
"do_get",
"(",
"firmware_uri",
")"
] | Gets the installed firmware for a logical interconnect.
Returns:
dict: LIFirmware. | [
"Gets",
"the",
"installed",
"firmware",
"for",
"a",
"logical",
"interconnect",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L377-L385 | train | 251,410 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/logical_interconnects.py | LogicalInterconnects.get_forwarding_information_base | def get_forwarding_information_base(self, filter=''):
"""
Gets the forwarding information base data for a logical interconnect. A maximum of 100 entries is returned.
Optional filtering criteria might be specified.
Args:
filter (list or str):
Filtering criteria may be specified using supported attributes: interconnectUri, macAddress,
internalVlan, externalVlan, and supported relation = (Equals). macAddress is 12 hexadecimal digits with
a colon between each pair of digits (upper case or lower case).
The default is no filter; all resources are returned.
Returns:
list: A set of interconnect MAC address entries.
"""
uri = "{}{}".format(self.data["uri"], self.FORWARDING_INFORMATION_PATH)
return self._helper.get_collection(uri, filter=filter) | python | def get_forwarding_information_base(self, filter=''):
"""
Gets the forwarding information base data for a logical interconnect. A maximum of 100 entries is returned.
Optional filtering criteria might be specified.
Args:
filter (list or str):
Filtering criteria may be specified using supported attributes: interconnectUri, macAddress,
internalVlan, externalVlan, and supported relation = (Equals). macAddress is 12 hexadecimal digits with
a colon between each pair of digits (upper case or lower case).
The default is no filter; all resources are returned.
Returns:
list: A set of interconnect MAC address entries.
"""
uri = "{}{}".format(self.data["uri"], self.FORWARDING_INFORMATION_PATH)
return self._helper.get_collection(uri, filter=filter) | [
"def",
"get_forwarding_information_base",
"(",
"self",
",",
"filter",
"=",
"''",
")",
":",
"uri",
"=",
"\"{}{}\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
",",
"self",
".",
"FORWARDING_INFORMATION_PATH",
")",
"return",
"self",
".",
"_helper",
".",
"get_collection",
"(",
"uri",
",",
"filter",
"=",
"filter",
")"
] | Gets the forwarding information base data for a logical interconnect. A maximum of 100 entries is returned.
Optional filtering criteria might be specified.
Args:
filter (list or str):
Filtering criteria may be specified using supported attributes: interconnectUri, macAddress,
internalVlan, externalVlan, and supported relation = (Equals). macAddress is 12 hexadecimal digits with
a colon between each pair of digits (upper case or lower case).
The default is no filter; all resources are returned.
Returns:
list: A set of interconnect MAC address entries. | [
"Gets",
"the",
"forwarding",
"information",
"base",
"data",
"for",
"a",
"logical",
"interconnect",
".",
"A",
"maximum",
"of",
"100",
"entries",
"is",
"returned",
".",
"Optional",
"filtering",
"criteria",
"might",
"be",
"specified",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L404-L420 | train | 251,411 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/logical_interconnects.py | LogicalInterconnects.create_forwarding_information_base | def create_forwarding_information_base(self, timeout=-1):
"""
Generates the forwarding information base dump file for a logical interconnect.
Args:
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns: Interconnect Forwarding Information Base DataInfo.
"""
uri = "{}{}".format(self.data["uri"], self.FORWARDING_INFORMATION_PATH)
return self._helper.do_post(uri, None, timeout, None) | python | def create_forwarding_information_base(self, timeout=-1):
"""
Generates the forwarding information base dump file for a logical interconnect.
Args:
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns: Interconnect Forwarding Information Base DataInfo.
"""
uri = "{}{}".format(self.data["uri"], self.FORWARDING_INFORMATION_PATH)
return self._helper.do_post(uri, None, timeout, None) | [
"def",
"create_forwarding_information_base",
"(",
"self",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"\"{}{}\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
",",
"self",
".",
"FORWARDING_INFORMATION_PATH",
")",
"return",
"self",
".",
"_helper",
".",
"do_post",
"(",
"uri",
",",
"None",
",",
"timeout",
",",
"None",
")"
] | Generates the forwarding information base dump file for a logical interconnect.
Args:
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns: Interconnect Forwarding Information Base DataInfo. | [
"Generates",
"the",
"forwarding",
"information",
"base",
"dump",
"file",
"for",
"a",
"logical",
"interconnect",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L423-L435 | train | 251,412 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/logical_interconnects.py | LogicalInterconnects.get_qos_aggregated_configuration | def get_qos_aggregated_configuration(self):
"""
Gets the QoS aggregated configuration for the logical interconnect.
Returns:
dict: QoS Configuration.
"""
uri = "{}{}".format(self.data["uri"], self.QOS_AGGREGATED_CONFIGURATION)
return self._helper.do_get(uri) | python | def get_qos_aggregated_configuration(self):
"""
Gets the QoS aggregated configuration for the logical interconnect.
Returns:
dict: QoS Configuration.
"""
uri = "{}{}".format(self.data["uri"], self.QOS_AGGREGATED_CONFIGURATION)
return self._helper.do_get(uri) | [
"def",
"get_qos_aggregated_configuration",
"(",
"self",
")",
":",
"uri",
"=",
"\"{}{}\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
",",
"self",
".",
"QOS_AGGREGATED_CONFIGURATION",
")",
"return",
"self",
".",
"_helper",
".",
"do_get",
"(",
"uri",
")"
] | Gets the QoS aggregated configuration for the logical interconnect.
Returns:
dict: QoS Configuration. | [
"Gets",
"the",
"QoS",
"aggregated",
"configuration",
"for",
"the",
"logical",
"interconnect",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L438-L446 | train | 251,413 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/logical_interconnects.py | LogicalInterconnects.update_qos_aggregated_configuration | def update_qos_aggregated_configuration(self, qos_configuration, timeout=-1):
"""
Updates the QoS aggregated configuration for the logical interconnect.
Args:
qos_configuration:
QOS configuration.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
dict: Logical Interconnect.
"""
uri = "{}{}".format(self.data["uri"], self.QOS_AGGREGATED_CONFIGURATION)
return self._helper.update(qos_configuration, uri=uri, timeout=timeout) | python | def update_qos_aggregated_configuration(self, qos_configuration, timeout=-1):
"""
Updates the QoS aggregated configuration for the logical interconnect.
Args:
qos_configuration:
QOS configuration.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
dict: Logical Interconnect.
"""
uri = "{}{}".format(self.data["uri"], self.QOS_AGGREGATED_CONFIGURATION)
return self._helper.update(qos_configuration, uri=uri, timeout=timeout) | [
"def",
"update_qos_aggregated_configuration",
"(",
"self",
",",
"qos_configuration",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"\"{}{}\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
",",
"self",
".",
"QOS_AGGREGATED_CONFIGURATION",
")",
"return",
"self",
".",
"_helper",
".",
"update",
"(",
"qos_configuration",
",",
"uri",
"=",
"uri",
",",
"timeout",
"=",
"timeout",
")"
] | Updates the QoS aggregated configuration for the logical interconnect.
Args:
qos_configuration:
QOS configuration.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
dict: Logical Interconnect. | [
"Updates",
"the",
"QoS",
"aggregated",
"configuration",
"for",
"the",
"logical",
"interconnect",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L449-L464 | train | 251,414 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/logical_interconnects.py | LogicalInterconnects.update_telemetry_configurations | def update_telemetry_configurations(self, configuration, timeout=-1):
"""
Updates the telemetry configuration of a logical interconnect. Changes to the telemetry configuration are
asynchronously applied to all managed interconnects.
Args:
configuration:
The telemetry configuration for the logical interconnect.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
dict: The Logical Interconnect.
"""
telemetry_conf_uri = self._get_telemetry_configuration_uri()
default_values = self._get_default_values(self.SETTINGS_TELEMETRY_CONFIG_DEFAULT_VALUES)
configuration = self._helper.update_resource_fields(configuration, default_values)
return self._helper.update(configuration, uri=telemetry_conf_uri, timeout=timeout) | python | def update_telemetry_configurations(self, configuration, timeout=-1):
"""
Updates the telemetry configuration of a logical interconnect. Changes to the telemetry configuration are
asynchronously applied to all managed interconnects.
Args:
configuration:
The telemetry configuration for the logical interconnect.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
dict: The Logical Interconnect.
"""
telemetry_conf_uri = self._get_telemetry_configuration_uri()
default_values = self._get_default_values(self.SETTINGS_TELEMETRY_CONFIG_DEFAULT_VALUES)
configuration = self._helper.update_resource_fields(configuration, default_values)
return self._helper.update(configuration, uri=telemetry_conf_uri, timeout=timeout) | [
"def",
"update_telemetry_configurations",
"(",
"self",
",",
"configuration",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"telemetry_conf_uri",
"=",
"self",
".",
"_get_telemetry_configuration_uri",
"(",
")",
"default_values",
"=",
"self",
".",
"_get_default_values",
"(",
"self",
".",
"SETTINGS_TELEMETRY_CONFIG_DEFAULT_VALUES",
")",
"configuration",
"=",
"self",
".",
"_helper",
".",
"update_resource_fields",
"(",
"configuration",
",",
"default_values",
")",
"return",
"self",
".",
"_helper",
".",
"update",
"(",
"configuration",
",",
"uri",
"=",
"telemetry_conf_uri",
",",
"timeout",
"=",
"timeout",
")"
] | Updates the telemetry configuration of a logical interconnect. Changes to the telemetry configuration are
asynchronously applied to all managed interconnects.
Args:
configuration:
The telemetry configuration for the logical interconnect.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
dict: The Logical Interconnect. | [
"Updates",
"the",
"telemetry",
"configuration",
"of",
"a",
"logical",
"interconnect",
".",
"Changes",
"to",
"the",
"telemetry",
"configuration",
"are",
"asynchronously",
"applied",
"to",
"all",
"managed",
"interconnects",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L485-L504 | train | 251,415 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/logical_interconnects.py | LogicalInterconnects.get_ethernet_settings | def get_ethernet_settings(self):
"""
Gets the Ethernet interconnect settings for the Logical Interconnect.
Returns:
dict: Ethernet Interconnect Settings
"""
uri = "{}/ethernetSettings".format(self.data["uri"])
return self._helper.do_get(uri) | python | def get_ethernet_settings(self):
"""
Gets the Ethernet interconnect settings for the Logical Interconnect.
Returns:
dict: Ethernet Interconnect Settings
"""
uri = "{}/ethernetSettings".format(self.data["uri"])
return self._helper.do_get(uri) | [
"def",
"get_ethernet_settings",
"(",
"self",
")",
":",
"uri",
"=",
"\"{}/ethernetSettings\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
")",
"return",
"self",
".",
"_helper",
".",
"do_get",
"(",
"uri",
")"
] | Gets the Ethernet interconnect settings for the Logical Interconnect.
Returns:
dict: Ethernet Interconnect Settings | [
"Gets",
"the",
"Ethernet",
"interconnect",
"settings",
"for",
"the",
"Logical",
"Interconnect",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L507-L515 | train | 251,416 |
HewlettPackard/python-hpOneView | hpOneView/image_streamer/resources/os_volumes.py | OsVolumes.download_archive | def download_archive(self, name, file_path):
"""
Download archived logs of the OS Volume.
Args:
name: Name of the OS Volume.
file_path (str): Destination file path.
Returns:
bool: Indicates if the resource was successfully downloaded.
"""
uri = self.URI + "/archive/" + name
return self._client.download(uri, file_path) | python | def download_archive(self, name, file_path):
"""
Download archived logs of the OS Volume.
Args:
name: Name of the OS Volume.
file_path (str): Destination file path.
Returns:
bool: Indicates if the resource was successfully downloaded.
"""
uri = self.URI + "/archive/" + name
return self._client.download(uri, file_path) | [
"def",
"download_archive",
"(",
"self",
",",
"name",
",",
"file_path",
")",
":",
"uri",
"=",
"self",
".",
"URI",
"+",
"\"/archive/\"",
"+",
"name",
"return",
"self",
".",
"_client",
".",
"download",
"(",
"uri",
",",
"file_path",
")"
] | Download archived logs of the OS Volume.
Args:
name: Name of the OS Volume.
file_path (str): Destination file path.
Returns:
bool: Indicates if the resource was successfully downloaded. | [
"Download",
"archived",
"logs",
"of",
"the",
"OS",
"Volume",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/resources/os_volumes.py#L110-L122 | train | 251,417 |
HewlettPackard/python-hpOneView | hpOneView/image_streamer/resources/os_volumes.py | OsVolumes.get_storage | def get_storage(self, id_or_uri):
"""
Get storage details of an OS Volume.
Args:
id_or_uri: ID or URI of the OS Volume.
Returns:
dict: Storage details
"""
uri = self.URI + "/{}/storage".format(extract_id_from_uri(id_or_uri))
return self._client.get(uri) | python | def get_storage(self, id_or_uri):
"""
Get storage details of an OS Volume.
Args:
id_or_uri: ID or URI of the OS Volume.
Returns:
dict: Storage details
"""
uri = self.URI + "/{}/storage".format(extract_id_from_uri(id_or_uri))
return self._client.get(uri) | [
"def",
"get_storage",
"(",
"self",
",",
"id_or_uri",
")",
":",
"uri",
"=",
"self",
".",
"URI",
"+",
"\"/{}/storage\"",
".",
"format",
"(",
"extract_id_from_uri",
"(",
"id_or_uri",
")",
")",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"uri",
")"
] | Get storage details of an OS Volume.
Args:
id_or_uri: ID or URI of the OS Volume.
Returns:
dict: Storage details | [
"Get",
"storage",
"details",
"of",
"an",
"OS",
"Volume",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/resources/os_volumes.py#L124-L135 | train | 251,418 |
HewlettPackard/python-hpOneView | hpOneView/resources/facilities/racks.py | Racks.get_device_topology | def get_device_topology(self, id_or_uri):
"""
Retrieves the topology information for the rack resource specified by ID or URI.
Args:
id_or_uri: Can be either the resource ID or the resource URI.
Return:
dict: Device topology.
"""
uri = self._client.build_uri(id_or_uri) + "/deviceTopology"
return self._client.get(uri) | python | def get_device_topology(self, id_or_uri):
"""
Retrieves the topology information for the rack resource specified by ID or URI.
Args:
id_or_uri: Can be either the resource ID or the resource URI.
Return:
dict: Device topology.
"""
uri = self._client.build_uri(id_or_uri) + "/deviceTopology"
return self._client.get(uri) | [
"def",
"get_device_topology",
"(",
"self",
",",
"id_or_uri",
")",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"id_or_uri",
")",
"+",
"\"/deviceTopology\"",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"uri",
")"
] | Retrieves the topology information for the rack resource specified by ID or URI.
Args:
id_or_uri: Can be either the resource ID or the resource URI.
Return:
dict: Device topology. | [
"Retrieves",
"the",
"topology",
"information",
"for",
"the",
"rack",
"resource",
"specified",
"by",
"ID",
"or",
"URI",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/facilities/racks.py#L91-L102 | train | 251,419 |
HewlettPackard/python-hpOneView | hpOneView/resources/fc_sans/managed_sans.py | ManagedSANs.get_by_name | def get_by_name(self, name):
"""
Gets a Managed SAN by name.
Args:
name: Name of the Managed SAN
Returns:
dict: Managed SAN.
"""
managed_sans = self.get_all()
result = [x for x in managed_sans if x['name'] == name]
resource = result[0] if result else None
if resource:
resource = self.new(self._connection, resource)
return resource | python | def get_by_name(self, name):
"""
Gets a Managed SAN by name.
Args:
name: Name of the Managed SAN
Returns:
dict: Managed SAN.
"""
managed_sans = self.get_all()
result = [x for x in managed_sans if x['name'] == name]
resource = result[0] if result else None
if resource:
resource = self.new(self._connection, resource)
return resource | [
"def",
"get_by_name",
"(",
"self",
",",
"name",
")",
":",
"managed_sans",
"=",
"self",
".",
"get_all",
"(",
")",
"result",
"=",
"[",
"x",
"for",
"x",
"in",
"managed_sans",
"if",
"x",
"[",
"'name'",
"]",
"==",
"name",
"]",
"resource",
"=",
"result",
"[",
"0",
"]",
"if",
"result",
"else",
"None",
"if",
"resource",
":",
"resource",
"=",
"self",
".",
"new",
"(",
"self",
".",
"_connection",
",",
"resource",
")",
"return",
"resource"
] | Gets a Managed SAN by name.
Args:
name: Name of the Managed SAN
Returns:
dict: Managed SAN. | [
"Gets",
"a",
"Managed",
"SAN",
"by",
"name",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/fc_sans/managed_sans.py#L71-L88 | train | 251,420 |
HewlettPackard/python-hpOneView | hpOneView/resources/fc_sans/managed_sans.py | ManagedSANs.get_endpoints | def get_endpoints(self, start=0, count=-1, filter='', sort=''):
"""
Gets a list of endpoints in a SAN.
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.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter (list or str):
A general filter/query string to narrow the list of items returned. The
default is no filter; all resources are returned.
sort:
The sort order of the returned data set. By default, the sort order is based
on create time with the oldest entry first.
Returns:
list: A list of endpoints.
"""
uri = "{}/endpoints/".format(self.data["uri"])
return self._helper.get_all(start, count, filter=filter, sort=sort, uri=uri) | python | def get_endpoints(self, start=0, count=-1, filter='', sort=''):
"""
Gets a list of endpoints in a SAN.
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.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter (list or str):
A general filter/query string to narrow the list of items returned. The
default is no filter; all resources are returned.
sort:
The sort order of the returned data set. By default, the sort order is based
on create time with the oldest entry first.
Returns:
list: A list of endpoints.
"""
uri = "{}/endpoints/".format(self.data["uri"])
return self._helper.get_all(start, count, filter=filter, sort=sort, uri=uri) | [
"def",
"get_endpoints",
"(",
"self",
",",
"start",
"=",
"0",
",",
"count",
"=",
"-",
"1",
",",
"filter",
"=",
"''",
",",
"sort",
"=",
"''",
")",
":",
"uri",
"=",
"\"{}/endpoints/\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
")",
"return",
"self",
".",
"_helper",
".",
"get_all",
"(",
"start",
",",
"count",
",",
"filter",
"=",
"filter",
",",
"sort",
"=",
"sort",
",",
"uri",
"=",
"uri",
")"
] | Gets a list of endpoints in a SAN.
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.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter (list or str):
A general filter/query string to narrow the list of items returned. The
default is no filter; all resources are returned.
sort:
The sort order of the returned data set. By default, the sort order is based
on create time with the oldest entry first.
Returns:
list: A list of endpoints. | [
"Gets",
"a",
"list",
"of",
"endpoints",
"in",
"a",
"SAN",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/fc_sans/managed_sans.py#L99-L122 | train | 251,421 |
HewlettPackard/python-hpOneView | hpOneView/resources/fc_sans/managed_sans.py | ManagedSANs.create_endpoints_csv_file | def create_endpoints_csv_file(self, timeout=-1):
"""
Creates an endpoints CSV file for a SAN.
Args:
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
dict: Endpoint CSV File Response.
"""
uri = "{}/endpoints/".format(self.data["uri"])
return self._helper.do_post(uri, {}, timeout, None) | python | def create_endpoints_csv_file(self, timeout=-1):
"""
Creates an endpoints CSV file for a SAN.
Args:
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
dict: Endpoint CSV File Response.
"""
uri = "{}/endpoints/".format(self.data["uri"])
return self._helper.do_post(uri, {}, timeout, None) | [
"def",
"create_endpoints_csv_file",
"(",
"self",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"\"{}/endpoints/\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
")",
"return",
"self",
".",
"_helper",
".",
"do_post",
"(",
"uri",
",",
"{",
"}",
",",
"timeout",
",",
"None",
")"
] | Creates an endpoints CSV file for a SAN.
Args:
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
dict: Endpoint CSV File Response. | [
"Creates",
"an",
"endpoints",
"CSV",
"file",
"for",
"a",
"SAN",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/fc_sans/managed_sans.py#L125-L138 | train | 251,422 |
HewlettPackard/python-hpOneView | hpOneView/resources/fc_sans/managed_sans.py | ManagedSANs.create_issues_report | def create_issues_report(self, timeout=-1):
"""
Creates an unexpected zoning report for a SAN.
Args:
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
list: A list of FCIssueResponse dict.
"""
uri = "{}/issues/".format(self.data["uri"])
return self._helper.create_report(uri, timeout) | python | def create_issues_report(self, timeout=-1):
"""
Creates an unexpected zoning report for a SAN.
Args:
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
list: A list of FCIssueResponse dict.
"""
uri = "{}/issues/".format(self.data["uri"])
return self._helper.create_report(uri, timeout) | [
"def",
"create_issues_report",
"(",
"self",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"\"{}/issues/\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
")",
"return",
"self",
".",
"_helper",
".",
"create_report",
"(",
"uri",
",",
"timeout",
")"
] | Creates an unexpected zoning report for a SAN.
Args:
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
list: A list of FCIssueResponse dict. | [
"Creates",
"an",
"unexpected",
"zoning",
"report",
"for",
"a",
"SAN",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/fc_sans/managed_sans.py#L141-L154 | train | 251,423 |
HewlettPackard/python-hpOneView | hpOneView/resources/settings/appliance_device_snmp_v1_trap_destinations.py | ApplianceDeviceSNMPv1TrapDestinations.create | def create(self, resource, id=None, timeout=-1):
"""
Adds the specified trap forwarding destination.
The trap destination associated with the specified id will be created if trap destination with that id does not exists.
The id can only be an integer greater than 0.
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 resource.
"""
if not id:
available_id = self.__get_first_available_id()
uri = '%s/%s' % (self.URI, str(available_id))
else:
uri = '%s/%s' % (self.URI, str(id))
return self._client.create(resource, uri=uri, timeout=timeout) | python | def create(self, resource, id=None, timeout=-1):
"""
Adds the specified trap forwarding destination.
The trap destination associated with the specified id will be created if trap destination with that id does not exists.
The id can only be an integer greater than 0.
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 resource.
"""
if not id:
available_id = self.__get_first_available_id()
uri = '%s/%s' % (self.URI, str(available_id))
else:
uri = '%s/%s' % (self.URI, str(id))
return self._client.create(resource, uri=uri, timeout=timeout) | [
"def",
"create",
"(",
"self",
",",
"resource",
",",
"id",
"=",
"None",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"if",
"not",
"id",
":",
"available_id",
"=",
"self",
".",
"__get_first_available_id",
"(",
")",
"uri",
"=",
"'%s/%s'",
"%",
"(",
"self",
".",
"URI",
",",
"str",
"(",
"available_id",
")",
")",
"else",
":",
"uri",
"=",
"'%s/%s'",
"%",
"(",
"self",
".",
"URI",
",",
"str",
"(",
"id",
")",
")",
"return",
"self",
".",
"_client",
".",
"create",
"(",
"resource",
",",
"uri",
"=",
"uri",
",",
"timeout",
"=",
"timeout",
")"
] | Adds the specified trap forwarding destination.
The trap destination associated with the specified id will be created if trap destination with that id does not exists.
The id can only be an integer greater than 0.
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 resource. | [
"Adds",
"the",
"specified",
"trap",
"forwarding",
"destination",
".",
"The",
"trap",
"destination",
"associated",
"with",
"the",
"specified",
"id",
"will",
"be",
"created",
"if",
"trap",
"destination",
"with",
"that",
"id",
"does",
"not",
"exists",
".",
"The",
"id",
"can",
"only",
"be",
"an",
"integer",
"greater",
"than",
"0",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/settings/appliance_device_snmp_v1_trap_destinations.py#L46-L67 | train | 251,424 |
HewlettPackard/python-hpOneView | hpOneView/resources/settings/appliance_device_snmp_v1_trap_destinations.py | ApplianceDeviceSNMPv1TrapDestinations.__findFirstMissing | def __findFirstMissing(self, array, start, end):
"""
Find the smallest elements missing in a sorted array.
Returns:
int: The smallest element missing.
"""
if (start > end):
return end + 1
if (start != array[start]):
return start
mid = int((start + end) / 2)
if (array[mid] == mid):
return self.__findFirstMissing(array, mid + 1, end)
return self.__findFirstMissing(array, start, mid) | python | def __findFirstMissing(self, array, start, end):
"""
Find the smallest elements missing in a sorted array.
Returns:
int: The smallest element missing.
"""
if (start > end):
return end + 1
if (start != array[start]):
return start
mid = int((start + end) / 2)
if (array[mid] == mid):
return self.__findFirstMissing(array, mid + 1, end)
return self.__findFirstMissing(array, start, mid) | [
"def",
"__findFirstMissing",
"(",
"self",
",",
"array",
",",
"start",
",",
"end",
")",
":",
"if",
"(",
"start",
">",
"end",
")",
":",
"return",
"end",
"+",
"1",
"if",
"(",
"start",
"!=",
"array",
"[",
"start",
"]",
")",
":",
"return",
"start",
"mid",
"=",
"int",
"(",
"(",
"start",
"+",
"end",
")",
"/",
"2",
")",
"if",
"(",
"array",
"[",
"mid",
"]",
"==",
"mid",
")",
":",
"return",
"self",
".",
"__findFirstMissing",
"(",
"array",
",",
"mid",
"+",
"1",
",",
"end",
")",
"return",
"self",
".",
"__findFirstMissing",
"(",
"array",
",",
"start",
",",
"mid",
")"
] | Find the smallest elements missing in a sorted array.
Returns:
int: The smallest element missing. | [
"Find",
"the",
"smallest",
"elements",
"missing",
"in",
"a",
"sorted",
"array",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/settings/appliance_device_snmp_v1_trap_destinations.py#L69-L87 | train | 251,425 |
HewlettPackard/python-hpOneView | hpOneView/resources/settings/appliance_device_snmp_v1_trap_destinations.py | ApplianceDeviceSNMPv1TrapDestinations.__get_first_available_id | def __get_first_available_id(self):
"""
Private method to get the first available id.
The id can only be an integer greater than 0.
Returns:
int: The first available id
"""
traps = self.get_all()
if traps:
used_ids = [0]
for trap in traps:
used_uris = trap.get('uri')
used_ids.append(int(used_uris.split('/')[-1]))
used_ids.sort()
return self.__findFirstMissing(used_ids, 0, len(used_ids) - 1)
else:
return 1 | python | def __get_first_available_id(self):
"""
Private method to get the first available id.
The id can only be an integer greater than 0.
Returns:
int: The first available id
"""
traps = self.get_all()
if traps:
used_ids = [0]
for trap in traps:
used_uris = trap.get('uri')
used_ids.append(int(used_uris.split('/')[-1]))
used_ids.sort()
return self.__findFirstMissing(used_ids, 0, len(used_ids) - 1)
else:
return 1 | [
"def",
"__get_first_available_id",
"(",
"self",
")",
":",
"traps",
"=",
"self",
".",
"get_all",
"(",
")",
"if",
"traps",
":",
"used_ids",
"=",
"[",
"0",
"]",
"for",
"trap",
"in",
"traps",
":",
"used_uris",
"=",
"trap",
".",
"get",
"(",
"'uri'",
")",
"used_ids",
".",
"append",
"(",
"int",
"(",
"used_uris",
".",
"split",
"(",
"'/'",
")",
"[",
"-",
"1",
"]",
")",
")",
"used_ids",
".",
"sort",
"(",
")",
"return",
"self",
".",
"__findFirstMissing",
"(",
"used_ids",
",",
"0",
",",
"len",
"(",
"used_ids",
")",
"-",
"1",
")",
"else",
":",
"return",
"1"
] | Private method to get the first available id.
The id can only be an integer greater than 0.
Returns:
int: The first available id | [
"Private",
"method",
"to",
"get",
"the",
"first",
"available",
"id",
".",
"The",
"id",
"can",
"only",
"be",
"an",
"integer",
"greater",
"than",
"0",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/settings/appliance_device_snmp_v1_trap_destinations.py#L89-L106 | train | 251,426 |
HewlettPackard/python-hpOneView | hpOneView/resources/servers/id_pools_ipv4_ranges.py | IdPoolsIpv4Ranges.update | def update(self, information, timeout=-1):
"""
Edit an IPv4 Range.
Args:
information (dict): Information to update.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Updated IPv4 range.
"""
return self._client.update(information, timeout=timeout) | python | def update(self, information, timeout=-1):
"""
Edit an IPv4 Range.
Args:
information (dict): Information to update.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Updated IPv4 range.
"""
return self._client.update(information, timeout=timeout) | [
"def",
"update",
"(",
"self",
",",
"information",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"return",
"self",
".",
"_client",
".",
"update",
"(",
"information",
",",
"timeout",
"=",
"timeout",
")"
] | Edit an IPv4 Range.
Args:
information (dict): Information to update.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Updated IPv4 range. | [
"Edit",
"an",
"IPv4",
"Range",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/id_pools_ipv4_ranges.py#L92-L105 | train | 251,427 |
HewlettPackard/python-hpOneView | hpOneView/resources/task_monitor.py | TaskMonitor.wait_for_task | def wait_for_task(self, task, timeout=-1):
"""
Wait for task execution and return associated resource.
Args:
task: task dict
timeout: timeout in seconds
Returns:
Associated resource when creating or updating; True when deleting.
"""
self.__wait_task_completion(task, timeout)
task = self.get(task)
logger.debug("Waiting for task. Percentage complete: " + str(task.get('computedPercentComplete')))
logger.debug("Waiting for task. Task state: " + str(task.get('taskState')))
task_response = self.__get_task_response(task)
logger.debug('Task completed')
return task_response | python | def wait_for_task(self, task, timeout=-1):
"""
Wait for task execution and return associated resource.
Args:
task: task dict
timeout: timeout in seconds
Returns:
Associated resource when creating or updating; True when deleting.
"""
self.__wait_task_completion(task, timeout)
task = self.get(task)
logger.debug("Waiting for task. Percentage complete: " + str(task.get('computedPercentComplete')))
logger.debug("Waiting for task. Task state: " + str(task.get('taskState')))
task_response = self.__get_task_response(task)
logger.debug('Task completed')
return task_response | [
"def",
"wait_for_task",
"(",
"self",
",",
"task",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"self",
".",
"__wait_task_completion",
"(",
"task",
",",
"timeout",
")",
"task",
"=",
"self",
".",
"get",
"(",
"task",
")",
"logger",
".",
"debug",
"(",
"\"Waiting for task. Percentage complete: \"",
"+",
"str",
"(",
"task",
".",
"get",
"(",
"'computedPercentComplete'",
")",
")",
")",
"logger",
".",
"debug",
"(",
"\"Waiting for task. Task state: \"",
"+",
"str",
"(",
"task",
".",
"get",
"(",
"'taskState'",
")",
")",
")",
"task_response",
"=",
"self",
".",
"__get_task_response",
"(",
"task",
")",
"logger",
".",
"debug",
"(",
"'Task completed'",
")",
"return",
"task_response"
] | Wait for task execution and return associated resource.
Args:
task: task dict
timeout: timeout in seconds
Returns:
Associated resource when creating or updating; True when deleting. | [
"Wait",
"for",
"task",
"execution",
"and",
"return",
"associated",
"resource",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/task_monitor.py#L70-L90 | train | 251,428 |
HewlettPackard/python-hpOneView | hpOneView/resources/task_monitor.py | TaskMonitor.get_completed_task | def get_completed_task(self, task, timeout=-1):
"""
Waits until the task is completed and returns the task resource.
Args:
task: TaskResource
timeout: Timeout in seconds
Returns:
dict: TaskResource
"""
self.__wait_task_completion(task, timeout)
return self.get(task) | python | def get_completed_task(self, task, timeout=-1):
"""
Waits until the task is completed and returns the task resource.
Args:
task: TaskResource
timeout: Timeout in seconds
Returns:
dict: TaskResource
"""
self.__wait_task_completion(task, timeout)
return self.get(task) | [
"def",
"get_completed_task",
"(",
"self",
",",
"task",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"self",
".",
"__wait_task_completion",
"(",
"task",
",",
"timeout",
")",
"return",
"self",
".",
"get",
"(",
"task",
")"
] | Waits until the task is completed and returns the task resource.
Args:
task: TaskResource
timeout: Timeout in seconds
Returns:
dict: TaskResource | [
"Waits",
"until",
"the",
"task",
"is",
"completed",
"and",
"returns",
"the",
"task",
"resource",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/task_monitor.py#L92-L105 | train | 251,429 |
HewlettPackard/python-hpOneView | hpOneView/resources/task_monitor.py | TaskMonitor.get_associated_resource | def get_associated_resource(self, task):
"""
Retrieve a resource associated with a task.
Args:
task: task dict
Returns:
tuple: task (updated), the entity found (dict)
"""
if not task:
raise HPOneViewUnknownType(MSG_INVALID_TASK)
if task['category'] != 'tasks' and task['category'] != 'backups':
# it is an error if type is not in obj, so let the except flow
raise HPOneViewUnknownType(MSG_UNKNOWN_OBJECT_TYPE)
if task['type'] == 'TaskResourceV2':
resource_uri = task['associatedResource']['resourceUri']
if resource_uri and resource_uri.startswith("/rest/appliance/support-dumps/"):
# Specific for support dumps
return task, resource_uri
elif task['type'] == 'BACKUP':
task = self._connection.get(task['taskUri'])
resource_uri = task['uri']
else:
raise HPOneViewInvalidResource(MSG_TASK_TYPE_UNRECONIZED % task['type'])
entity = {}
if resource_uri:
entity = self._connection.get(resource_uri)
return task, entity | python | def get_associated_resource(self, task):
"""
Retrieve a resource associated with a task.
Args:
task: task dict
Returns:
tuple: task (updated), the entity found (dict)
"""
if not task:
raise HPOneViewUnknownType(MSG_INVALID_TASK)
if task['category'] != 'tasks' and task['category'] != 'backups':
# it is an error if type is not in obj, so let the except flow
raise HPOneViewUnknownType(MSG_UNKNOWN_OBJECT_TYPE)
if task['type'] == 'TaskResourceV2':
resource_uri = task['associatedResource']['resourceUri']
if resource_uri and resource_uri.startswith("/rest/appliance/support-dumps/"):
# Specific for support dumps
return task, resource_uri
elif task['type'] == 'BACKUP':
task = self._connection.get(task['taskUri'])
resource_uri = task['uri']
else:
raise HPOneViewInvalidResource(MSG_TASK_TYPE_UNRECONIZED % task['type'])
entity = {}
if resource_uri:
entity = self._connection.get(resource_uri)
return task, entity | [
"def",
"get_associated_resource",
"(",
"self",
",",
"task",
")",
":",
"if",
"not",
"task",
":",
"raise",
"HPOneViewUnknownType",
"(",
"MSG_INVALID_TASK",
")",
"if",
"task",
"[",
"'category'",
"]",
"!=",
"'tasks'",
"and",
"task",
"[",
"'category'",
"]",
"!=",
"'backups'",
":",
"# it is an error if type is not in obj, so let the except flow",
"raise",
"HPOneViewUnknownType",
"(",
"MSG_UNKNOWN_OBJECT_TYPE",
")",
"if",
"task",
"[",
"'type'",
"]",
"==",
"'TaskResourceV2'",
":",
"resource_uri",
"=",
"task",
"[",
"'associatedResource'",
"]",
"[",
"'resourceUri'",
"]",
"if",
"resource_uri",
"and",
"resource_uri",
".",
"startswith",
"(",
"\"/rest/appliance/support-dumps/\"",
")",
":",
"# Specific for support dumps",
"return",
"task",
",",
"resource_uri",
"elif",
"task",
"[",
"'type'",
"]",
"==",
"'BACKUP'",
":",
"task",
"=",
"self",
".",
"_connection",
".",
"get",
"(",
"task",
"[",
"'taskUri'",
"]",
")",
"resource_uri",
"=",
"task",
"[",
"'uri'",
"]",
"else",
":",
"raise",
"HPOneViewInvalidResource",
"(",
"MSG_TASK_TYPE_UNRECONIZED",
"%",
"task",
"[",
"'type'",
"]",
")",
"entity",
"=",
"{",
"}",
"if",
"resource_uri",
":",
"entity",
"=",
"self",
".",
"_connection",
".",
"get",
"(",
"resource_uri",
")",
"return",
"task",
",",
"entity"
] | Retrieve a resource associated with a task.
Args:
task: task dict
Returns:
tuple: task (updated), the entity found (dict) | [
"Retrieve",
"a",
"resource",
"associated",
"with",
"a",
"task",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/task_monitor.py#L225-L261 | train | 251,430 |
HewlettPackard/python-hpOneView | hpOneView/resources/settings/backups.py | Backups.update_config | def update_config(self, config, timeout=-1):
"""
Updates the remote server configuration and the automatic backup schedule for backup.
Args:
config (dict): Object to update.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView, just stop waiting for its completion.
Returns:
dict: Backup details.
"""
return self._client.update(config, uri=self.URI + "/config", timeout=timeout) | python | def update_config(self, config, timeout=-1):
"""
Updates the remote server configuration and the automatic backup schedule for backup.
Args:
config (dict): Object to update.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView, just stop waiting for its completion.
Returns:
dict: Backup details.
"""
return self._client.update(config, uri=self.URI + "/config", timeout=timeout) | [
"def",
"update_config",
"(",
"self",
",",
"config",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"return",
"self",
".",
"_client",
".",
"update",
"(",
"config",
",",
"uri",
"=",
"self",
".",
"URI",
"+",
"\"/config\"",
",",
"timeout",
"=",
"timeout",
")"
] | Updates the remote server configuration and the automatic backup schedule for backup.
Args:
config (dict): Object to update.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView, just stop waiting for its completion.
Returns:
dict: Backup details. | [
"Updates",
"the",
"remote",
"server",
"configuration",
"and",
"the",
"automatic",
"backup",
"schedule",
"for",
"backup",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/settings/backups.py#L125-L139 | train | 251,431 |
HewlettPackard/python-hpOneView | hpOneView/resources/settings/backups.py | Backups.update_remote_archive | def update_remote_archive(self, save_uri, timeout=-1):
"""
Saves a backup of the appliance to a previously-configured remote location.
Args:
save_uri (dict): The URI for saving the backup to a previously configured location.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView, just stop waiting for its completion.
Returns:
dict: Backup details.
"""
return self._client.update_with_zero_body(uri=save_uri, timeout=timeout) | python | def update_remote_archive(self, save_uri, timeout=-1):
"""
Saves a backup of the appliance to a previously-configured remote location.
Args:
save_uri (dict): The URI for saving the backup to a previously configured location.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView, just stop waiting for its completion.
Returns:
dict: Backup details.
"""
return self._client.update_with_zero_body(uri=save_uri, timeout=timeout) | [
"def",
"update_remote_archive",
"(",
"self",
",",
"save_uri",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"return",
"self",
".",
"_client",
".",
"update_with_zero_body",
"(",
"uri",
"=",
"save_uri",
",",
"timeout",
"=",
"timeout",
")"
] | Saves a backup of the appliance to a previously-configured remote location.
Args:
save_uri (dict): The URI for saving the backup to a previously configured location.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView, just stop waiting for its completion.
Returns:
dict: Backup details. | [
"Saves",
"a",
"backup",
"of",
"the",
"appliance",
"to",
"a",
"previously",
"-",
"configured",
"remote",
"location",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/settings/backups.py#L141-L155 | train | 251,432 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/uplink_sets.py | UplinkSets.get_ethernet_networks | def get_ethernet_networks(self):
"""
Gets a list of associated ethernet networks of an uplink set.
Args:
id_or_uri: Can be either the uplink set id or the uplink set uri.
Returns:
list: Associated ethernet networks.
"""
network_uris = self.data.get('networkUris')
networks = []
if network_uris:
for uri in network_uris:
networks.append(self._ethernet_networks.get_by_uri(uri))
return networks | python | def get_ethernet_networks(self):
"""
Gets a list of associated ethernet networks of an uplink set.
Args:
id_or_uri: Can be either the uplink set id or the uplink set uri.
Returns:
list: Associated ethernet networks.
"""
network_uris = self.data.get('networkUris')
networks = []
if network_uris:
for uri in network_uris:
networks.append(self._ethernet_networks.get_by_uri(uri))
return networks | [
"def",
"get_ethernet_networks",
"(",
"self",
")",
":",
"network_uris",
"=",
"self",
".",
"data",
".",
"get",
"(",
"'networkUris'",
")",
"networks",
"=",
"[",
"]",
"if",
"network_uris",
":",
"for",
"uri",
"in",
"network_uris",
":",
"networks",
".",
"append",
"(",
"self",
".",
"_ethernet_networks",
".",
"get_by_uri",
"(",
"uri",
")",
")",
"return",
"networks"
] | Gets a list of associated ethernet networks of an uplink set.
Args:
id_or_uri: Can be either the uplink set id or the uplink set uri.
Returns:
list: Associated ethernet networks. | [
"Gets",
"a",
"list",
"of",
"associated",
"ethernet",
"networks",
"of",
"an",
"uplink",
"set",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/uplink_sets.py#L60-L75 | train | 251,433 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/uplink_sets.py | UplinkSets.__set_ethernet_uris | def __set_ethernet_uris(self, ethernet_names, operation="add"):
"""Updates network uris."""
if not isinstance(ethernet_names, list):
ethernet_names = [ethernet_names]
associated_enets = self.data.get('networkUris', [])
ethernet_uris = []
for i, enet in enumerate(ethernet_names):
enet_exists = self._ethernet_networks.get_by_name(enet)
if enet_exists:
ethernet_uris.append(enet_exists.data['uri'])
else:
raise HPOneViewResourceNotFound("Ethernet: {} does not exist".foramt(enet))
if operation == "remove":
enets_to_update = sorted(list(set(associated_enets) - set(ethernet_uris)))
elif operation == "add":
enets_to_update = sorted(list(set(associated_enets).union(set(ethernet_uris))))
else:
raise ValueError("Value {} is not supported as operation. The supported values are: ['add', 'remove']")
if set(enets_to_update) != set(associated_enets):
updated_network = {'networkUris': enets_to_update}
self.update(updated_network) | python | def __set_ethernet_uris(self, ethernet_names, operation="add"):
"""Updates network uris."""
if not isinstance(ethernet_names, list):
ethernet_names = [ethernet_names]
associated_enets = self.data.get('networkUris', [])
ethernet_uris = []
for i, enet in enumerate(ethernet_names):
enet_exists = self._ethernet_networks.get_by_name(enet)
if enet_exists:
ethernet_uris.append(enet_exists.data['uri'])
else:
raise HPOneViewResourceNotFound("Ethernet: {} does not exist".foramt(enet))
if operation == "remove":
enets_to_update = sorted(list(set(associated_enets) - set(ethernet_uris)))
elif operation == "add":
enets_to_update = sorted(list(set(associated_enets).union(set(ethernet_uris))))
else:
raise ValueError("Value {} is not supported as operation. The supported values are: ['add', 'remove']")
if set(enets_to_update) != set(associated_enets):
updated_network = {'networkUris': enets_to_update}
self.update(updated_network) | [
"def",
"__set_ethernet_uris",
"(",
"self",
",",
"ethernet_names",
",",
"operation",
"=",
"\"add\"",
")",
":",
"if",
"not",
"isinstance",
"(",
"ethernet_names",
",",
"list",
")",
":",
"ethernet_names",
"=",
"[",
"ethernet_names",
"]",
"associated_enets",
"=",
"self",
".",
"data",
".",
"get",
"(",
"'networkUris'",
",",
"[",
"]",
")",
"ethernet_uris",
"=",
"[",
"]",
"for",
"i",
",",
"enet",
"in",
"enumerate",
"(",
"ethernet_names",
")",
":",
"enet_exists",
"=",
"self",
".",
"_ethernet_networks",
".",
"get_by_name",
"(",
"enet",
")",
"if",
"enet_exists",
":",
"ethernet_uris",
".",
"append",
"(",
"enet_exists",
".",
"data",
"[",
"'uri'",
"]",
")",
"else",
":",
"raise",
"HPOneViewResourceNotFound",
"(",
"\"Ethernet: {} does not exist\"",
".",
"foramt",
"(",
"enet",
")",
")",
"if",
"operation",
"==",
"\"remove\"",
":",
"enets_to_update",
"=",
"sorted",
"(",
"list",
"(",
"set",
"(",
"associated_enets",
")",
"-",
"set",
"(",
"ethernet_uris",
")",
")",
")",
"elif",
"operation",
"==",
"\"add\"",
":",
"enets_to_update",
"=",
"sorted",
"(",
"list",
"(",
"set",
"(",
"associated_enets",
")",
".",
"union",
"(",
"set",
"(",
"ethernet_uris",
")",
")",
")",
")",
"else",
":",
"raise",
"ValueError",
"(",
"\"Value {} is not supported as operation. The supported values are: ['add', 'remove']\"",
")",
"if",
"set",
"(",
"enets_to_update",
")",
"!=",
"set",
"(",
"associated_enets",
")",
":",
"updated_network",
"=",
"{",
"'networkUris'",
":",
"enets_to_update",
"}",
"self",
".",
"update",
"(",
"updated_network",
")"
] | Updates network uris. | [
"Updates",
"network",
"uris",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/uplink_sets.py#L110-L134 | train | 251,434 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/logical_interconnect_groups.py | LogicalInterconnectGroups.get_settings | def get_settings(self):
"""
Gets the interconnect settings for a logical interconnect group.
Returns:
dict: Interconnect Settings.
"""
uri = "{}/settings".format(self.data["uri"])
return self._helper.do_get(uri) | python | def get_settings(self):
"""
Gets the interconnect settings for a logical interconnect group.
Returns:
dict: Interconnect Settings.
"""
uri = "{}/settings".format(self.data["uri"])
return self._helper.do_get(uri) | [
"def",
"get_settings",
"(",
"self",
")",
":",
"uri",
"=",
"\"{}/settings\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
")",
"return",
"self",
".",
"_helper",
".",
"do_get",
"(",
"uri",
")"
] | Gets the interconnect settings for a logical interconnect group.
Returns:
dict: Interconnect Settings. | [
"Gets",
"the",
"interconnect",
"settings",
"for",
"a",
"logical",
"interconnect",
"group",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnect_groups.py#L93-L101 | train | 251,435 |
HewlettPackard/python-hpOneView | hpOneView/resources/settings/firmware_bundles.py | FirmwareBundles.upload | def upload(self, file_path, timeout=-1):
"""
Upload an SPP ISO image file or a hotfix file to the appliance.
The API supports upload of one hotfix at a time into the system.
For the successful upload of a hotfix, ensure its original name and extension are not altered.
Args:
file_path: Full path to firmware.
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: Information about the updated firmware bundle.
"""
return self._client.upload(file_path, timeout=timeout) | python | def upload(self, file_path, timeout=-1):
"""
Upload an SPP ISO image file or a hotfix file to the appliance.
The API supports upload of one hotfix at a time into the system.
For the successful upload of a hotfix, ensure its original name and extension are not altered.
Args:
file_path: Full path to firmware.
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: Information about the updated firmware bundle.
"""
return self._client.upload(file_path, timeout=timeout) | [
"def",
"upload",
"(",
"self",
",",
"file_path",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"return",
"self",
".",
"_client",
".",
"upload",
"(",
"file_path",
",",
"timeout",
"=",
"timeout",
")"
] | Upload an SPP ISO image file or a hotfix file to the appliance.
The API supports upload of one hotfix at a time into the system.
For the successful upload of a hotfix, ensure its original name and extension are not altered.
Args:
file_path: Full path to firmware.
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: Information about the updated firmware bundle. | [
"Upload",
"an",
"SPP",
"ISO",
"image",
"file",
"or",
"a",
"hotfix",
"file",
"to",
"the",
"appliance",
".",
"The",
"API",
"supports",
"upload",
"of",
"one",
"hotfix",
"at",
"a",
"time",
"into",
"the",
"system",
".",
"For",
"the",
"successful",
"upload",
"of",
"a",
"hotfix",
"ensure",
"its",
"original",
"name",
"and",
"extension",
"are",
"not",
"altered",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/settings/firmware_bundles.py#L48-L62 | train | 251,436 |
HewlettPackard/python-hpOneView | hpOneView/resources/search/index_resources.py | IndexResources.get | def get(self, uri):
"""
Gets an index resource by URI.
Args:
uri: The resource URI.
Returns:
dict: The index resource.
"""
uri = self.URI + uri
return self._client.get(uri) | python | def get(self, uri):
"""
Gets an index resource by URI.
Args:
uri: The resource URI.
Returns:
dict: The index resource.
"""
uri = self.URI + uri
return self._client.get(uri) | [
"def",
"get",
"(",
"self",
",",
"uri",
")",
":",
"uri",
"=",
"self",
".",
"URI",
"+",
"uri",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"uri",
")"
] | Gets an index resource by URI.
Args:
uri: The resource URI.
Returns:
dict: The index resource. | [
"Gets",
"an",
"index",
"resource",
"by",
"URI",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/search/index_resources.py#L104-L115 | train | 251,437 |
HewlettPackard/python-hpOneView | hpOneView/resources/storage/storage_pools.py | StoragePools.get_reachable_storage_pools | def get_reachable_storage_pools(self, start=0, count=-1, filter='', query='', sort='',
networks=None, scope_exclusions=None, scope_uris=''):
"""
Gets the storage pools that are connected on the specified networks
based on the storage system port's expected network connectivity.
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.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter: 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.
query: A general query string to narrow the list of resources returned.
The default is no query - all resources are returned.
networks: Specifies the comma-separated list of network URIs used by the
reachable storage pools.
scope_exclusions: Specifies the comma-separated list of storage-pools URIs
that will be excluded from the scope validation checks.
scope_uris: Specifies the comma-separated list of scope URIs used by the
reachable storage pools.
Returns:
list: Reachable Storage Pools List.
"""
uri = self.URI + "/reachable-storage-pools"
if networks:
elements = "\'"
for n in networks:
elements += n + ','
elements = elements[:-1] + "\'"
uri = uri + "?networks=" + elements
if scope_exclusions:
storage_pools_uris = ",".join(scope_exclusions)
uri = uri + "?" if "?" not in uri else uri + "&"
uri += "scopeExclusions={}".format(storage_pools_uris)
return self._client.get(self._client.build_query_uri(start=start, count=count, filter=filter, query=query,
sort=sort, uri=uri, scope_uris=scope_uris)) | python | def get_reachable_storage_pools(self, start=0, count=-1, filter='', query='', sort='',
networks=None, scope_exclusions=None, scope_uris=''):
"""
Gets the storage pools that are connected on the specified networks
based on the storage system port's expected network connectivity.
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.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter: 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.
query: A general query string to narrow the list of resources returned.
The default is no query - all resources are returned.
networks: Specifies the comma-separated list of network URIs used by the
reachable storage pools.
scope_exclusions: Specifies the comma-separated list of storage-pools URIs
that will be excluded from the scope validation checks.
scope_uris: Specifies the comma-separated list of scope URIs used by the
reachable storage pools.
Returns:
list: Reachable Storage Pools List.
"""
uri = self.URI + "/reachable-storage-pools"
if networks:
elements = "\'"
for n in networks:
elements += n + ','
elements = elements[:-1] + "\'"
uri = uri + "?networks=" + elements
if scope_exclusions:
storage_pools_uris = ",".join(scope_exclusions)
uri = uri + "?" if "?" not in uri else uri + "&"
uri += "scopeExclusions={}".format(storage_pools_uris)
return self._client.get(self._client.build_query_uri(start=start, count=count, filter=filter, query=query,
sort=sort, uri=uri, scope_uris=scope_uris)) | [
"def",
"get_reachable_storage_pools",
"(",
"self",
",",
"start",
"=",
"0",
",",
"count",
"=",
"-",
"1",
",",
"filter",
"=",
"''",
",",
"query",
"=",
"''",
",",
"sort",
"=",
"''",
",",
"networks",
"=",
"None",
",",
"scope_exclusions",
"=",
"None",
",",
"scope_uris",
"=",
"''",
")",
":",
"uri",
"=",
"self",
".",
"URI",
"+",
"\"/reachable-storage-pools\"",
"if",
"networks",
":",
"elements",
"=",
"\"\\'\"",
"for",
"n",
"in",
"networks",
":",
"elements",
"+=",
"n",
"+",
"','",
"elements",
"=",
"elements",
"[",
":",
"-",
"1",
"]",
"+",
"\"\\'\"",
"uri",
"=",
"uri",
"+",
"\"?networks=\"",
"+",
"elements",
"if",
"scope_exclusions",
":",
"storage_pools_uris",
"=",
"\",\"",
".",
"join",
"(",
"scope_exclusions",
")",
"uri",
"=",
"uri",
"+",
"\"?\"",
"if",
"\"?\"",
"not",
"in",
"uri",
"else",
"uri",
"+",
"\"&\"",
"uri",
"+=",
"\"scopeExclusions={}\"",
".",
"format",
"(",
"storage_pools_uris",
")",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"self",
".",
"_client",
".",
"build_query_uri",
"(",
"start",
"=",
"start",
",",
"count",
"=",
"count",
",",
"filter",
"=",
"filter",
",",
"query",
"=",
"query",
",",
"sort",
"=",
"sort",
",",
"uri",
"=",
"uri",
",",
"scope_uris",
"=",
"scope_uris",
")",
")"
] | Gets the storage pools that are connected on the specified networks
based on the storage system port's expected network connectivity.
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.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter: 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.
query: A general query string to narrow the list of resources returned.
The default is no query - all resources are returned.
networks: Specifies the comma-separated list of network URIs used by the
reachable storage pools.
scope_exclusions: Specifies the comma-separated list of storage-pools URIs
that will be excluded from the scope validation checks.
scope_uris: Specifies the comma-separated list of scope URIs used by the
reachable storage pools.
Returns:
list: Reachable Storage Pools List. | [
"Gets",
"the",
"storage",
"pools",
"that",
"are",
"connected",
"on",
"the",
"specified",
"networks",
"based",
"on",
"the",
"storage",
"system",
"port",
"s",
"expected",
"network",
"connectivity",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/storage_pools.py#L138-L181 | train | 251,438 |
HewlettPackard/python-hpOneView | hpOneView/resources/security/certificate_rabbitmq.py | CertificateRabbitMQ.generate | def generate(self, information, timeout=-1):
"""
Generates a self signed certificate or an internal CA signed certificate for RabbitMQ clients.
Args:
information (dict): Information to generate the certificate for RabbitMQ clients.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: RabbitMQ certificate generated
"""
return self._client.create(information, timeout=timeout) | python | def generate(self, information, timeout=-1):
"""
Generates a self signed certificate or an internal CA signed certificate for RabbitMQ clients.
Args:
information (dict): Information to generate the certificate for RabbitMQ clients.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: RabbitMQ certificate generated
"""
return self._client.create(information, timeout=timeout) | [
"def",
"generate",
"(",
"self",
",",
"information",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"return",
"self",
".",
"_client",
".",
"create",
"(",
"information",
",",
"timeout",
"=",
"timeout",
")"
] | Generates a self signed certificate or an internal CA signed certificate for RabbitMQ clients.
Args:
information (dict): Information to generate the certificate for RabbitMQ clients.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: RabbitMQ certificate generated | [
"Generates",
"a",
"self",
"signed",
"certificate",
"or",
"an",
"internal",
"CA",
"signed",
"certificate",
"for",
"RabbitMQ",
"clients",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/security/certificate_rabbitmq.py#L44-L57 | train | 251,439 |
HewlettPackard/python-hpOneView | hpOneView/resources/security/certificate_rabbitmq.py | CertificateRabbitMQ.get_key_pair | def get_key_pair(self, alias_name):
"""
Retrieves the public and private key pair associated with the specified alias name.
Args:
alias_name: Key pair associated with the RabbitMQ
Returns:
dict: RabbitMQ certificate
"""
uri = self.URI + "/keypair/" + alias_name
return self._client.get(uri) | python | def get_key_pair(self, alias_name):
"""
Retrieves the public and private key pair associated with the specified alias name.
Args:
alias_name: Key pair associated with the RabbitMQ
Returns:
dict: RabbitMQ certificate
"""
uri = self.URI + "/keypair/" + alias_name
return self._client.get(uri) | [
"def",
"get_key_pair",
"(",
"self",
",",
"alias_name",
")",
":",
"uri",
"=",
"self",
".",
"URI",
"+",
"\"/keypair/\"",
"+",
"alias_name",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"uri",
")"
] | Retrieves the public and private key pair associated with the specified alias name.
Args:
alias_name: Key pair associated with the RabbitMQ
Returns:
dict: RabbitMQ certificate | [
"Retrieves",
"the",
"public",
"and",
"private",
"key",
"pair",
"associated",
"with",
"the",
"specified",
"alias",
"name",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/security/certificate_rabbitmq.py#L71-L82 | train | 251,440 |
HewlettPackard/python-hpOneView | hpOneView/resources/security/certificate_rabbitmq.py | CertificateRabbitMQ.get_keys | def get_keys(self, alias_name, key_format):
"""
Retrieves the contents of PKCS12 file in the format specified.
This PKCS12 formatted file contains both the certificate as well as the key file data.
Valid key formats are Base64 and PKCS12.
Args:
alias_name: Key pair associated with the RabbitMQ
key_format: Valid key formats are Base64 and PKCS12.
Returns:
dict: RabbitMQ certificate
"""
uri = self.URI + "/keys/" + alias_name + "?format=" + key_format
return self._client.get(uri) | python | def get_keys(self, alias_name, key_format):
"""
Retrieves the contents of PKCS12 file in the format specified.
This PKCS12 formatted file contains both the certificate as well as the key file data.
Valid key formats are Base64 and PKCS12.
Args:
alias_name: Key pair associated with the RabbitMQ
key_format: Valid key formats are Base64 and PKCS12.
Returns:
dict: RabbitMQ certificate
"""
uri = self.URI + "/keys/" + alias_name + "?format=" + key_format
return self._client.get(uri) | [
"def",
"get_keys",
"(",
"self",
",",
"alias_name",
",",
"key_format",
")",
":",
"uri",
"=",
"self",
".",
"URI",
"+",
"\"/keys/\"",
"+",
"alias_name",
"+",
"\"?format=\"",
"+",
"key_format",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"uri",
")"
] | Retrieves the contents of PKCS12 file in the format specified.
This PKCS12 formatted file contains both the certificate as well as the key file data.
Valid key formats are Base64 and PKCS12.
Args:
alias_name: Key pair associated with the RabbitMQ
key_format: Valid key formats are Base64 and PKCS12.
Returns:
dict: RabbitMQ certificate | [
"Retrieves",
"the",
"contents",
"of",
"PKCS12",
"file",
"in",
"the",
"format",
"specified",
".",
"This",
"PKCS12",
"formatted",
"file",
"contains",
"both",
"the",
"certificate",
"as",
"well",
"as",
"the",
"key",
"file",
"data",
".",
"Valid",
"key",
"formats",
"are",
"Base64",
"and",
"PKCS12",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/security/certificate_rabbitmq.py#L84-L97 | train | 251,441 |
HewlettPackard/python-hpOneView | hpOneView/resources/servers/id_pools.py | IdPools.validate_id_pool | def validate_id_pool(self, id_or_uri, ids_pools):
"""
Validates an ID pool.
Args:
id_or_uri:
ID or URI of range.
ids_pools (list):
List of Id Pools.
Returns:
dict: A dict containing a list with IDs.
"""
uri = self._client.build_uri(id_or_uri) + "/validate?idList=" + "&idList=".join(ids_pools)
return self._client.get(uri) | python | def validate_id_pool(self, id_or_uri, ids_pools):
"""
Validates an ID pool.
Args:
id_or_uri:
ID or URI of range.
ids_pools (list):
List of Id Pools.
Returns:
dict: A dict containing a list with IDs.
"""
uri = self._client.build_uri(id_or_uri) + "/validate?idList=" + "&idList=".join(ids_pools)
return self._client.get(uri) | [
"def",
"validate_id_pool",
"(",
"self",
",",
"id_or_uri",
",",
"ids_pools",
")",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"id_or_uri",
")",
"+",
"\"/validate?idList=\"",
"+",
"\"&idList=\"",
".",
"join",
"(",
"ids_pools",
")",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"uri",
")"
] | Validates an ID pool.
Args:
id_or_uri:
ID or URI of range.
ids_pools (list):
List of Id Pools.
Returns:
dict: A dict containing a list with IDs. | [
"Validates",
"an",
"ID",
"pool",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/id_pools.py#L73-L87 | train | 251,442 |
HewlettPackard/python-hpOneView | hpOneView/resources/servers/id_pools.py | IdPools.generate | def generate(self, id_or_uri):
"""
Generates and returns a random range.
Args:
id_or_uri:
ID or URI of range.
Returns:
dict: A dict containing a list with IDs.
"""
uri = self._client.build_uri(id_or_uri) + "/generate"
return self._client.get(uri) | python | def generate(self, id_or_uri):
"""
Generates and returns a random range.
Args:
id_or_uri:
ID or URI of range.
Returns:
dict: A dict containing a list with IDs.
"""
uri = self._client.build_uri(id_or_uri) + "/generate"
return self._client.get(uri) | [
"def",
"generate",
"(",
"self",
",",
"id_or_uri",
")",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"id_or_uri",
")",
"+",
"\"/generate\"",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"uri",
")"
] | Generates and returns a random range.
Args:
id_or_uri:
ID or URI of range.
Returns:
dict: A dict containing a list with IDs. | [
"Generates",
"and",
"returns",
"a",
"random",
"range",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/id_pools.py#L169-L181 | train | 251,443 |
HewlettPackard/python-hpOneView | hpOneView/resources/storage/storage_volume_templates.py | StorageVolumeTemplates.get_connectable_volume_templates | def get_connectable_volume_templates(self, start=0, count=-1, filter='', query='', sort=''):
"""
Gets the storage volume templates that are available on the specified networks based on the storage system
port's expected network connectivity. If there are no storage volume templates that meet the specified
connectivity criteria, an empty collection will be returned.
Returns:
list: Storage volume templates.
"""
uri = self.URI + "/connectable-volume-templates"
get_uri = self._client.build_query_uri(start=start, count=count, filter=filter,
query=query, sort=sort, uri=uri)
return self._client.get(get_uri) | python | def get_connectable_volume_templates(self, start=0, count=-1, filter='', query='', sort=''):
"""
Gets the storage volume templates that are available on the specified networks based on the storage system
port's expected network connectivity. If there are no storage volume templates that meet the specified
connectivity criteria, an empty collection will be returned.
Returns:
list: Storage volume templates.
"""
uri = self.URI + "/connectable-volume-templates"
get_uri = self._client.build_query_uri(start=start, count=count, filter=filter,
query=query, sort=sort, uri=uri)
return self._client.get(get_uri) | [
"def",
"get_connectable_volume_templates",
"(",
"self",
",",
"start",
"=",
"0",
",",
"count",
"=",
"-",
"1",
",",
"filter",
"=",
"''",
",",
"query",
"=",
"''",
",",
"sort",
"=",
"''",
")",
":",
"uri",
"=",
"self",
".",
"URI",
"+",
"\"/connectable-volume-templates\"",
"get_uri",
"=",
"self",
".",
"_client",
".",
"build_query_uri",
"(",
"start",
"=",
"start",
",",
"count",
"=",
"count",
",",
"filter",
"=",
"filter",
",",
"query",
"=",
"query",
",",
"sort",
"=",
"sort",
",",
"uri",
"=",
"uri",
")",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"get_uri",
")"
] | Gets the storage volume templates that are available on the specified networks based on the storage system
port's expected network connectivity. If there are no storage volume templates that meet the specified
connectivity criteria, an empty collection will be returned.
Returns:
list: Storage volume templates. | [
"Gets",
"the",
"storage",
"volume",
"templates",
"that",
"are",
"available",
"on",
"the",
"specified",
"networks",
"based",
"on",
"the",
"storage",
"system",
"port",
"s",
"expected",
"network",
"connectivity",
".",
"If",
"there",
"are",
"no",
"storage",
"volume",
"templates",
"that",
"meet",
"the",
"specified",
"connectivity",
"criteria",
"an",
"empty",
"collection",
"will",
"be",
"returned",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/storage_volume_templates.py#L107-L120 | train | 251,444 |
HewlettPackard/python-hpOneView | hpOneView/resources/storage/storage_volume_templates.py | StorageVolumeTemplates.get_reachable_volume_templates | def get_reachable_volume_templates(self, start=0, count=-1, filter='', query='', sort='',
networks=None, scope_uris='', private_allowed_only=False):
"""
Gets the storage templates that are connected on the specified networks based on the storage system
port's expected network connectivity.
Returns:
list: Storage volume templates.
"""
uri = self.URI + "/reachable-volume-templates"
uri += "?networks={}&privateAllowedOnly={}".format(networks, private_allowed_only)
get_uri = self._client.build_query_uri(start=start, count=count, filter=filter,
query=query, sort=sort, uri=uri, scope_uris=scope_uris)
return self._client.get(get_uri) | python | def get_reachable_volume_templates(self, start=0, count=-1, filter='', query='', sort='',
networks=None, scope_uris='', private_allowed_only=False):
"""
Gets the storage templates that are connected on the specified networks based on the storage system
port's expected network connectivity.
Returns:
list: Storage volume templates.
"""
uri = self.URI + "/reachable-volume-templates"
uri += "?networks={}&privateAllowedOnly={}".format(networks, private_allowed_only)
get_uri = self._client.build_query_uri(start=start, count=count, filter=filter,
query=query, sort=sort, uri=uri, scope_uris=scope_uris)
return self._client.get(get_uri) | [
"def",
"get_reachable_volume_templates",
"(",
"self",
",",
"start",
"=",
"0",
",",
"count",
"=",
"-",
"1",
",",
"filter",
"=",
"''",
",",
"query",
"=",
"''",
",",
"sort",
"=",
"''",
",",
"networks",
"=",
"None",
",",
"scope_uris",
"=",
"''",
",",
"private_allowed_only",
"=",
"False",
")",
":",
"uri",
"=",
"self",
".",
"URI",
"+",
"\"/reachable-volume-templates\"",
"uri",
"+=",
"\"?networks={}&privateAllowedOnly={}\"",
".",
"format",
"(",
"networks",
",",
"private_allowed_only",
")",
"get_uri",
"=",
"self",
".",
"_client",
".",
"build_query_uri",
"(",
"start",
"=",
"start",
",",
"count",
"=",
"count",
",",
"filter",
"=",
"filter",
",",
"query",
"=",
"query",
",",
"sort",
"=",
"sort",
",",
"uri",
"=",
"uri",
",",
"scope_uris",
"=",
"scope_uris",
")",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"get_uri",
")"
] | Gets the storage templates that are connected on the specified networks based on the storage system
port's expected network connectivity.
Returns:
list: Storage volume templates. | [
"Gets",
"the",
"storage",
"templates",
"that",
"are",
"connected",
"on",
"the",
"specified",
"networks",
"based",
"on",
"the",
"storage",
"system",
"port",
"s",
"expected",
"network",
"connectivity",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/storage_volume_templates.py#L122-L137 | train | 251,445 |
HewlettPackard/python-hpOneView | hpOneView/resources/storage/storage_volume_templates.py | StorageVolumeTemplates.get_compatible_systems | def get_compatible_systems(self, id_or_uri):
"""
Retrieves a collection of all storage systems that is applicable to this storage volume template.
Args:
id_or_uri:
Can be either the power device id or the uri
Returns:
list: Storage systems.
"""
uri = self._client.build_uri(id_or_uri) + "/compatible-systems"
return self._client.get(uri) | python | def get_compatible_systems(self, id_or_uri):
"""
Retrieves a collection of all storage systems that is applicable to this storage volume template.
Args:
id_or_uri:
Can be either the power device id or the uri
Returns:
list: Storage systems.
"""
uri = self._client.build_uri(id_or_uri) + "/compatible-systems"
return self._client.get(uri) | [
"def",
"get_compatible_systems",
"(",
"self",
",",
"id_or_uri",
")",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"id_or_uri",
")",
"+",
"\"/compatible-systems\"",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"uri",
")"
] | Retrieves a collection of all storage systems that is applicable to this storage volume template.
Args:
id_or_uri:
Can be either the power device id or the uri
Returns:
list: Storage systems. | [
"Retrieves",
"a",
"collection",
"of",
"all",
"storage",
"systems",
"that",
"is",
"applicable",
"to",
"this",
"storage",
"volume",
"template",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/storage_volume_templates.py#L139-L151 | train | 251,446 |
HewlettPackard/python-hpOneView | hpOneView/resources/storage/volumes.py | Volumes.add_from_existing | def add_from_existing(self, resource, timeout=-1):
"""
Adds a volume that already exists in the Storage system
Args:
resource (dict):
Object to create.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView, just stop waiting for its completion.
Returns:
dict: Added resource.
"""
uri = self.URI + "/from-existing"
return self._client.create(resource, uri=uri, timeout=timeout) | python | def add_from_existing(self, resource, timeout=-1):
"""
Adds a volume that already exists in the Storage system
Args:
resource (dict):
Object to create.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView, just stop waiting for its completion.
Returns:
dict: Added resource.
"""
uri = self.URI + "/from-existing"
return self._client.create(resource, uri=uri, timeout=timeout) | [
"def",
"add_from_existing",
"(",
"self",
",",
"resource",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"self",
".",
"URI",
"+",
"\"/from-existing\"",
"return",
"self",
".",
"_client",
".",
"create",
"(",
"resource",
",",
"uri",
"=",
"uri",
",",
"timeout",
"=",
"timeout",
")"
] | Adds a volume that already exists in the Storage system
Args:
resource (dict):
Object to create.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView, just stop waiting for its completion.
Returns:
dict: Added resource. | [
"Adds",
"a",
"volume",
"that",
"already",
"exists",
"in",
"the",
"Storage",
"system"
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/volumes.py#L136-L151 | train | 251,447 |
HewlettPackard/python-hpOneView | hpOneView/resources/storage/volumes.py | Volumes.create_from_snapshot | def create_from_snapshot(self, data, timeout=-1):
"""
Creates a new volume on the storage system from a snapshot of a volume.
A volume template must also be specified when creating a volume from a snapshot.
The global setting "StorageVolumeTemplateRequired" controls whether or
not root volume templates can be used to provision volumes.
The value of this setting defaults to "false".
If the value is set to "true", then only templates with an "isRoot" value of "false"
can be used to provision a volume.
Args:
data (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 data.
"""
uri = self.URI + "/from-snapshot"
return self._client.create(data, uri=uri, timeout=timeout) | python | def create_from_snapshot(self, data, timeout=-1):
"""
Creates a new volume on the storage system from a snapshot of a volume.
A volume template must also be specified when creating a volume from a snapshot.
The global setting "StorageVolumeTemplateRequired" controls whether or
not root volume templates can be used to provision volumes.
The value of this setting defaults to "false".
If the value is set to "true", then only templates with an "isRoot" value of "false"
can be used to provision a volume.
Args:
data (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 data.
"""
uri = self.URI + "/from-snapshot"
return self._client.create(data, uri=uri, timeout=timeout) | [
"def",
"create_from_snapshot",
"(",
"self",
",",
"data",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"self",
".",
"URI",
"+",
"\"/from-snapshot\"",
"return",
"self",
".",
"_client",
".",
"create",
"(",
"data",
",",
"uri",
"=",
"uri",
",",
"timeout",
"=",
"timeout",
")"
] | Creates a new volume on the storage system from a snapshot of a volume.
A volume template must also be specified when creating a volume from a snapshot.
The global setting "StorageVolumeTemplateRequired" controls whether or
not root volume templates can be used to provision volumes.
The value of this setting defaults to "false".
If the value is set to "true", then only templates with an "isRoot" value of "false"
can be used to provision a volume.
Args:
data (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 data. | [
"Creates",
"a",
"new",
"volume",
"on",
"the",
"storage",
"system",
"from",
"a",
"snapshot",
"of",
"a",
"volume",
".",
"A",
"volume",
"template",
"must",
"also",
"be",
"specified",
"when",
"creating",
"a",
"volume",
"from",
"a",
"snapshot",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/volumes.py#L153-L175 | train | 251,448 |
HewlettPackard/python-hpOneView | hpOneView/resources/storage/volumes.py | Volumes.delete | def delete(self, resource, force=False, export_only=None, suppress_device_updates=None, timeout=-1):
"""
Deletes a managed volume.
Args:
resource (dict):
Object to delete.
force:
If set to true, the operation completes despite any problems with
network connectivity or errors on the resource itself. The default is false.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
export_only:
Valid prior to API500. By default, volumes will be deleted from OneView, and storage system.
To delete the volume from OneView only, you must set its value to True.
Setting its value to False has the same behavior as the default behavior.
suppress_device_updates:
Valid API500 onwards. By default, volumes will be deleted from OneView, and storage system.
To delete the volume from OneView only, you must set its value to True.
Setting its value to False has the same behavior as the default behavior.
Returns:
bool: Indicates if the volume was successfully deleted.
"""
custom_headers = {'If-Match': '*'}
if 'uri' in resource:
uri = resource['uri']
else:
uri = self._client.build_uri(resource)
if suppress_device_updates:
uri += '?suppressDeviceUpdates=true'
if export_only:
custom_headers['exportOnly'] = True
return self._client.delete(uri, force=force, timeout=timeout, custom_headers=custom_headers) | python | def delete(self, resource, force=False, export_only=None, suppress_device_updates=None, timeout=-1):
"""
Deletes a managed volume.
Args:
resource (dict):
Object to delete.
force:
If set to true, the operation completes despite any problems with
network connectivity or errors on the resource itself. The default is false.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
export_only:
Valid prior to API500. By default, volumes will be deleted from OneView, and storage system.
To delete the volume from OneView only, you must set its value to True.
Setting its value to False has the same behavior as the default behavior.
suppress_device_updates:
Valid API500 onwards. By default, volumes will be deleted from OneView, and storage system.
To delete the volume from OneView only, you must set its value to True.
Setting its value to False has the same behavior as the default behavior.
Returns:
bool: Indicates if the volume was successfully deleted.
"""
custom_headers = {'If-Match': '*'}
if 'uri' in resource:
uri = resource['uri']
else:
uri = self._client.build_uri(resource)
if suppress_device_updates:
uri += '?suppressDeviceUpdates=true'
if export_only:
custom_headers['exportOnly'] = True
return self._client.delete(uri, force=force, timeout=timeout, custom_headers=custom_headers) | [
"def",
"delete",
"(",
"self",
",",
"resource",
",",
"force",
"=",
"False",
",",
"export_only",
"=",
"None",
",",
"suppress_device_updates",
"=",
"None",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"custom_headers",
"=",
"{",
"'If-Match'",
":",
"'*'",
"}",
"if",
"'uri'",
"in",
"resource",
":",
"uri",
"=",
"resource",
"[",
"'uri'",
"]",
"else",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"resource",
")",
"if",
"suppress_device_updates",
":",
"uri",
"+=",
"'?suppressDeviceUpdates=true'",
"if",
"export_only",
":",
"custom_headers",
"[",
"'exportOnly'",
"]",
"=",
"True",
"return",
"self",
".",
"_client",
".",
"delete",
"(",
"uri",
",",
"force",
"=",
"force",
",",
"timeout",
"=",
"timeout",
",",
"custom_headers",
"=",
"custom_headers",
")"
] | Deletes a managed volume.
Args:
resource (dict):
Object to delete.
force:
If set to true, the operation completes despite any problems with
network connectivity or errors on the resource itself. The default is false.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
export_only:
Valid prior to API500. By default, volumes will be deleted from OneView, and storage system.
To delete the volume from OneView only, you must set its value to True.
Setting its value to False has the same behavior as the default behavior.
suppress_device_updates:
Valid API500 onwards. By default, volumes will be deleted from OneView, and storage system.
To delete the volume from OneView only, you must set its value to True.
Setting its value to False has the same behavior as the default behavior.
Returns:
bool: Indicates if the volume was successfully deleted. | [
"Deletes",
"a",
"managed",
"volume",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/volumes.py#L197-L231 | train | 251,449 |
HewlettPackard/python-hpOneView | hpOneView/resources/storage/volumes.py | Volumes.get_snapshots | def get_snapshots(self, volume_id_or_uri, start=0, count=-1, filter='', sort=''):
"""
Gets all snapshots of a volume. Returns a list of snapshots based on optional sorting and filtering, and
constrained by start and count parameters.
Args:
volume_id_or_uri:
Can be either the volume id or the volume 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.
filter (list or str):
A general filter/query string to narrow the list of items returned. The
default is no filter; all resources are returned.
sort:
The sort order of the returned data set. By default, the sort order is based
on create time with the oldest entry first.
Returns:
list: A list of snapshots.
"""
uri = self.__build_volume_snapshot_uri(volume_id_or_uri)
return self._client.get_all(start, count, filter=filter, sort=sort, uri=uri) | python | def get_snapshots(self, volume_id_or_uri, start=0, count=-1, filter='', sort=''):
"""
Gets all snapshots of a volume. Returns a list of snapshots based on optional sorting and filtering, and
constrained by start and count parameters.
Args:
volume_id_or_uri:
Can be either the volume id or the volume 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.
filter (list or str):
A general filter/query string to narrow the list of items returned. The
default is no filter; all resources are returned.
sort:
The sort order of the returned data set. By default, the sort order is based
on create time with the oldest entry first.
Returns:
list: A list of snapshots.
"""
uri = self.__build_volume_snapshot_uri(volume_id_or_uri)
return self._client.get_all(start, count, filter=filter, sort=sort, uri=uri) | [
"def",
"get_snapshots",
"(",
"self",
",",
"volume_id_or_uri",
",",
"start",
"=",
"0",
",",
"count",
"=",
"-",
"1",
",",
"filter",
"=",
"''",
",",
"sort",
"=",
"''",
")",
":",
"uri",
"=",
"self",
".",
"__build_volume_snapshot_uri",
"(",
"volume_id_or_uri",
")",
"return",
"self",
".",
"_client",
".",
"get_all",
"(",
"start",
",",
"count",
",",
"filter",
"=",
"filter",
",",
"sort",
"=",
"sort",
",",
"uri",
"=",
"uri",
")"
] | Gets all snapshots of a volume. Returns a list of snapshots based on optional sorting and filtering, and
constrained by start and count parameters.
Args:
volume_id_or_uri:
Can be either the volume id or the volume 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.
filter (list or str):
A general filter/query string to narrow the list of items returned. The
default is no filter; all resources are returned.
sort:
The sort order of the returned data set. By default, the sort order is based
on create time with the oldest entry first.
Returns:
list: A list of snapshots. | [
"Gets",
"all",
"snapshots",
"of",
"a",
"volume",
".",
"Returns",
"a",
"list",
"of",
"snapshots",
"based",
"on",
"optional",
"sorting",
"and",
"filtering",
"and",
"constrained",
"by",
"start",
"and",
"count",
"parameters",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/volumes.py#L242-L268 | train | 251,450 |
HewlettPackard/python-hpOneView | hpOneView/resources/storage/volumes.py | Volumes.create_snapshot | def create_snapshot(self, volume_id_or_uri, snapshot, timeout=-1):
"""
Creates a snapshot for the specified volume.
Args:
volume_id_or_uri:
Can be either the volume ID or the volume URI.
snapshot (dict):
Object to create.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
dict: Storage volume.
"""
uri = self.__build_volume_snapshot_uri(volume_id_or_uri)
return self._client.create(snapshot, uri=uri, timeout=timeout, default_values=self.DEFAULT_VALUES_SNAPSHOT) | python | def create_snapshot(self, volume_id_or_uri, snapshot, timeout=-1):
"""
Creates a snapshot for the specified volume.
Args:
volume_id_or_uri:
Can be either the volume ID or the volume URI.
snapshot (dict):
Object to create.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
dict: Storage volume.
"""
uri = self.__build_volume_snapshot_uri(volume_id_or_uri)
return self._client.create(snapshot, uri=uri, timeout=timeout, default_values=self.DEFAULT_VALUES_SNAPSHOT) | [
"def",
"create_snapshot",
"(",
"self",
",",
"volume_id_or_uri",
",",
"snapshot",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"self",
".",
"__build_volume_snapshot_uri",
"(",
"volume_id_or_uri",
")",
"return",
"self",
".",
"_client",
".",
"create",
"(",
"snapshot",
",",
"uri",
"=",
"uri",
",",
"timeout",
"=",
"timeout",
",",
"default_values",
"=",
"self",
".",
"DEFAULT_VALUES_SNAPSHOT",
")"
] | Creates a snapshot for the specified volume.
Args:
volume_id_or_uri:
Can be either the volume ID or the volume URI.
snapshot (dict):
Object to create.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
dict: Storage volume. | [
"Creates",
"a",
"snapshot",
"for",
"the",
"specified",
"volume",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/volumes.py#L270-L288 | train | 251,451 |
HewlettPackard/python-hpOneView | hpOneView/resources/storage/volumes.py | Volumes.get_snapshot | def get_snapshot(self, snapshot_id_or_uri, volume_id_or_uri=None):
"""
Gets a snapshot of a volume.
Args:
volume_id_or_uri:
Can be either the volume ID or the volume URI. It is optional if it is passed a snapshot URI,
but required if it passed a snapshot ID.
snapshot_id_or_uri:
Can be either the snapshot ID or the snapshot URI.
Returns:
dict: The snapshot.
"""
uri = self.__build_volume_snapshot_uri(volume_id_or_uri, snapshot_id_or_uri)
return self._client.get(uri) | python | def get_snapshot(self, snapshot_id_or_uri, volume_id_or_uri=None):
"""
Gets a snapshot of a volume.
Args:
volume_id_or_uri:
Can be either the volume ID or the volume URI. It is optional if it is passed a snapshot URI,
but required if it passed a snapshot ID.
snapshot_id_or_uri:
Can be either the snapshot ID or the snapshot URI.
Returns:
dict: The snapshot.
"""
uri = self.__build_volume_snapshot_uri(volume_id_or_uri, snapshot_id_or_uri)
return self._client.get(uri) | [
"def",
"get_snapshot",
"(",
"self",
",",
"snapshot_id_or_uri",
",",
"volume_id_or_uri",
"=",
"None",
")",
":",
"uri",
"=",
"self",
".",
"__build_volume_snapshot_uri",
"(",
"volume_id_or_uri",
",",
"snapshot_id_or_uri",
")",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"uri",
")"
] | Gets a snapshot of a volume.
Args:
volume_id_or_uri:
Can be either the volume ID or the volume URI. It is optional if it is passed a snapshot URI,
but required if it passed a snapshot ID.
snapshot_id_or_uri:
Can be either the snapshot ID or the snapshot URI.
Returns:
dict: The snapshot. | [
"Gets",
"a",
"snapshot",
"of",
"a",
"volume",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/volumes.py#L290-L305 | train | 251,452 |
HewlettPackard/python-hpOneView | hpOneView/resources/storage/volumes.py | Volumes.get_snapshot_by | def get_snapshot_by(self, volume_id_or_uri, field, value):
"""
Gets all snapshots that match the filter.
The search is case-insensitive.
Args:
volume_id_or_uri: Can be either the volume id or the volume uri.
field: Field name to filter.
value: Value to filter.
Returns:
list: Snapshots
"""
uri = self.__build_volume_snapshot_uri(volume_id_or_uri)
return self._client.get_by(field, value, uri=uri) | python | def get_snapshot_by(self, volume_id_or_uri, field, value):
"""
Gets all snapshots that match the filter.
The search is case-insensitive.
Args:
volume_id_or_uri: Can be either the volume id or the volume uri.
field: Field name to filter.
value: Value to filter.
Returns:
list: Snapshots
"""
uri = self.__build_volume_snapshot_uri(volume_id_or_uri)
return self._client.get_by(field, value, uri=uri) | [
"def",
"get_snapshot_by",
"(",
"self",
",",
"volume_id_or_uri",
",",
"field",
",",
"value",
")",
":",
"uri",
"=",
"self",
".",
"__build_volume_snapshot_uri",
"(",
"volume_id_or_uri",
")",
"return",
"self",
".",
"_client",
".",
"get_by",
"(",
"field",
",",
"value",
",",
"uri",
"=",
"uri",
")"
] | Gets all snapshots that match the filter.
The search is case-insensitive.
Args:
volume_id_or_uri: Can be either the volume id or the volume uri.
field: Field name to filter.
value: Value to filter.
Returns:
list: Snapshots | [
"Gets",
"all",
"snapshots",
"that",
"match",
"the",
"filter",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/volumes.py#L327-L342 | train | 251,453 |
HewlettPackard/python-hpOneView | hpOneView/resources/storage/volumes.py | Volumes.get_extra_managed_storage_volume_paths | def get_extra_managed_storage_volume_paths(self, start=0, count=-1, filter='', sort=''):
"""
Gets the list of extra managed storage volume paths.
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.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter (list or str):
A general filter/query string to narrow the list of items returned. The
default is no filter; all resources are returned.
sort:
The sort order of the returned data set. By default, the sort order is based
on create time with the oldest entry first.
Returns:
list: A list of extra managed storage volume paths.
"""
uri = self.URI + '/repair?alertFixType=ExtraManagedStorageVolumePaths'
return self._client.get_all(start, count, filter=filter, sort=sort, uri=uri) | python | def get_extra_managed_storage_volume_paths(self, start=0, count=-1, filter='', sort=''):
"""
Gets the list of extra managed storage volume paths.
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.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter (list or str):
A general filter/query string to narrow the list of items returned. The
default is no filter; all resources are returned.
sort:
The sort order of the returned data set. By default, the sort order is based
on create time with the oldest entry first.
Returns:
list: A list of extra managed storage volume paths.
"""
uri = self.URI + '/repair?alertFixType=ExtraManagedStorageVolumePaths'
return self._client.get_all(start, count, filter=filter, sort=sort, uri=uri) | [
"def",
"get_extra_managed_storage_volume_paths",
"(",
"self",
",",
"start",
"=",
"0",
",",
"count",
"=",
"-",
"1",
",",
"filter",
"=",
"''",
",",
"sort",
"=",
"''",
")",
":",
"uri",
"=",
"self",
".",
"URI",
"+",
"'/repair?alertFixType=ExtraManagedStorageVolumePaths'",
"return",
"self",
".",
"_client",
".",
"get_all",
"(",
"start",
",",
"count",
",",
"filter",
"=",
"filter",
",",
"sort",
"=",
"sort",
",",
"uri",
"=",
"uri",
")"
] | Gets the list of extra managed storage volume paths.
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.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter (list or str):
A general filter/query string to narrow the list of items returned. The
default is no filter; all resources are returned.
sort:
The sort order of the returned data set. By default, the sort order is based
on create time with the oldest entry first.
Returns:
list: A list of extra managed storage volume paths. | [
"Gets",
"the",
"list",
"of",
"extra",
"managed",
"storage",
"volume",
"paths",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/volumes.py#L344-L367 | train | 251,454 |
HewlettPackard/python-hpOneView | hpOneView/resources/storage/volumes.py | Volumes.repair | def repair(self, volume_id_or_uri, timeout=-1):
"""
Removes extra presentations from a specified volume on the storage system.
Args:
volume_id_or_uri:
Can be either the volume id or the volume uri.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
dict: Storage volume.
"""
data = {
"type": "ExtraManagedStorageVolumePaths",
"resourceUri": self._client.build_uri(volume_id_or_uri)
}
custom_headers = {'Accept-Language': 'en_US'}
uri = self.URI + '/repair'
return self._client.create(data, uri=uri, timeout=timeout, custom_headers=custom_headers) | python | def repair(self, volume_id_or_uri, timeout=-1):
"""
Removes extra presentations from a specified volume on the storage system.
Args:
volume_id_or_uri:
Can be either the volume id or the volume uri.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
dict: Storage volume.
"""
data = {
"type": "ExtraManagedStorageVolumePaths",
"resourceUri": self._client.build_uri(volume_id_or_uri)
}
custom_headers = {'Accept-Language': 'en_US'}
uri = self.URI + '/repair'
return self._client.create(data, uri=uri, timeout=timeout, custom_headers=custom_headers) | [
"def",
"repair",
"(",
"self",
",",
"volume_id_or_uri",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"data",
"=",
"{",
"\"type\"",
":",
"\"ExtraManagedStorageVolumePaths\"",
",",
"\"resourceUri\"",
":",
"self",
".",
"_client",
".",
"build_uri",
"(",
"volume_id_or_uri",
")",
"}",
"custom_headers",
"=",
"{",
"'Accept-Language'",
":",
"'en_US'",
"}",
"uri",
"=",
"self",
".",
"URI",
"+",
"'/repair'",
"return",
"self",
".",
"_client",
".",
"create",
"(",
"data",
",",
"uri",
"=",
"uri",
",",
"timeout",
"=",
"timeout",
",",
"custom_headers",
"=",
"custom_headers",
")"
] | Removes extra presentations from a specified volume on the storage system.
Args:
volume_id_or_uri:
Can be either the volume id or the volume uri.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
dict: Storage volume. | [
"Removes",
"extra",
"presentations",
"from",
"a",
"specified",
"volume",
"on",
"the",
"storage",
"system",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/volumes.py#L369-L389 | train | 251,455 |
HewlettPackard/python-hpOneView | hpOneView/resources/storage/volumes.py | Volumes.get_attachable_volumes | def get_attachable_volumes(self, start=0, count=-1, filter='', query='', sort='', scope_uris='', connections=''):
"""
Gets the volumes that are connected on the specified networks based on the storage system port's expected
network connectivity.
A volume is attachable if it satisfies either of the following conditions:
* The volume is shareable.
* The volume not shareable and not attached.
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.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter (list or str):
A general filter/query string to narrow the list of items returned. The
default is no filter; all resources are returned.
query:
A general query string to narrow the list of resources returned. The default
is no query; 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.
connections:
A list of dicts specifics the connections used by the attachable volumes. Needs network uri, initiatoer
name and optional proxy name
scope_uris:
A list specifics the list of scope uris used by the attachable volumed.
Returns:
list: A list of attachable volumes that the appliance manages.
"""
uri = self.URI + '/attachable-volumes'
if connections:
uri += str('?' + 'connections=' + connections.__str__())
return self._client.get_all(start, count, filter=filter, query=query, sort=sort, uri=uri, scope_uris=scope_uris) | python | def get_attachable_volumes(self, start=0, count=-1, filter='', query='', sort='', scope_uris='', connections=''):
"""
Gets the volumes that are connected on the specified networks based on the storage system port's expected
network connectivity.
A volume is attachable if it satisfies either of the following conditions:
* The volume is shareable.
* The volume not shareable and not attached.
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.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter (list or str):
A general filter/query string to narrow the list of items returned. The
default is no filter; all resources are returned.
query:
A general query string to narrow the list of resources returned. The default
is no query; 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.
connections:
A list of dicts specifics the connections used by the attachable volumes. Needs network uri, initiatoer
name and optional proxy name
scope_uris:
A list specifics the list of scope uris used by the attachable volumed.
Returns:
list: A list of attachable volumes that the appliance manages.
"""
uri = self.URI + '/attachable-volumes'
if connections:
uri += str('?' + 'connections=' + connections.__str__())
return self._client.get_all(start, count, filter=filter, query=query, sort=sort, uri=uri, scope_uris=scope_uris) | [
"def",
"get_attachable_volumes",
"(",
"self",
",",
"start",
"=",
"0",
",",
"count",
"=",
"-",
"1",
",",
"filter",
"=",
"''",
",",
"query",
"=",
"''",
",",
"sort",
"=",
"''",
",",
"scope_uris",
"=",
"''",
",",
"connections",
"=",
"''",
")",
":",
"uri",
"=",
"self",
".",
"URI",
"+",
"'/attachable-volumes'",
"if",
"connections",
":",
"uri",
"+=",
"str",
"(",
"'?'",
"+",
"'connections='",
"+",
"connections",
".",
"__str__",
"(",
")",
")",
"return",
"self",
".",
"_client",
".",
"get_all",
"(",
"start",
",",
"count",
",",
"filter",
"=",
"filter",
",",
"query",
"=",
"query",
",",
"sort",
"=",
"sort",
",",
"uri",
"=",
"uri",
",",
"scope_uris",
"=",
"scope_uris",
")"
] | Gets the volumes that are connected on the specified networks based on the storage system port's expected
network connectivity.
A volume is attachable if it satisfies either of the following conditions:
* The volume is shareable.
* The volume not shareable and not attached.
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.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter (list or str):
A general filter/query string to narrow the list of items returned. The
default is no filter; all resources are returned.
query:
A general query string to narrow the list of resources returned. The default
is no query; 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.
connections:
A list of dicts specifics the connections used by the attachable volumes. Needs network uri, initiatoer
name and optional proxy name
scope_uris:
A list specifics the list of scope uris used by the attachable volumed.
Returns:
list: A list of attachable volumes that the appliance manages. | [
"Gets",
"the",
"volumes",
"that",
"are",
"connected",
"on",
"the",
"specified",
"networks",
"based",
"on",
"the",
"storage",
"system",
"port",
"s",
"expected",
"network",
"connectivity",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/volumes.py#L391-L429 | train | 251,456 |
HewlettPackard/python-hpOneView | hpOneView/resources/servers/enclosures.py | Enclosures.update_configuration | def update_configuration(self, timeout=-1):
"""
Reapplies the appliance's configuration on the enclosure. This includes running the same configure steps
that were performed as part of the enclosure add.
Args:
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
Enclosure
"""
uri = "{}/configuration".format(self.data['uri'])
return self.update_with_zero_body(uri=uri, timeout=timeout) | python | def update_configuration(self, timeout=-1):
"""
Reapplies the appliance's configuration on the enclosure. This includes running the same configure steps
that were performed as part of the enclosure add.
Args:
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
Enclosure
"""
uri = "{}/configuration".format(self.data['uri'])
return self.update_with_zero_body(uri=uri, timeout=timeout) | [
"def",
"update_configuration",
"(",
"self",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"\"{}/configuration\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"'uri'",
"]",
")",
"return",
"self",
".",
"update_with_zero_body",
"(",
"uri",
"=",
"uri",
",",
"timeout",
"=",
"timeout",
")"
] | Reapplies the appliance's configuration on the enclosure. This includes running the same configure steps
that were performed as part of the enclosure add.
Args:
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
Enclosure | [
"Reapplies",
"the",
"appliance",
"s",
"configuration",
"on",
"the",
"enclosure",
".",
"This",
"includes",
"running",
"the",
"same",
"configure",
"steps",
"that",
"were",
"performed",
"as",
"part",
"of",
"the",
"enclosure",
"add",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/enclosures.py#L106-L119 | train | 251,457 |
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 | train | 251,458 |
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 | train | 251,459 |
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 | train | 251,460 |
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 | train | 251,461 |
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 | train | 251,462 |
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 | train | 251,463 |
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 | train | 251,464 |
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 | train | 251,465 |
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 | train | 251,466 |
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 | train | 251,467 |
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 | train | 251,468 |
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 | train | 251,469 |
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 | train | 251,470 |
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 | train | 251,471 |
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 | train | 251,472 |
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 | train | 251,473 |
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 | train | 251,474 |
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 | train | 251,475 |
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 | train | 251,476 |
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 | train | 251,477 |
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 | train | 251,478 |
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 | train | 251,479 |
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 | train | 251,480 |
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 | train | 251,481 |
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 | train | 251,482 |
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 | train | 251,483 |
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 | train | 251,484 |
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 | train | 251,485 |
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 | train | 251,486 |
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 | train | 251,487 |
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 | train | 251,488 |
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 | train | 251,489 |
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 | train | 251,490 |
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 | train | 251,491 |
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 | train | 251,492 |
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 | train | 251,493 |
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 | train | 251,494 |
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 | train | 251,495 |
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 | train | 251,496 |
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 | train | 251,497 |
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 | train | 251,498 |
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 | train | 251,499 |