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/servers/server_profiles.py | ServerProfiles.get_compliance_preview | def get_compliance_preview(self):
"""
Gets the preview of manual and automatic updates required to make the server profile
consistent with its template.
Returns:
dict: Server profile compliance preview.
"""
uri = '{}/compliance-preview'.format(self.data["uri"])
return self._helper.do_get(uri) | python | def get_compliance_preview(self):
"""
Gets the preview of manual and automatic updates required to make the server profile
consistent with its template.
Returns:
dict: Server profile compliance preview.
"""
uri = '{}/compliance-preview'.format(self.data["uri"])
return self._helper.do_get(uri) | [
"def",
"get_compliance_preview",
"(",
"self",
")",
":",
"uri",
"=",
"'{}/compliance-preview'",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
")",
"return",
"self",
".",
"_helper",
".",
"do_get",
"(",
"uri",
")"
] | Gets the preview of manual and automatic updates required to make the server profile
consistent with its template.
Returns:
dict: Server profile compliance preview. | [
"Gets",
"the",
"preview",
"of",
"manual",
"and",
"automatic",
"updates",
"required",
"to",
"make",
"the",
"server",
"profile",
"consistent",
"with",
"its",
"template",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/server_profiles.py#L138-L147 | train | 251,500 |
HewlettPackard/python-hpOneView | hpOneView/resources/servers/server_profiles.py | ServerProfiles.get_profile_ports | def get_profile_ports(self, **kwargs):
"""
Retrieves the port model associated with a server or server hardware type and enclosure group.
Args:
enclosureGroupUri (str):
The URI of the enclosure group associated with the resource.
serverHardwareTypeUri (str):
The URI of the server hardware type associated with the resource.
serverHardwareUri (str):
The URI of the server hardware associated with the resource.
Returns:
dict: Profile port.
"""
uri = self._helper.build_uri_with_query_string(kwargs, '/profile-ports')
return self._helper.do_get(uri) | python | def get_profile_ports(self, **kwargs):
"""
Retrieves the port model associated with a server or server hardware type and enclosure group.
Args:
enclosureGroupUri (str):
The URI of the enclosure group associated with the resource.
serverHardwareTypeUri (str):
The URI of the server hardware type associated with the resource.
serverHardwareUri (str):
The URI of the server hardware associated with the resource.
Returns:
dict: Profile port.
"""
uri = self._helper.build_uri_with_query_string(kwargs, '/profile-ports')
return self._helper.do_get(uri) | [
"def",
"get_profile_ports",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"uri",
"=",
"self",
".",
"_helper",
".",
"build_uri_with_query_string",
"(",
"kwargs",
",",
"'/profile-ports'",
")",
"return",
"self",
".",
"_helper",
".",
"do_get",
"(",
"uri",
")"
] | Retrieves the port model associated with a server or server hardware type and enclosure group.
Args:
enclosureGroupUri (str):
The URI of the enclosure group associated with the resource.
serverHardwareTypeUri (str):
The URI of the server hardware type associated with the resource.
serverHardwareUri (str):
The URI of the server hardware associated with the resource.
Returns:
dict: Profile port. | [
"Retrieves",
"the",
"port",
"model",
"associated",
"with",
"a",
"server",
"or",
"server",
"hardware",
"type",
"and",
"enclosure",
"group",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/server_profiles.py#L149-L165 | train | 251,501 |
HewlettPackard/python-hpOneView | hpOneView/resources/servers/server_profiles.py | ServerProfiles.get_messages | def get_messages(self):
"""
Retrieves the error or status messages associated with the specified profile.
Returns:
dict: Server Profile Health.
"""
uri = '{}/messages'.format(self.data["uri"])
return self._helper.do_get(uri) | python | def get_messages(self):
"""
Retrieves the error or status messages associated with the specified profile.
Returns:
dict: Server Profile Health.
"""
uri = '{}/messages'.format(self.data["uri"])
return self._helper.do_get(uri) | [
"def",
"get_messages",
"(",
"self",
")",
":",
"uri",
"=",
"'{}/messages'",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
")",
"return",
"self",
".",
"_helper",
".",
"do_get",
"(",
"uri",
")"
] | Retrieves the error or status messages associated with the specified profile.
Returns:
dict: Server Profile Health. | [
"Retrieves",
"the",
"error",
"or",
"status",
"messages",
"associated",
"with",
"the",
"specified",
"profile",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/server_profiles.py#L168-L176 | train | 251,502 |
HewlettPackard/python-hpOneView | hpOneView/resources/servers/server_profiles.py | ServerProfiles.get_available_networks | def get_available_networks(self, **kwargs):
"""
Retrieves the list of Ethernet networks, Fiber Channel networks, and network sets that are available to a
server profile, along with their respective ports.
Args:
enclosureGroupUri (str): The URI of the enclosure group associated with the resource.
functionType (str): The FunctionType (Ethernet or FibreChannel) to filter the list of networks returned.
serverHardwareTypeUri (str): The URI of the server hardware type associated with the resource.
serverHardwareUri (str): The URI of the server hardware associated with the resource.
view (str): Returns a specific subset of the attributes of the resource or collection, by
specifying the name of a predefined view. The default view is expand (show all attributes
of the resource and all elements of collections of resources).
Values:
Ethernet
Specifies that the connection is to an Ethernet network or a network set.
FibreChannel
Specifies that the connection is to a Fibre Channel network.
profileUri (str): If the URI of the server profile is provided the list of available networks will
include only networks that share a scope with the server profile.
scopeUris (str): An expression to restrict the resources returned according to the scopes
to which they are assigned
Returns:
list: Available networks.
"""
uri = self._helper.build_uri_with_query_string(kwargs, '/available-networks')
return self._helper.do_get(uri) | python | def get_available_networks(self, **kwargs):
"""
Retrieves the list of Ethernet networks, Fiber Channel networks, and network sets that are available to a
server profile, along with their respective ports.
Args:
enclosureGroupUri (str): The URI of the enclosure group associated with the resource.
functionType (str): The FunctionType (Ethernet or FibreChannel) to filter the list of networks returned.
serverHardwareTypeUri (str): The URI of the server hardware type associated with the resource.
serverHardwareUri (str): The URI of the server hardware associated with the resource.
view (str): Returns a specific subset of the attributes of the resource or collection, by
specifying the name of a predefined view. The default view is expand (show all attributes
of the resource and all elements of collections of resources).
Values:
Ethernet
Specifies that the connection is to an Ethernet network or a network set.
FibreChannel
Specifies that the connection is to a Fibre Channel network.
profileUri (str): If the URI of the server profile is provided the list of available networks will
include only networks that share a scope with the server profile.
scopeUris (str): An expression to restrict the resources returned according to the scopes
to which they are assigned
Returns:
list: Available networks.
"""
uri = self._helper.build_uri_with_query_string(kwargs, '/available-networks')
return self._helper.do_get(uri) | [
"def",
"get_available_networks",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"uri",
"=",
"self",
".",
"_helper",
".",
"build_uri_with_query_string",
"(",
"kwargs",
",",
"'/available-networks'",
")",
"return",
"self",
".",
"_helper",
".",
"do_get",
"(",
"uri",
")"
] | Retrieves the list of Ethernet networks, Fiber Channel networks, and network sets that are available to a
server profile, along with their respective ports.
Args:
enclosureGroupUri (str): The URI of the enclosure group associated with the resource.
functionType (str): The FunctionType (Ethernet or FibreChannel) to filter the list of networks returned.
serverHardwareTypeUri (str): The URI of the server hardware type associated with the resource.
serverHardwareUri (str): The URI of the server hardware associated with the resource.
view (str): Returns a specific subset of the attributes of the resource or collection, by
specifying the name of a predefined view. The default view is expand (show all attributes
of the resource and all elements of collections of resources).
Values:
Ethernet
Specifies that the connection is to an Ethernet network or a network set.
FibreChannel
Specifies that the connection is to a Fibre Channel network.
profileUri (str): If the URI of the server profile is provided the list of available networks will
include only networks that share a scope with the server profile.
scopeUris (str): An expression to restrict the resources returned according to the scopes
to which they are assigned
Returns:
list: Available networks. | [
"Retrieves",
"the",
"list",
"of",
"Ethernet",
"networks",
"Fiber",
"Channel",
"networks",
"and",
"network",
"sets",
"that",
"are",
"available",
"to",
"a",
"server",
"profile",
"along",
"with",
"their",
"respective",
"ports",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/server_profiles.py#L205-L233 | train | 251,503 |
HewlettPackard/python-hpOneView | hpOneView/resources/servers/server_profiles.py | ServerProfiles.get_available_servers | def get_available_servers(self, **kwargs):
"""
Retrieves the list of available servers.
Args:
enclosureGroupUri (str): The URI of the enclosure group associated with the resource.
serverHardwareTypeUri (str): The URI of the server hardware type associated with the resource.
profileUri (str): The URI of the server profile resource.
scopeUris (str): An expression to restrict the resources returned according to
the scopes to which they are assigned.
filter (list or str): A general filter/query string to narrow the list of items returned.
The default is no filter, all resources are returned.
Returns:
list: Available servers.
"""
uri = self._helper.build_uri_with_query_string(kwargs, '/available-servers')
return self._helper.do_get(uri) | python | def get_available_servers(self, **kwargs):
"""
Retrieves the list of available servers.
Args:
enclosureGroupUri (str): The URI of the enclosure group associated with the resource.
serverHardwareTypeUri (str): The URI of the server hardware type associated with the resource.
profileUri (str): The URI of the server profile resource.
scopeUris (str): An expression to restrict the resources returned according to
the scopes to which they are assigned.
filter (list or str): A general filter/query string to narrow the list of items returned.
The default is no filter, all resources are returned.
Returns:
list: Available servers.
"""
uri = self._helper.build_uri_with_query_string(kwargs, '/available-servers')
return self._helper.do_get(uri) | [
"def",
"get_available_servers",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"uri",
"=",
"self",
".",
"_helper",
".",
"build_uri_with_query_string",
"(",
"kwargs",
",",
"'/available-servers'",
")",
"return",
"self",
".",
"_helper",
".",
"do_get",
"(",
"uri",
")"
] | Retrieves the list of available servers.
Args:
enclosureGroupUri (str): The URI of the enclosure group associated with the resource.
serverHardwareTypeUri (str): The URI of the server hardware type associated with the resource.
profileUri (str): The URI of the server profile resource.
scopeUris (str): An expression to restrict the resources returned according to
the scopes to which they are assigned.
filter (list or str): A general filter/query string to narrow the list of items returned.
The default is no filter, all resources are returned.
Returns:
list: Available servers. | [
"Retrieves",
"the",
"list",
"of",
"available",
"servers",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/server_profiles.py#L235-L251 | train | 251,504 |
HewlettPackard/python-hpOneView | hpOneView/resources/servers/server_profiles.py | ServerProfiles.get_available_storage_system | def get_available_storage_system(self, **kwargs):
"""
Retrieves a specific storage system and its associated volumes available to the server profile based
on the given server hardware type and enclosure group.
Args:
enclosureGroupUri (str):
The URI of the enclosure group associated with the resource.
serverHardwareTypeUri (str):
The URI of the server hardware type associated with the resource.
storageSystemId (str):
The storage system ID associated with the resource.
Returns:
dict: Available storage system.
"""
uri = self._helper.build_uri_with_query_string(kwargs, '/available-storage-system')
return self._helper.do_get(uri) | python | def get_available_storage_system(self, **kwargs):
"""
Retrieves a specific storage system and its associated volumes available to the server profile based
on the given server hardware type and enclosure group.
Args:
enclosureGroupUri (str):
The URI of the enclosure group associated with the resource.
serverHardwareTypeUri (str):
The URI of the server hardware type associated with the resource.
storageSystemId (str):
The storage system ID associated with the resource.
Returns:
dict: Available storage system.
"""
uri = self._helper.build_uri_with_query_string(kwargs, '/available-storage-system')
return self._helper.do_get(uri) | [
"def",
"get_available_storage_system",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"uri",
"=",
"self",
".",
"_helper",
".",
"build_uri_with_query_string",
"(",
"kwargs",
",",
"'/available-storage-system'",
")",
"return",
"self",
".",
"_helper",
".",
"do_get",
"(",
"uri",
")"
] | Retrieves a specific storage system and its associated volumes available to the server profile based
on the given server hardware type and enclosure group.
Args:
enclosureGroupUri (str):
The URI of the enclosure group associated with the resource.
serverHardwareTypeUri (str):
The URI of the server hardware type associated with the resource.
storageSystemId (str):
The storage system ID associated with the resource.
Returns:
dict: Available storage system. | [
"Retrieves",
"a",
"specific",
"storage",
"system",
"and",
"its",
"associated",
"volumes",
"available",
"to",
"the",
"server",
"profile",
"based",
"on",
"the",
"given",
"server",
"hardware",
"type",
"and",
"enclosure",
"group",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/server_profiles.py#L253-L270 | train | 251,505 |
HewlettPackard/python-hpOneView | hpOneView/resources/servers/server_profiles.py | ServerProfiles.get_available_storage_systems | def get_available_storage_systems(self, start=0, count=-1, filter='', sort='', **kwargs):
"""
Retrieves the list of the storage systems and their associated volumes available to the server profile
based on the given server hardware type and enclosure group.
Args:
count:
The number of resources to return. A count of -1 requests all items. The actual number of items in
the response may differ from the requested count if the sum of start and count exceed the total
number of items.
start:
The first item to return, using 0-based indexing. If not specified, the default is 0 - start with the
first available item.
filter (list or str):
A general filter/query string to narrow the list of items returned. The default is no filter; all
resources are returned.
sort:
The sort order of the returned data set. By default, the sort order is based on create time, with the
oldest entry first.
enclosureGroupUri (str):
The URI of the enclosure group associated with the resource.
serverHardwareTypeUri (str):
The URI of the server hardware type associated with the resource.
Returns:
list: Available storage systems.
"""
uri = self._helper.build_uri_with_query_string(kwargs, '/available-storage-systems')
return self._helper.get_all(start=start, count=count, filter=filter, sort=sort, uri=uri) | python | def get_available_storage_systems(self, start=0, count=-1, filter='', sort='', **kwargs):
"""
Retrieves the list of the storage systems and their associated volumes available to the server profile
based on the given server hardware type and enclosure group.
Args:
count:
The number of resources to return. A count of -1 requests all items. The actual number of items in
the response may differ from the requested count if the sum of start and count exceed the total
number of items.
start:
The first item to return, using 0-based indexing. If not specified, the default is 0 - start with the
first available item.
filter (list or str):
A general filter/query string to narrow the list of items returned. The default is no filter; all
resources are returned.
sort:
The sort order of the returned data set. By default, the sort order is based on create time, with the
oldest entry first.
enclosureGroupUri (str):
The URI of the enclosure group associated with the resource.
serverHardwareTypeUri (str):
The URI of the server hardware type associated with the resource.
Returns:
list: Available storage systems.
"""
uri = self._helper.build_uri_with_query_string(kwargs, '/available-storage-systems')
return self._helper.get_all(start=start, count=count, filter=filter, sort=sort, uri=uri) | [
"def",
"get_available_storage_systems",
"(",
"self",
",",
"start",
"=",
"0",
",",
"count",
"=",
"-",
"1",
",",
"filter",
"=",
"''",
",",
"sort",
"=",
"''",
",",
"*",
"*",
"kwargs",
")",
":",
"uri",
"=",
"self",
".",
"_helper",
".",
"build_uri_with_query_string",
"(",
"kwargs",
",",
"'/available-storage-systems'",
")",
"return",
"self",
".",
"_helper",
".",
"get_all",
"(",
"start",
"=",
"start",
",",
"count",
"=",
"count",
",",
"filter",
"=",
"filter",
",",
"sort",
"=",
"sort",
",",
"uri",
"=",
"uri",
")"
] | Retrieves the list of the storage systems and their associated volumes available to the server profile
based on the given server hardware type and enclosure group.
Args:
count:
The number of resources to return. A count of -1 requests all items. The actual number of items in
the response may differ from the requested count if the sum of start and count exceed the total
number of items.
start:
The first item to return, using 0-based indexing. If not specified, the default is 0 - start with the
first available item.
filter (list or str):
A general filter/query string to narrow the list of items returned. The default is no filter; all
resources are returned.
sort:
The sort order of the returned data set. By default, the sort order is based on create time, with the
oldest entry first.
enclosureGroupUri (str):
The URI of the enclosure group associated with the resource.
serverHardwareTypeUri (str):
The URI of the server hardware type associated with the resource.
Returns:
list: Available storage systems. | [
"Retrieves",
"the",
"list",
"of",
"the",
"storage",
"systems",
"and",
"their",
"associated",
"volumes",
"available",
"to",
"the",
"server",
"profile",
"based",
"on",
"the",
"given",
"server",
"hardware",
"type",
"and",
"enclosure",
"group",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/server_profiles.py#L272-L300 | train | 251,506 |
HewlettPackard/python-hpOneView | hpOneView/resources/servers/server_profiles.py | ServerProfiles.get_available_targets | def get_available_targets(self, **kwargs):
"""
Retrieves a list of the target servers and empty device bays that are available for assignment to the server
profile.
Args:
enclosureGroupUri (str): The URI of the enclosure group associated with the resource.
serverHardwareTypeUri (str): The URI of the server hardware type associated with the resource.
profileUri (str): The URI of the server profile associated with the resource.
scopeUris (str): An expression to restrict the resources returned according to
the scopes to which they are assigned.
filter (list or str): A general filter/query string to narrow the list of items returned.
The default is no filter, all resources are returned.
Returns:
list: List of available servers and bays.
"""
uri = self._helper.build_uri_with_query_string(kwargs, '/available-targets')
return self._helper.do_get(uri) | python | def get_available_targets(self, **kwargs):
"""
Retrieves a list of the target servers and empty device bays that are available for assignment to the server
profile.
Args:
enclosureGroupUri (str): The URI of the enclosure group associated with the resource.
serverHardwareTypeUri (str): The URI of the server hardware type associated with the resource.
profileUri (str): The URI of the server profile associated with the resource.
scopeUris (str): An expression to restrict the resources returned according to
the scopes to which they are assigned.
filter (list or str): A general filter/query string to narrow the list of items returned.
The default is no filter, all resources are returned.
Returns:
list: List of available servers and bays.
"""
uri = self._helper.build_uri_with_query_string(kwargs, '/available-targets')
return self._helper.do_get(uri) | [
"def",
"get_available_targets",
"(",
"self",
",",
"*",
"*",
"kwargs",
")",
":",
"uri",
"=",
"self",
".",
"_helper",
".",
"build_uri_with_query_string",
"(",
"kwargs",
",",
"'/available-targets'",
")",
"return",
"self",
".",
"_helper",
".",
"do_get",
"(",
"uri",
")"
] | Retrieves a list of the target servers and empty device bays that are available for assignment to the server
profile.
Args:
enclosureGroupUri (str): The URI of the enclosure group associated with the resource.
serverHardwareTypeUri (str): The URI of the server hardware type associated with the resource.
profileUri (str): The URI of the server profile associated with the resource.
scopeUris (str): An expression to restrict the resources returned according to
the scopes to which they are assigned.
filter (list or str): A general filter/query string to narrow the list of items returned.
The default is no filter, all resources are returned.
Returns:
list: List of available servers and bays. | [
"Retrieves",
"a",
"list",
"of",
"the",
"target",
"servers",
"and",
"empty",
"device",
"bays",
"that",
"are",
"available",
"for",
"assignment",
"to",
"the",
"server",
"profile",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/server_profiles.py#L302-L320 | train | 251,507 |
HewlettPackard/python-hpOneView | hpOneView/resources/servers/server_profiles.py | ServerProfiles.get_new_profile_template | def get_new_profile_template(self):
"""
Retrieves the profile template for a given server profile.
Returns:
dict: Server profile template.
"""
uri = '{}/new-profile-template'.format(self.data["uri"])
return self._helper.do_get(uri) | python | def get_new_profile_template(self):
"""
Retrieves the profile template for a given server profile.
Returns:
dict: Server profile template.
"""
uri = '{}/new-profile-template'.format(self.data["uri"])
return self._helper.do_get(uri) | [
"def",
"get_new_profile_template",
"(",
"self",
")",
":",
"uri",
"=",
"'{}/new-profile-template'",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
")",
"return",
"self",
".",
"_helper",
".",
"do_get",
"(",
"uri",
")"
] | Retrieves the profile template for a given server profile.
Returns:
dict: Server profile template. | [
"Retrieves",
"the",
"profile",
"template",
"for",
"a",
"given",
"server",
"profile",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/server_profiles.py#L323-L331 | train | 251,508 |
HewlettPackard/python-hpOneView | hpOneView/resources/servers/enclosure_groups.py | EnclosureGroups.update_script | def update_script(self, script_body):
"""
Updates the configuration script of the enclosure-group with the specified URI.
Args:
id_or_uri: Resource id or resource uri.
script_body: Configuration script.
Returns:
dict: Updated enclosure group.
"""
uri = "{}/script".format(self.data['uri'])
return self._helper.update(script_body, uri=uri) | python | def update_script(self, script_body):
"""
Updates the configuration script of the enclosure-group with the specified URI.
Args:
id_or_uri: Resource id or resource uri.
script_body: Configuration script.
Returns:
dict: Updated enclosure group.
"""
uri = "{}/script".format(self.data['uri'])
return self._helper.update(script_body, uri=uri) | [
"def",
"update_script",
"(",
"self",
",",
"script_body",
")",
":",
"uri",
"=",
"\"{}/script\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"'uri'",
"]",
")",
"return",
"self",
".",
"_helper",
".",
"update",
"(",
"script_body",
",",
"uri",
"=",
"uri",
")"
] | Updates the configuration script of the enclosure-group with the specified URI.
Args:
id_or_uri: Resource id or resource uri.
script_body: Configuration script.
Returns:
dict: Updated enclosure group. | [
"Updates",
"the",
"configuration",
"script",
"of",
"the",
"enclosure",
"-",
"group",
"with",
"the",
"specified",
"URI",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/enclosure_groups.py#L94-L107 | train | 251,509 |
HewlettPackard/python-hpOneView | hpOneView/resources/storage/storage_volume_attachments.py | StorageVolumeAttachments.remove_extra_presentations | def remove_extra_presentations(self, resource, timeout=-1):
"""
Removes extra presentations from a specified server profile.
Args:
resource (dict):
Object to create
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Associated storage attachment resource.
"""
uri = self.URI + "/repair"
custom_headers = {'Accept-Language': 'en_US'}
return self._client.create(resource, uri=uri, timeout=timeout, custom_headers=custom_headers) | python | def remove_extra_presentations(self, resource, timeout=-1):
"""
Removes extra presentations from a specified server profile.
Args:
resource (dict):
Object to create
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Associated storage attachment resource.
"""
uri = self.URI + "/repair"
custom_headers = {'Accept-Language': 'en_US'}
return self._client.create(resource, uri=uri, timeout=timeout, custom_headers=custom_headers) | [
"def",
"remove_extra_presentations",
"(",
"self",
",",
"resource",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"self",
".",
"URI",
"+",
"\"/repair\"",
"custom_headers",
"=",
"{",
"'Accept-Language'",
":",
"'en_US'",
"}",
"return",
"self",
".",
"_client",
".",
"create",
"(",
"resource",
",",
"uri",
"=",
"uri",
",",
"timeout",
"=",
"timeout",
",",
"custom_headers",
"=",
"custom_headers",
")"
] | Removes extra presentations from a specified server profile.
Args:
resource (dict):
Object to create
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Associated storage attachment resource. | [
"Removes",
"extra",
"presentations",
"from",
"a",
"specified",
"server",
"profile",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/storage_volume_attachments.py#L98-L113 | train | 251,510 |
HewlettPackard/python-hpOneView | hpOneView/resources/storage/storage_volume_attachments.py | StorageVolumeAttachments.get_paths | def get_paths(self, id_or_uri, path_id_or_uri=''):
"""
Gets all paths or a specific attachment path for the specified volume attachment.
Args:
id_or_uri: Can be either the volume attachment id or the volume attachment uri.
path_id_or_uri: Can be either the path id or the path uri.
Returns:
dict: Paths.
"""
if path_id_or_uri:
uri = self._client.build_uri(path_id_or_uri)
if "/paths" not in uri:
uri = self._client.build_uri(
id_or_uri) + "/paths" + "/" + path_id_or_uri
else:
uri = self._client.build_uri(id_or_uri) + "/paths"
return self._client.get(uri) | python | def get_paths(self, id_or_uri, path_id_or_uri=''):
"""
Gets all paths or a specific attachment path for the specified volume attachment.
Args:
id_or_uri: Can be either the volume attachment id or the volume attachment uri.
path_id_or_uri: Can be either the path id or the path uri.
Returns:
dict: Paths.
"""
if path_id_or_uri:
uri = self._client.build_uri(path_id_or_uri)
if "/paths" not in uri:
uri = self._client.build_uri(
id_or_uri) + "/paths" + "/" + path_id_or_uri
else:
uri = self._client.build_uri(id_or_uri) + "/paths"
return self._client.get(uri) | [
"def",
"get_paths",
"(",
"self",
",",
"id_or_uri",
",",
"path_id_or_uri",
"=",
"''",
")",
":",
"if",
"path_id_or_uri",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"path_id_or_uri",
")",
"if",
"\"/paths\"",
"not",
"in",
"uri",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"id_or_uri",
")",
"+",
"\"/paths\"",
"+",
"\"/\"",
"+",
"path_id_or_uri",
"else",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"id_or_uri",
")",
"+",
"\"/paths\"",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"uri",
")"
] | Gets all paths or a specific attachment path for the specified volume attachment.
Args:
id_or_uri: Can be either the volume attachment id or the volume attachment uri.
path_id_or_uri: Can be either the path id or the path uri.
Returns:
dict: Paths. | [
"Gets",
"all",
"paths",
"or",
"a",
"specific",
"attachment",
"path",
"for",
"the",
"specified",
"volume",
"attachment",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/storage_volume_attachments.py#L115-L135 | train | 251,511 |
HewlettPackard/python-hpOneView | hpOneView/image_streamer/resources/artifact_bundles.py | ArtifactBundles.get_backup | def get_backup(self, id_or_uri):
"""
Get the details for the backup from an Artifact Bundle.
Args:
id_or_uri: ID or URI of the Artifact Bundle.
Returns:
Dict: Backup for an Artifacts Bundle.
"""
uri = self.BACKUPS_PATH + '/' + extract_id_from_uri(id_or_uri)
return self._client.get(id_or_uri=uri) | python | def get_backup(self, id_or_uri):
"""
Get the details for the backup from an Artifact Bundle.
Args:
id_or_uri: ID or URI of the Artifact Bundle.
Returns:
Dict: Backup for an Artifacts Bundle.
"""
uri = self.BACKUPS_PATH + '/' + extract_id_from_uri(id_or_uri)
return self._client.get(id_or_uri=uri) | [
"def",
"get_backup",
"(",
"self",
",",
"id_or_uri",
")",
":",
"uri",
"=",
"self",
".",
"BACKUPS_PATH",
"+",
"'/'",
"+",
"extract_id_from_uri",
"(",
"id_or_uri",
")",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"id_or_uri",
"=",
"uri",
")"
] | Get the details for the backup from an Artifact Bundle.
Args:
id_or_uri: ID or URI of the Artifact Bundle.
Returns:
Dict: Backup for an Artifacts Bundle. | [
"Get",
"the",
"details",
"for",
"the",
"backup",
"from",
"an",
"Artifact",
"Bundle",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/resources/artifact_bundles.py#L129-L140 | train | 251,512 |
HewlettPackard/python-hpOneView | hpOneView/image_streamer/resources/artifact_bundles.py | ArtifactBundles.download_archive_artifact_bundle | def download_archive_artifact_bundle(self, id_or_uri, file_path):
"""
Downloads an archive for the Artifact Bundle.
Args:
id_or_uri: ID or URI of the Artifact Bundle.
file_path(str): Destination file path.
Returns:
bool: Successfully downloaded.
"""
uri = self.BACKUP_ARCHIVE_PATH + '/' + extract_id_from_uri(id_or_uri)
return self._client.download(uri, file_path) | python | def download_archive_artifact_bundle(self, id_or_uri, file_path):
"""
Downloads an archive for the Artifact Bundle.
Args:
id_or_uri: ID or URI of the Artifact Bundle.
file_path(str): Destination file path.
Returns:
bool: Successfully downloaded.
"""
uri = self.BACKUP_ARCHIVE_PATH + '/' + extract_id_from_uri(id_or_uri)
return self._client.download(uri, file_path) | [
"def",
"download_archive_artifact_bundle",
"(",
"self",
",",
"id_or_uri",
",",
"file_path",
")",
":",
"uri",
"=",
"self",
".",
"BACKUP_ARCHIVE_PATH",
"+",
"'/'",
"+",
"extract_id_from_uri",
"(",
"id_or_uri",
")",
"return",
"self",
".",
"_client",
".",
"download",
"(",
"uri",
",",
"file_path",
")"
] | Downloads an archive for the Artifact Bundle.
Args:
id_or_uri: ID or URI of the Artifact Bundle.
file_path(str): Destination file path.
Returns:
bool: Successfully downloaded. | [
"Downloads",
"an",
"archive",
"for",
"the",
"Artifact",
"Bundle",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/resources/artifact_bundles.py#L142-L155 | train | 251,513 |
HewlettPackard/python-hpOneView | hpOneView/image_streamer/resources/artifact_bundles.py | ArtifactBundles.download_artifact_bundle | def download_artifact_bundle(self, id_or_uri, file_path):
"""
Download the Artifact Bundle.
Args:
id_or_uri: ID or URI of the Artifact Bundle.
file_path(str): Destination file path.
Returns:
bool: Successfully downloaded.
"""
uri = self.DOWNLOAD_PATH + '/' + extract_id_from_uri(id_or_uri)
return self._client.download(uri, file_path) | python | def download_artifact_bundle(self, id_or_uri, file_path):
"""
Download the Artifact Bundle.
Args:
id_or_uri: ID or URI of the Artifact Bundle.
file_path(str): Destination file path.
Returns:
bool: Successfully downloaded.
"""
uri = self.DOWNLOAD_PATH + '/' + extract_id_from_uri(id_or_uri)
return self._client.download(uri, file_path) | [
"def",
"download_artifact_bundle",
"(",
"self",
",",
"id_or_uri",
",",
"file_path",
")",
":",
"uri",
"=",
"self",
".",
"DOWNLOAD_PATH",
"+",
"'/'",
"+",
"extract_id_from_uri",
"(",
"id_or_uri",
")",
"return",
"self",
".",
"_client",
".",
"download",
"(",
"uri",
",",
"file_path",
")"
] | Download the Artifact Bundle.
Args:
id_or_uri: ID or URI of the Artifact Bundle.
file_path(str): Destination file path.
Returns:
bool: Successfully downloaded. | [
"Download",
"the",
"Artifact",
"Bundle",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/resources/artifact_bundles.py#L157-L169 | train | 251,514 |
HewlettPackard/python-hpOneView | hpOneView/image_streamer/resources/artifact_bundles.py | ArtifactBundles.create_backup | def create_backup(self, resource, timeout=-1):
"""
Creates a backup bundle with all the artifacts present on the appliance. At any given point only one backup
bundle will exist on the appliance.
Args:
resource (dict): Deployment Group to create the backup.
timeout:
Timeout in seconds. Waits for task completion by default. The timeout does not abort the operation in
OneView, it just stops waiting for its completion.
Returns:
dict: A Deployment Group associated with the Artifact Bundle backup.
"""
return self._client.create(resource, uri=self.BACKUPS_PATH, timeout=timeout) | python | def create_backup(self, resource, timeout=-1):
"""
Creates a backup bundle with all the artifacts present on the appliance. At any given point only one backup
bundle will exist on the appliance.
Args:
resource (dict): Deployment Group to create the backup.
timeout:
Timeout in seconds. Waits for task completion by default. The timeout does not abort the operation in
OneView, it just stops waiting for its completion.
Returns:
dict: A Deployment Group associated with the Artifact Bundle backup.
"""
return self._client.create(resource, uri=self.BACKUPS_PATH, timeout=timeout) | [
"def",
"create_backup",
"(",
"self",
",",
"resource",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"return",
"self",
".",
"_client",
".",
"create",
"(",
"resource",
",",
"uri",
"=",
"self",
".",
"BACKUPS_PATH",
",",
"timeout",
"=",
"timeout",
")"
] | Creates a backup bundle with all the artifacts present on the appliance. At any given point only one backup
bundle will exist on the appliance.
Args:
resource (dict): Deployment Group to create the backup.
timeout:
Timeout in seconds. Waits for task completion by default. The timeout does not abort the operation in
OneView, it just stops waiting for its completion.
Returns:
dict: A Deployment Group associated with the Artifact Bundle backup. | [
"Creates",
"a",
"backup",
"bundle",
"with",
"all",
"the",
"artifacts",
"present",
"on",
"the",
"appliance",
".",
"At",
"any",
"given",
"point",
"only",
"one",
"backup",
"bundle",
"will",
"exist",
"on",
"the",
"appliance",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/resources/artifact_bundles.py#L171-L185 | train | 251,515 |
HewlettPackard/python-hpOneView | hpOneView/image_streamer/resources/artifact_bundles.py | ArtifactBundles.upload_backup_bundle_from_file | def upload_backup_bundle_from_file(self, file_path, deployment_groups_id_or_uri):
"""
Restore an Artifact Bundle from a backup file.
Args:
file_path (str): The File Path to restore the Artifact Bundle.
deployment_groups_id_or_uri: ID or URI of the Deployment Groups.
Returns:
dict: Deployment group.
"""
deployment_groups_uri = deployment_groups_id_or_uri
if self.DEPLOYMENT_GROUPS_URI not in deployment_groups_id_or_uri:
deployment_groups_uri = self.DEPLOYMENT_GROUPS_URI + deployment_groups_id_or_uri
uri = self.BACKUP_ARCHIVE_PATH + "?deploymentGrpUri=" + deployment_groups_uri
return self._client.upload(file_path, uri) | python | def upload_backup_bundle_from_file(self, file_path, deployment_groups_id_or_uri):
"""
Restore an Artifact Bundle from a backup file.
Args:
file_path (str): The File Path to restore the Artifact Bundle.
deployment_groups_id_or_uri: ID or URI of the Deployment Groups.
Returns:
dict: Deployment group.
"""
deployment_groups_uri = deployment_groups_id_or_uri
if self.DEPLOYMENT_GROUPS_URI not in deployment_groups_id_or_uri:
deployment_groups_uri = self.DEPLOYMENT_GROUPS_URI + deployment_groups_id_or_uri
uri = self.BACKUP_ARCHIVE_PATH + "?deploymentGrpUri=" + deployment_groups_uri
return self._client.upload(file_path, uri) | [
"def",
"upload_backup_bundle_from_file",
"(",
"self",
",",
"file_path",
",",
"deployment_groups_id_or_uri",
")",
":",
"deployment_groups_uri",
"=",
"deployment_groups_id_or_uri",
"if",
"self",
".",
"DEPLOYMENT_GROUPS_URI",
"not",
"in",
"deployment_groups_id_or_uri",
":",
"deployment_groups_uri",
"=",
"self",
".",
"DEPLOYMENT_GROUPS_URI",
"+",
"deployment_groups_id_or_uri",
"uri",
"=",
"self",
".",
"BACKUP_ARCHIVE_PATH",
"+",
"\"?deploymentGrpUri=\"",
"+",
"deployment_groups_uri",
"return",
"self",
".",
"_client",
".",
"upload",
"(",
"file_path",
",",
"uri",
")"
] | Restore an Artifact Bundle from a backup file.
Args:
file_path (str): The File Path to restore the Artifact Bundle.
deployment_groups_id_or_uri: ID or URI of the Deployment Groups.
Returns:
dict: Deployment group. | [
"Restore",
"an",
"Artifact",
"Bundle",
"from",
"a",
"backup",
"file",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/resources/artifact_bundles.py#L199-L217 | train | 251,516 |
HewlettPackard/python-hpOneView | hpOneView/image_streamer/resources/artifact_bundles.py | ArtifactBundles.update | def update(self, resource, timeout=-1):
"""
Updates only name for the Artifact Bundle.
Args:
resource (dict): Object to update.
timeout:
Timeout in seconds. Waits for task completion by default. The timeout does not abort the operation
in OneView, it just stops waiting for its completion.
Returns:
dict: Updated resource.
"""
return self._client.update(resource, timeout=timeout, default_values=self.DEFAULT_VALUES) | python | def update(self, resource, timeout=-1):
"""
Updates only name for the Artifact Bundle.
Args:
resource (dict): Object to update.
timeout:
Timeout in seconds. Waits for task completion by default. The timeout does not abort the operation
in OneView, it just stops waiting for its completion.
Returns:
dict: Updated resource.
"""
return self._client.update(resource, timeout=timeout, default_values=self.DEFAULT_VALUES) | [
"def",
"update",
"(",
"self",
",",
"resource",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"return",
"self",
".",
"_client",
".",
"update",
"(",
"resource",
",",
"timeout",
"=",
"timeout",
",",
"default_values",
"=",
"self",
".",
"DEFAULT_VALUES",
")"
] | Updates only name for the Artifact Bundle.
Args:
resource (dict): Object to update.
timeout:
Timeout in seconds. Waits for task completion by default. The timeout does not abort the operation
in OneView, it just stops waiting for its completion.
Returns:
dict: Updated resource. | [
"Updates",
"only",
"name",
"for",
"the",
"Artifact",
"Bundle",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/resources/artifact_bundles.py#L250-L263 | train | 251,517 |
HewlettPackard/python-hpOneView | hpOneView/image_streamer/resources/artifact_bundles.py | ArtifactBundles.extract_bundle | def extract_bundle(self, resource, timeout=-1):
"""
Extracts the existing bundle on the appliance and creates all the artifacts.
Args:
resource (dict): Artifact Bundle to extract.
timeout:
Timeout in seconds. Waits for task completion by default. The timeout does not abort the operation in
OneView, it just stops waiting for its completion.
Returns:
dict: The Artifact Bundle.
"""
return self._client.update(resource, timeout=timeout, custom_headers={"Content-Type": "text/plain"}) | python | def extract_bundle(self, resource, timeout=-1):
"""
Extracts the existing bundle on the appliance and creates all the artifacts.
Args:
resource (dict): Artifact Bundle to extract.
timeout:
Timeout in seconds. Waits for task completion by default. The timeout does not abort the operation in
OneView, it just stops waiting for its completion.
Returns:
dict: The Artifact Bundle.
"""
return self._client.update(resource, timeout=timeout, custom_headers={"Content-Type": "text/plain"}) | [
"def",
"extract_bundle",
"(",
"self",
",",
"resource",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"return",
"self",
".",
"_client",
".",
"update",
"(",
"resource",
",",
"timeout",
"=",
"timeout",
",",
"custom_headers",
"=",
"{",
"\"Content-Type\"",
":",
"\"text/plain\"",
"}",
")"
] | Extracts the existing bundle on the appliance and creates all the artifacts.
Args:
resource (dict): Artifact Bundle to extract.
timeout:
Timeout in seconds. Waits for task completion by default. The timeout does not abort the operation in
OneView, it just stops waiting for its completion.
Returns:
dict: The Artifact Bundle. | [
"Extracts",
"the",
"existing",
"bundle",
"on",
"the",
"appliance",
"and",
"creates",
"all",
"the",
"artifacts",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/resources/artifact_bundles.py#L265-L278 | train | 251,518 |
HewlettPackard/python-hpOneView | hpOneView/image_streamer/resources/artifact_bundles.py | ArtifactBundles.extract_backup_bundle | def extract_backup_bundle(self, resource, timeout=-1):
"""
Extracts the existing backup bundle on the appliance and creates all the artifacts.
Args:
resource (dict): Deployment Group to extract.
timeout:
Timeout in seconds. Waits for task completion by default. The timeout does not abort the operation in
OneView, it just stops waiting for its completion.
Returns:
dict: A Deployment Group associated with the Artifact Bundle backup.
"""
return self._client.update(resource, uri=self.BACKUP_ARCHIVE_PATH, timeout=timeout) | python | def extract_backup_bundle(self, resource, timeout=-1):
"""
Extracts the existing backup bundle on the appliance and creates all the artifacts.
Args:
resource (dict): Deployment Group to extract.
timeout:
Timeout in seconds. Waits for task completion by default. The timeout does not abort the operation in
OneView, it just stops waiting for its completion.
Returns:
dict: A Deployment Group associated with the Artifact Bundle backup.
"""
return self._client.update(resource, uri=self.BACKUP_ARCHIVE_PATH, timeout=timeout) | [
"def",
"extract_backup_bundle",
"(",
"self",
",",
"resource",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"return",
"self",
".",
"_client",
".",
"update",
"(",
"resource",
",",
"uri",
"=",
"self",
".",
"BACKUP_ARCHIVE_PATH",
",",
"timeout",
"=",
"timeout",
")"
] | Extracts the existing backup bundle on the appliance and creates all the artifacts.
Args:
resource (dict): Deployment Group to extract.
timeout:
Timeout in seconds. Waits for task completion by default. The timeout does not abort the operation in
OneView, it just stops waiting for its completion.
Returns:
dict: A Deployment Group associated with the Artifact Bundle backup. | [
"Extracts",
"the",
"existing",
"backup",
"bundle",
"on",
"the",
"appliance",
"and",
"creates",
"all",
"the",
"artifacts",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/resources/artifact_bundles.py#L280-L293 | train | 251,519 |
HewlettPackard/python-hpOneView | hpOneView/image_streamer/resources/artifact_bundles.py | ArtifactBundles.stop_artifact_creation | def stop_artifact_creation(self, id_or_uri, task_uri):
"""
Stops creation of the selected Artifact Bundle.
Args:
id_or_uri: ID or URI of the Artifact Bundle.
task_uri: Task URI associated with the Artifact Bundle.
Returns:
string:
"""
data = {
"taskUri": task_uri
}
uri = self.URI + '/' + extract_id_from_uri(id_or_uri) + self.STOP_CREATION_PATH
return self._client.update(data, uri=uri) | python | def stop_artifact_creation(self, id_or_uri, task_uri):
"""
Stops creation of the selected Artifact Bundle.
Args:
id_or_uri: ID or URI of the Artifact Bundle.
task_uri: Task URI associated with the Artifact Bundle.
Returns:
string:
"""
data = {
"taskUri": task_uri
}
uri = self.URI + '/' + extract_id_from_uri(id_or_uri) + self.STOP_CREATION_PATH
return self._client.update(data, uri=uri) | [
"def",
"stop_artifact_creation",
"(",
"self",
",",
"id_or_uri",
",",
"task_uri",
")",
":",
"data",
"=",
"{",
"\"taskUri\"",
":",
"task_uri",
"}",
"uri",
"=",
"self",
".",
"URI",
"+",
"'/'",
"+",
"extract_id_from_uri",
"(",
"id_or_uri",
")",
"+",
"self",
".",
"STOP_CREATION_PATH",
"return",
"self",
".",
"_client",
".",
"update",
"(",
"data",
",",
"uri",
"=",
"uri",
")"
] | Stops creation of the selected Artifact Bundle.
Args:
id_or_uri: ID or URI of the Artifact Bundle.
task_uri: Task URI associated with the Artifact Bundle.
Returns:
string: | [
"Stops",
"creation",
"of",
"the",
"selected",
"Artifact",
"Bundle",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/resources/artifact_bundles.py#L295-L312 | train | 251,520 |
HewlettPackard/python-hpOneView | hpOneView/resources/servers/logical_enclosures.py | LogicalEnclosures.get_script | def get_script(self):
"""
Gets the configuration script of the logical enclosure by ID or URI.
Return:
str: Configuration script.
"""
uri = "{}/script".format(self.data["uri"])
return self._helper.do_get(uri) | python | def get_script(self):
"""
Gets the configuration script of the logical enclosure by ID or URI.
Return:
str: Configuration script.
"""
uri = "{}/script".format(self.data["uri"])
return self._helper.do_get(uri) | [
"def",
"get_script",
"(",
"self",
")",
":",
"uri",
"=",
"\"{}/script\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
")",
"return",
"self",
".",
"_helper",
".",
"do_get",
"(",
"uri",
")"
] | Gets the configuration script of the logical enclosure by ID or URI.
Return:
str: Configuration script. | [
"Gets",
"the",
"configuration",
"script",
"of",
"the",
"logical",
"enclosure",
"by",
"ID",
"or",
"URI",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/logical_enclosures.py#L97-L105 | train | 251,521 |
HewlettPackard/python-hpOneView | hpOneView/resources/servers/logical_enclosures.py | LogicalEnclosures.update_script | def update_script(self, information, timeout=-1):
"""
Updates the configuration script of the logical enclosure and on all enclosures in the logical enclosure with
the specified ID.
Args:
information: Updated script.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Return:
Configuration script.
"""
uri = "{}/script".format(self.data["uri"])
return self._helper.update(information, uri=uri, timeout=timeout) | python | def update_script(self, information, timeout=-1):
"""
Updates the configuration script of the logical enclosure and on all enclosures in the logical enclosure with
the specified ID.
Args:
information: Updated script.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Return:
Configuration script.
"""
uri = "{}/script".format(self.data["uri"])
return self._helper.update(information, uri=uri, timeout=timeout) | [
"def",
"update_script",
"(",
"self",
",",
"information",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"\"{}/script\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
")",
"return",
"self",
".",
"_helper",
".",
"update",
"(",
"information",
",",
"uri",
"=",
"uri",
",",
"timeout",
"=",
"timeout",
")"
] | Updates the configuration script of the logical enclosure and on all enclosures in the logical enclosure with
the specified ID.
Args:
information: Updated script.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Return:
Configuration script. | [
"Updates",
"the",
"configuration",
"script",
"of",
"the",
"logical",
"enclosure",
"and",
"on",
"all",
"enclosures",
"in",
"the",
"logical",
"enclosure",
"with",
"the",
"specified",
"ID",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/logical_enclosures.py#L108-L122 | train | 251,522 |
HewlettPackard/python-hpOneView | hpOneView/resources/servers/logical_enclosures.py | LogicalEnclosures.generate_support_dump | def generate_support_dump(self, information, timeout=-1):
"""
Generates a support dump for the logical enclosure with the specified ID. A logical enclosure support dump
includes content for logical interconnects associated with that logical enclosure. By default, it also contains
appliance support dump content.
Args:
information (dict): Information to generate support dump.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Support dump.
"""
uri = "{}/support-dumps".format(self.data["uri"])
return self._helper.create(information, uri=uri, timeout=timeout) | python | def generate_support_dump(self, information, timeout=-1):
"""
Generates a support dump for the logical enclosure with the specified ID. A logical enclosure support dump
includes content for logical interconnects associated with that logical enclosure. By default, it also contains
appliance support dump content.
Args:
information (dict): Information to generate support dump.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Support dump.
"""
uri = "{}/support-dumps".format(self.data["uri"])
return self._helper.create(information, uri=uri, timeout=timeout) | [
"def",
"generate_support_dump",
"(",
"self",
",",
"information",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"\"{}/support-dumps\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
")",
"return",
"self",
".",
"_helper",
".",
"create",
"(",
"information",
",",
"uri",
"=",
"uri",
",",
"timeout",
"=",
"timeout",
")"
] | Generates a support dump for the logical enclosure with the specified ID. A logical enclosure support dump
includes content for logical interconnects associated with that logical enclosure. By default, it also contains
appliance support dump content.
Args:
information (dict): Information to generate support dump.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Support dump. | [
"Generates",
"a",
"support",
"dump",
"for",
"the",
"logical",
"enclosure",
"with",
"the",
"specified",
"ID",
".",
"A",
"logical",
"enclosure",
"support",
"dump",
"includes",
"content",
"for",
"logical",
"interconnects",
"associated",
"with",
"that",
"logical",
"enclosure",
".",
"By",
"default",
"it",
"also",
"contains",
"appliance",
"support",
"dump",
"content",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/logical_enclosures.py#L125-L140 | train | 251,523 |
HewlettPackard/python-hpOneView | hpOneView/resources/servers/logical_enclosures.py | LogicalEnclosures.update_from_group | def update_from_group(self, data=None, timeout=-1):
"""
Use this action to make a logical enclosure consistent with the enclosure group when the logical enclosure is
in the Inconsistent state.
Args:
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Logical enclosure.
"""
uri = "{}/updateFromGroup".format(self.data["uri"])
return self._helper.update(data, uri, timeout=timeout) | python | def update_from_group(self, data=None, timeout=-1):
"""
Use this action to make a logical enclosure consistent with the enclosure group when the logical enclosure is
in the Inconsistent state.
Args:
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Logical enclosure.
"""
uri = "{}/updateFromGroup".format(self.data["uri"])
return self._helper.update(data, uri, timeout=timeout) | [
"def",
"update_from_group",
"(",
"self",
",",
"data",
"=",
"None",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"\"{}/updateFromGroup\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
")",
"return",
"self",
".",
"_helper",
".",
"update",
"(",
"data",
",",
"uri",
",",
"timeout",
"=",
"timeout",
")"
] | Use this action to make a logical enclosure consistent with the enclosure group when the logical enclosure is
in the Inconsistent state.
Args:
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Logical enclosure. | [
"Use",
"this",
"action",
"to",
"make",
"a",
"logical",
"enclosure",
"consistent",
"with",
"the",
"enclosure",
"group",
"when",
"the",
"logical",
"enclosure",
"is",
"in",
"the",
"Inconsistent",
"state",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/logical_enclosures.py#L143-L156 | train | 251,524 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/ethernet_networks.py | EthernetNetworks.create_bulk | def create_bulk(self, resource, timeout=-1):
"""
Creates bulk Ethernet networks.
Args:
resource (dict): Specifications to create in bulk.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
list: List of created Ethernet Networks.
"""
uri = self.URI + '/bulk'
default_values = self._get_default_values(self.BULK_DEFAULT_VALUES)
updated_data = self._helper.update_resource_fields(resource, default_values)
self._helper.create(updated_data, uri=uri, timeout=timeout)
return self.get_range(resource['namePrefix'], resource['vlanIdRange']) | python | def create_bulk(self, resource, timeout=-1):
"""
Creates bulk Ethernet networks.
Args:
resource (dict): Specifications to create in bulk.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
list: List of created Ethernet Networks.
"""
uri = self.URI + '/bulk'
default_values = self._get_default_values(self.BULK_DEFAULT_VALUES)
updated_data = self._helper.update_resource_fields(resource, default_values)
self._helper.create(updated_data, uri=uri, timeout=timeout)
return self.get_range(resource['namePrefix'], resource['vlanIdRange']) | [
"def",
"create_bulk",
"(",
"self",
",",
"resource",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"self",
".",
"URI",
"+",
"'/bulk'",
"default_values",
"=",
"self",
".",
"_get_default_values",
"(",
"self",
".",
"BULK_DEFAULT_VALUES",
")",
"updated_data",
"=",
"self",
".",
"_helper",
".",
"update_resource_fields",
"(",
"resource",
",",
"default_values",
")",
"self",
".",
"_helper",
".",
"create",
"(",
"updated_data",
",",
"uri",
"=",
"uri",
",",
"timeout",
"=",
"timeout",
")",
"return",
"self",
".",
"get_range",
"(",
"resource",
"[",
"'namePrefix'",
"]",
",",
"resource",
"[",
"'vlanIdRange'",
"]",
")"
] | Creates bulk Ethernet networks.
Args:
resource (dict): Specifications to create in bulk.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
list: List of created Ethernet Networks. | [
"Creates",
"bulk",
"Ethernet",
"networks",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/ethernet_networks.py#L63-L83 | train | 251,525 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/ethernet_networks.py | EthernetNetworks.get_range | def get_range(self, name_prefix, vlan_id_range):
"""
Gets a list of Ethernet Networks that match the 'given name_prefix' and the 'vlan_id_range'.
Examples:
>>> enet.get_range('Enet_name', '1-2,5')
# The result contains the ethernet network with names:
['Enet_name_1', 'Enet_name_2', 'Enet_name_5']
>>> enet.get_range('Enet_name', '2')
# The result contains the ethernet network with names:
['Enet_name_1', 'Enet_name_2']
Args:
name_prefix: The Ethernet Network prefix
vlan_id_range: A combination of values or ranges to be retrieved. For example, '1-10,50,51,500-700'.
Returns:
list: A list of Ethernet Networks.
"""
filter = '"\'name\' matches \'{}\_%\'"'.format(name_prefix)
ethernet_networks = self.get_all(filter=filter, sort='vlanId:ascending')
vlan_ids = self.dissociate_values_or_ranges(vlan_id_range)
for net in ethernet_networks[:]:
if int(net['vlanId']) not in vlan_ids:
ethernet_networks.remove(net)
return ethernet_networks | python | def get_range(self, name_prefix, vlan_id_range):
"""
Gets a list of Ethernet Networks that match the 'given name_prefix' and the 'vlan_id_range'.
Examples:
>>> enet.get_range('Enet_name', '1-2,5')
# The result contains the ethernet network with names:
['Enet_name_1', 'Enet_name_2', 'Enet_name_5']
>>> enet.get_range('Enet_name', '2')
# The result contains the ethernet network with names:
['Enet_name_1', 'Enet_name_2']
Args:
name_prefix: The Ethernet Network prefix
vlan_id_range: A combination of values or ranges to be retrieved. For example, '1-10,50,51,500-700'.
Returns:
list: A list of Ethernet Networks.
"""
filter = '"\'name\' matches \'{}\_%\'"'.format(name_prefix)
ethernet_networks = self.get_all(filter=filter, sort='vlanId:ascending')
vlan_ids = self.dissociate_values_or_ranges(vlan_id_range)
for net in ethernet_networks[:]:
if int(net['vlanId']) not in vlan_ids:
ethernet_networks.remove(net)
return ethernet_networks | [
"def",
"get_range",
"(",
"self",
",",
"name_prefix",
",",
"vlan_id_range",
")",
":",
"filter",
"=",
"'\"\\'name\\' matches \\'{}\\_%\\'\"'",
".",
"format",
"(",
"name_prefix",
")",
"ethernet_networks",
"=",
"self",
".",
"get_all",
"(",
"filter",
"=",
"filter",
",",
"sort",
"=",
"'vlanId:ascending'",
")",
"vlan_ids",
"=",
"self",
".",
"dissociate_values_or_ranges",
"(",
"vlan_id_range",
")",
"for",
"net",
"in",
"ethernet_networks",
"[",
":",
"]",
":",
"if",
"int",
"(",
"net",
"[",
"'vlanId'",
"]",
")",
"not",
"in",
"vlan_ids",
":",
"ethernet_networks",
".",
"remove",
"(",
"net",
")",
"return",
"ethernet_networks"
] | Gets a list of Ethernet Networks that match the 'given name_prefix' and the 'vlan_id_range'.
Examples:
>>> enet.get_range('Enet_name', '1-2,5')
# The result contains the ethernet network with names:
['Enet_name_1', 'Enet_name_2', 'Enet_name_5']
>>> enet.get_range('Enet_name', '2')
# The result contains the ethernet network with names:
['Enet_name_1', 'Enet_name_2']
Args:
name_prefix: The Ethernet Network prefix
vlan_id_range: A combination of values or ranges to be retrieved. For example, '1-10,50,51,500-700'.
Returns:
list: A list of Ethernet Networks. | [
"Gets",
"a",
"list",
"of",
"Ethernet",
"Networks",
"that",
"match",
"the",
"given",
"name_prefix",
"and",
"the",
"vlan_id_range",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/ethernet_networks.py#L85-L114 | train | 251,526 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/ethernet_networks.py | EthernetNetworks.get_associated_profiles | def get_associated_profiles(self):
"""
Gets the URIs of profiles which are using an Ethernet network.
Args:
id_or_uri: Can be either the logical interconnect group id or the logical interconnect group uri
Returns:
list: URIs of the associated profiles.
"""
uri = "{}/associatedProfiles".format(self.data['uri'])
return self._helper.do_get(uri) | python | def get_associated_profiles(self):
"""
Gets the URIs of profiles which are using an Ethernet network.
Args:
id_or_uri: Can be either the logical interconnect group id or the logical interconnect group uri
Returns:
list: URIs of the associated profiles.
"""
uri = "{}/associatedProfiles".format(self.data['uri'])
return self._helper.do_get(uri) | [
"def",
"get_associated_profiles",
"(",
"self",
")",
":",
"uri",
"=",
"\"{}/associatedProfiles\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"'uri'",
"]",
")",
"return",
"self",
".",
"_helper",
".",
"do_get",
"(",
"uri",
")"
] | Gets the URIs of profiles which are using an Ethernet network.
Args:
id_or_uri: Can be either the logical interconnect group id or the logical interconnect group uri
Returns:
list: URIs of the associated profiles. | [
"Gets",
"the",
"URIs",
"of",
"profiles",
"which",
"are",
"using",
"an",
"Ethernet",
"network",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/ethernet_networks.py#L154-L166 | train | 251,527 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/ethernet_networks.py | EthernetNetworks.get_associated_uplink_groups | def get_associated_uplink_groups(self):
"""
Gets the uplink sets which are using an Ethernet network.
Returns:
list: URIs of the associated uplink sets.
"""
uri = "{}/associatedUplinkGroups".format(self.data['uri'])
return self._helper.do_get(uri) | python | def get_associated_uplink_groups(self):
"""
Gets the uplink sets which are using an Ethernet network.
Returns:
list: URIs of the associated uplink sets.
"""
uri = "{}/associatedUplinkGroups".format(self.data['uri'])
return self._helper.do_get(uri) | [
"def",
"get_associated_uplink_groups",
"(",
"self",
")",
":",
"uri",
"=",
"\"{}/associatedUplinkGroups\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"'uri'",
"]",
")",
"return",
"self",
".",
"_helper",
".",
"do_get",
"(",
"uri",
")"
] | Gets the uplink sets which are using an Ethernet network.
Returns:
list: URIs of the associated uplink sets. | [
"Gets",
"the",
"uplink",
"sets",
"which",
"are",
"using",
"an",
"Ethernet",
"network",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/ethernet_networks.py#L169-L178 | train | 251,528 |
HewlettPackard/python-hpOneView | hpOneView/resources/resource.py | merge_resources | def merge_resources(resource1, resource2):
"""
Updates a copy of resource1 with resource2 values and returns the merged dictionary.
Args:
resource1: original resource
resource2: resource to update resource1
Returns:
dict: merged resource
"""
merged = resource1.copy()
merged.update(resource2)
return merged | python | def merge_resources(resource1, resource2):
"""
Updates a copy of resource1 with resource2 values and returns the merged dictionary.
Args:
resource1: original resource
resource2: resource to update resource1
Returns:
dict: merged resource
"""
merged = resource1.copy()
merged.update(resource2)
return merged | [
"def",
"merge_resources",
"(",
"resource1",
",",
"resource2",
")",
":",
"merged",
"=",
"resource1",
".",
"copy",
"(",
")",
"merged",
".",
"update",
"(",
"resource2",
")",
"return",
"merged"
] | Updates a copy of resource1 with resource2 values and returns the merged dictionary.
Args:
resource1: original resource
resource2: resource to update resource1
Returns:
dict: merged resource | [
"Updates",
"a",
"copy",
"of",
"resource1",
"with",
"resource2",
"values",
"and",
"returns",
"the",
"merged",
"dictionary",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L1737-L1750 | train | 251,529 |
HewlettPackard/python-hpOneView | hpOneView/resources/resource.py | merge_default_values | def merge_default_values(resource_list, default_values):
"""
Generate a new list where each item of original resource_list will be merged with the default_values.
Args:
resource_list: list with items to be merged
default_values: properties to be merged with each item list. If the item already contains some property
the original value will be maintained.
Returns:
list: list containing each item merged with default_values
"""
def merge_item(resource):
return merge_resources(default_values, resource)
return lmap(merge_item, resource_list) | python | def merge_default_values(resource_list, default_values):
"""
Generate a new list where each item of original resource_list will be merged with the default_values.
Args:
resource_list: list with items to be merged
default_values: properties to be merged with each item list. If the item already contains some property
the original value will be maintained.
Returns:
list: list containing each item merged with default_values
"""
def merge_item(resource):
return merge_resources(default_values, resource)
return lmap(merge_item, resource_list) | [
"def",
"merge_default_values",
"(",
"resource_list",
",",
"default_values",
")",
":",
"def",
"merge_item",
"(",
"resource",
")",
":",
"return",
"merge_resources",
"(",
"default_values",
",",
"resource",
")",
"return",
"lmap",
"(",
"merge_item",
",",
"resource_list",
")"
] | Generate a new list where each item of original resource_list will be merged with the default_values.
Args:
resource_list: list with items to be merged
default_values: properties to be merged with each item list. If the item already contains some property
the original value will be maintained.
Returns:
list: list containing each item merged with default_values | [
"Generate",
"a",
"new",
"list",
"where",
"each",
"item",
"of",
"original",
"resource_list",
"will",
"be",
"merged",
"with",
"the",
"default_values",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L1753-L1769 | train | 251,530 |
HewlettPackard/python-hpOneView | hpOneView/resources/resource.py | Resource.ensure_resource_data | def ensure_resource_data(self, update_data=False):
"""Retrieves data from OneView and updates resource object.
Args:
update_data: Flag to update resource data when it is required.
"""
# Check for unique identifier in the resource data
if not any(key in self.data for key in self.UNIQUE_IDENTIFIERS):
raise exceptions.HPOneViewMissingUniqueIdentifiers(MISSING_UNIQUE_IDENTIFIERS)
# Returns if data update is not required
if not update_data:
return
resource_data = None
if 'uri' in self.UNIQUE_IDENTIFIERS and self.data.get('uri'):
resource_data = self._helper.do_get(self.data['uri'])
else:
for identifier in self.UNIQUE_IDENTIFIERS:
identifier_value = self.data.get(identifier)
if identifier_value:
result = self.get_by(identifier, identifier_value)
if result and isinstance(result, list):
resource_data = result[0]
break
if resource_data:
self.data.update(resource_data)
else:
raise exceptions.HPOneViewResourceNotFound(RESOURCE_DOES_NOT_EXIST) | python | def ensure_resource_data(self, update_data=False):
"""Retrieves data from OneView and updates resource object.
Args:
update_data: Flag to update resource data when it is required.
"""
# Check for unique identifier in the resource data
if not any(key in self.data for key in self.UNIQUE_IDENTIFIERS):
raise exceptions.HPOneViewMissingUniqueIdentifiers(MISSING_UNIQUE_IDENTIFIERS)
# Returns if data update is not required
if not update_data:
return
resource_data = None
if 'uri' in self.UNIQUE_IDENTIFIERS and self.data.get('uri'):
resource_data = self._helper.do_get(self.data['uri'])
else:
for identifier in self.UNIQUE_IDENTIFIERS:
identifier_value = self.data.get(identifier)
if identifier_value:
result = self.get_by(identifier, identifier_value)
if result and isinstance(result, list):
resource_data = result[0]
break
if resource_data:
self.data.update(resource_data)
else:
raise exceptions.HPOneViewResourceNotFound(RESOURCE_DOES_NOT_EXIST) | [
"def",
"ensure_resource_data",
"(",
"self",
",",
"update_data",
"=",
"False",
")",
":",
"# Check for unique identifier in the resource data",
"if",
"not",
"any",
"(",
"key",
"in",
"self",
".",
"data",
"for",
"key",
"in",
"self",
".",
"UNIQUE_IDENTIFIERS",
")",
":",
"raise",
"exceptions",
".",
"HPOneViewMissingUniqueIdentifiers",
"(",
"MISSING_UNIQUE_IDENTIFIERS",
")",
"# Returns if data update is not required",
"if",
"not",
"update_data",
":",
"return",
"resource_data",
"=",
"None",
"if",
"'uri'",
"in",
"self",
".",
"UNIQUE_IDENTIFIERS",
"and",
"self",
".",
"data",
".",
"get",
"(",
"'uri'",
")",
":",
"resource_data",
"=",
"self",
".",
"_helper",
".",
"do_get",
"(",
"self",
".",
"data",
"[",
"'uri'",
"]",
")",
"else",
":",
"for",
"identifier",
"in",
"self",
".",
"UNIQUE_IDENTIFIERS",
":",
"identifier_value",
"=",
"self",
".",
"data",
".",
"get",
"(",
"identifier",
")",
"if",
"identifier_value",
":",
"result",
"=",
"self",
".",
"get_by",
"(",
"identifier",
",",
"identifier_value",
")",
"if",
"result",
"and",
"isinstance",
"(",
"result",
",",
"list",
")",
":",
"resource_data",
"=",
"result",
"[",
"0",
"]",
"break",
"if",
"resource_data",
":",
"self",
".",
"data",
".",
"update",
"(",
"resource_data",
")",
"else",
":",
"raise",
"exceptions",
".",
"HPOneViewResourceNotFound",
"(",
"RESOURCE_DOES_NOT_EXIST",
")"
] | Retrieves data from OneView and updates resource object.
Args:
update_data: Flag to update resource data when it is required. | [
"Retrieves",
"data",
"from",
"OneView",
"and",
"updates",
"resource",
"object",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L110-L141 | train | 251,531 |
HewlettPackard/python-hpOneView | hpOneView/resources/resource.py | Resource.get_by | def get_by(self, field, value):
"""Get the resource by passing a field and its value.
Note:
This function uses get_all passing a filter.The search is case-insensitive.
Args:
field: Field name to filter.
value: Value to filter.
Returns:
dict
"""
if not field:
logger.exception(RESOURCE_CLIENT_INVALID_FIELD)
raise ValueError(RESOURCE_CLIENT_INVALID_FIELD)
filter = "\"{0}='{1}'\"".format(field, value)
results = self.get_all(filter=filter)
# Workaround when the OneView filter does not work, it will filter again
if "." not in field:
# This filter only work for the first level
results = [item for item in results if str(item.get(field, "")).lower() == value.lower()]
return results | python | def get_by(self, field, value):
"""Get the resource by passing a field and its value.
Note:
This function uses get_all passing a filter.The search is case-insensitive.
Args:
field: Field name to filter.
value: Value to filter.
Returns:
dict
"""
if not field:
logger.exception(RESOURCE_CLIENT_INVALID_FIELD)
raise ValueError(RESOURCE_CLIENT_INVALID_FIELD)
filter = "\"{0}='{1}'\"".format(field, value)
results = self.get_all(filter=filter)
# Workaround when the OneView filter does not work, it will filter again
if "." not in field:
# This filter only work for the first level
results = [item for item in results if str(item.get(field, "")).lower() == value.lower()]
return results | [
"def",
"get_by",
"(",
"self",
",",
"field",
",",
"value",
")",
":",
"if",
"not",
"field",
":",
"logger",
".",
"exception",
"(",
"RESOURCE_CLIENT_INVALID_FIELD",
")",
"raise",
"ValueError",
"(",
"RESOURCE_CLIENT_INVALID_FIELD",
")",
"filter",
"=",
"\"\\\"{0}='{1}'\\\"\"",
".",
"format",
"(",
"field",
",",
"value",
")",
"results",
"=",
"self",
".",
"get_all",
"(",
"filter",
"=",
"filter",
")",
"# Workaround when the OneView filter does not work, it will filter again",
"if",
"\".\"",
"not",
"in",
"field",
":",
"# This filter only work for the first level",
"results",
"=",
"[",
"item",
"for",
"item",
"in",
"results",
"if",
"str",
"(",
"item",
".",
"get",
"(",
"field",
",",
"\"\"",
")",
")",
".",
"lower",
"(",
")",
"==",
"value",
".",
"lower",
"(",
")",
"]",
"return",
"results"
] | Get the resource by passing a field and its value.
Note:
This function uses get_all passing a filter.The search is case-insensitive.
Args:
field: Field name to filter.
value: Value to filter.
Returns:
dict | [
"Get",
"the",
"resource",
"by",
"passing",
"a",
"field",
"and",
"its",
"value",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L234-L259 | train | 251,532 |
HewlettPackard/python-hpOneView | hpOneView/resources/resource.py | Resource.get_by_name | def get_by_name(self, name):
"""Retrieves a resource by its name.
Args:
name: Resource name.
Returns:
Resource object or None if resource does not exist.
"""
result = self.get_by("name", name)
if result:
data = result[0]
new_resource = self.new(self._connection, data)
else:
new_resource = None
return new_resource | python | def get_by_name(self, name):
"""Retrieves a resource by its name.
Args:
name: Resource name.
Returns:
Resource object or None if resource does not exist.
"""
result = self.get_by("name", name)
if result:
data = result[0]
new_resource = self.new(self._connection, data)
else:
new_resource = None
return new_resource | [
"def",
"get_by_name",
"(",
"self",
",",
"name",
")",
":",
"result",
"=",
"self",
".",
"get_by",
"(",
"\"name\"",
",",
"name",
")",
"if",
"result",
":",
"data",
"=",
"result",
"[",
"0",
"]",
"new_resource",
"=",
"self",
".",
"new",
"(",
"self",
".",
"_connection",
",",
"data",
")",
"else",
":",
"new_resource",
"=",
"None",
"return",
"new_resource"
] | Retrieves a resource by its name.
Args:
name: Resource name.
Returns:
Resource object or None if resource does not exist. | [
"Retrieves",
"a",
"resource",
"by",
"its",
"name",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L261-L278 | train | 251,533 |
HewlettPackard/python-hpOneView | hpOneView/resources/resource.py | Resource.get_by_uri | def get_by_uri(self, uri):
"""Retrieves a resource by its URI
Args:
uri: URI of the resource
Returns:
Resource object
"""
self._helper.validate_resource_uri(uri)
data = self._helper.do_get(uri)
if data:
new_resource = self.new(self._connection, data)
else:
new_resource = None
return new_resource | python | def get_by_uri(self, uri):
"""Retrieves a resource by its URI
Args:
uri: URI of the resource
Returns:
Resource object
"""
self._helper.validate_resource_uri(uri)
data = self._helper.do_get(uri)
if data:
new_resource = self.new(self._connection, data)
else:
new_resource = None
return new_resource | [
"def",
"get_by_uri",
"(",
"self",
",",
"uri",
")",
":",
"self",
".",
"_helper",
".",
"validate_resource_uri",
"(",
"uri",
")",
"data",
"=",
"self",
".",
"_helper",
".",
"do_get",
"(",
"uri",
")",
"if",
"data",
":",
"new_resource",
"=",
"self",
".",
"new",
"(",
"self",
".",
"_connection",
",",
"data",
")",
"else",
":",
"new_resource",
"=",
"None",
"return",
"new_resource"
] | Retrieves a resource by its URI
Args:
uri: URI of the resource
Returns:
Resource object | [
"Retrieves",
"a",
"resource",
"by",
"its",
"URI"
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L280-L297 | train | 251,534 |
HewlettPackard/python-hpOneView | hpOneView/resources/resource.py | Resource._get_default_values | def _get_default_values(self, default_values=None):
"""Gets the default values set for a resource"""
if not default_values:
default_values = self.DEFAULT_VALUES
if default_values:
api_version = str(self._connection._apiVersion)
values = default_values.get(api_version, {}).copy()
else:
values = {}
return values | python | def _get_default_values(self, default_values=None):
"""Gets the default values set for a resource"""
if not default_values:
default_values = self.DEFAULT_VALUES
if default_values:
api_version = str(self._connection._apiVersion)
values = default_values.get(api_version, {}).copy()
else:
values = {}
return values | [
"def",
"_get_default_values",
"(",
"self",
",",
"default_values",
"=",
"None",
")",
":",
"if",
"not",
"default_values",
":",
"default_values",
"=",
"self",
".",
"DEFAULT_VALUES",
"if",
"default_values",
":",
"api_version",
"=",
"str",
"(",
"self",
".",
"_connection",
".",
"_apiVersion",
")",
"values",
"=",
"default_values",
".",
"get",
"(",
"api_version",
",",
"{",
"}",
")",
".",
"copy",
"(",
")",
"else",
":",
"values",
"=",
"{",
"}",
"return",
"values"
] | Gets the default values set for a resource | [
"Gets",
"the",
"default",
"values",
"set",
"for",
"a",
"resource"
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L299-L311 | train | 251,535 |
HewlettPackard/python-hpOneView | hpOneView/resources/resource.py | Resource._merge_default_values | def _merge_default_values(self):
"""Merge default values with resource data."""
values = self._get_default_values()
for key, value in values.items():
if not self.data.get(key):
self.data[key] = value | python | def _merge_default_values(self):
"""Merge default values with resource data."""
values = self._get_default_values()
for key, value in values.items():
if not self.data.get(key):
self.data[key] = value | [
"def",
"_merge_default_values",
"(",
"self",
")",
":",
"values",
"=",
"self",
".",
"_get_default_values",
"(",
")",
"for",
"key",
",",
"value",
"in",
"values",
".",
"items",
"(",
")",
":",
"if",
"not",
"self",
".",
"data",
".",
"get",
"(",
"key",
")",
":",
"self",
".",
"data",
"[",
"key",
"]",
"=",
"value"
] | Merge default values with resource data. | [
"Merge",
"default",
"values",
"with",
"resource",
"data",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L313-L318 | train | 251,536 |
HewlettPackard/python-hpOneView | hpOneView/resources/resource.py | ResourceHelper.create_report | def create_report(self, uri, timeout=-1):
"""
Creates a report and returns the output.
Args:
uri: URI
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
list:
"""
logger.debug('Creating Report (uri = %s)'.format(uri))
task, _ = self._connection.post(uri, {})
if not task:
raise exceptions.HPOneViewException(RESOURCE_CLIENT_TASK_EXPECTED)
task = self._task_monitor.get_completed_task(task, timeout)
return task['taskOutput'] | python | def create_report(self, uri, timeout=-1):
"""
Creates a report and returns the output.
Args:
uri: URI
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
list:
"""
logger.debug('Creating Report (uri = %s)'.format(uri))
task, _ = self._connection.post(uri, {})
if not task:
raise exceptions.HPOneViewException(RESOURCE_CLIENT_TASK_EXPECTED)
task = self._task_monitor.get_completed_task(task, timeout)
return task['taskOutput'] | [
"def",
"create_report",
"(",
"self",
",",
"uri",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"logger",
".",
"debug",
"(",
"'Creating Report (uri = %s)'",
".",
"format",
"(",
"uri",
")",
")",
"task",
",",
"_",
"=",
"self",
".",
"_connection",
".",
"post",
"(",
"uri",
",",
"{",
"}",
")",
"if",
"not",
"task",
":",
"raise",
"exceptions",
".",
"HPOneViewException",
"(",
"RESOURCE_CLIENT_TASK_EXPECTED",
")",
"task",
"=",
"self",
".",
"_task_monitor",
".",
"get_completed_task",
"(",
"task",
",",
"timeout",
")",
"return",
"task",
"[",
"'taskOutput'",
"]"
] | Creates a report and returns the output.
Args:
uri: URI
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
list: | [
"Creates",
"a",
"report",
"and",
"returns",
"the",
"output",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L471-L492 | train | 251,537 |
HewlettPackard/python-hpOneView | hpOneView/resources/resource.py | ResourceHelper.build_query_uri | def build_query_uri(self, uri=None, start=0, count=-1, filter='', query='', sort='', view='', fields='', scope_uris=''):
"""Builds the URI from given parameters.
More than one request can be send to get the items, regardless the query parameter 'count', because the actual
number of items in the response might differ from the requested count. Some types of resource have a limited
number of items returned on each call. For those resources, additional calls are made to the API to retrieve
any other items matching the given filter. The actual number of items can also differ from the requested call
if the requested number of items would take too long.
The use of optional parameters for OneView 2.0 is described at:
http://h17007.www1.hpe.com/docs/enterprise/servers/oneview2.0/cic-api/en/api-docs/current/index.html
Note:
Single quote - "'" - inside a query parameter is not supported by OneView API.
Args:
start: The first item to return, using 0-based indexing.
If not specified, the default is 0 - start with the first available item.
count: The number of resources to return. A count of -1 requests all items (default).
filter (list or str): A general filter/query string to narrow the list of items returned. The default is no
filter; all resources are returned.
query: A single query parameter can do what would take multiple parameters or multiple GET requests using
filter. Use query for more complex queries. NOTE: This parameter is experimental for OneView 2.0.
sort: The sort order of the returned data set. By default, the sort order is based on create time with the
oldest entry first.
view: Returns a specific subset of the attributes of the resource or collection by specifying the name of a
predefined view. The default view is expand (show all attributes of the resource and all elements of
the collections or resources).
fields: Name of the fields.
uri: A specific URI (optional)
scope_uris: An expression to restrict the resources returned according to the scopes to
which they are assigned.
Returns:
uri: The complete uri
"""
if filter:
filter = self.make_query_filter(filter)
if query:
query = "&query=" + quote(query)
if sort:
sort = "&sort=" + quote(sort)
if view:
view = "&view=" + quote(view)
if fields:
fields = "&fields=" + quote(fields)
if scope_uris:
scope_uris = "&scopeUris=" + quote(scope_uris)
path = uri if uri else self._base_uri
self.validate_resource_uri(path)
symbol = '?' if '?' not in path else '&'
uri = "{0}{1}start={2}&count={3}{4}{5}{6}{7}{8}{9}".format(path, symbol, start, count, filter, query, sort,
view, fields, scope_uris)
return uri | python | def build_query_uri(self, uri=None, start=0, count=-1, filter='', query='', sort='', view='', fields='', scope_uris=''):
"""Builds the URI from given parameters.
More than one request can be send to get the items, regardless the query parameter 'count', because the actual
number of items in the response might differ from the requested count. Some types of resource have a limited
number of items returned on each call. For those resources, additional calls are made to the API to retrieve
any other items matching the given filter. The actual number of items can also differ from the requested call
if the requested number of items would take too long.
The use of optional parameters for OneView 2.0 is described at:
http://h17007.www1.hpe.com/docs/enterprise/servers/oneview2.0/cic-api/en/api-docs/current/index.html
Note:
Single quote - "'" - inside a query parameter is not supported by OneView API.
Args:
start: The first item to return, using 0-based indexing.
If not specified, the default is 0 - start with the first available item.
count: The number of resources to return. A count of -1 requests all items (default).
filter (list or str): A general filter/query string to narrow the list of items returned. The default is no
filter; all resources are returned.
query: A single query parameter can do what would take multiple parameters or multiple GET requests using
filter. Use query for more complex queries. NOTE: This parameter is experimental for OneView 2.0.
sort: The sort order of the returned data set. By default, the sort order is based on create time with the
oldest entry first.
view: Returns a specific subset of the attributes of the resource or collection by specifying the name of a
predefined view. The default view is expand (show all attributes of the resource and all elements of
the collections or resources).
fields: Name of the fields.
uri: A specific URI (optional)
scope_uris: An expression to restrict the resources returned according to the scopes to
which they are assigned.
Returns:
uri: The complete uri
"""
if filter:
filter = self.make_query_filter(filter)
if query:
query = "&query=" + quote(query)
if sort:
sort = "&sort=" + quote(sort)
if view:
view = "&view=" + quote(view)
if fields:
fields = "&fields=" + quote(fields)
if scope_uris:
scope_uris = "&scopeUris=" + quote(scope_uris)
path = uri if uri else self._base_uri
self.validate_resource_uri(path)
symbol = '?' if '?' not in path else '&'
uri = "{0}{1}start={2}&count={3}{4}{5}{6}{7}{8}{9}".format(path, symbol, start, count, filter, query, sort,
view, fields, scope_uris)
return uri | [
"def",
"build_query_uri",
"(",
"self",
",",
"uri",
"=",
"None",
",",
"start",
"=",
"0",
",",
"count",
"=",
"-",
"1",
",",
"filter",
"=",
"''",
",",
"query",
"=",
"''",
",",
"sort",
"=",
"''",
",",
"view",
"=",
"''",
",",
"fields",
"=",
"''",
",",
"scope_uris",
"=",
"''",
")",
":",
"if",
"filter",
":",
"filter",
"=",
"self",
".",
"make_query_filter",
"(",
"filter",
")",
"if",
"query",
":",
"query",
"=",
"\"&query=\"",
"+",
"quote",
"(",
"query",
")",
"if",
"sort",
":",
"sort",
"=",
"\"&sort=\"",
"+",
"quote",
"(",
"sort",
")",
"if",
"view",
":",
"view",
"=",
"\"&view=\"",
"+",
"quote",
"(",
"view",
")",
"if",
"fields",
":",
"fields",
"=",
"\"&fields=\"",
"+",
"quote",
"(",
"fields",
")",
"if",
"scope_uris",
":",
"scope_uris",
"=",
"\"&scopeUris=\"",
"+",
"quote",
"(",
"scope_uris",
")",
"path",
"=",
"uri",
"if",
"uri",
"else",
"self",
".",
"_base_uri",
"self",
".",
"validate_resource_uri",
"(",
"path",
")",
"symbol",
"=",
"'?'",
"if",
"'?'",
"not",
"in",
"path",
"else",
"'&'",
"uri",
"=",
"\"{0}{1}start={2}&count={3}{4}{5}{6}{7}{8}{9}\"",
".",
"format",
"(",
"path",
",",
"symbol",
",",
"start",
",",
"count",
",",
"filter",
",",
"query",
",",
"sort",
",",
"view",
",",
"fields",
",",
"scope_uris",
")",
"return",
"uri"
] | Builds the URI from given parameters.
More than one request can be send to get the items, regardless the query parameter 'count', because the actual
number of items in the response might differ from the requested count. Some types of resource have a limited
number of items returned on each call. For those resources, additional calls are made to the API to retrieve
any other items matching the given filter. The actual number of items can also differ from the requested call
if the requested number of items would take too long.
The use of optional parameters for OneView 2.0 is described at:
http://h17007.www1.hpe.com/docs/enterprise/servers/oneview2.0/cic-api/en/api-docs/current/index.html
Note:
Single quote - "'" - inside a query parameter is not supported by OneView API.
Args:
start: The first item to return, using 0-based indexing.
If not specified, the default is 0 - start with the first available item.
count: The number of resources to return. A count of -1 requests all items (default).
filter (list or str): A general filter/query string to narrow the list of items returned. The default is no
filter; all resources are returned.
query: A single query parameter can do what would take multiple parameters or multiple GET requests using
filter. Use query for more complex queries. NOTE: This parameter is experimental for OneView 2.0.
sort: The sort order of the returned data set. By default, the sort order is based on create time with the
oldest entry first.
view: Returns a specific subset of the attributes of the resource or collection by specifying the name of a
predefined view. The default view is expand (show all attributes of the resource and all elements of
the collections or resources).
fields: Name of the fields.
uri: A specific URI (optional)
scope_uris: An expression to restrict the resources returned according to the scopes to
which they are assigned.
Returns:
uri: The complete uri | [
"Builds",
"the",
"URI",
"from",
"given",
"parameters",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L523-L585 | train | 251,538 |
HewlettPackard/python-hpOneView | hpOneView/resources/resource.py | ResourceHelper.build_uri | def build_uri(self, id_or_uri):
"""Helps to build the URI from resource id and validate the URI.
Args:
id_or_uri: ID/URI of the resource.
Returns:
Returns a valid resource URI
"""
if not id_or_uri:
logger.exception(RESOURCE_CLIENT_INVALID_ID)
raise ValueError(RESOURCE_CLIENT_INVALID_ID)
if "/" in id_or_uri:
self.validate_resource_uri(id_or_uri)
return id_or_uri
else:
return self._base_uri + "/" + id_or_uri | python | def build_uri(self, id_or_uri):
"""Helps to build the URI from resource id and validate the URI.
Args:
id_or_uri: ID/URI of the resource.
Returns:
Returns a valid resource URI
"""
if not id_or_uri:
logger.exception(RESOURCE_CLIENT_INVALID_ID)
raise ValueError(RESOURCE_CLIENT_INVALID_ID)
if "/" in id_or_uri:
self.validate_resource_uri(id_or_uri)
return id_or_uri
else:
return self._base_uri + "/" + id_or_uri | [
"def",
"build_uri",
"(",
"self",
",",
"id_or_uri",
")",
":",
"if",
"not",
"id_or_uri",
":",
"logger",
".",
"exception",
"(",
"RESOURCE_CLIENT_INVALID_ID",
")",
"raise",
"ValueError",
"(",
"RESOURCE_CLIENT_INVALID_ID",
")",
"if",
"\"/\"",
"in",
"id_or_uri",
":",
"self",
".",
"validate_resource_uri",
"(",
"id_or_uri",
")",
"return",
"id_or_uri",
"else",
":",
"return",
"self",
".",
"_base_uri",
"+",
"\"/\"",
"+",
"id_or_uri"
] | Helps to build the URI from resource id and validate the URI.
Args:
id_or_uri: ID/URI of the resource.
Returns:
Returns a valid resource URI | [
"Helps",
"to",
"build",
"the",
"URI",
"from",
"resource",
"id",
"and",
"validate",
"the",
"URI",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L594-L611 | train | 251,539 |
HewlettPackard/python-hpOneView | hpOneView/resources/resource.py | ResourceHelper.build_subresource_uri | def build_subresource_uri(self, resource_id_or_uri=None, subresource_id_or_uri=None, subresource_path=''):
"""Helps to build a URI with resource path and its sub resource path.
Args:
resoure_id_or_uri: ID/URI of the main resource.
subresource_id__or_uri: ID/URI of the sub resource.
subresource_path: Sub resource path to be added with the URI.
Returns:
Returns URI
"""
if subresource_id_or_uri and "/" in subresource_id_or_uri:
return subresource_id_or_uri
else:
if not resource_id_or_uri:
raise exceptions.HPOneViewValueError(RESOURCE_ID_OR_URI_REQUIRED)
resource_uri = self.build_uri(resource_id_or_uri)
uri = "{}/{}/{}".format(resource_uri, subresource_path, str(subresource_id_or_uri or ''))
uri = uri.replace("//", "/")
if uri.endswith("/"):
uri = uri[:-1]
return uri | python | def build_subresource_uri(self, resource_id_or_uri=None, subresource_id_or_uri=None, subresource_path=''):
"""Helps to build a URI with resource path and its sub resource path.
Args:
resoure_id_or_uri: ID/URI of the main resource.
subresource_id__or_uri: ID/URI of the sub resource.
subresource_path: Sub resource path to be added with the URI.
Returns:
Returns URI
"""
if subresource_id_or_uri and "/" in subresource_id_or_uri:
return subresource_id_or_uri
else:
if not resource_id_or_uri:
raise exceptions.HPOneViewValueError(RESOURCE_ID_OR_URI_REQUIRED)
resource_uri = self.build_uri(resource_id_or_uri)
uri = "{}/{}/{}".format(resource_uri, subresource_path, str(subresource_id_or_uri or ''))
uri = uri.replace("//", "/")
if uri.endswith("/"):
uri = uri[:-1]
return uri | [
"def",
"build_subresource_uri",
"(",
"self",
",",
"resource_id_or_uri",
"=",
"None",
",",
"subresource_id_or_uri",
"=",
"None",
",",
"subresource_path",
"=",
"''",
")",
":",
"if",
"subresource_id_or_uri",
"and",
"\"/\"",
"in",
"subresource_id_or_uri",
":",
"return",
"subresource_id_or_uri",
"else",
":",
"if",
"not",
"resource_id_or_uri",
":",
"raise",
"exceptions",
".",
"HPOneViewValueError",
"(",
"RESOURCE_ID_OR_URI_REQUIRED",
")",
"resource_uri",
"=",
"self",
".",
"build_uri",
"(",
"resource_id_or_uri",
")",
"uri",
"=",
"\"{}/{}/{}\"",
".",
"format",
"(",
"resource_uri",
",",
"subresource_path",
",",
"str",
"(",
"subresource_id_or_uri",
"or",
"''",
")",
")",
"uri",
"=",
"uri",
".",
"replace",
"(",
"\"//\"",
",",
"\"/\"",
")",
"if",
"uri",
".",
"endswith",
"(",
"\"/\"",
")",
":",
"uri",
"=",
"uri",
"[",
":",
"-",
"1",
"]",
"return",
"uri"
] | Helps to build a URI with resource path and its sub resource path.
Args:
resoure_id_or_uri: ID/URI of the main resource.
subresource_id__or_uri: ID/URI of the sub resource.
subresource_path: Sub resource path to be added with the URI.
Returns:
Returns URI | [
"Helps",
"to",
"build",
"a",
"URI",
"with",
"resource",
"path",
"and",
"its",
"sub",
"resource",
"path",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L613-L638 | train | 251,540 |
HewlettPackard/python-hpOneView | hpOneView/resources/resource.py | ResourceHelper.validate_resource_uri | def validate_resource_uri(self, path):
"""Helper method to validate URI of the resource."""
if self._base_uri not in path:
logger.exception('Get by uri : unrecognized uri: (%s)' % path)
raise exceptions.HPOneViewUnknownType(UNRECOGNIZED_URI) | python | def validate_resource_uri(self, path):
"""Helper method to validate URI of the resource."""
if self._base_uri not in path:
logger.exception('Get by uri : unrecognized uri: (%s)' % path)
raise exceptions.HPOneViewUnknownType(UNRECOGNIZED_URI) | [
"def",
"validate_resource_uri",
"(",
"self",
",",
"path",
")",
":",
"if",
"self",
".",
"_base_uri",
"not",
"in",
"path",
":",
"logger",
".",
"exception",
"(",
"'Get by uri : unrecognized uri: (%s)'",
"%",
"path",
")",
"raise",
"exceptions",
".",
"HPOneViewUnknownType",
"(",
"UNRECOGNIZED_URI",
")"
] | Helper method to validate URI of the resource. | [
"Helper",
"method",
"to",
"validate",
"URI",
"of",
"the",
"resource",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L640-L644 | train | 251,541 |
HewlettPackard/python-hpOneView | hpOneView/resources/resource.py | ResourceHelper.do_requests_to_getall | def do_requests_to_getall(self, uri, requested_count):
"""Helps to make http request for get_all method.
Note:
This method will be checking for the pagination URI in the response
and make request to pagination URI to get all the resources.
"""
items = []
while uri:
logger.debug('Making HTTP request to get all resources. Uri: {0}'.format(uri))
response = self._connection.get(uri)
members = self.get_members(response)
items += members
logger.debug("Response getAll: nextPageUri = {0}, members list length: {1}".format(uri, str(len(members))))
uri = self.get_next_page(response, items, requested_count)
logger.debug('Total # of members found = {0}'.format(str(len(items))))
return items | python | def do_requests_to_getall(self, uri, requested_count):
"""Helps to make http request for get_all method.
Note:
This method will be checking for the pagination URI in the response
and make request to pagination URI to get all the resources.
"""
items = []
while uri:
logger.debug('Making HTTP request to get all resources. Uri: {0}'.format(uri))
response = self._connection.get(uri)
members = self.get_members(response)
items += members
logger.debug("Response getAll: nextPageUri = {0}, members list length: {1}".format(uri, str(len(members))))
uri = self.get_next_page(response, items, requested_count)
logger.debug('Total # of members found = {0}'.format(str(len(items))))
return items | [
"def",
"do_requests_to_getall",
"(",
"self",
",",
"uri",
",",
"requested_count",
")",
":",
"items",
"=",
"[",
"]",
"while",
"uri",
":",
"logger",
".",
"debug",
"(",
"'Making HTTP request to get all resources. Uri: {0}'",
".",
"format",
"(",
"uri",
")",
")",
"response",
"=",
"self",
".",
"_connection",
".",
"get",
"(",
"uri",
")",
"members",
"=",
"self",
".",
"get_members",
"(",
"response",
")",
"items",
"+=",
"members",
"logger",
".",
"debug",
"(",
"\"Response getAll: nextPageUri = {0}, members list length: {1}\"",
".",
"format",
"(",
"uri",
",",
"str",
"(",
"len",
"(",
"members",
")",
")",
")",
")",
"uri",
"=",
"self",
".",
"get_next_page",
"(",
"response",
",",
"items",
",",
"requested_count",
")",
"logger",
".",
"debug",
"(",
"'Total # of members found = {0}'",
".",
"format",
"(",
"str",
"(",
"len",
"(",
"items",
")",
")",
")",
")",
"return",
"items"
] | Helps to make http request for get_all method.
Note:
This method will be checking for the pagination URI in the response
and make request to pagination URI to get all the resources. | [
"Helps",
"to",
"make",
"http",
"request",
"for",
"get_all",
"method",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L678-L697 | train | 251,542 |
HewlettPackard/python-hpOneView | hpOneView/resources/resource.py | ResourceHelper.do_get | def do_get(self, uri):
"""Helps to make get requests
Args:
uri: URI of the resource
Returns:
Returns: Returns the resource data
"""
self.validate_resource_uri(uri)
return self._connection.get(uri) | python | def do_get(self, uri):
"""Helps to make get requests
Args:
uri: URI of the resource
Returns:
Returns: Returns the resource data
"""
self.validate_resource_uri(uri)
return self._connection.get(uri) | [
"def",
"do_get",
"(",
"self",
",",
"uri",
")",
":",
"self",
".",
"validate_resource_uri",
"(",
"uri",
")",
"return",
"self",
".",
"_connection",
".",
"get",
"(",
"uri",
")"
] | Helps to make get requests
Args:
uri: URI of the resource
Returns:
Returns: Returns the resource data | [
"Helps",
"to",
"make",
"get",
"requests"
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L710-L720 | train | 251,543 |
HewlettPackard/python-hpOneView | hpOneView/resources/resource.py | ResourceHelper.do_post | def do_post(self, uri, resource, timeout, custom_headers):
"""Helps to make post requests.
Args:
uri: URI of the resource.
resource: Resource data to post.
timeout: Time out for the request in seconds.
cutom_headers: Allows to add custom http headers.
Returns:
Retunrs Task object.
"""
self.validate_resource_uri(uri)
task, entity = self._connection.post(uri, resource, custom_headers=custom_headers)
if not task:
return entity
return self._task_monitor.wait_for_task(task, timeout) | python | def do_post(self, uri, resource, timeout, custom_headers):
"""Helps to make post requests.
Args:
uri: URI of the resource.
resource: Resource data to post.
timeout: Time out for the request in seconds.
cutom_headers: Allows to add custom http headers.
Returns:
Retunrs Task object.
"""
self.validate_resource_uri(uri)
task, entity = self._connection.post(uri, resource, custom_headers=custom_headers)
if not task:
return entity
return self._task_monitor.wait_for_task(task, timeout) | [
"def",
"do_post",
"(",
"self",
",",
"uri",
",",
"resource",
",",
"timeout",
",",
"custom_headers",
")",
":",
"self",
".",
"validate_resource_uri",
"(",
"uri",
")",
"task",
",",
"entity",
"=",
"self",
".",
"_connection",
".",
"post",
"(",
"uri",
",",
"resource",
",",
"custom_headers",
"=",
"custom_headers",
")",
"if",
"not",
"task",
":",
"return",
"entity",
"return",
"self",
".",
"_task_monitor",
".",
"wait_for_task",
"(",
"task",
",",
"timeout",
")"
] | Helps to make post requests.
Args:
uri: URI of the resource.
resource: Resource data to post.
timeout: Time out for the request in seconds.
cutom_headers: Allows to add custom http headers.
Returns:
Retunrs Task object. | [
"Helps",
"to",
"make",
"post",
"requests",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L722-L741 | train | 251,544 |
HewlettPackard/python-hpOneView | hpOneView/resources/resource.py | ResourceHelper.do_put | def do_put(self, uri, resource, timeout, custom_headers):
"""Helps to make put requests.
Args:
uri: URI of the resource
timeout: Time out for the request in seconds.
custom_headers: Allows to set custom http headers.
Retuns:
Returns Task object
"""
self.validate_resource_uri(uri)
task, body = self._connection.put(uri, resource, custom_headers=custom_headers)
if not task:
return body
return self._task_monitor.wait_for_task(task, timeout) | python | def do_put(self, uri, resource, timeout, custom_headers):
"""Helps to make put requests.
Args:
uri: URI of the resource
timeout: Time out for the request in seconds.
custom_headers: Allows to set custom http headers.
Retuns:
Returns Task object
"""
self.validate_resource_uri(uri)
task, body = self._connection.put(uri, resource, custom_headers=custom_headers)
if not task:
return body
return self._task_monitor.wait_for_task(task, timeout) | [
"def",
"do_put",
"(",
"self",
",",
"uri",
",",
"resource",
",",
"timeout",
",",
"custom_headers",
")",
":",
"self",
".",
"validate_resource_uri",
"(",
"uri",
")",
"task",
",",
"body",
"=",
"self",
".",
"_connection",
".",
"put",
"(",
"uri",
",",
"resource",
",",
"custom_headers",
"=",
"custom_headers",
")",
"if",
"not",
"task",
":",
"return",
"body",
"return",
"self",
".",
"_task_monitor",
".",
"wait_for_task",
"(",
"task",
",",
"timeout",
")"
] | Helps to make put requests.
Args:
uri: URI of the resource
timeout: Time out for the request in seconds.
custom_headers: Allows to set custom http headers.
Retuns:
Returns Task object | [
"Helps",
"to",
"make",
"put",
"requests",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L743-L761 | train | 251,545 |
HewlettPackard/python-hpOneView | hpOneView/resources/resource.py | ResourceFileHandlerMixin.download | def download(self, uri, file_path):
"""Downloads the contents of the requested URI to a stream.
Args:
uri: URI
file_path: File path destination
Returns:
bool: Indicates if the file was successfully downloaded.
"""
with open(file_path, 'wb') as file:
return self._connection.download_to_stream(file, uri) | python | def download(self, uri, file_path):
"""Downloads the contents of the requested URI to a stream.
Args:
uri: URI
file_path: File path destination
Returns:
bool: Indicates if the file was successfully downloaded.
"""
with open(file_path, 'wb') as file:
return self._connection.download_to_stream(file, uri) | [
"def",
"download",
"(",
"self",
",",
"uri",
",",
"file_path",
")",
":",
"with",
"open",
"(",
"file_path",
",",
"'wb'",
")",
"as",
"file",
":",
"return",
"self",
".",
"_connection",
".",
"download_to_stream",
"(",
"file",
",",
"uri",
")"
] | Downloads the contents of the requested URI to a stream.
Args:
uri: URI
file_path: File path destination
Returns:
bool: Indicates if the file was successfully downloaded. | [
"Downloads",
"the",
"contents",
"of",
"the",
"requested",
"URI",
"to",
"a",
"stream",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L863-L874 | train | 251,546 |
HewlettPackard/python-hpOneView | hpOneView/resources/resource.py | ResourceClient.build_query_uri | def build_query_uri(self, start=0, count=-1, filter='', query='', sort='', view='', fields='', uri=None, scope_uris=''):
"""
Builds the URI given the parameters.
More than one request can be send to get the items, regardless the query parameter 'count', because the actual
number of items in the response might differ from the requested count. Some types of resource have a limited
number of items returned on each call. For those resources, additional calls are made to the API to retrieve
any other items matching the given filter. The actual number of items can also differ from the requested call
if the requested number of items would take too long.
The use of optional parameters for OneView 2.0 is described at:
http://h17007.www1.hpe.com/docs/enterprise/servers/oneview2.0/cic-api/en/api-docs/current/index.html
Note:
Single quote - "'" - inside a query parameter is not supported by OneView API.
Args:
start:
The first item to return, using 0-based indexing.
If not specified, the default is 0 - start with the first available item.
count:
The number of resources to return. A count of -1 requests all items (default).
filter (list or str):
A general filter/query string to narrow the list of items returned. The default is no
filter; all resources are returned.
query:
A single query parameter can do what would take multiple parameters or multiple GET requests using
filter. Use query for more complex queries. NOTE: This parameter is experimental for OneView 2.0.
sort:
The sort order of the returned data set. By default, the sort order is based on create time with the
oldest entry first.
view:
Returns a specific subset of the attributes of the resource or collection by specifying the name of a
predefined view. The default view is expand (show all attributes of the resource and all elements of
the collections or resources).
fields:
Name of the fields.
uri:
A specific URI (optional)
scope_uris:
An expression to restrict the resources returned according to the scopes to
which they are assigned.
Returns:
uri: The complete uri
"""
if filter:
filter = self.__make_query_filter(filter)
if query:
query = "&query=" + quote(query)
if sort:
sort = "&sort=" + quote(sort)
if view:
view = "&view=" + quote(view)
if fields:
fields = "&fields=" + quote(fields)
if scope_uris:
scope_uris = "&scopeUris=" + quote(scope_uris)
path = uri if uri else self._uri
self.__validate_resource_uri(path)
symbol = '?' if '?' not in path else '&'
uri = "{0}{1}start={2}&count={3}{4}{5}{6}{7}{8}{9}".format(path, symbol, start, count, filter, query, sort,
view, fields, scope_uris)
return uri | python | def build_query_uri(self, start=0, count=-1, filter='', query='', sort='', view='', fields='', uri=None, scope_uris=''):
"""
Builds the URI given the parameters.
More than one request can be send to get the items, regardless the query parameter 'count', because the actual
number of items in the response might differ from the requested count. Some types of resource have a limited
number of items returned on each call. For those resources, additional calls are made to the API to retrieve
any other items matching the given filter. The actual number of items can also differ from the requested call
if the requested number of items would take too long.
The use of optional parameters for OneView 2.0 is described at:
http://h17007.www1.hpe.com/docs/enterprise/servers/oneview2.0/cic-api/en/api-docs/current/index.html
Note:
Single quote - "'" - inside a query parameter is not supported by OneView API.
Args:
start:
The first item to return, using 0-based indexing.
If not specified, the default is 0 - start with the first available item.
count:
The number of resources to return. A count of -1 requests all items (default).
filter (list or str):
A general filter/query string to narrow the list of items returned. The default is no
filter; all resources are returned.
query:
A single query parameter can do what would take multiple parameters or multiple GET requests using
filter. Use query for more complex queries. NOTE: This parameter is experimental for OneView 2.0.
sort:
The sort order of the returned data set. By default, the sort order is based on create time with the
oldest entry first.
view:
Returns a specific subset of the attributes of the resource or collection by specifying the name of a
predefined view. The default view is expand (show all attributes of the resource and all elements of
the collections or resources).
fields:
Name of the fields.
uri:
A specific URI (optional)
scope_uris:
An expression to restrict the resources returned according to the scopes to
which they are assigned.
Returns:
uri: The complete uri
"""
if filter:
filter = self.__make_query_filter(filter)
if query:
query = "&query=" + quote(query)
if sort:
sort = "&sort=" + quote(sort)
if view:
view = "&view=" + quote(view)
if fields:
fields = "&fields=" + quote(fields)
if scope_uris:
scope_uris = "&scopeUris=" + quote(scope_uris)
path = uri if uri else self._uri
self.__validate_resource_uri(path)
symbol = '?' if '?' not in path else '&'
uri = "{0}{1}start={2}&count={3}{4}{5}{6}{7}{8}{9}".format(path, symbol, start, count, filter, query, sort,
view, fields, scope_uris)
return uri | [
"def",
"build_query_uri",
"(",
"self",
",",
"start",
"=",
"0",
",",
"count",
"=",
"-",
"1",
",",
"filter",
"=",
"''",
",",
"query",
"=",
"''",
",",
"sort",
"=",
"''",
",",
"view",
"=",
"''",
",",
"fields",
"=",
"''",
",",
"uri",
"=",
"None",
",",
"scope_uris",
"=",
"''",
")",
":",
"if",
"filter",
":",
"filter",
"=",
"self",
".",
"__make_query_filter",
"(",
"filter",
")",
"if",
"query",
":",
"query",
"=",
"\"&query=\"",
"+",
"quote",
"(",
"query",
")",
"if",
"sort",
":",
"sort",
"=",
"\"&sort=\"",
"+",
"quote",
"(",
"sort",
")",
"if",
"view",
":",
"view",
"=",
"\"&view=\"",
"+",
"quote",
"(",
"view",
")",
"if",
"fields",
":",
"fields",
"=",
"\"&fields=\"",
"+",
"quote",
"(",
"fields",
")",
"if",
"scope_uris",
":",
"scope_uris",
"=",
"\"&scopeUris=\"",
"+",
"quote",
"(",
"scope_uris",
")",
"path",
"=",
"uri",
"if",
"uri",
"else",
"self",
".",
"_uri",
"self",
".",
"__validate_resource_uri",
"(",
"path",
")",
"symbol",
"=",
"'?'",
"if",
"'?'",
"not",
"in",
"path",
"else",
"'&'",
"uri",
"=",
"\"{0}{1}start={2}&count={3}{4}{5}{6}{7}{8}{9}\"",
".",
"format",
"(",
"path",
",",
"symbol",
",",
"start",
",",
"count",
",",
"filter",
",",
"query",
",",
"sort",
",",
"view",
",",
"fields",
",",
"scope_uris",
")",
"return",
"uri"
] | Builds the URI given the parameters.
More than one request can be send to get the items, regardless the query parameter 'count', because the actual
number of items in the response might differ from the requested count. Some types of resource have a limited
number of items returned on each call. For those resources, additional calls are made to the API to retrieve
any other items matching the given filter. The actual number of items can also differ from the requested call
if the requested number of items would take too long.
The use of optional parameters for OneView 2.0 is described at:
http://h17007.www1.hpe.com/docs/enterprise/servers/oneview2.0/cic-api/en/api-docs/current/index.html
Note:
Single quote - "'" - inside a query parameter is not supported by OneView API.
Args:
start:
The first item to return, using 0-based indexing.
If not specified, the default is 0 - start with the first available item.
count:
The number of resources to return. A count of -1 requests all items (default).
filter (list or str):
A general filter/query string to narrow the list of items returned. The default is no
filter; all resources are returned.
query:
A single query parameter can do what would take multiple parameters or multiple GET requests using
filter. Use query for more complex queries. NOTE: This parameter is experimental for OneView 2.0.
sort:
The sort order of the returned data set. By default, the sort order is based on create time with the
oldest entry first.
view:
Returns a specific subset of the attributes of the resource or collection by specifying the name of a
predefined view. The default view is expand (show all attributes of the resource and all elements of
the collections or resources).
fields:
Name of the fields.
uri:
A specific URI (optional)
scope_uris:
An expression to restrict the resources returned according to the scopes to
which they are assigned.
Returns:
uri: The complete uri | [
"Builds",
"the",
"URI",
"given",
"the",
"parameters",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L1023-L1095 | train | 251,547 |
HewlettPackard/python-hpOneView | hpOneView/resources/resource.py | ResourceClient.upload | def upload(self, file_path, uri=None, timeout=-1):
"""
Makes a multipart request.
Args:
file_path:
File to upload.
uri:
A specific URI (optional).
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Response body.
"""
if not uri:
uri = self._uri
upload_file_name = os.path.basename(file_path)
task, entity = self._connection.post_multipart_with_response_handling(uri, file_path, upload_file_name)
if not task:
return entity
return self._task_monitor.wait_for_task(task, timeout) | python | def upload(self, file_path, uri=None, timeout=-1):
"""
Makes a multipart request.
Args:
file_path:
File to upload.
uri:
A specific URI (optional).
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Response body.
"""
if not uri:
uri = self._uri
upload_file_name = os.path.basename(file_path)
task, entity = self._connection.post_multipart_with_response_handling(uri, file_path, upload_file_name)
if not task:
return entity
return self._task_monitor.wait_for_task(task, timeout) | [
"def",
"upload",
"(",
"self",
",",
"file_path",
",",
"uri",
"=",
"None",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"if",
"not",
"uri",
":",
"uri",
"=",
"self",
".",
"_uri",
"upload_file_name",
"=",
"os",
".",
"path",
".",
"basename",
"(",
"file_path",
")",
"task",
",",
"entity",
"=",
"self",
".",
"_connection",
".",
"post_multipart_with_response_handling",
"(",
"uri",
",",
"file_path",
",",
"upload_file_name",
")",
"if",
"not",
"task",
":",
"return",
"entity",
"return",
"self",
".",
"_task_monitor",
".",
"wait_for_task",
"(",
"task",
",",
"timeout",
")"
] | Makes a multipart request.
Args:
file_path:
File to upload.
uri:
A specific URI (optional).
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Response body. | [
"Makes",
"a",
"multipart",
"request",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L1376-L1401 | train | 251,548 |
HewlettPackard/python-hpOneView | hpOneView/resources/resource.py | ResourceClient.get_by | def get_by(self, field, value, uri=None):
"""
This function uses get_all passing a filter.
The search is case-insensitive.
Args:
field: Field name to filter.
value: Value to filter.
uri: Resource uri.
Returns:
dict
"""
if not field:
logger.exception(RESOURCE_CLIENT_INVALID_FIELD)
raise ValueError(RESOURCE_CLIENT_INVALID_FIELD)
if not uri:
uri = self._uri
self.__validate_resource_uri(uri)
logger.debug('Get by (uri = %s, field = %s, value = %s)' %
(uri, field, str(value)))
filter = "\"{0}='{1}'\"".format(field, value)
results = self.get_all(filter=filter, uri=uri)
# Workaround when the OneView filter does not work, it will filter again
if "." not in field:
# This filter only work for the first level
results = [item for item in results if str(item.get(field, '')).lower() == value.lower()]
return results | python | def get_by(self, field, value, uri=None):
"""
This function uses get_all passing a filter.
The search is case-insensitive.
Args:
field: Field name to filter.
value: Value to filter.
uri: Resource uri.
Returns:
dict
"""
if not field:
logger.exception(RESOURCE_CLIENT_INVALID_FIELD)
raise ValueError(RESOURCE_CLIENT_INVALID_FIELD)
if not uri:
uri = self._uri
self.__validate_resource_uri(uri)
logger.debug('Get by (uri = %s, field = %s, value = %s)' %
(uri, field, str(value)))
filter = "\"{0}='{1}'\"".format(field, value)
results = self.get_all(filter=filter, uri=uri)
# Workaround when the OneView filter does not work, it will filter again
if "." not in field:
# This filter only work for the first level
results = [item for item in results if str(item.get(field, '')).lower() == value.lower()]
return results | [
"def",
"get_by",
"(",
"self",
",",
"field",
",",
"value",
",",
"uri",
"=",
"None",
")",
":",
"if",
"not",
"field",
":",
"logger",
".",
"exception",
"(",
"RESOURCE_CLIENT_INVALID_FIELD",
")",
"raise",
"ValueError",
"(",
"RESOURCE_CLIENT_INVALID_FIELD",
")",
"if",
"not",
"uri",
":",
"uri",
"=",
"self",
".",
"_uri",
"self",
".",
"__validate_resource_uri",
"(",
"uri",
")",
"logger",
".",
"debug",
"(",
"'Get by (uri = %s, field = %s, value = %s)'",
"%",
"(",
"uri",
",",
"field",
",",
"str",
"(",
"value",
")",
")",
")",
"filter",
"=",
"\"\\\"{0}='{1}'\\\"\"",
".",
"format",
"(",
"field",
",",
"value",
")",
"results",
"=",
"self",
".",
"get_all",
"(",
"filter",
"=",
"filter",
",",
"uri",
"=",
"uri",
")",
"# Workaround when the OneView filter does not work, it will filter again",
"if",
"\".\"",
"not",
"in",
"field",
":",
"# This filter only work for the first level",
"results",
"=",
"[",
"item",
"for",
"item",
"in",
"results",
"if",
"str",
"(",
"item",
".",
"get",
"(",
"field",
",",
"''",
")",
")",
".",
"lower",
"(",
")",
"==",
"value",
".",
"lower",
"(",
")",
"]",
"return",
"results"
] | This function uses get_all passing a filter.
The search is case-insensitive.
Args:
field: Field name to filter.
value: Value to filter.
uri: Resource uri.
Returns:
dict | [
"This",
"function",
"uses",
"get_all",
"passing",
"a",
"filter",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/resource.py#L1457-L1490 | train | 251,549 |
HewlettPackard/python-hpOneView | hpOneView/resources/settings/firmware_drivers.py | FirmwareDrivers.get_by | def get_by(self, field, value):
"""
Gets the list of firmware baseline resources managed by the appliance. Optional parameters can be used to
filter the list of resources returned.
The search is case-insensitive.
Args:
field: Field name to filter.
value: Value to filter.
Returns:
list: List of firmware baseline resources.
"""
firmwares = self.get_all()
matches = []
for item in firmwares:
if item.get(field) == value:
matches.append(item)
return matches | python | def get_by(self, field, value):
"""
Gets the list of firmware baseline resources managed by the appliance. Optional parameters can be used to
filter the list of resources returned.
The search is case-insensitive.
Args:
field: Field name to filter.
value: Value to filter.
Returns:
list: List of firmware baseline resources.
"""
firmwares = self.get_all()
matches = []
for item in firmwares:
if item.get(field) == value:
matches.append(item)
return matches | [
"def",
"get_by",
"(",
"self",
",",
"field",
",",
"value",
")",
":",
"firmwares",
"=",
"self",
".",
"get_all",
"(",
")",
"matches",
"=",
"[",
"]",
"for",
"item",
"in",
"firmwares",
":",
"if",
"item",
".",
"get",
"(",
"field",
")",
"==",
"value",
":",
"matches",
".",
"append",
"(",
"item",
")",
"return",
"matches"
] | Gets the list of firmware baseline resources managed by the appliance. Optional parameters can be used to
filter the list of resources returned.
The search is case-insensitive.
Args:
field: Field name to filter.
value: Value to filter.
Returns:
list: List of firmware baseline resources. | [
"Gets",
"the",
"list",
"of",
"firmware",
"baseline",
"resources",
"managed",
"by",
"the",
"appliance",
".",
"Optional",
"parameters",
"can",
"be",
"used",
"to",
"filter",
"the",
"list",
"of",
"resources",
"returned",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/settings/firmware_drivers.py#L73-L92 | train | 251,550 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/interconnects.py | Interconnects.get_statistics | def get_statistics(self, id_or_uri, port_name=''):
"""
Gets the statistics from an interconnect.
Args:
id_or_uri: Can be either the interconnect id or the interconnect uri.
port_name (str): A specific port name of an interconnect.
Returns:
dict: The statistics for the interconnect that matches id.
"""
uri = self._client.build_uri(id_or_uri) + "/statistics"
if port_name:
uri = uri + "/" + port_name
return self._client.get(uri) | python | def get_statistics(self, id_or_uri, port_name=''):
"""
Gets the statistics from an interconnect.
Args:
id_or_uri: Can be either the interconnect id or the interconnect uri.
port_name (str): A specific port name of an interconnect.
Returns:
dict: The statistics for the interconnect that matches id.
"""
uri = self._client.build_uri(id_or_uri) + "/statistics"
if port_name:
uri = uri + "/" + port_name
return self._client.get(uri) | [
"def",
"get_statistics",
"(",
"self",
",",
"id_or_uri",
",",
"port_name",
"=",
"''",
")",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"id_or_uri",
")",
"+",
"\"/statistics\"",
"if",
"port_name",
":",
"uri",
"=",
"uri",
"+",
"\"/\"",
"+",
"port_name",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"uri",
")"
] | Gets the statistics from an interconnect.
Args:
id_or_uri: Can be either the interconnect id or the interconnect uri.
port_name (str): A specific port name of an interconnect.
Returns:
dict: The statistics for the interconnect that matches id. | [
"Gets",
"the",
"statistics",
"from",
"an",
"interconnect",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/interconnects.py#L75-L91 | train | 251,551 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/interconnects.py | Interconnects.get_subport_statistics | def get_subport_statistics(self, id_or_uri, port_name, subport_number):
"""
Gets the subport statistics on an interconnect.
Args:
id_or_uri: Can be either the interconnect id or the interconnect uri.
port_name (str): A specific port name of an interconnect.
subport_number (int): The subport.
Returns:
dict: The statistics for the interconnect that matches id, port_name, and subport_number.
"""
uri = self._client.build_uri(id_or_uri) + "/statistics/{0}/subport/{1}".format(port_name, subport_number)
return self._client.get(uri) | python | def get_subport_statistics(self, id_or_uri, port_name, subport_number):
"""
Gets the subport statistics on an interconnect.
Args:
id_or_uri: Can be either the interconnect id or the interconnect uri.
port_name (str): A specific port name of an interconnect.
subport_number (int): The subport.
Returns:
dict: The statistics for the interconnect that matches id, port_name, and subport_number.
"""
uri = self._client.build_uri(id_or_uri) + "/statistics/{0}/subport/{1}".format(port_name, subport_number)
return self._client.get(uri) | [
"def",
"get_subport_statistics",
"(",
"self",
",",
"id_or_uri",
",",
"port_name",
",",
"subport_number",
")",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"id_or_uri",
")",
"+",
"\"/statistics/{0}/subport/{1}\"",
".",
"format",
"(",
"port_name",
",",
"subport_number",
")",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"uri",
")"
] | Gets the subport statistics on an interconnect.
Args:
id_or_uri: Can be either the interconnect id or the interconnect uri.
port_name (str): A specific port name of an interconnect.
subport_number (int): The subport.
Returns:
dict: The statistics for the interconnect that matches id, port_name, and subport_number. | [
"Gets",
"the",
"subport",
"statistics",
"on",
"an",
"interconnect",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/interconnects.py#L93-L106 | train | 251,552 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/interconnects.py | Interconnects.get_name_servers | def get_name_servers(self, id_or_uri):
"""
Gets the named servers for an interconnect.
Args:
id_or_uri: Can be either the interconnect id or the interconnect uri.
Returns:
dict: the name servers for an interconnect.
"""
uri = self._client.build_uri(id_or_uri) + "/nameServers"
return self._client.get(uri) | python | def get_name_servers(self, id_or_uri):
"""
Gets the named servers for an interconnect.
Args:
id_or_uri: Can be either the interconnect id or the interconnect uri.
Returns:
dict: the name servers for an interconnect.
"""
uri = self._client.build_uri(id_or_uri) + "/nameServers"
return self._client.get(uri) | [
"def",
"get_name_servers",
"(",
"self",
",",
"id_or_uri",
")",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"id_or_uri",
")",
"+",
"\"/nameServers\"",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"uri",
")"
] | Gets the named servers for an interconnect.
Args:
id_or_uri: Can be either the interconnect id or the interconnect uri.
Returns:
dict: the name servers for an interconnect. | [
"Gets",
"the",
"named",
"servers",
"for",
"an",
"interconnect",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/interconnects.py#L108-L120 | train | 251,553 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/interconnects.py | Interconnects.update_port | def update_port(self, port_information, id_or_uri, timeout=-1):
"""
Updates an interconnect port.
Args:
id_or_uri: Can be either the interconnect id or the interconnect uri.
port_information (dict): object to update
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: The interconnect.
"""
uri = self._client.build_uri(id_or_uri) + "/ports"
return self._client.update(port_information, uri, timeout) | python | def update_port(self, port_information, id_or_uri, timeout=-1):
"""
Updates an interconnect port.
Args:
id_or_uri: Can be either the interconnect id or the interconnect uri.
port_information (dict): object to update
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: The interconnect.
"""
uri = self._client.build_uri(id_or_uri) + "/ports"
return self._client.update(port_information, uri, timeout) | [
"def",
"update_port",
"(",
"self",
",",
"port_information",
",",
"id_or_uri",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"id_or_uri",
")",
"+",
"\"/ports\"",
"return",
"self",
".",
"_client",
".",
"update",
"(",
"port_information",
",",
"uri",
",",
"timeout",
")"
] | Updates an interconnect port.
Args:
id_or_uri: Can be either the interconnect id or the interconnect uri.
port_information (dict): object to update
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: The interconnect. | [
"Updates",
"an",
"interconnect",
"port",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/interconnects.py#L186-L201 | train | 251,554 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/interconnects.py | Interconnects.update_ports | def update_ports(self, ports, id_or_uri, timeout=-1):
"""
Updates the interconnect ports.
Args:
id_or_uri: Can be either the interconnect id or the interconnect uri.
ports (list): Ports to update.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: The interconnect.
"""
resources = merge_default_values(ports, {'type': 'port'})
uri = self._client.build_uri(id_or_uri) + "/update-ports"
return self._client.update(resources, uri, timeout) | python | def update_ports(self, ports, id_or_uri, timeout=-1):
"""
Updates the interconnect ports.
Args:
id_or_uri: Can be either the interconnect id or the interconnect uri.
ports (list): Ports to update.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: The interconnect.
"""
resources = merge_default_values(ports, {'type': 'port'})
uri = self._client.build_uri(id_or_uri) + "/update-ports"
return self._client.update(resources, uri, timeout) | [
"def",
"update_ports",
"(",
"self",
",",
"ports",
",",
"id_or_uri",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"resources",
"=",
"merge_default_values",
"(",
"ports",
",",
"{",
"'type'",
":",
"'port'",
"}",
")",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"id_or_uri",
")",
"+",
"\"/update-ports\"",
"return",
"self",
".",
"_client",
".",
"update",
"(",
"resources",
",",
"uri",
",",
"timeout",
")"
] | Updates the interconnect ports.
Args:
id_or_uri: Can be either the interconnect id or the interconnect uri.
ports (list): Ports to update.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: The interconnect. | [
"Updates",
"the",
"interconnect",
"ports",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/interconnects.py#L203-L220 | train | 251,555 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/interconnects.py | Interconnects.reset_port_protection | def reset_port_protection(self, id_or_uri, timeout=-1):
"""
Triggers a reset of port protection.
Cause port protection to be reset on all the interconnects of the logical interconnect that matches ID.
Args:
id_or_uri: Can be either the interconnect id or the interconnect uri.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: The interconnect.
"""
uri = self._client.build_uri(id_or_uri) + "/resetportprotection"
return self._client.update_with_zero_body(uri, timeout) | python | def reset_port_protection(self, id_or_uri, timeout=-1):
"""
Triggers a reset of port protection.
Cause port protection to be reset on all the interconnects of the logical interconnect that matches ID.
Args:
id_or_uri: Can be either the interconnect id or the interconnect uri.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: The interconnect.
"""
uri = self._client.build_uri(id_or_uri) + "/resetportprotection"
return self._client.update_with_zero_body(uri, timeout) | [
"def",
"reset_port_protection",
"(",
"self",
",",
"id_or_uri",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"id_or_uri",
")",
"+",
"\"/resetportprotection\"",
"return",
"self",
".",
"_client",
".",
"update_with_zero_body",
"(",
"uri",
",",
"timeout",
")"
] | Triggers a reset of port protection.
Cause port protection to be reset on all the interconnects of the logical interconnect that matches ID.
Args:
id_or_uri: Can be either the interconnect id or the interconnect uri.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: The interconnect. | [
"Triggers",
"a",
"reset",
"of",
"port",
"protection",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/interconnects.py#L222-L238 | train | 251,556 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/interconnects.py | Interconnects.get_ports | def get_ports(self, id_or_uri, start=0, count=-1):
"""
Gets all interconnect ports.
Args:
id_or_uri: Can be either the interconnect id or the interconnect uri.
start:
The first item to return, using 0-based indexing.
If not specified, the default is 0 - start with the first available item.
count:
The number of resources to return. A count of -1 requests all items.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
Returns:
list: All interconnect ports.
"""
uri = self._client.build_subresource_uri(resource_id_or_uri=id_or_uri, subresource_path="ports")
return self._client.get_all(start, count, uri=uri) | python | def get_ports(self, id_or_uri, start=0, count=-1):
"""
Gets all interconnect ports.
Args:
id_or_uri: Can be either the interconnect id or the interconnect uri.
start:
The first item to return, using 0-based indexing.
If not specified, the default is 0 - start with the first available item.
count:
The number of resources to return. A count of -1 requests all items.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
Returns:
list: All interconnect ports.
"""
uri = self._client.build_subresource_uri(resource_id_or_uri=id_or_uri, subresource_path="ports")
return self._client.get_all(start, count, uri=uri) | [
"def",
"get_ports",
"(",
"self",
",",
"id_or_uri",
",",
"start",
"=",
"0",
",",
"count",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_subresource_uri",
"(",
"resource_id_or_uri",
"=",
"id_or_uri",
",",
"subresource_path",
"=",
"\"ports\"",
")",
"return",
"self",
".",
"_client",
".",
"get_all",
"(",
"start",
",",
"count",
",",
"uri",
"=",
"uri",
")"
] | Gets all interconnect ports.
Args:
id_or_uri: Can be either the interconnect id or the interconnect uri.
start:
The first item to return, using 0-based indexing.
If not specified, the default is 0 - start with the first available item.
count:
The number of resources to return. A count of -1 requests all items.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
Returns:
list: All interconnect ports. | [
"Gets",
"all",
"interconnect",
"ports",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/interconnects.py#L240-L258 | train | 251,557 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/interconnects.py | Interconnects.get_port | def get_port(self, id_or_uri, port_id_or_uri):
"""
Gets an interconnect port.
Args:
id_or_uri: Can be either the interconnect id or uri.
port_id_or_uri: The interconnect port id or uri.
Returns:
dict: The interconnect port.
"""
uri = self._client.build_subresource_uri(id_or_uri, port_id_or_uri, "ports")
return self._client.get(uri) | python | def get_port(self, id_or_uri, port_id_or_uri):
"""
Gets an interconnect port.
Args:
id_or_uri: Can be either the interconnect id or uri.
port_id_or_uri: The interconnect port id or uri.
Returns:
dict: The interconnect port.
"""
uri = self._client.build_subresource_uri(id_or_uri, port_id_or_uri, "ports")
return self._client.get(uri) | [
"def",
"get_port",
"(",
"self",
",",
"id_or_uri",
",",
"port_id_or_uri",
")",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_subresource_uri",
"(",
"id_or_uri",
",",
"port_id_or_uri",
",",
"\"ports\"",
")",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"uri",
")"
] | Gets an interconnect port.
Args:
id_or_uri: Can be either the interconnect id or uri.
port_id_or_uri: The interconnect port id or uri.
Returns:
dict: The interconnect port. | [
"Gets",
"an",
"interconnect",
"port",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/interconnects.py#L260-L272 | train | 251,558 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/interconnects.py | Interconnects.get_pluggable_module_information | def get_pluggable_module_information(self, id_or_uri):
"""
Gets all the pluggable module information.
Args:
id_or_uri: Can be either the interconnect id or uri.
Returns:
array: dicts of the pluggable module information.
"""
uri = self._client.build_uri(id_or_uri) + "/pluggableModuleInformation"
return self._client.get(uri) | python | def get_pluggable_module_information(self, id_or_uri):
"""
Gets all the pluggable module information.
Args:
id_or_uri: Can be either the interconnect id or uri.
Returns:
array: dicts of the pluggable module information.
"""
uri = self._client.build_uri(id_or_uri) + "/pluggableModuleInformation"
return self._client.get(uri) | [
"def",
"get_pluggable_module_information",
"(",
"self",
",",
"id_or_uri",
")",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"id_or_uri",
")",
"+",
"\"/pluggableModuleInformation\"",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"uri",
")"
] | Gets all the pluggable module information.
Args:
id_or_uri: Can be either the interconnect id or uri.
Returns:
array: dicts of the pluggable module information. | [
"Gets",
"all",
"the",
"pluggable",
"module",
"information",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/interconnects.py#L274-L285 | train | 251,559 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/interconnects.py | Interconnects.update_configuration | def update_configuration(self, id_or_uri, timeout=-1):
"""
Reapplies the appliance's configuration on the interconnect. This includes running the same configure steps
that were performed as part of the interconnect add by the enclosure.
Args:
id_or_uri: Can be either the resource ID or the resource URI.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
Interconnect
"""
uri = self._client.build_uri(id_or_uri) + "/configuration"
return self._client.update_with_zero_body(uri, timeout=timeout) | python | def update_configuration(self, id_or_uri, timeout=-1):
"""
Reapplies the appliance's configuration on the interconnect. This includes running the same configure steps
that were performed as part of the interconnect add by the enclosure.
Args:
id_or_uri: Can be either the resource ID or the resource URI.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
Interconnect
"""
uri = self._client.build_uri(id_or_uri) + "/configuration"
return self._client.update_with_zero_body(uri, timeout=timeout) | [
"def",
"update_configuration",
"(",
"self",
",",
"id_or_uri",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"id_or_uri",
")",
"+",
"\"/configuration\"",
"return",
"self",
".",
"_client",
".",
"update_with_zero_body",
"(",
"uri",
",",
"timeout",
"=",
"timeout",
")"
] | Reapplies the appliance's configuration on the interconnect. This includes running the same configure steps
that were performed as part of the interconnect add by the enclosure.
Args:
id_or_uri: Can be either the resource ID or the resource URI.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
Interconnect | [
"Reapplies",
"the",
"appliance",
"s",
"configuration",
"on",
"the",
"interconnect",
".",
"This",
"includes",
"running",
"the",
"same",
"configure",
"steps",
"that",
"were",
"performed",
"as",
"part",
"of",
"the",
"interconnect",
"add",
"by",
"the",
"enclosure",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/interconnects.py#L287-L301 | train | 251,560 |
HewlettPackard/python-hpOneView | hpOneView/resources/fc_sans/san_managers.py | SanManagers.update | def update(self, resource, id_or_uri):
"""
Updates a registered Device Manager.
Args:
resource (dict): Object to update.
id_or_uri: Can be either the Device manager ID or URI.
Returns:
dict: The device manager resource.
"""
return self._client.update(resource=resource, uri=id_or_uri) | python | def update(self, resource, id_or_uri):
"""
Updates a registered Device Manager.
Args:
resource (dict): Object to update.
id_or_uri: Can be either the Device manager ID or URI.
Returns:
dict: The device manager resource.
"""
return self._client.update(resource=resource, uri=id_or_uri) | [
"def",
"update",
"(",
"self",
",",
"resource",
",",
"id_or_uri",
")",
":",
"return",
"self",
".",
"_client",
".",
"update",
"(",
"resource",
"=",
"resource",
",",
"uri",
"=",
"id_or_uri",
")"
] | Updates a registered Device Manager.
Args:
resource (dict): Object to update.
id_or_uri: Can be either the Device manager ID or URI.
Returns:
dict: The device manager resource. | [
"Updates",
"a",
"registered",
"Device",
"Manager",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/fc_sans/san_managers.py#L87-L98 | train | 251,561 |
HewlettPackard/python-hpOneView | hpOneView/resources/fc_sans/san_managers.py | SanManagers.add | def add(self, resource, provider_uri_or_id, timeout=-1):
"""
Adds a Device Manager under the specified provider.
Args:
resource (dict): Object to add.
provider_uri_or_id: ID or URI of provider.
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 SAN Manager.
"""
uri = self._provider_client.build_uri(provider_uri_or_id) + "/device-managers"
return self._client.create(resource=resource, uri=uri, timeout=timeout) | python | def add(self, resource, provider_uri_or_id, timeout=-1):
"""
Adds a Device Manager under the specified provider.
Args:
resource (dict): Object to add.
provider_uri_or_id: ID or URI of provider.
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 SAN Manager.
"""
uri = self._provider_client.build_uri(provider_uri_or_id) + "/device-managers"
return self._client.create(resource=resource, uri=uri, timeout=timeout) | [
"def",
"add",
"(",
"self",
",",
"resource",
",",
"provider_uri_or_id",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"self",
".",
"_provider_client",
".",
"build_uri",
"(",
"provider_uri_or_id",
")",
"+",
"\"/device-managers\"",
"return",
"self",
".",
"_client",
".",
"create",
"(",
"resource",
"=",
"resource",
",",
"uri",
"=",
"uri",
",",
"timeout",
"=",
"timeout",
")"
] | Adds a Device Manager under the specified provider.
Args:
resource (dict): Object to add.
provider_uri_or_id: ID or URI of provider.
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 SAN Manager. | [
"Adds",
"a",
"Device",
"Manager",
"under",
"the",
"specified",
"provider",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/fc_sans/san_managers.py#L100-L115 | train | 251,562 |
HewlettPackard/python-hpOneView | hpOneView/resources/fc_sans/san_managers.py | SanManagers.get_provider_uri | def get_provider_uri(self, provider_display_name):
"""
Gets uri for a specific provider.
Args:
provider_display_name: Display name of the provider.
Returns:
uri
"""
providers = self._provider_client.get_by('displayName', provider_display_name)
return providers[0]['uri'] if providers else None | python | def get_provider_uri(self, provider_display_name):
"""
Gets uri for a specific provider.
Args:
provider_display_name: Display name of the provider.
Returns:
uri
"""
providers = self._provider_client.get_by('displayName', provider_display_name)
return providers[0]['uri'] if providers else None | [
"def",
"get_provider_uri",
"(",
"self",
",",
"provider_display_name",
")",
":",
"providers",
"=",
"self",
".",
"_provider_client",
".",
"get_by",
"(",
"'displayName'",
",",
"provider_display_name",
")",
"return",
"providers",
"[",
"0",
"]",
"[",
"'uri'",
"]",
"if",
"providers",
"else",
"None"
] | Gets uri for a specific provider.
Args:
provider_display_name: Display name of the provider.
Returns:
uri | [
"Gets",
"uri",
"for",
"a",
"specific",
"provider",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/fc_sans/san_managers.py#L117-L128 | train | 251,563 |
HewlettPackard/python-hpOneView | hpOneView/resources/fc_sans/san_managers.py | SanManagers.get_default_connection_info | def get_default_connection_info(self, provider_name):
"""
Gets default connection info for a specific provider.
Args:
provider_name: Name of the provider.
Returns:
dict: Default connection information.
"""
provider = self._provider_client.get_by_name(provider_name)
if provider:
return provider['defaultConnectionInfo']
else:
return {} | python | def get_default_connection_info(self, provider_name):
"""
Gets default connection info for a specific provider.
Args:
provider_name: Name of the provider.
Returns:
dict: Default connection information.
"""
provider = self._provider_client.get_by_name(provider_name)
if provider:
return provider['defaultConnectionInfo']
else:
return {} | [
"def",
"get_default_connection_info",
"(",
"self",
",",
"provider_name",
")",
":",
"provider",
"=",
"self",
".",
"_provider_client",
".",
"get_by_name",
"(",
"provider_name",
")",
"if",
"provider",
":",
"return",
"provider",
"[",
"'defaultConnectionInfo'",
"]",
"else",
":",
"return",
"{",
"}"
] | Gets default connection info for a specific provider.
Args:
provider_name: Name of the provider.
Returns:
dict: Default connection information. | [
"Gets",
"default",
"connection",
"info",
"for",
"a",
"specific",
"provider",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/fc_sans/san_managers.py#L130-L144 | train | 251,564 |
HewlettPackard/python-hpOneView | hpOneView/resources/fc_sans/san_managers.py | SanManagers.get_by_name | def get_by_name(self, name):
"""
Gets a SAN Manager by name.
Args:
name: Name of the SAN Manager
Returns:
dict: SAN Manager.
"""
san_managers = self._client.get_all()
result = [x for x in san_managers if x['name'] == name]
return result[0] if result else None | python | def get_by_name(self, name):
"""
Gets a SAN Manager by name.
Args:
name: Name of the SAN Manager
Returns:
dict: SAN Manager.
"""
san_managers = self._client.get_all()
result = [x for x in san_managers if x['name'] == name]
return result[0] if result else None | [
"def",
"get_by_name",
"(",
"self",
",",
"name",
")",
":",
"san_managers",
"=",
"self",
".",
"_client",
".",
"get_all",
"(",
")",
"result",
"=",
"[",
"x",
"for",
"x",
"in",
"san_managers",
"if",
"x",
"[",
"'name'",
"]",
"==",
"name",
"]",
"return",
"result",
"[",
"0",
"]",
"if",
"result",
"else",
"None"
] | Gets a SAN Manager by name.
Args:
name: Name of the SAN Manager
Returns:
dict: SAN Manager. | [
"Gets",
"a",
"SAN",
"Manager",
"by",
"name",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/fc_sans/san_managers.py#L161-L173 | train | 251,565 |
HewlettPackard/python-hpOneView | hpOneView/resources/fc_sans/san_managers.py | SanManagers.get_by_provider_display_name | def get_by_provider_display_name(self, provider_display_name):
"""
Gets a SAN Manager by provider display name.
Args:
provider_display_name: Name of the Provider Display Name
Returns:
dict: SAN Manager.
"""
san_managers = self._client.get_all()
result = [x for x in san_managers if x['providerDisplayName'] == provider_display_name]
return result[0] if result else None | python | def get_by_provider_display_name(self, provider_display_name):
"""
Gets a SAN Manager by provider display name.
Args:
provider_display_name: Name of the Provider Display Name
Returns:
dict: SAN Manager.
"""
san_managers = self._client.get_all()
result = [x for x in san_managers if x['providerDisplayName'] == provider_display_name]
return result[0] if result else None | [
"def",
"get_by_provider_display_name",
"(",
"self",
",",
"provider_display_name",
")",
":",
"san_managers",
"=",
"self",
".",
"_client",
".",
"get_all",
"(",
")",
"result",
"=",
"[",
"x",
"for",
"x",
"in",
"san_managers",
"if",
"x",
"[",
"'providerDisplayName'",
"]",
"==",
"provider_display_name",
"]",
"return",
"result",
"[",
"0",
"]",
"if",
"result",
"else",
"None"
] | Gets a SAN Manager by provider display name.
Args:
provider_display_name: Name of the Provider Display Name
Returns:
dict: SAN Manager. | [
"Gets",
"a",
"SAN",
"Manager",
"by",
"provider",
"display",
"name",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/fc_sans/san_managers.py#L175-L187 | train | 251,566 |
HewlettPackard/python-hpOneView | hpOneView/resources/data_services/metric_streaming.py | MetricStreaming.update_configuration | def update_configuration(self, configuration):
"""
Updates the metrics configuration with the new values. Overwrites the existing configuration.
Args:
configuration (dict):
Dictionary with a list of objects which contain frequency, sample interval, and source type for each
resource-type.
Returns:
dict: The current configuration for which metrics are being relayed.
"""
return self._client.update(configuration, uri=self.URI + "/configuration") | python | def update_configuration(self, configuration):
"""
Updates the metrics configuration with the new values. Overwrites the existing configuration.
Args:
configuration (dict):
Dictionary with a list of objects which contain frequency, sample interval, and source type for each
resource-type.
Returns:
dict: The current configuration for which metrics are being relayed.
"""
return self._client.update(configuration, uri=self.URI + "/configuration") | [
"def",
"update_configuration",
"(",
"self",
",",
"configuration",
")",
":",
"return",
"self",
".",
"_client",
".",
"update",
"(",
"configuration",
",",
"uri",
"=",
"self",
".",
"URI",
"+",
"\"/configuration\"",
")"
] | Updates the metrics configuration with the new values. Overwrites the existing configuration.
Args:
configuration (dict):
Dictionary with a list of objects which contain frequency, sample interval, and source type for each
resource-type.
Returns:
dict: The current configuration for which metrics are being relayed. | [
"Updates",
"the",
"metrics",
"configuration",
"with",
"the",
"new",
"values",
".",
"Overwrites",
"the",
"existing",
"configuration",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/data_services/metric_streaming.py#L99-L112 | train | 251,567 |
HewlettPackard/python-hpOneView | hpOneView/resources/settings/appliance_device_snmp_v3_users.py | ApplianceDeviceSNMPv3Users.delete_all | def delete_all(self, filter=None, timeout=-1):
"""
Delete an SNMPv3 User based on User name specified in filter. The user will be deleted only if it has no associated destinations.
Args:
username: ID or URI of SNMPv3 user.
filter: A general filter/query string to narrow the list of items returned.
The default is no filter - all resources are returned.
Returns:
bool: Indicates if the resource was successfully deleted.
"""
return self._client.delete_all(filter=filter, timeout=timeout) | python | def delete_all(self, filter=None, timeout=-1):
"""
Delete an SNMPv3 User based on User name specified in filter. The user will be deleted only if it has no associated destinations.
Args:
username: ID or URI of SNMPv3 user.
filter: A general filter/query string to narrow the list of items returned.
The default is no filter - all resources are returned.
Returns:
bool: Indicates if the resource was successfully deleted.
"""
return self._client.delete_all(filter=filter, timeout=timeout) | [
"def",
"delete_all",
"(",
"self",
",",
"filter",
"=",
"None",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"return",
"self",
".",
"_client",
".",
"delete_all",
"(",
"filter",
"=",
"filter",
",",
"timeout",
"=",
"timeout",
")"
] | Delete an SNMPv3 User based on User name specified in filter. The user will be deleted only if it has no associated destinations.
Args:
username: ID or URI of SNMPv3 user.
filter: A general filter/query string to narrow the list of items returned.
The default is no filter - all resources are returned.
Returns:
bool: Indicates if the resource was successfully deleted. | [
"Delete",
"an",
"SNMPv3",
"User",
"based",
"on",
"User",
"name",
"specified",
"in",
"filter",
".",
"The",
"user",
"will",
"be",
"deleted",
"only",
"if",
"it",
"has",
"no",
"associated",
"destinations",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/settings/appliance_device_snmp_v3_users.py#L122-L134 | train | 251,568 |
HewlettPackard/python-hpOneView | hpOneView/resources/networking/switches.py | Switches.update_ports | def update_ports(self, ports, id_or_uri):
"""
Updates the switch ports. Only the ports under the management of OneView and those that are unlinked are
supported for update.
Note:
This method is available for API version 300 or later.
Args:
ports: List of Switch Ports.
id_or_uri: Can be either the switch id or the switch uri.
Returns:
dict: Switch
"""
ports = merge_default_values(ports, {'type': 'port'})
uri = self._client.build_uri(id_or_uri) + "/update-ports"
return self._client.update(uri=uri, resource=ports) | python | def update_ports(self, ports, id_or_uri):
"""
Updates the switch ports. Only the ports under the management of OneView and those that are unlinked are
supported for update.
Note:
This method is available for API version 300 or later.
Args:
ports: List of Switch Ports.
id_or_uri: Can be either the switch id or the switch uri.
Returns:
dict: Switch
"""
ports = merge_default_values(ports, {'type': 'port'})
uri = self._client.build_uri(id_or_uri) + "/update-ports"
return self._client.update(uri=uri, resource=ports) | [
"def",
"update_ports",
"(",
"self",
",",
"ports",
",",
"id_or_uri",
")",
":",
"ports",
"=",
"merge_default_values",
"(",
"ports",
",",
"{",
"'type'",
":",
"'port'",
"}",
")",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"id_or_uri",
")",
"+",
"\"/update-ports\"",
"return",
"self",
".",
"_client",
".",
"update",
"(",
"uri",
"=",
"uri",
",",
"resource",
"=",
"ports",
")"
] | Updates the switch ports. Only the ports under the management of OneView and those that are unlinked are
supported for update.
Note:
This method is available for API version 300 or later.
Args:
ports: List of Switch Ports.
id_or_uri: Can be either the switch id or the switch uri.
Returns:
dict: Switch | [
"Updates",
"the",
"switch",
"ports",
".",
"Only",
"the",
"ports",
"under",
"the",
"management",
"of",
"OneView",
"and",
"those",
"that",
"are",
"unlinked",
"are",
"supported",
"for",
"update",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/switches.py#L152-L170 | train | 251,569 |
HewlettPackard/python-hpOneView | hpOneView/oneview_client.py | OneViewClient.from_json_file | def from_json_file(cls, file_name):
"""
Construct OneViewClient using a json file.
Args:
file_name: json full path.
Returns:
OneViewClient:
"""
with open(file_name) as json_data:
config = json.load(json_data)
return cls(config) | python | def from_json_file(cls, file_name):
"""
Construct OneViewClient using a json file.
Args:
file_name: json full path.
Returns:
OneViewClient:
"""
with open(file_name) as json_data:
config = json.load(json_data)
return cls(config) | [
"def",
"from_json_file",
"(",
"cls",
",",
"file_name",
")",
":",
"with",
"open",
"(",
"file_name",
")",
"as",
"json_data",
":",
"config",
"=",
"json",
".",
"load",
"(",
"json_data",
")",
"return",
"cls",
"(",
"config",
")"
] | Construct OneViewClient using a json file.
Args:
file_name: json full path.
Returns:
OneViewClient: | [
"Construct",
"OneViewClient",
"using",
"a",
"json",
"file",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L209-L222 | train | 251,570 |
HewlettPackard/python-hpOneView | hpOneView/oneview_client.py | OneViewClient.from_environment_variables | def from_environment_variables(cls):
"""
Construct OneViewClient using environment variables.
Allowed variables: ONEVIEWSDK_IP (required), ONEVIEWSDK_USERNAME (required), ONEVIEWSDK_PASSWORD (required),
ONEVIEWSDK_AUTH_LOGIN_DOMAIN, ONEVIEWSDK_API_VERSION, ONEVIEWSDK_IMAGE_STREAMER_IP, ONEVIEWSDK_SESSIONID, ONEVIEWSDK_SSL_CERTIFICATE,
ONEVIEWSDK_CONNECTION_TIMEOUT and ONEVIEWSDK_PROXY.
Returns:
OneViewClient:
"""
ip = os.environ.get('ONEVIEWSDK_IP', '')
image_streamer_ip = os.environ.get('ONEVIEWSDK_IMAGE_STREAMER_IP', '')
api_version = int(os.environ.get('ONEVIEWSDK_API_VERSION', OneViewClient.DEFAULT_API_VERSION))
ssl_certificate = os.environ.get('ONEVIEWSDK_SSL_CERTIFICATE', '')
username = os.environ.get('ONEVIEWSDK_USERNAME', '')
auth_login_domain = os.environ.get('ONEVIEWSDK_AUTH_LOGIN_DOMAIN', '')
password = os.environ.get('ONEVIEWSDK_PASSWORD', '')
proxy = os.environ.get('ONEVIEWSDK_PROXY', '')
sessionID = os.environ.get('ONEVIEWSDK_SESSIONID', '')
timeout = os.environ.get('ONEVIEWSDK_CONNECTION_TIMEOUT')
config = dict(ip=ip,
image_streamer_ip=image_streamer_ip,
api_version=api_version,
ssl_certificate=ssl_certificate,
credentials=dict(userName=username, authLoginDomain=auth_login_domain, password=password, sessionID=sessionID),
proxy=proxy, timeout=timeout)
return cls(config) | python | def from_environment_variables(cls):
"""
Construct OneViewClient using environment variables.
Allowed variables: ONEVIEWSDK_IP (required), ONEVIEWSDK_USERNAME (required), ONEVIEWSDK_PASSWORD (required),
ONEVIEWSDK_AUTH_LOGIN_DOMAIN, ONEVIEWSDK_API_VERSION, ONEVIEWSDK_IMAGE_STREAMER_IP, ONEVIEWSDK_SESSIONID, ONEVIEWSDK_SSL_CERTIFICATE,
ONEVIEWSDK_CONNECTION_TIMEOUT and ONEVIEWSDK_PROXY.
Returns:
OneViewClient:
"""
ip = os.environ.get('ONEVIEWSDK_IP', '')
image_streamer_ip = os.environ.get('ONEVIEWSDK_IMAGE_STREAMER_IP', '')
api_version = int(os.environ.get('ONEVIEWSDK_API_VERSION', OneViewClient.DEFAULT_API_VERSION))
ssl_certificate = os.environ.get('ONEVIEWSDK_SSL_CERTIFICATE', '')
username = os.environ.get('ONEVIEWSDK_USERNAME', '')
auth_login_domain = os.environ.get('ONEVIEWSDK_AUTH_LOGIN_DOMAIN', '')
password = os.environ.get('ONEVIEWSDK_PASSWORD', '')
proxy = os.environ.get('ONEVIEWSDK_PROXY', '')
sessionID = os.environ.get('ONEVIEWSDK_SESSIONID', '')
timeout = os.environ.get('ONEVIEWSDK_CONNECTION_TIMEOUT')
config = dict(ip=ip,
image_streamer_ip=image_streamer_ip,
api_version=api_version,
ssl_certificate=ssl_certificate,
credentials=dict(userName=username, authLoginDomain=auth_login_domain, password=password, sessionID=sessionID),
proxy=proxy, timeout=timeout)
return cls(config) | [
"def",
"from_environment_variables",
"(",
"cls",
")",
":",
"ip",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'ONEVIEWSDK_IP'",
",",
"''",
")",
"image_streamer_ip",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'ONEVIEWSDK_IMAGE_STREAMER_IP'",
",",
"''",
")",
"api_version",
"=",
"int",
"(",
"os",
".",
"environ",
".",
"get",
"(",
"'ONEVIEWSDK_API_VERSION'",
",",
"OneViewClient",
".",
"DEFAULT_API_VERSION",
")",
")",
"ssl_certificate",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'ONEVIEWSDK_SSL_CERTIFICATE'",
",",
"''",
")",
"username",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'ONEVIEWSDK_USERNAME'",
",",
"''",
")",
"auth_login_domain",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'ONEVIEWSDK_AUTH_LOGIN_DOMAIN'",
",",
"''",
")",
"password",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'ONEVIEWSDK_PASSWORD'",
",",
"''",
")",
"proxy",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'ONEVIEWSDK_PROXY'",
",",
"''",
")",
"sessionID",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'ONEVIEWSDK_SESSIONID'",
",",
"''",
")",
"timeout",
"=",
"os",
".",
"environ",
".",
"get",
"(",
"'ONEVIEWSDK_CONNECTION_TIMEOUT'",
")",
"config",
"=",
"dict",
"(",
"ip",
"=",
"ip",
",",
"image_streamer_ip",
"=",
"image_streamer_ip",
",",
"api_version",
"=",
"api_version",
",",
"ssl_certificate",
"=",
"ssl_certificate",
",",
"credentials",
"=",
"dict",
"(",
"userName",
"=",
"username",
",",
"authLoginDomain",
"=",
"auth_login_domain",
",",
"password",
"=",
"password",
",",
"sessionID",
"=",
"sessionID",
")",
",",
"proxy",
"=",
"proxy",
",",
"timeout",
"=",
"timeout",
")",
"return",
"cls",
"(",
"config",
")"
] | Construct OneViewClient using environment variables.
Allowed variables: ONEVIEWSDK_IP (required), ONEVIEWSDK_USERNAME (required), ONEVIEWSDK_PASSWORD (required),
ONEVIEWSDK_AUTH_LOGIN_DOMAIN, ONEVIEWSDK_API_VERSION, ONEVIEWSDK_IMAGE_STREAMER_IP, ONEVIEWSDK_SESSIONID, ONEVIEWSDK_SSL_CERTIFICATE,
ONEVIEWSDK_CONNECTION_TIMEOUT and ONEVIEWSDK_PROXY.
Returns:
OneViewClient: | [
"Construct",
"OneViewClient",
"using",
"environment",
"variables",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L225-L254 | train | 251,571 |
HewlettPackard/python-hpOneView | hpOneView/oneview_client.py | OneViewClient.create_image_streamer_client | def create_image_streamer_client(self):
"""
Create the Image Streamer API Client.
Returns:
ImageStreamerClient:
"""
image_streamer = ImageStreamerClient(self.__image_streamer_ip,
self.__connection.get_session_id(),
self.__connection._apiVersion,
self.__connection._sslBundle)
return image_streamer | python | def create_image_streamer_client(self):
"""
Create the Image Streamer API Client.
Returns:
ImageStreamerClient:
"""
image_streamer = ImageStreamerClient(self.__image_streamer_ip,
self.__connection.get_session_id(),
self.__connection._apiVersion,
self.__connection._sslBundle)
return image_streamer | [
"def",
"create_image_streamer_client",
"(",
"self",
")",
":",
"image_streamer",
"=",
"ImageStreamerClient",
"(",
"self",
".",
"__image_streamer_ip",
",",
"self",
".",
"__connection",
".",
"get_session_id",
"(",
")",
",",
"self",
".",
"__connection",
".",
"_apiVersion",
",",
"self",
".",
"__connection",
".",
"_sslBundle",
")",
"return",
"image_streamer"
] | Create the Image Streamer API Client.
Returns:
ImageStreamerClient: | [
"Create",
"the",
"Image",
"Streamer",
"API",
"Client",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L292-L304 | train | 251,572 |
HewlettPackard/python-hpOneView | hpOneView/oneview_client.py | OneViewClient.certificate_authority | def certificate_authority(self):
"""
Gets the Certificate Authority API client.
Returns:
CertificateAuthority:
"""
if not self.__certificate_authority:
self.__certificate_authority = CertificateAuthority(self.__connection)
return self.__certificate_authority | python | def certificate_authority(self):
"""
Gets the Certificate Authority API client.
Returns:
CertificateAuthority:
"""
if not self.__certificate_authority:
self.__certificate_authority = CertificateAuthority(self.__connection)
return self.__certificate_authority | [
"def",
"certificate_authority",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__certificate_authority",
":",
"self",
".",
"__certificate_authority",
"=",
"CertificateAuthority",
"(",
"self",
".",
"__connection",
")",
"return",
"self",
".",
"__certificate_authority"
] | Gets the Certificate Authority API client.
Returns:
CertificateAuthority: | [
"Gets",
"the",
"Certificate",
"Authority",
"API",
"client",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L307-L316 | train | 251,573 |
HewlettPackard/python-hpOneView | hpOneView/oneview_client.py | OneViewClient.connections | def connections(self):
"""
Gets the Connections API client.
Returns:
Connections:
"""
if not self.__connections:
self.__connections = Connections(
self.__connection)
return self.__connections | python | def connections(self):
"""
Gets the Connections API client.
Returns:
Connections:
"""
if not self.__connections:
self.__connections = Connections(
self.__connection)
return self.__connections | [
"def",
"connections",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__connections",
":",
"self",
".",
"__connections",
"=",
"Connections",
"(",
"self",
".",
"__connection",
")",
"return",
"self",
".",
"__connections"
] | Gets the Connections API client.
Returns:
Connections: | [
"Gets",
"the",
"Connections",
"API",
"client",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L319-L329 | train | 251,574 |
HewlettPackard/python-hpOneView | hpOneView/oneview_client.py | OneViewClient.fcoe_networks | def fcoe_networks(self):
"""
Gets the FcoeNetworks API client.
Returns:
FcoeNetworks:
"""
if not self.__fcoe_networks:
self.__fcoe_networks = FcoeNetworks(self.__connection)
return self.__fcoe_networks | python | def fcoe_networks(self):
"""
Gets the FcoeNetworks API client.
Returns:
FcoeNetworks:
"""
if not self.__fcoe_networks:
self.__fcoe_networks = FcoeNetworks(self.__connection)
return self.__fcoe_networks | [
"def",
"fcoe_networks",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__fcoe_networks",
":",
"self",
".",
"__fcoe_networks",
"=",
"FcoeNetworks",
"(",
"self",
".",
"__connection",
")",
"return",
"self",
".",
"__fcoe_networks"
] | Gets the FcoeNetworks API client.
Returns:
FcoeNetworks: | [
"Gets",
"the",
"FcoeNetworks",
"API",
"client",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L352-L361 | train | 251,575 |
HewlettPackard/python-hpOneView | hpOneView/oneview_client.py | OneViewClient.fabrics | def fabrics(self):
"""
Gets the Fabrics API client.
Returns:
Fabrics:
"""
if not self.__fabrics:
self.__fabrics = Fabrics(self.__connection)
return self.__fabrics | python | def fabrics(self):
"""
Gets the Fabrics API client.
Returns:
Fabrics:
"""
if not self.__fabrics:
self.__fabrics = Fabrics(self.__connection)
return self.__fabrics | [
"def",
"fabrics",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__fabrics",
":",
"self",
".",
"__fabrics",
"=",
"Fabrics",
"(",
"self",
".",
"__connection",
")",
"return",
"self",
".",
"__fabrics"
] | Gets the Fabrics API client.
Returns:
Fabrics: | [
"Gets",
"the",
"Fabrics",
"API",
"client",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L374-L383 | train | 251,576 |
HewlettPackard/python-hpOneView | hpOneView/oneview_client.py | OneViewClient.restores | def restores(self):
"""
Gets the Restores API client.
Returns:
Restores:
"""
if not self.__restores:
self.__restores = Restores(self.__connection)
return self.__restores | python | def restores(self):
"""
Gets the Restores API client.
Returns:
Restores:
"""
if not self.__restores:
self.__restores = Restores(self.__connection)
return self.__restores | [
"def",
"restores",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__restores",
":",
"self",
".",
"__restores",
"=",
"Restores",
"(",
"self",
".",
"__connection",
")",
"return",
"self",
".",
"__restores"
] | Gets the Restores API client.
Returns:
Restores: | [
"Gets",
"the",
"Restores",
"API",
"client",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L386-L395 | train | 251,577 |
HewlettPackard/python-hpOneView | hpOneView/oneview_client.py | OneViewClient.scopes | def scopes(self):
"""
Gets the Scopes API client.
Returns:
Scopes:
"""
if not self.__scopes:
self.__scopes = Scopes(self.__connection)
return self.__scopes | python | def scopes(self):
"""
Gets the Scopes API client.
Returns:
Scopes:
"""
if not self.__scopes:
self.__scopes = Scopes(self.__connection)
return self.__scopes | [
"def",
"scopes",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__scopes",
":",
"self",
".",
"__scopes",
"=",
"Scopes",
"(",
"self",
".",
"__connection",
")",
"return",
"self",
".",
"__scopes"
] | Gets the Scopes API client.
Returns:
Scopes: | [
"Gets",
"the",
"Scopes",
"API",
"client",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L398-L407 | train | 251,578 |
HewlettPackard/python-hpOneView | hpOneView/oneview_client.py | OneViewClient.datacenters | def datacenters(self):
"""
Gets the Datacenters API client.
Returns:
Datacenters:
"""
if not self.__datacenters:
self.__datacenters = Datacenters(self.__connection)
return self.__datacenters | python | def datacenters(self):
"""
Gets the Datacenters API client.
Returns:
Datacenters:
"""
if not self.__datacenters:
self.__datacenters = Datacenters(self.__connection)
return self.__datacenters | [
"def",
"datacenters",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__datacenters",
":",
"self",
".",
"__datacenters",
"=",
"Datacenters",
"(",
"self",
".",
"__connection",
")",
"return",
"self",
".",
"__datacenters"
] | Gets the Datacenters API client.
Returns:
Datacenters: | [
"Gets",
"the",
"Datacenters",
"API",
"client",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L410-L419 | train | 251,579 |
HewlettPackard/python-hpOneView | hpOneView/oneview_client.py | OneViewClient.network_sets | def network_sets(self):
"""
Gets the NetworkSets API client.
Returns:
NetworkSets:
"""
if not self.__network_sets:
self.__network_sets = NetworkSets(self.__connection)
return self.__network_sets | python | def network_sets(self):
"""
Gets the NetworkSets API client.
Returns:
NetworkSets:
"""
if not self.__network_sets:
self.__network_sets = NetworkSets(self.__connection)
return self.__network_sets | [
"def",
"network_sets",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__network_sets",
":",
"self",
".",
"__network_sets",
"=",
"NetworkSets",
"(",
"self",
".",
"__connection",
")",
"return",
"self",
".",
"__network_sets"
] | Gets the NetworkSets API client.
Returns:
NetworkSets: | [
"Gets",
"the",
"NetworkSets",
"API",
"client",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L422-L431 | train | 251,580 |
HewlettPackard/python-hpOneView | hpOneView/oneview_client.py | OneViewClient.server_hardware | def server_hardware(self):
"""
Gets the ServerHardware API client.
Returns:
ServerHardware:
"""
if not self.__server_hardware:
self.__server_hardware = ServerHardware(self.__connection)
return self.__server_hardware | python | def server_hardware(self):
"""
Gets the ServerHardware API client.
Returns:
ServerHardware:
"""
if not self.__server_hardware:
self.__server_hardware = ServerHardware(self.__connection)
return self.__server_hardware | [
"def",
"server_hardware",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__server_hardware",
":",
"self",
".",
"__server_hardware",
"=",
"ServerHardware",
"(",
"self",
".",
"__connection",
")",
"return",
"self",
".",
"__server_hardware"
] | Gets the ServerHardware API client.
Returns:
ServerHardware: | [
"Gets",
"the",
"ServerHardware",
"API",
"client",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L434-L443 | train | 251,581 |
HewlettPackard/python-hpOneView | hpOneView/oneview_client.py | OneViewClient.server_hardware_types | def server_hardware_types(self):
"""
Gets the ServerHardwareTypes API client.
Returns:
ServerHardwareTypes:
"""
if not self.__server_hardware_types:
self.__server_hardware_types = ServerHardwareTypes(
self.__connection)
return self.__server_hardware_types | python | def server_hardware_types(self):
"""
Gets the ServerHardwareTypes API client.
Returns:
ServerHardwareTypes:
"""
if not self.__server_hardware_types:
self.__server_hardware_types = ServerHardwareTypes(
self.__connection)
return self.__server_hardware_types | [
"def",
"server_hardware_types",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__server_hardware_types",
":",
"self",
".",
"__server_hardware_types",
"=",
"ServerHardwareTypes",
"(",
"self",
".",
"__connection",
")",
"return",
"self",
".",
"__server_hardware_types"
] | Gets the ServerHardwareTypes API client.
Returns:
ServerHardwareTypes: | [
"Gets",
"the",
"ServerHardwareTypes",
"API",
"client",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L446-L456 | train | 251,582 |
HewlettPackard/python-hpOneView | hpOneView/oneview_client.py | OneViewClient.id_pools_vsn_ranges | def id_pools_vsn_ranges(self):
"""
Gets the IdPoolsRanges API Client for VSN Ranges.
Returns:
IdPoolsRanges:
"""
if not self.__id_pools_vsn_ranges:
self.__id_pools_vsn_ranges = IdPoolsRanges('vsn', self.__connection)
return self.__id_pools_vsn_ranges | python | def id_pools_vsn_ranges(self):
"""
Gets the IdPoolsRanges API Client for VSN Ranges.
Returns:
IdPoolsRanges:
"""
if not self.__id_pools_vsn_ranges:
self.__id_pools_vsn_ranges = IdPoolsRanges('vsn', self.__connection)
return self.__id_pools_vsn_ranges | [
"def",
"id_pools_vsn_ranges",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__id_pools_vsn_ranges",
":",
"self",
".",
"__id_pools_vsn_ranges",
"=",
"IdPoolsRanges",
"(",
"'vsn'",
",",
"self",
".",
"__connection",
")",
"return",
"self",
".",
"__id_pools_vsn_ranges"
] | Gets the IdPoolsRanges API Client for VSN Ranges.
Returns:
IdPoolsRanges: | [
"Gets",
"the",
"IdPoolsRanges",
"API",
"Client",
"for",
"VSN",
"Ranges",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L459-L468 | train | 251,583 |
HewlettPackard/python-hpOneView | hpOneView/oneview_client.py | OneViewClient.id_pools_vmac_ranges | def id_pools_vmac_ranges(self):
"""
Gets the IdPoolsRanges API Client for VMAC Ranges.
Returns:
IdPoolsRanges:
"""
if not self.__id_pools_vmac_ranges:
self.__id_pools_vmac_ranges = IdPoolsRanges('vmac', self.__connection)
return self.__id_pools_vmac_ranges | python | def id_pools_vmac_ranges(self):
"""
Gets the IdPoolsRanges API Client for VMAC Ranges.
Returns:
IdPoolsRanges:
"""
if not self.__id_pools_vmac_ranges:
self.__id_pools_vmac_ranges = IdPoolsRanges('vmac', self.__connection)
return self.__id_pools_vmac_ranges | [
"def",
"id_pools_vmac_ranges",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__id_pools_vmac_ranges",
":",
"self",
".",
"__id_pools_vmac_ranges",
"=",
"IdPoolsRanges",
"(",
"'vmac'",
",",
"self",
".",
"__connection",
")",
"return",
"self",
".",
"__id_pools_vmac_ranges"
] | Gets the IdPoolsRanges API Client for VMAC Ranges.
Returns:
IdPoolsRanges: | [
"Gets",
"the",
"IdPoolsRanges",
"API",
"Client",
"for",
"VMAC",
"Ranges",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L471-L480 | train | 251,584 |
HewlettPackard/python-hpOneView | hpOneView/oneview_client.py | OneViewClient.id_pools_vwwn_ranges | def id_pools_vwwn_ranges(self):
"""
Gets the IdPoolsRanges API Client for VWWN Ranges.
Returns:
IdPoolsRanges:
"""
if not self.__id_pools_vwwn_ranges:
self.__id_pools_vwwn_ranges = IdPoolsRanges('vwwn', self.__connection)
return self.__id_pools_vwwn_ranges | python | def id_pools_vwwn_ranges(self):
"""
Gets the IdPoolsRanges API Client for VWWN Ranges.
Returns:
IdPoolsRanges:
"""
if not self.__id_pools_vwwn_ranges:
self.__id_pools_vwwn_ranges = IdPoolsRanges('vwwn', self.__connection)
return self.__id_pools_vwwn_ranges | [
"def",
"id_pools_vwwn_ranges",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__id_pools_vwwn_ranges",
":",
"self",
".",
"__id_pools_vwwn_ranges",
"=",
"IdPoolsRanges",
"(",
"'vwwn'",
",",
"self",
".",
"__connection",
")",
"return",
"self",
".",
"__id_pools_vwwn_ranges"
] | Gets the IdPoolsRanges API Client for VWWN Ranges.
Returns:
IdPoolsRanges: | [
"Gets",
"the",
"IdPoolsRanges",
"API",
"Client",
"for",
"VWWN",
"Ranges",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L483-L492 | train | 251,585 |
HewlettPackard/python-hpOneView | hpOneView/oneview_client.py | OneViewClient.id_pools_ipv4_ranges | def id_pools_ipv4_ranges(self):
"""
Gets the IdPoolsIpv4Ranges API client.
Returns:
IdPoolsIpv4Ranges:
"""
if not self.__id_pools_ipv4_ranges:
self.__id_pools_ipv4_ranges = IdPoolsIpv4Ranges(self.__connection)
return self.__id_pools_ipv4_ranges | python | def id_pools_ipv4_ranges(self):
"""
Gets the IdPoolsIpv4Ranges API client.
Returns:
IdPoolsIpv4Ranges:
"""
if not self.__id_pools_ipv4_ranges:
self.__id_pools_ipv4_ranges = IdPoolsIpv4Ranges(self.__connection)
return self.__id_pools_ipv4_ranges | [
"def",
"id_pools_ipv4_ranges",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__id_pools_ipv4_ranges",
":",
"self",
".",
"__id_pools_ipv4_ranges",
"=",
"IdPoolsIpv4Ranges",
"(",
"self",
".",
"__connection",
")",
"return",
"self",
".",
"__id_pools_ipv4_ranges"
] | Gets the IdPoolsIpv4Ranges API client.
Returns:
IdPoolsIpv4Ranges: | [
"Gets",
"the",
"IdPoolsIpv4Ranges",
"API",
"client",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L495-L504 | train | 251,586 |
HewlettPackard/python-hpOneView | hpOneView/oneview_client.py | OneViewClient.id_pools_ipv4_subnets | def id_pools_ipv4_subnets(self):
"""
Gets the IdPoolsIpv4Subnets API client.
Returns:
IdPoolsIpv4Subnets:
"""
if not self.__id_pools_ipv4_subnets:
self.__id_pools_ipv4_subnets = IdPoolsIpv4Subnets(self.__connection)
return self.__id_pools_ipv4_subnets | python | def id_pools_ipv4_subnets(self):
"""
Gets the IdPoolsIpv4Subnets API client.
Returns:
IdPoolsIpv4Subnets:
"""
if not self.__id_pools_ipv4_subnets:
self.__id_pools_ipv4_subnets = IdPoolsIpv4Subnets(self.__connection)
return self.__id_pools_ipv4_subnets | [
"def",
"id_pools_ipv4_subnets",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__id_pools_ipv4_subnets",
":",
"self",
".",
"__id_pools_ipv4_subnets",
"=",
"IdPoolsIpv4Subnets",
"(",
"self",
".",
"__connection",
")",
"return",
"self",
".",
"__id_pools_ipv4_subnets"
] | Gets the IdPoolsIpv4Subnets API client.
Returns:
IdPoolsIpv4Subnets: | [
"Gets",
"the",
"IdPoolsIpv4Subnets",
"API",
"client",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L507-L516 | train | 251,587 |
HewlettPackard/python-hpOneView | hpOneView/oneview_client.py | OneViewClient.id_pools | def id_pools(self):
"""
Gets the IdPools API client.
Returns:
IdPools:
"""
if not self.__id_pools:
self.__id_pools = IdPools(self.__connection)
return self.__id_pools | python | def id_pools(self):
"""
Gets the IdPools API client.
Returns:
IdPools:
"""
if not self.__id_pools:
self.__id_pools = IdPools(self.__connection)
return self.__id_pools | [
"def",
"id_pools",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__id_pools",
":",
"self",
".",
"__id_pools",
"=",
"IdPools",
"(",
"self",
".",
"__connection",
")",
"return",
"self",
".",
"__id_pools"
] | Gets the IdPools API client.
Returns:
IdPools: | [
"Gets",
"the",
"IdPools",
"API",
"client",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L519-L528 | train | 251,588 |
HewlettPackard/python-hpOneView | hpOneView/oneview_client.py | OneViewClient.switches | def switches(self):
"""
Gets the Switches API client.
Returns:
Switches:
"""
if not self.__switches:
self.__switches = Switches(self.__connection)
return self.__switches | python | def switches(self):
"""
Gets the Switches API client.
Returns:
Switches:
"""
if not self.__switches:
self.__switches = Switches(self.__connection)
return self.__switches | [
"def",
"switches",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__switches",
":",
"self",
".",
"__switches",
"=",
"Switches",
"(",
"self",
".",
"__connection",
")",
"return",
"self",
".",
"__switches"
] | Gets the Switches API client.
Returns:
Switches: | [
"Gets",
"the",
"Switches",
"API",
"client",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L531-L540 | train | 251,589 |
HewlettPackard/python-hpOneView | hpOneView/oneview_client.py | OneViewClient.roles | def roles(self):
"""
Gets the Roles API client.
Returns:
Roles:
"""
if not self.__roles:
self.__roles = Roles(self.__connection)
return self.__roles | python | def roles(self):
"""
Gets the Roles API client.
Returns:
Roles:
"""
if not self.__roles:
self.__roles = Roles(self.__connection)
return self.__roles | [
"def",
"roles",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__roles",
":",
"self",
".",
"__roles",
"=",
"Roles",
"(",
"self",
".",
"__connection",
")",
"return",
"self",
".",
"__roles"
] | Gets the Roles API client.
Returns:
Roles: | [
"Gets",
"the",
"Roles",
"API",
"client",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L543-L552 | train | 251,590 |
HewlettPackard/python-hpOneView | hpOneView/oneview_client.py | OneViewClient.switch_types | def switch_types(self):
"""
Gets the SwitchTypes API client.
Returns:
SwitchTypes:
"""
if not self.__switch_types:
self.__switch_types = SwitchTypes(self.__connection)
return self.__switch_types | python | def switch_types(self):
"""
Gets the SwitchTypes API client.
Returns:
SwitchTypes:
"""
if not self.__switch_types:
self.__switch_types = SwitchTypes(self.__connection)
return self.__switch_types | [
"def",
"switch_types",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__switch_types",
":",
"self",
".",
"__switch_types",
"=",
"SwitchTypes",
"(",
"self",
".",
"__connection",
")",
"return",
"self",
".",
"__switch_types"
] | Gets the SwitchTypes API client.
Returns:
SwitchTypes: | [
"Gets",
"the",
"SwitchTypes",
"API",
"client",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L555-L564 | train | 251,591 |
HewlettPackard/python-hpOneView | hpOneView/oneview_client.py | OneViewClient.logical_switches | def logical_switches(self):
"""
Gets the LogicalSwitches API client.
Returns:
LogicalSwitches:
"""
if not self.__logical_switches:
self.__logical_switches = LogicalSwitches(self.__connection)
return self.__logical_switches | python | def logical_switches(self):
"""
Gets the LogicalSwitches API client.
Returns:
LogicalSwitches:
"""
if not self.__logical_switches:
self.__logical_switches = LogicalSwitches(self.__connection)
return self.__logical_switches | [
"def",
"logical_switches",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__logical_switches",
":",
"self",
".",
"__logical_switches",
"=",
"LogicalSwitches",
"(",
"self",
".",
"__connection",
")",
"return",
"self",
".",
"__logical_switches"
] | Gets the LogicalSwitches API client.
Returns:
LogicalSwitches: | [
"Gets",
"the",
"LogicalSwitches",
"API",
"client",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L577-L586 | train | 251,592 |
HewlettPackard/python-hpOneView | hpOneView/oneview_client.py | OneViewClient.tasks | def tasks(self):
"""
Gets the Tasks API client.
Returns:
Tasks:
"""
if not self.__tasks:
self.__tasks = Tasks(self.__connection)
return self.__tasks | python | def tasks(self):
"""
Gets the Tasks API client.
Returns:
Tasks:
"""
if not self.__tasks:
self.__tasks = Tasks(self.__connection)
return self.__tasks | [
"def",
"tasks",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__tasks",
":",
"self",
".",
"__tasks",
"=",
"Tasks",
"(",
"self",
".",
"__connection",
")",
"return",
"self",
".",
"__tasks"
] | Gets the Tasks API client.
Returns:
Tasks: | [
"Gets",
"the",
"Tasks",
"API",
"client",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L589-L598 | train | 251,593 |
HewlettPackard/python-hpOneView | hpOneView/oneview_client.py | OneViewClient.enclosure_groups | def enclosure_groups(self):
"""
Gets the EnclosureGroups API client.
Returns:
EnclosureGroups:
"""
if not self.__enclosure_groups:
self.__enclosure_groups = EnclosureGroups(self.__connection)
return self.__enclosure_groups | python | def enclosure_groups(self):
"""
Gets the EnclosureGroups API client.
Returns:
EnclosureGroups:
"""
if not self.__enclosure_groups:
self.__enclosure_groups = EnclosureGroups(self.__connection)
return self.__enclosure_groups | [
"def",
"enclosure_groups",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__enclosure_groups",
":",
"self",
".",
"__enclosure_groups",
"=",
"EnclosureGroups",
"(",
"self",
".",
"__connection",
")",
"return",
"self",
".",
"__enclosure_groups"
] | Gets the EnclosureGroups API client.
Returns:
EnclosureGroups: | [
"Gets",
"the",
"EnclosureGroups",
"API",
"client",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L601-L610 | train | 251,594 |
HewlettPackard/python-hpOneView | hpOneView/oneview_client.py | OneViewClient.logical_enclosures | def logical_enclosures(self):
"""
Gets the LogicalEnclosures API client.
Returns:
LogicalEnclosures:
"""
if not self.__logical_enclosures:
self.__logical_enclosures = LogicalEnclosures(self.__connection)
return self.__logical_enclosures | python | def logical_enclosures(self):
"""
Gets the LogicalEnclosures API client.
Returns:
LogicalEnclosures:
"""
if not self.__logical_enclosures:
self.__logical_enclosures = LogicalEnclosures(self.__connection)
return self.__logical_enclosures | [
"def",
"logical_enclosures",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__logical_enclosures",
":",
"self",
".",
"__logical_enclosures",
"=",
"LogicalEnclosures",
"(",
"self",
".",
"__connection",
")",
"return",
"self",
".",
"__logical_enclosures"
] | Gets the LogicalEnclosures API client.
Returns:
LogicalEnclosures: | [
"Gets",
"the",
"LogicalEnclosures",
"API",
"client",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L623-L632 | train | 251,595 |
HewlettPackard/python-hpOneView | hpOneView/oneview_client.py | OneViewClient.metric_streaming | def metric_streaming(self):
"""
Gets the MetricStreaming API client.
Returns:
MetricStreaming:
"""
if not self.__metric_streaming:
self.__metric_streaming = MetricStreaming(self.__connection)
return self.__metric_streaming | python | def metric_streaming(self):
"""
Gets the MetricStreaming API client.
Returns:
MetricStreaming:
"""
if not self.__metric_streaming:
self.__metric_streaming = MetricStreaming(self.__connection)
return self.__metric_streaming | [
"def",
"metric_streaming",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__metric_streaming",
":",
"self",
".",
"__metric_streaming",
"=",
"MetricStreaming",
"(",
"self",
".",
"__connection",
")",
"return",
"self",
".",
"__metric_streaming"
] | Gets the MetricStreaming API client.
Returns:
MetricStreaming: | [
"Gets",
"the",
"MetricStreaming",
"API",
"client",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L635-L644 | train | 251,596 |
HewlettPackard/python-hpOneView | hpOneView/oneview_client.py | OneViewClient.interconnects | def interconnects(self):
"""
Gets the Interconnects API client.
Returns:
Interconnects:
"""
if not self.__interconnects:
self.__interconnects = Interconnects(self.__connection)
return self.__interconnects | python | def interconnects(self):
"""
Gets the Interconnects API client.
Returns:
Interconnects:
"""
if not self.__interconnects:
self.__interconnects = Interconnects(self.__connection)
return self.__interconnects | [
"def",
"interconnects",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__interconnects",
":",
"self",
".",
"__interconnects",
"=",
"Interconnects",
"(",
"self",
".",
"__connection",
")",
"return",
"self",
".",
"__interconnects"
] | Gets the Interconnects API client.
Returns:
Interconnects: | [
"Gets",
"the",
"Interconnects",
"API",
"client",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L647-L656 | train | 251,597 |
HewlettPackard/python-hpOneView | hpOneView/oneview_client.py | OneViewClient.interconnect_link_topologies | def interconnect_link_topologies(self):
"""
Gets the InterconnectLinkTopologies API client.
Returns:
InterconnectLinkTopologies:
"""
if not self.__interconnect_link_topologies:
self.__interconnect_link_topologies = InterconnectLinkTopologies(self.__connection)
return self.__interconnect_link_topologies | python | def interconnect_link_topologies(self):
"""
Gets the InterconnectLinkTopologies API client.
Returns:
InterconnectLinkTopologies:
"""
if not self.__interconnect_link_topologies:
self.__interconnect_link_topologies = InterconnectLinkTopologies(self.__connection)
return self.__interconnect_link_topologies | [
"def",
"interconnect_link_topologies",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__interconnect_link_topologies",
":",
"self",
".",
"__interconnect_link_topologies",
"=",
"InterconnectLinkTopologies",
"(",
"self",
".",
"__connection",
")",
"return",
"self",
".",
"__interconnect_link_topologies"
] | Gets the InterconnectLinkTopologies API client.
Returns:
InterconnectLinkTopologies: | [
"Gets",
"the",
"InterconnectLinkTopologies",
"API",
"client",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L669-L678 | train | 251,598 |
HewlettPackard/python-hpOneView | hpOneView/oneview_client.py | OneViewClient.sas_interconnect_types | def sas_interconnect_types(self):
"""
Gets the SasInterconnectTypes API client.
Returns:
SasInterconnectTypes:
"""
if not self.__sas_interconnect_types:
self.__sas_interconnect_types = SasInterconnectTypes(self.__connection)
return self.__sas_interconnect_types | python | def sas_interconnect_types(self):
"""
Gets the SasInterconnectTypes API client.
Returns:
SasInterconnectTypes:
"""
if not self.__sas_interconnect_types:
self.__sas_interconnect_types = SasInterconnectTypes(self.__connection)
return self.__sas_interconnect_types | [
"def",
"sas_interconnect_types",
"(",
"self",
")",
":",
"if",
"not",
"self",
".",
"__sas_interconnect_types",
":",
"self",
".",
"__sas_interconnect_types",
"=",
"SasInterconnectTypes",
"(",
"self",
".",
"__connection",
")",
"return",
"self",
".",
"__sas_interconnect_types"
] | Gets the SasInterconnectTypes API client.
Returns:
SasInterconnectTypes: | [
"Gets",
"the",
"SasInterconnectTypes",
"API",
"client",
"."
] | 3c6219723ef25e6e0c83d44a89007f89bc325b89 | https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/oneview_client.py#L681-L690 | train | 251,599 |