id
int32 0
252k
| repo
stringlengths 7
55
| path
stringlengths 4
127
| func_name
stringlengths 1
88
| original_string
stringlengths 75
19.8k
| language
stringclasses 1
value | code
stringlengths 75
19.8k
| code_tokens
list | docstring
stringlengths 3
17.3k
| docstring_tokens
list | sha
stringlengths 40
40
| url
stringlengths 87
242
|
|---|---|---|---|---|---|---|---|---|---|---|---|
18,500
|
hendrix/hendrix
|
hendrix/experience/hey_joe.py
|
_ParticipantRegistry.remove
|
def remove(self, participant):
"""
Unsubscribe this participant from all topic to which it is subscribed.
"""
for topic, participants in list(self._participants_by_topic.items()):
self.unsubscribe(participant, topic)
# It's possible that we just nixe the last subscriber.
if not participants: # IE, nobody is still listening at this topic.
del self._participants_by_topic[topic]
|
python
|
def remove(self, participant):
"""
Unsubscribe this participant from all topic to which it is subscribed.
"""
for topic, participants in list(self._participants_by_topic.items()):
self.unsubscribe(participant, topic)
# It's possible that we just nixe the last subscriber.
if not participants: # IE, nobody is still listening at this topic.
del self._participants_by_topic[topic]
|
[
"def",
"remove",
"(",
"self",
",",
"participant",
")",
":",
"for",
"topic",
",",
"participants",
"in",
"list",
"(",
"self",
".",
"_participants_by_topic",
".",
"items",
"(",
")",
")",
":",
"self",
".",
"unsubscribe",
"(",
"participant",
",",
"topic",
")",
"# It's possible that we just nixe the last subscriber.",
"if",
"not",
"participants",
":",
"# IE, nobody is still listening at this topic.",
"del",
"self",
".",
"_participants_by_topic",
"[",
"topic",
"]"
] |
Unsubscribe this participant from all topic to which it is subscribed.
|
[
"Unsubscribe",
"this",
"participant",
"from",
"all",
"topic",
"to",
"which",
"it",
"is",
"subscribed",
"."
] |
175af011a7e5822b772bfec0e11a46466bb8688d
|
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/experience/hey_joe.py#L67-L75
|
18,501
|
hendrix/hendrix
|
hendrix/deploy/tls.py
|
HendrixDeployTLS.addSSLService
|
def addSSLService(self):
"adds a SSLService to the instaitated HendrixService"
https_port = self.options['https_port']
self.tls_service = HendrixTCPServiceWithTLS(https_port, self.hendrix.site, self.key, self.cert,
self.context_factory, self.context_factory_kwargs)
self.tls_service.setServiceParent(self.hendrix)
|
python
|
def addSSLService(self):
"adds a SSLService to the instaitated HendrixService"
https_port = self.options['https_port']
self.tls_service = HendrixTCPServiceWithTLS(https_port, self.hendrix.site, self.key, self.cert,
self.context_factory, self.context_factory_kwargs)
self.tls_service.setServiceParent(self.hendrix)
|
[
"def",
"addSSLService",
"(",
"self",
")",
":",
"https_port",
"=",
"self",
".",
"options",
"[",
"'https_port'",
"]",
"self",
".",
"tls_service",
"=",
"HendrixTCPServiceWithTLS",
"(",
"https_port",
",",
"self",
".",
"hendrix",
".",
"site",
",",
"self",
".",
"key",
",",
"self",
".",
"cert",
",",
"self",
".",
"context_factory",
",",
"self",
".",
"context_factory_kwargs",
")",
"self",
".",
"tls_service",
".",
"setServiceParent",
"(",
"self",
".",
"hendrix",
")"
] |
adds a SSLService to the instaitated HendrixService
|
[
"adds",
"a",
"SSLService",
"to",
"the",
"instaitated",
"HendrixService"
] |
175af011a7e5822b772bfec0e11a46466bb8688d
|
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/deploy/tls.py#L61-L66
|
18,502
|
hendrix/hendrix
|
hendrix/contrib/cache/backends/memory_cache.py
|
MemoryCacheBackend.addResource
|
def addResource(self, content, uri, headers):
"""
Adds the a hendrix.contrib.cache.resource.CachedResource to the
ReverseProxy cache connection
"""
self.cache[uri] = CachedResource(content, headers)
|
python
|
def addResource(self, content, uri, headers):
"""
Adds the a hendrix.contrib.cache.resource.CachedResource to the
ReverseProxy cache connection
"""
self.cache[uri] = CachedResource(content, headers)
|
[
"def",
"addResource",
"(",
"self",
",",
"content",
",",
"uri",
",",
"headers",
")",
":",
"self",
".",
"cache",
"[",
"uri",
"]",
"=",
"CachedResource",
"(",
"content",
",",
"headers",
")"
] |
Adds the a hendrix.contrib.cache.resource.CachedResource to the
ReverseProxy cache connection
|
[
"Adds",
"the",
"a",
"hendrix",
".",
"contrib",
".",
"cache",
".",
"resource",
".",
"CachedResource",
"to",
"the",
"ReverseProxy",
"cache",
"connection"
] |
175af011a7e5822b772bfec0e11a46466bb8688d
|
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/contrib/cache/backends/memory_cache.py#L15-L20
|
18,503
|
hendrix/hendrix
|
hendrix/contrib/cache/__init__.py
|
decompressBuffer
|
def decompressBuffer(buffer):
"complements the compressBuffer function in CacheClient"
zbuf = cStringIO.StringIO(buffer)
zfile = gzip.GzipFile(fileobj=zbuf)
deflated = zfile.read()
zfile.close()
return deflated
|
python
|
def decompressBuffer(buffer):
"complements the compressBuffer function in CacheClient"
zbuf = cStringIO.StringIO(buffer)
zfile = gzip.GzipFile(fileobj=zbuf)
deflated = zfile.read()
zfile.close()
return deflated
|
[
"def",
"decompressBuffer",
"(",
"buffer",
")",
":",
"zbuf",
"=",
"cStringIO",
".",
"StringIO",
"(",
"buffer",
")",
"zfile",
"=",
"gzip",
".",
"GzipFile",
"(",
"fileobj",
"=",
"zbuf",
")",
"deflated",
"=",
"zfile",
".",
"read",
"(",
")",
"zfile",
".",
"close",
"(",
")",
"return",
"deflated"
] |
complements the compressBuffer function in CacheClient
|
[
"complements",
"the",
"compressBuffer",
"function",
"in",
"CacheClient"
] |
175af011a7e5822b772bfec0e11a46466bb8688d
|
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/contrib/cache/__init__.py#L30-L36
|
18,504
|
hendrix/hendrix
|
hendrix/contrib/cache/__init__.py
|
CachedResource.getMaxAge
|
def getMaxAge(self):
"get the max-age in seconds from the saved headers data"
max_age = 0
cache_control = self.headers.get('cache-control')
if cache_control:
params = dict(urlparse.parse_qsl(cache_control))
max_age = int(params.get('max-age', '0'))
return max_age
|
python
|
def getMaxAge(self):
"get the max-age in seconds from the saved headers data"
max_age = 0
cache_control = self.headers.get('cache-control')
if cache_control:
params = dict(urlparse.parse_qsl(cache_control))
max_age = int(params.get('max-age', '0'))
return max_age
|
[
"def",
"getMaxAge",
"(",
"self",
")",
":",
"max_age",
"=",
"0",
"cache_control",
"=",
"self",
".",
"headers",
".",
"get",
"(",
"'cache-control'",
")",
"if",
"cache_control",
":",
"params",
"=",
"dict",
"(",
"urlparse",
".",
"parse_qsl",
"(",
"cache_control",
")",
")",
"max_age",
"=",
"int",
"(",
"params",
".",
"get",
"(",
"'max-age'",
",",
"'0'",
")",
")",
"return",
"max_age"
] |
get the max-age in seconds from the saved headers data
|
[
"get",
"the",
"max",
"-",
"age",
"in",
"seconds",
"from",
"the",
"saved",
"headers",
"data"
] |
175af011a7e5822b772bfec0e11a46466bb8688d
|
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/contrib/cache/__init__.py#L51-L58
|
18,505
|
hendrix/hendrix
|
hendrix/contrib/cache/__init__.py
|
CachedResource.getLastModified
|
def getLastModified(self):
"returns the GMT last-modified datetime or None"
last_modified = self.headers.get('last-modified')
if last_modified:
last_modified = self.convertTimeString(last_modified)
return last_modified
|
python
|
def getLastModified(self):
"returns the GMT last-modified datetime or None"
last_modified = self.headers.get('last-modified')
if last_modified:
last_modified = self.convertTimeString(last_modified)
return last_modified
|
[
"def",
"getLastModified",
"(",
"self",
")",
":",
"last_modified",
"=",
"self",
".",
"headers",
".",
"get",
"(",
"'last-modified'",
")",
"if",
"last_modified",
":",
"last_modified",
"=",
"self",
".",
"convertTimeString",
"(",
"last_modified",
")",
"return",
"last_modified"
] |
returns the GMT last-modified datetime or None
|
[
"returns",
"the",
"GMT",
"last",
"-",
"modified",
"datetime",
"or",
"None"
] |
175af011a7e5822b772bfec0e11a46466bb8688d
|
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/contrib/cache/__init__.py#L68-L73
|
18,506
|
hendrix/hendrix
|
hendrix/contrib/cache/__init__.py
|
CachedResource.getDate
|
def getDate(self):
"returns the GMT response datetime or None"
date = self.headers.get('date')
if date:
date = self.convertTimeString(date)
return date
|
python
|
def getDate(self):
"returns the GMT response datetime or None"
date = self.headers.get('date')
if date:
date = self.convertTimeString(date)
return date
|
[
"def",
"getDate",
"(",
"self",
")",
":",
"date",
"=",
"self",
".",
"headers",
".",
"get",
"(",
"'date'",
")",
"if",
"date",
":",
"date",
"=",
"self",
".",
"convertTimeString",
"(",
"date",
")",
"return",
"date"
] |
returns the GMT response datetime or None
|
[
"returns",
"the",
"GMT",
"response",
"datetime",
"or",
"None"
] |
175af011a7e5822b772bfec0e11a46466bb8688d
|
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/contrib/cache/__init__.py#L75-L80
|
18,507
|
hendrix/hendrix
|
hendrix/contrib/cache/__init__.py
|
CachedResource.isFresh
|
def isFresh(self):
"returns True if cached object is still fresh"
max_age = self.getMaxAge()
date = self.getDate()
is_fresh = False
if max_age and date:
delta_time = datetime.now() - date
is_fresh = delta_time.total_seconds() < max_age
return is_fresh
|
python
|
def isFresh(self):
"returns True if cached object is still fresh"
max_age = self.getMaxAge()
date = self.getDate()
is_fresh = False
if max_age and date:
delta_time = datetime.now() - date
is_fresh = delta_time.total_seconds() < max_age
return is_fresh
|
[
"def",
"isFresh",
"(",
"self",
")",
":",
"max_age",
"=",
"self",
".",
"getMaxAge",
"(",
")",
"date",
"=",
"self",
".",
"getDate",
"(",
")",
"is_fresh",
"=",
"False",
"if",
"max_age",
"and",
"date",
":",
"delta_time",
"=",
"datetime",
".",
"now",
"(",
")",
"-",
"date",
"is_fresh",
"=",
"delta_time",
".",
"total_seconds",
"(",
")",
"<",
"max_age",
"return",
"is_fresh"
] |
returns True if cached object is still fresh
|
[
"returns",
"True",
"if",
"cached",
"object",
"is",
"still",
"fresh"
] |
175af011a7e5822b772bfec0e11a46466bb8688d
|
https://github.com/hendrix/hendrix/blob/175af011a7e5822b772bfec0e11a46466bb8688d/hendrix/contrib/cache/__init__.py#L82-L90
|
18,508
|
aio-libs/aiohttp-cors
|
aiohttp_cors/cors_config.py
|
_CorsConfigImpl._on_response_prepare
|
async def _on_response_prepare(self,
request: web.Request,
response: web.StreamResponse):
"""Non-preflight CORS request response processor.
If request is done on CORS-enabled route, process request parameters
and set appropriate CORS response headers.
"""
if (not self._router_adapter.is_cors_enabled_on_request(request) or
self._router_adapter.is_preflight_request(request)):
# Either not CORS enabled route, or preflight request which is
# handled in its own handler.
return
# Processing response of non-preflight CORS-enabled request.
config = self._router_adapter.get_non_preflight_request_config(request)
# Handle according to part 6.1 of the CORS specification.
origin = request.headers.get(hdrs.ORIGIN)
if origin is None:
# Terminate CORS according to CORS 6.1.1.
return
options = config.get(origin, config.get("*"))
if options is None:
# Terminate CORS according to CORS 6.1.2.
return
assert hdrs.ACCESS_CONTROL_ALLOW_ORIGIN not in response.headers
assert hdrs.ACCESS_CONTROL_ALLOW_CREDENTIALS not in response.headers
assert hdrs.ACCESS_CONTROL_EXPOSE_HEADERS not in response.headers
# Process according to CORS 6.1.4.
# Set exposed headers (server headers exposed to client) before
# setting any other headers.
if options.expose_headers == "*":
# Expose all headers that are set in response.
exposed_headers = \
frozenset(response.headers.keys()) - _SIMPLE_RESPONSE_HEADERS
response.headers[hdrs.ACCESS_CONTROL_EXPOSE_HEADERS] = \
",".join(exposed_headers)
elif options.expose_headers:
# Expose predefined list of headers.
response.headers[hdrs.ACCESS_CONTROL_EXPOSE_HEADERS] = \
",".join(options.expose_headers)
# Process according to CORS 6.1.3.
# Set allowed origin.
response.headers[hdrs.ACCESS_CONTROL_ALLOW_ORIGIN] = origin
if options.allow_credentials:
# Set allowed credentials.
response.headers[hdrs.ACCESS_CONTROL_ALLOW_CREDENTIALS] = _TRUE
|
python
|
async def _on_response_prepare(self,
request: web.Request,
response: web.StreamResponse):
"""Non-preflight CORS request response processor.
If request is done on CORS-enabled route, process request parameters
and set appropriate CORS response headers.
"""
if (not self._router_adapter.is_cors_enabled_on_request(request) or
self._router_adapter.is_preflight_request(request)):
# Either not CORS enabled route, or preflight request which is
# handled in its own handler.
return
# Processing response of non-preflight CORS-enabled request.
config = self._router_adapter.get_non_preflight_request_config(request)
# Handle according to part 6.1 of the CORS specification.
origin = request.headers.get(hdrs.ORIGIN)
if origin is None:
# Terminate CORS according to CORS 6.1.1.
return
options = config.get(origin, config.get("*"))
if options is None:
# Terminate CORS according to CORS 6.1.2.
return
assert hdrs.ACCESS_CONTROL_ALLOW_ORIGIN not in response.headers
assert hdrs.ACCESS_CONTROL_ALLOW_CREDENTIALS not in response.headers
assert hdrs.ACCESS_CONTROL_EXPOSE_HEADERS not in response.headers
# Process according to CORS 6.1.4.
# Set exposed headers (server headers exposed to client) before
# setting any other headers.
if options.expose_headers == "*":
# Expose all headers that are set in response.
exposed_headers = \
frozenset(response.headers.keys()) - _SIMPLE_RESPONSE_HEADERS
response.headers[hdrs.ACCESS_CONTROL_EXPOSE_HEADERS] = \
",".join(exposed_headers)
elif options.expose_headers:
# Expose predefined list of headers.
response.headers[hdrs.ACCESS_CONTROL_EXPOSE_HEADERS] = \
",".join(options.expose_headers)
# Process according to CORS 6.1.3.
# Set allowed origin.
response.headers[hdrs.ACCESS_CONTROL_ALLOW_ORIGIN] = origin
if options.allow_credentials:
# Set allowed credentials.
response.headers[hdrs.ACCESS_CONTROL_ALLOW_CREDENTIALS] = _TRUE
|
[
"async",
"def",
"_on_response_prepare",
"(",
"self",
",",
"request",
":",
"web",
".",
"Request",
",",
"response",
":",
"web",
".",
"StreamResponse",
")",
":",
"if",
"(",
"not",
"self",
".",
"_router_adapter",
".",
"is_cors_enabled_on_request",
"(",
"request",
")",
"or",
"self",
".",
"_router_adapter",
".",
"is_preflight_request",
"(",
"request",
")",
")",
":",
"# Either not CORS enabled route, or preflight request which is",
"# handled in its own handler.",
"return",
"# Processing response of non-preflight CORS-enabled request.",
"config",
"=",
"self",
".",
"_router_adapter",
".",
"get_non_preflight_request_config",
"(",
"request",
")",
"# Handle according to part 6.1 of the CORS specification.",
"origin",
"=",
"request",
".",
"headers",
".",
"get",
"(",
"hdrs",
".",
"ORIGIN",
")",
"if",
"origin",
"is",
"None",
":",
"# Terminate CORS according to CORS 6.1.1.",
"return",
"options",
"=",
"config",
".",
"get",
"(",
"origin",
",",
"config",
".",
"get",
"(",
"\"*\"",
")",
")",
"if",
"options",
"is",
"None",
":",
"# Terminate CORS according to CORS 6.1.2.",
"return",
"assert",
"hdrs",
".",
"ACCESS_CONTROL_ALLOW_ORIGIN",
"not",
"in",
"response",
".",
"headers",
"assert",
"hdrs",
".",
"ACCESS_CONTROL_ALLOW_CREDENTIALS",
"not",
"in",
"response",
".",
"headers",
"assert",
"hdrs",
".",
"ACCESS_CONTROL_EXPOSE_HEADERS",
"not",
"in",
"response",
".",
"headers",
"# Process according to CORS 6.1.4.",
"# Set exposed headers (server headers exposed to client) before",
"# setting any other headers.",
"if",
"options",
".",
"expose_headers",
"==",
"\"*\"",
":",
"# Expose all headers that are set in response.",
"exposed_headers",
"=",
"frozenset",
"(",
"response",
".",
"headers",
".",
"keys",
"(",
")",
")",
"-",
"_SIMPLE_RESPONSE_HEADERS",
"response",
".",
"headers",
"[",
"hdrs",
".",
"ACCESS_CONTROL_EXPOSE_HEADERS",
"]",
"=",
"\",\"",
".",
"join",
"(",
"exposed_headers",
")",
"elif",
"options",
".",
"expose_headers",
":",
"# Expose predefined list of headers.",
"response",
".",
"headers",
"[",
"hdrs",
".",
"ACCESS_CONTROL_EXPOSE_HEADERS",
"]",
"=",
"\",\"",
".",
"join",
"(",
"options",
".",
"expose_headers",
")",
"# Process according to CORS 6.1.3.",
"# Set allowed origin.",
"response",
".",
"headers",
"[",
"hdrs",
".",
"ACCESS_CONTROL_ALLOW_ORIGIN",
"]",
"=",
"origin",
"if",
"options",
".",
"allow_credentials",
":",
"# Set allowed credentials.",
"response",
".",
"headers",
"[",
"hdrs",
".",
"ACCESS_CONTROL_ALLOW_CREDENTIALS",
"]",
"=",
"_TRUE"
] |
Non-preflight CORS request response processor.
If request is done on CORS-enabled route, process request parameters
and set appropriate CORS response headers.
|
[
"Non",
"-",
"preflight",
"CORS",
"request",
"response",
"processor",
"."
] |
14affbd95c88c675eb513c1d295ede1897930f94
|
https://github.com/aio-libs/aiohttp-cors/blob/14affbd95c88c675eb513c1d295ede1897930f94/aiohttp_cors/cors_config.py#L141-L195
|
18,509
|
aio-libs/aiohttp-cors
|
aiohttp_cors/resource_options.py
|
_is_proper_sequence
|
def _is_proper_sequence(seq):
"""Returns is seq is sequence and not string."""
return (isinstance(seq, collections.abc.Sequence) and
not isinstance(seq, str))
|
python
|
def _is_proper_sequence(seq):
"""Returns is seq is sequence and not string."""
return (isinstance(seq, collections.abc.Sequence) and
not isinstance(seq, str))
|
[
"def",
"_is_proper_sequence",
"(",
"seq",
")",
":",
"return",
"(",
"isinstance",
"(",
"seq",
",",
"collections",
".",
"abc",
".",
"Sequence",
")",
"and",
"not",
"isinstance",
"(",
"seq",
",",
"str",
")",
")"
] |
Returns is seq is sequence and not string.
|
[
"Returns",
"is",
"seq",
"is",
"sequence",
"and",
"not",
"string",
"."
] |
14affbd95c88c675eb513c1d295ede1897930f94
|
https://github.com/aio-libs/aiohttp-cors/blob/14affbd95c88c675eb513c1d295ede1897930f94/aiohttp_cors/resource_options.py#L25-L28
|
18,510
|
aio-libs/aiohttp-cors
|
aiohttp_cors/__init__.py
|
setup
|
def setup(app: web.Application, *,
defaults: Mapping[str, Union[ResourceOptions,
Mapping[str, Any]]]=None) -> CorsConfig:
"""Setup CORS processing for the application.
To enable CORS for a resource you need to explicitly add route for
that resource using `CorsConfig.add()` method::
app = aiohttp.web.Application()
cors = aiohttp_cors.setup(app)
cors.add(
app.router.add_route("GET", "/resource", handler),
{
"*": aiohttp_cors.ResourceOptions(
allow_credentials=True,
expose_headers="*",
allow_headers="*"),
})
:param app:
The application for which CORS will be configured.
:param defaults:
Default settings for origins.
)
"""
cors = CorsConfig(app, defaults=defaults)
app[APP_CONFIG_KEY] = cors
return cors
|
python
|
def setup(app: web.Application, *,
defaults: Mapping[str, Union[ResourceOptions,
Mapping[str, Any]]]=None) -> CorsConfig:
"""Setup CORS processing for the application.
To enable CORS for a resource you need to explicitly add route for
that resource using `CorsConfig.add()` method::
app = aiohttp.web.Application()
cors = aiohttp_cors.setup(app)
cors.add(
app.router.add_route("GET", "/resource", handler),
{
"*": aiohttp_cors.ResourceOptions(
allow_credentials=True,
expose_headers="*",
allow_headers="*"),
})
:param app:
The application for which CORS will be configured.
:param defaults:
Default settings for origins.
)
"""
cors = CorsConfig(app, defaults=defaults)
app[APP_CONFIG_KEY] = cors
return cors
|
[
"def",
"setup",
"(",
"app",
":",
"web",
".",
"Application",
",",
"*",
",",
"defaults",
":",
"Mapping",
"[",
"str",
",",
"Union",
"[",
"ResourceOptions",
",",
"Mapping",
"[",
"str",
",",
"Any",
"]",
"]",
"]",
"=",
"None",
")",
"->",
"CorsConfig",
":",
"cors",
"=",
"CorsConfig",
"(",
"app",
",",
"defaults",
"=",
"defaults",
")",
"app",
"[",
"APP_CONFIG_KEY",
"]",
"=",
"cors",
"return",
"cors"
] |
Setup CORS processing for the application.
To enable CORS for a resource you need to explicitly add route for
that resource using `CorsConfig.add()` method::
app = aiohttp.web.Application()
cors = aiohttp_cors.setup(app)
cors.add(
app.router.add_route("GET", "/resource", handler),
{
"*": aiohttp_cors.ResourceOptions(
allow_credentials=True,
expose_headers="*",
allow_headers="*"),
})
:param app:
The application for which CORS will be configured.
:param defaults:
Default settings for origins.
)
|
[
"Setup",
"CORS",
"processing",
"for",
"the",
"application",
"."
] |
14affbd95c88c675eb513c1d295ede1897930f94
|
https://github.com/aio-libs/aiohttp-cors/blob/14affbd95c88c675eb513c1d295ede1897930f94/aiohttp_cors/__init__.py#L40-L67
|
18,511
|
aio-libs/aiohttp-cors
|
aiohttp_cors/preflight_handler.py
|
_PreflightHandler._parse_request_method
|
def _parse_request_method(request: web.Request):
"""Parse Access-Control-Request-Method header of the preflight request
"""
method = request.headers.get(hdrs.ACCESS_CONTROL_REQUEST_METHOD)
if method is None:
raise web.HTTPForbidden(
text="CORS preflight request failed: "
"'Access-Control-Request-Method' header is not specified")
# FIXME: validate method string (ABNF: method = token), if parsing
# fails, raise HTTPForbidden.
return method
|
python
|
def _parse_request_method(request: web.Request):
"""Parse Access-Control-Request-Method header of the preflight request
"""
method = request.headers.get(hdrs.ACCESS_CONTROL_REQUEST_METHOD)
if method is None:
raise web.HTTPForbidden(
text="CORS preflight request failed: "
"'Access-Control-Request-Method' header is not specified")
# FIXME: validate method string (ABNF: method = token), if parsing
# fails, raise HTTPForbidden.
return method
|
[
"def",
"_parse_request_method",
"(",
"request",
":",
"web",
".",
"Request",
")",
":",
"method",
"=",
"request",
".",
"headers",
".",
"get",
"(",
"hdrs",
".",
"ACCESS_CONTROL_REQUEST_METHOD",
")",
"if",
"method",
"is",
"None",
":",
"raise",
"web",
".",
"HTTPForbidden",
"(",
"text",
"=",
"\"CORS preflight request failed: \"",
"\"'Access-Control-Request-Method' header is not specified\"",
")",
"# FIXME: validate method string (ABNF: method = token), if parsing",
"# fails, raise HTTPForbidden.",
"return",
"method"
] |
Parse Access-Control-Request-Method header of the preflight request
|
[
"Parse",
"Access",
"-",
"Control",
"-",
"Request",
"-",
"Method",
"header",
"of",
"the",
"preflight",
"request"
] |
14affbd95c88c675eb513c1d295ede1897930f94
|
https://github.com/aio-libs/aiohttp-cors/blob/14affbd95c88c675eb513c1d295ede1897930f94/aiohttp_cors/preflight_handler.py#L10-L22
|
18,512
|
aio-libs/aiohttp-cors
|
aiohttp_cors/preflight_handler.py
|
_PreflightHandler._parse_request_headers
|
def _parse_request_headers(request: web.Request):
"""Parse Access-Control-Request-Headers header or the preflight request
Returns set of headers in upper case.
"""
headers = request.headers.get(hdrs.ACCESS_CONTROL_REQUEST_HEADERS)
if headers is None:
return frozenset()
# FIXME: validate each header string, if parsing fails, raise
# HTTPForbidden.
# FIXME: check, that headers split and stripped correctly (according
# to ABNF).
headers = (h.strip(" \t").upper() for h in headers.split(","))
# pylint: disable=bad-builtin
return frozenset(filter(None, headers))
|
python
|
def _parse_request_headers(request: web.Request):
"""Parse Access-Control-Request-Headers header or the preflight request
Returns set of headers in upper case.
"""
headers = request.headers.get(hdrs.ACCESS_CONTROL_REQUEST_HEADERS)
if headers is None:
return frozenset()
# FIXME: validate each header string, if parsing fails, raise
# HTTPForbidden.
# FIXME: check, that headers split and stripped correctly (according
# to ABNF).
headers = (h.strip(" \t").upper() for h in headers.split(","))
# pylint: disable=bad-builtin
return frozenset(filter(None, headers))
|
[
"def",
"_parse_request_headers",
"(",
"request",
":",
"web",
".",
"Request",
")",
":",
"headers",
"=",
"request",
".",
"headers",
".",
"get",
"(",
"hdrs",
".",
"ACCESS_CONTROL_REQUEST_HEADERS",
")",
"if",
"headers",
"is",
"None",
":",
"return",
"frozenset",
"(",
")",
"# FIXME: validate each header string, if parsing fails, raise",
"# HTTPForbidden.",
"# FIXME: check, that headers split and stripped correctly (according",
"# to ABNF).",
"headers",
"=",
"(",
"h",
".",
"strip",
"(",
"\" \\t\"",
")",
".",
"upper",
"(",
")",
"for",
"h",
"in",
"headers",
".",
"split",
"(",
"\",\"",
")",
")",
"# pylint: disable=bad-builtin",
"return",
"frozenset",
"(",
"filter",
"(",
"None",
",",
"headers",
")",
")"
] |
Parse Access-Control-Request-Headers header or the preflight request
Returns set of headers in upper case.
|
[
"Parse",
"Access",
"-",
"Control",
"-",
"Request",
"-",
"Headers",
"header",
"or",
"the",
"preflight",
"request"
] |
14affbd95c88c675eb513c1d295ede1897930f94
|
https://github.com/aio-libs/aiohttp-cors/blob/14affbd95c88c675eb513c1d295ede1897930f94/aiohttp_cors/preflight_handler.py#L25-L40
|
18,513
|
aio-libs/aiohttp-cors
|
aiohttp_cors/preflight_handler.py
|
_PreflightHandler._preflight_handler
|
async def _preflight_handler(self, request: web.Request):
"""CORS preflight request handler"""
# Handle according to part 6.2 of the CORS specification.
origin = request.headers.get(hdrs.ORIGIN)
if origin is None:
# Terminate CORS according to CORS 6.2.1.
raise web.HTTPForbidden(
text="CORS preflight request failed: "
"origin header is not specified in the request")
# CORS 6.2.3. Doing it out of order is not an error.
request_method = self._parse_request_method(request)
# CORS 6.2.5. Doing it out of order is not an error.
try:
config = \
await self._get_config(request, origin, request_method)
except KeyError:
raise web.HTTPForbidden(
text="CORS preflight request failed: "
"request method {!r} is not allowed "
"for {!r} origin".format(request_method, origin))
if not config:
# No allowed origins for the route.
# Terminate CORS according to CORS 6.2.1.
raise web.HTTPForbidden(
text="CORS preflight request failed: "
"no origins are allowed")
options = config.get(origin, config.get("*"))
if options is None:
# No configuration for the origin - deny.
# Terminate CORS according to CORS 6.2.2.
raise web.HTTPForbidden(
text="CORS preflight request failed: "
"origin '{}' is not allowed".format(origin))
# CORS 6.2.4
request_headers = self._parse_request_headers(request)
# CORS 6.2.6
if options.allow_headers == "*":
pass
else:
disallowed_headers = request_headers - options.allow_headers
if disallowed_headers:
raise web.HTTPForbidden(
text="CORS preflight request failed: "
"headers are not allowed: {}".format(
", ".join(disallowed_headers)))
# Ok, CORS actual request with specified in the preflight request
# parameters is allowed.
# Set appropriate headers and return 200 response.
response = web.Response()
# CORS 6.2.7
response.headers[hdrs.ACCESS_CONTROL_ALLOW_ORIGIN] = origin
if options.allow_credentials:
# Set allowed credentials.
response.headers[hdrs.ACCESS_CONTROL_ALLOW_CREDENTIALS] = _TRUE
# CORS 6.2.8
if options.max_age is not None:
response.headers[hdrs.ACCESS_CONTROL_MAX_AGE] = \
str(options.max_age)
# CORS 6.2.9
# TODO: more optimal for client preflight request cache would be to
# respond with ALL allowed methods.
response.headers[hdrs.ACCESS_CONTROL_ALLOW_METHODS] = request_method
# CORS 6.2.10
if request_headers:
# Note: case of the headers in the request is changed, but this
# shouldn't be a problem, since the headers should be compared in
# the case-insensitive way.
response.headers[hdrs.ACCESS_CONTROL_ALLOW_HEADERS] = \
",".join(request_headers)
return response
|
python
|
async def _preflight_handler(self, request: web.Request):
"""CORS preflight request handler"""
# Handle according to part 6.2 of the CORS specification.
origin = request.headers.get(hdrs.ORIGIN)
if origin is None:
# Terminate CORS according to CORS 6.2.1.
raise web.HTTPForbidden(
text="CORS preflight request failed: "
"origin header is not specified in the request")
# CORS 6.2.3. Doing it out of order is not an error.
request_method = self._parse_request_method(request)
# CORS 6.2.5. Doing it out of order is not an error.
try:
config = \
await self._get_config(request, origin, request_method)
except KeyError:
raise web.HTTPForbidden(
text="CORS preflight request failed: "
"request method {!r} is not allowed "
"for {!r} origin".format(request_method, origin))
if not config:
# No allowed origins for the route.
# Terminate CORS according to CORS 6.2.1.
raise web.HTTPForbidden(
text="CORS preflight request failed: "
"no origins are allowed")
options = config.get(origin, config.get("*"))
if options is None:
# No configuration for the origin - deny.
# Terminate CORS according to CORS 6.2.2.
raise web.HTTPForbidden(
text="CORS preflight request failed: "
"origin '{}' is not allowed".format(origin))
# CORS 6.2.4
request_headers = self._parse_request_headers(request)
# CORS 6.2.6
if options.allow_headers == "*":
pass
else:
disallowed_headers = request_headers - options.allow_headers
if disallowed_headers:
raise web.HTTPForbidden(
text="CORS preflight request failed: "
"headers are not allowed: {}".format(
", ".join(disallowed_headers)))
# Ok, CORS actual request with specified in the preflight request
# parameters is allowed.
# Set appropriate headers and return 200 response.
response = web.Response()
# CORS 6.2.7
response.headers[hdrs.ACCESS_CONTROL_ALLOW_ORIGIN] = origin
if options.allow_credentials:
# Set allowed credentials.
response.headers[hdrs.ACCESS_CONTROL_ALLOW_CREDENTIALS] = _TRUE
# CORS 6.2.8
if options.max_age is not None:
response.headers[hdrs.ACCESS_CONTROL_MAX_AGE] = \
str(options.max_age)
# CORS 6.2.9
# TODO: more optimal for client preflight request cache would be to
# respond with ALL allowed methods.
response.headers[hdrs.ACCESS_CONTROL_ALLOW_METHODS] = request_method
# CORS 6.2.10
if request_headers:
# Note: case of the headers in the request is changed, but this
# shouldn't be a problem, since the headers should be compared in
# the case-insensitive way.
response.headers[hdrs.ACCESS_CONTROL_ALLOW_HEADERS] = \
",".join(request_headers)
return response
|
[
"async",
"def",
"_preflight_handler",
"(",
"self",
",",
"request",
":",
"web",
".",
"Request",
")",
":",
"# Handle according to part 6.2 of the CORS specification.",
"origin",
"=",
"request",
".",
"headers",
".",
"get",
"(",
"hdrs",
".",
"ORIGIN",
")",
"if",
"origin",
"is",
"None",
":",
"# Terminate CORS according to CORS 6.2.1.",
"raise",
"web",
".",
"HTTPForbidden",
"(",
"text",
"=",
"\"CORS preflight request failed: \"",
"\"origin header is not specified in the request\"",
")",
"# CORS 6.2.3. Doing it out of order is not an error.",
"request_method",
"=",
"self",
".",
"_parse_request_method",
"(",
"request",
")",
"# CORS 6.2.5. Doing it out of order is not an error.",
"try",
":",
"config",
"=",
"await",
"self",
".",
"_get_config",
"(",
"request",
",",
"origin",
",",
"request_method",
")",
"except",
"KeyError",
":",
"raise",
"web",
".",
"HTTPForbidden",
"(",
"text",
"=",
"\"CORS preflight request failed: \"",
"\"request method {!r} is not allowed \"",
"\"for {!r} origin\"",
".",
"format",
"(",
"request_method",
",",
"origin",
")",
")",
"if",
"not",
"config",
":",
"# No allowed origins for the route.",
"# Terminate CORS according to CORS 6.2.1.",
"raise",
"web",
".",
"HTTPForbidden",
"(",
"text",
"=",
"\"CORS preflight request failed: \"",
"\"no origins are allowed\"",
")",
"options",
"=",
"config",
".",
"get",
"(",
"origin",
",",
"config",
".",
"get",
"(",
"\"*\"",
")",
")",
"if",
"options",
"is",
"None",
":",
"# No configuration for the origin - deny.",
"# Terminate CORS according to CORS 6.2.2.",
"raise",
"web",
".",
"HTTPForbidden",
"(",
"text",
"=",
"\"CORS preflight request failed: \"",
"\"origin '{}' is not allowed\"",
".",
"format",
"(",
"origin",
")",
")",
"# CORS 6.2.4",
"request_headers",
"=",
"self",
".",
"_parse_request_headers",
"(",
"request",
")",
"# CORS 6.2.6",
"if",
"options",
".",
"allow_headers",
"==",
"\"*\"",
":",
"pass",
"else",
":",
"disallowed_headers",
"=",
"request_headers",
"-",
"options",
".",
"allow_headers",
"if",
"disallowed_headers",
":",
"raise",
"web",
".",
"HTTPForbidden",
"(",
"text",
"=",
"\"CORS preflight request failed: \"",
"\"headers are not allowed: {}\"",
".",
"format",
"(",
"\", \"",
".",
"join",
"(",
"disallowed_headers",
")",
")",
")",
"# Ok, CORS actual request with specified in the preflight request",
"# parameters is allowed.",
"# Set appropriate headers and return 200 response.",
"response",
"=",
"web",
".",
"Response",
"(",
")",
"# CORS 6.2.7",
"response",
".",
"headers",
"[",
"hdrs",
".",
"ACCESS_CONTROL_ALLOW_ORIGIN",
"]",
"=",
"origin",
"if",
"options",
".",
"allow_credentials",
":",
"# Set allowed credentials.",
"response",
".",
"headers",
"[",
"hdrs",
".",
"ACCESS_CONTROL_ALLOW_CREDENTIALS",
"]",
"=",
"_TRUE",
"# CORS 6.2.8",
"if",
"options",
".",
"max_age",
"is",
"not",
"None",
":",
"response",
".",
"headers",
"[",
"hdrs",
".",
"ACCESS_CONTROL_MAX_AGE",
"]",
"=",
"str",
"(",
"options",
".",
"max_age",
")",
"# CORS 6.2.9",
"# TODO: more optimal for client preflight request cache would be to",
"# respond with ALL allowed methods.",
"response",
".",
"headers",
"[",
"hdrs",
".",
"ACCESS_CONTROL_ALLOW_METHODS",
"]",
"=",
"request_method",
"# CORS 6.2.10",
"if",
"request_headers",
":",
"# Note: case of the headers in the request is changed, but this",
"# shouldn't be a problem, since the headers should be compared in",
"# the case-insensitive way.",
"response",
".",
"headers",
"[",
"hdrs",
".",
"ACCESS_CONTROL_ALLOW_HEADERS",
"]",
"=",
"\",\"",
".",
"join",
"(",
"request_headers",
")",
"return",
"response"
] |
CORS preflight request handler
|
[
"CORS",
"preflight",
"request",
"handler"
] |
14affbd95c88c675eb513c1d295ede1897930f94
|
https://github.com/aio-libs/aiohttp-cors/blob/14affbd95c88c675eb513c1d295ede1897930f94/aiohttp_cors/preflight_handler.py#L45-L130
|
18,514
|
aio-libs/aiohttp-cors
|
aiohttp_cors/urldispatcher_router_adapter.py
|
ResourcesUrlDispatcherRouterAdapter.add_preflight_handler
|
def add_preflight_handler(
self,
routing_entity: Union[web.Resource, web.StaticResource,
web.ResourceRoute],
handler):
"""Add OPTIONS handler for all routes defined by `routing_entity`.
Does nothing if CORS handler already handles routing entity.
Should fail if there are conflicting user-defined OPTIONS handlers.
"""
if isinstance(routing_entity, web.Resource):
resource = routing_entity
# Add preflight handler for Resource, if not yet added.
if resource in self._resources_with_preflight_handlers:
# Preflight handler already added for this resource.
return
for route_obj in resource:
if route_obj.method == hdrs.METH_OPTIONS:
if route_obj.handler is handler:
return # already added
else:
raise ValueError(
"{!r} already has OPTIONS handler {!r}"
.format(resource, route_obj.handler))
elif route_obj.method == hdrs.METH_ANY:
if _is_web_view(route_obj):
self._preflight_routes.add(route_obj)
self._resources_with_preflight_handlers.add(resource)
return
else:
raise ValueError("{!r} already has a '*' handler "
"for all methods".format(resource))
preflight_route = resource.add_route(hdrs.METH_OPTIONS, handler)
self._preflight_routes.add(preflight_route)
self._resources_with_preflight_handlers.add(resource)
elif isinstance(routing_entity, web.StaticResource):
resource = routing_entity
# Add preflight handler for Resource, if not yet added.
if resource in self._resources_with_preflight_handlers:
# Preflight handler already added for this resource.
return
resource.set_options_route(handler)
preflight_route = resource._routes[hdrs.METH_OPTIONS]
self._preflight_routes.add(preflight_route)
self._resources_with_preflight_handlers.add(resource)
elif isinstance(routing_entity, web.ResourceRoute):
route = routing_entity
if not self.is_cors_for_resource(route.resource):
self.add_preflight_handler(route.resource, handler)
else:
raise ValueError(
"Resource or ResourceRoute expected, got {!r}".format(
routing_entity))
|
python
|
def add_preflight_handler(
self,
routing_entity: Union[web.Resource, web.StaticResource,
web.ResourceRoute],
handler):
"""Add OPTIONS handler for all routes defined by `routing_entity`.
Does nothing if CORS handler already handles routing entity.
Should fail if there are conflicting user-defined OPTIONS handlers.
"""
if isinstance(routing_entity, web.Resource):
resource = routing_entity
# Add preflight handler for Resource, if not yet added.
if resource in self._resources_with_preflight_handlers:
# Preflight handler already added for this resource.
return
for route_obj in resource:
if route_obj.method == hdrs.METH_OPTIONS:
if route_obj.handler is handler:
return # already added
else:
raise ValueError(
"{!r} already has OPTIONS handler {!r}"
.format(resource, route_obj.handler))
elif route_obj.method == hdrs.METH_ANY:
if _is_web_view(route_obj):
self._preflight_routes.add(route_obj)
self._resources_with_preflight_handlers.add(resource)
return
else:
raise ValueError("{!r} already has a '*' handler "
"for all methods".format(resource))
preflight_route = resource.add_route(hdrs.METH_OPTIONS, handler)
self._preflight_routes.add(preflight_route)
self._resources_with_preflight_handlers.add(resource)
elif isinstance(routing_entity, web.StaticResource):
resource = routing_entity
# Add preflight handler for Resource, if not yet added.
if resource in self._resources_with_preflight_handlers:
# Preflight handler already added for this resource.
return
resource.set_options_route(handler)
preflight_route = resource._routes[hdrs.METH_OPTIONS]
self._preflight_routes.add(preflight_route)
self._resources_with_preflight_handlers.add(resource)
elif isinstance(routing_entity, web.ResourceRoute):
route = routing_entity
if not self.is_cors_for_resource(route.resource):
self.add_preflight_handler(route.resource, handler)
else:
raise ValueError(
"Resource or ResourceRoute expected, got {!r}".format(
routing_entity))
|
[
"def",
"add_preflight_handler",
"(",
"self",
",",
"routing_entity",
":",
"Union",
"[",
"web",
".",
"Resource",
",",
"web",
".",
"StaticResource",
",",
"web",
".",
"ResourceRoute",
"]",
",",
"handler",
")",
":",
"if",
"isinstance",
"(",
"routing_entity",
",",
"web",
".",
"Resource",
")",
":",
"resource",
"=",
"routing_entity",
"# Add preflight handler for Resource, if not yet added.",
"if",
"resource",
"in",
"self",
".",
"_resources_with_preflight_handlers",
":",
"# Preflight handler already added for this resource.",
"return",
"for",
"route_obj",
"in",
"resource",
":",
"if",
"route_obj",
".",
"method",
"==",
"hdrs",
".",
"METH_OPTIONS",
":",
"if",
"route_obj",
".",
"handler",
"is",
"handler",
":",
"return",
"# already added",
"else",
":",
"raise",
"ValueError",
"(",
"\"{!r} already has OPTIONS handler {!r}\"",
".",
"format",
"(",
"resource",
",",
"route_obj",
".",
"handler",
")",
")",
"elif",
"route_obj",
".",
"method",
"==",
"hdrs",
".",
"METH_ANY",
":",
"if",
"_is_web_view",
"(",
"route_obj",
")",
":",
"self",
".",
"_preflight_routes",
".",
"add",
"(",
"route_obj",
")",
"self",
".",
"_resources_with_preflight_handlers",
".",
"add",
"(",
"resource",
")",
"return",
"else",
":",
"raise",
"ValueError",
"(",
"\"{!r} already has a '*' handler \"",
"\"for all methods\"",
".",
"format",
"(",
"resource",
")",
")",
"preflight_route",
"=",
"resource",
".",
"add_route",
"(",
"hdrs",
".",
"METH_OPTIONS",
",",
"handler",
")",
"self",
".",
"_preflight_routes",
".",
"add",
"(",
"preflight_route",
")",
"self",
".",
"_resources_with_preflight_handlers",
".",
"add",
"(",
"resource",
")",
"elif",
"isinstance",
"(",
"routing_entity",
",",
"web",
".",
"StaticResource",
")",
":",
"resource",
"=",
"routing_entity",
"# Add preflight handler for Resource, if not yet added.",
"if",
"resource",
"in",
"self",
".",
"_resources_with_preflight_handlers",
":",
"# Preflight handler already added for this resource.",
"return",
"resource",
".",
"set_options_route",
"(",
"handler",
")",
"preflight_route",
"=",
"resource",
".",
"_routes",
"[",
"hdrs",
".",
"METH_OPTIONS",
"]",
"self",
".",
"_preflight_routes",
".",
"add",
"(",
"preflight_route",
")",
"self",
".",
"_resources_with_preflight_handlers",
".",
"add",
"(",
"resource",
")",
"elif",
"isinstance",
"(",
"routing_entity",
",",
"web",
".",
"ResourceRoute",
")",
":",
"route",
"=",
"routing_entity",
"if",
"not",
"self",
".",
"is_cors_for_resource",
"(",
"route",
".",
"resource",
")",
":",
"self",
".",
"add_preflight_handler",
"(",
"route",
".",
"resource",
",",
"handler",
")",
"else",
":",
"raise",
"ValueError",
"(",
"\"Resource or ResourceRoute expected, got {!r}\"",
".",
"format",
"(",
"routing_entity",
")",
")"
] |
Add OPTIONS handler for all routes defined by `routing_entity`.
Does nothing if CORS handler already handles routing entity.
Should fail if there are conflicting user-defined OPTIONS handlers.
|
[
"Add",
"OPTIONS",
"handler",
"for",
"all",
"routes",
"defined",
"by",
"routing_entity",
"."
] |
14affbd95c88c675eb513c1d295ede1897930f94
|
https://github.com/aio-libs/aiohttp-cors/blob/14affbd95c88c675eb513c1d295ede1897930f94/aiohttp_cors/urldispatcher_router_adapter.py#L137-L200
|
18,515
|
aio-libs/aiohttp-cors
|
aiohttp_cors/urldispatcher_router_adapter.py
|
ResourcesUrlDispatcherRouterAdapter.is_preflight_request
|
def is_preflight_request(self, request: web.Request) -> bool:
"""Is `request` is a CORS preflight request."""
route = self._request_route(request)
if _is_web_view(route, strict=False):
return request.method == 'OPTIONS'
return route in self._preflight_routes
|
python
|
def is_preflight_request(self, request: web.Request) -> bool:
"""Is `request` is a CORS preflight request."""
route = self._request_route(request)
if _is_web_view(route, strict=False):
return request.method == 'OPTIONS'
return route in self._preflight_routes
|
[
"def",
"is_preflight_request",
"(",
"self",
",",
"request",
":",
"web",
".",
"Request",
")",
"->",
"bool",
":",
"route",
"=",
"self",
".",
"_request_route",
"(",
"request",
")",
"if",
"_is_web_view",
"(",
"route",
",",
"strict",
"=",
"False",
")",
":",
"return",
"request",
".",
"method",
"==",
"'OPTIONS'",
"return",
"route",
"in",
"self",
".",
"_preflight_routes"
] |
Is `request` is a CORS preflight request.
|
[
"Is",
"request",
"is",
"a",
"CORS",
"preflight",
"request",
"."
] |
14affbd95c88c675eb513c1d295ede1897930f94
|
https://github.com/aio-libs/aiohttp-cors/blob/14affbd95c88c675eb513c1d295ede1897930f94/aiohttp_cors/urldispatcher_router_adapter.py#L214-L219
|
18,516
|
aio-libs/aiohttp-cors
|
aiohttp_cors/urldispatcher_router_adapter.py
|
ResourcesUrlDispatcherRouterAdapter.is_cors_enabled_on_request
|
def is_cors_enabled_on_request(self, request: web.Request) -> bool:
"""Is `request` is a request for CORS-enabled resource."""
return self._request_resource(request) in self._resource_config
|
python
|
def is_cors_enabled_on_request(self, request: web.Request) -> bool:
"""Is `request` is a request for CORS-enabled resource."""
return self._request_resource(request) in self._resource_config
|
[
"def",
"is_cors_enabled_on_request",
"(",
"self",
",",
"request",
":",
"web",
".",
"Request",
")",
"->",
"bool",
":",
"return",
"self",
".",
"_request_resource",
"(",
"request",
")",
"in",
"self",
".",
"_resource_config"
] |
Is `request` is a request for CORS-enabled resource.
|
[
"Is",
"request",
"is",
"a",
"request",
"for",
"CORS",
"-",
"enabled",
"resource",
"."
] |
14affbd95c88c675eb513c1d295ede1897930f94
|
https://github.com/aio-libs/aiohttp-cors/blob/14affbd95c88c675eb513c1d295ede1897930f94/aiohttp_cors/urldispatcher_router_adapter.py#L221-L224
|
18,517
|
aio-libs/aiohttp-cors
|
aiohttp_cors/urldispatcher_router_adapter.py
|
ResourcesUrlDispatcherRouterAdapter.set_config_for_routing_entity
|
def set_config_for_routing_entity(
self,
routing_entity: Union[web.Resource, web.StaticResource,
web.ResourceRoute],
config):
"""Record configuration for resource or it's route."""
if isinstance(routing_entity, (web.Resource, web.StaticResource)):
resource = routing_entity
# Add resource configuration or fail if it's already added.
if resource in self._resource_config:
raise ValueError(
"CORS is already configured for {!r} resource.".format(
resource))
self._resource_config[resource] = _ResourceConfig(
default_config=config)
elif isinstance(routing_entity, web.ResourceRoute):
route = routing_entity
# Add resource's route configuration or fail if it's already added.
if route.resource not in self._resource_config:
self.set_config_for_routing_entity(route.resource, config)
if route.resource not in self._resource_config:
raise ValueError(
"Can't setup CORS for {!r} request, "
"CORS must be enabled for route's resource first.".format(
route))
resource_config = self._resource_config[route.resource]
if route.method in resource_config.method_config:
raise ValueError(
"Can't setup CORS for {!r} route: CORS already "
"configured on resource {!r} for {} method".format(
route, route.resource, route.method))
resource_config.method_config[route.method] = config
else:
raise ValueError(
"Resource or ResourceRoute expected, got {!r}".format(
routing_entity))
|
python
|
def set_config_for_routing_entity(
self,
routing_entity: Union[web.Resource, web.StaticResource,
web.ResourceRoute],
config):
"""Record configuration for resource or it's route."""
if isinstance(routing_entity, (web.Resource, web.StaticResource)):
resource = routing_entity
# Add resource configuration or fail if it's already added.
if resource in self._resource_config:
raise ValueError(
"CORS is already configured for {!r} resource.".format(
resource))
self._resource_config[resource] = _ResourceConfig(
default_config=config)
elif isinstance(routing_entity, web.ResourceRoute):
route = routing_entity
# Add resource's route configuration or fail if it's already added.
if route.resource not in self._resource_config:
self.set_config_for_routing_entity(route.resource, config)
if route.resource not in self._resource_config:
raise ValueError(
"Can't setup CORS for {!r} request, "
"CORS must be enabled for route's resource first.".format(
route))
resource_config = self._resource_config[route.resource]
if route.method in resource_config.method_config:
raise ValueError(
"Can't setup CORS for {!r} route: CORS already "
"configured on resource {!r} for {} method".format(
route, route.resource, route.method))
resource_config.method_config[route.method] = config
else:
raise ValueError(
"Resource or ResourceRoute expected, got {!r}".format(
routing_entity))
|
[
"def",
"set_config_for_routing_entity",
"(",
"self",
",",
"routing_entity",
":",
"Union",
"[",
"web",
".",
"Resource",
",",
"web",
".",
"StaticResource",
",",
"web",
".",
"ResourceRoute",
"]",
",",
"config",
")",
":",
"if",
"isinstance",
"(",
"routing_entity",
",",
"(",
"web",
".",
"Resource",
",",
"web",
".",
"StaticResource",
")",
")",
":",
"resource",
"=",
"routing_entity",
"# Add resource configuration or fail if it's already added.",
"if",
"resource",
"in",
"self",
".",
"_resource_config",
":",
"raise",
"ValueError",
"(",
"\"CORS is already configured for {!r} resource.\"",
".",
"format",
"(",
"resource",
")",
")",
"self",
".",
"_resource_config",
"[",
"resource",
"]",
"=",
"_ResourceConfig",
"(",
"default_config",
"=",
"config",
")",
"elif",
"isinstance",
"(",
"routing_entity",
",",
"web",
".",
"ResourceRoute",
")",
":",
"route",
"=",
"routing_entity",
"# Add resource's route configuration or fail if it's already added.",
"if",
"route",
".",
"resource",
"not",
"in",
"self",
".",
"_resource_config",
":",
"self",
".",
"set_config_for_routing_entity",
"(",
"route",
".",
"resource",
",",
"config",
")",
"if",
"route",
".",
"resource",
"not",
"in",
"self",
".",
"_resource_config",
":",
"raise",
"ValueError",
"(",
"\"Can't setup CORS for {!r} request, \"",
"\"CORS must be enabled for route's resource first.\"",
".",
"format",
"(",
"route",
")",
")",
"resource_config",
"=",
"self",
".",
"_resource_config",
"[",
"route",
".",
"resource",
"]",
"if",
"route",
".",
"method",
"in",
"resource_config",
".",
"method_config",
":",
"raise",
"ValueError",
"(",
"\"Can't setup CORS for {!r} route: CORS already \"",
"\"configured on resource {!r} for {} method\"",
".",
"format",
"(",
"route",
",",
"route",
".",
"resource",
",",
"route",
".",
"method",
")",
")",
"resource_config",
".",
"method_config",
"[",
"route",
".",
"method",
"]",
"=",
"config",
"else",
":",
"raise",
"ValueError",
"(",
"\"Resource or ResourceRoute expected, got {!r}\"",
".",
"format",
"(",
"routing_entity",
")",
")"
] |
Record configuration for resource or it's route.
|
[
"Record",
"configuration",
"for",
"resource",
"or",
"it",
"s",
"route",
"."
] |
14affbd95c88c675eb513c1d295ede1897930f94
|
https://github.com/aio-libs/aiohttp-cors/blob/14affbd95c88c675eb513c1d295ede1897930f94/aiohttp_cors/urldispatcher_router_adapter.py#L226-L271
|
18,518
|
aio-libs/aiohttp-cors
|
aiohttp_cors/urldispatcher_router_adapter.py
|
ResourcesUrlDispatcherRouterAdapter.get_non_preflight_request_config
|
def get_non_preflight_request_config(self, request: web.Request):
"""Get stored CORS configuration for routing entity that handles
specified request."""
assert self.is_cors_enabled_on_request(request)
resource = self._request_resource(request)
resource_config = self._resource_config[resource]
# Take Route config (if any) with defaults from Resource CORS
# configuration and global defaults.
route = request.match_info.route
if _is_web_view(route, strict=False):
method_config = request.match_info.handler.get_request_config(
request, request.method)
else:
method_config = resource_config.method_config.get(request.method,
{})
defaulted_config = collections.ChainMap(
method_config,
resource_config.default_config,
self._default_config)
return defaulted_config
|
python
|
def get_non_preflight_request_config(self, request: web.Request):
"""Get stored CORS configuration for routing entity that handles
specified request."""
assert self.is_cors_enabled_on_request(request)
resource = self._request_resource(request)
resource_config = self._resource_config[resource]
# Take Route config (if any) with defaults from Resource CORS
# configuration and global defaults.
route = request.match_info.route
if _is_web_view(route, strict=False):
method_config = request.match_info.handler.get_request_config(
request, request.method)
else:
method_config = resource_config.method_config.get(request.method,
{})
defaulted_config = collections.ChainMap(
method_config,
resource_config.default_config,
self._default_config)
return defaulted_config
|
[
"def",
"get_non_preflight_request_config",
"(",
"self",
",",
"request",
":",
"web",
".",
"Request",
")",
":",
"assert",
"self",
".",
"is_cors_enabled_on_request",
"(",
"request",
")",
"resource",
"=",
"self",
".",
"_request_resource",
"(",
"request",
")",
"resource_config",
"=",
"self",
".",
"_resource_config",
"[",
"resource",
"]",
"# Take Route config (if any) with defaults from Resource CORS",
"# configuration and global defaults.",
"route",
"=",
"request",
".",
"match_info",
".",
"route",
"if",
"_is_web_view",
"(",
"route",
",",
"strict",
"=",
"False",
")",
":",
"method_config",
"=",
"request",
".",
"match_info",
".",
"handler",
".",
"get_request_config",
"(",
"request",
",",
"request",
".",
"method",
")",
"else",
":",
"method_config",
"=",
"resource_config",
".",
"method_config",
".",
"get",
"(",
"request",
".",
"method",
",",
"{",
"}",
")",
"defaulted_config",
"=",
"collections",
".",
"ChainMap",
"(",
"method_config",
",",
"resource_config",
".",
"default_config",
",",
"self",
".",
"_default_config",
")",
"return",
"defaulted_config"
] |
Get stored CORS configuration for routing entity that handles
specified request.
|
[
"Get",
"stored",
"CORS",
"configuration",
"for",
"routing",
"entity",
"that",
"handles",
"specified",
"request",
"."
] |
14affbd95c88c675eb513c1d295ede1897930f94
|
https://github.com/aio-libs/aiohttp-cors/blob/14affbd95c88c675eb513c1d295ede1897930f94/aiohttp_cors/urldispatcher_router_adapter.py#L302-L324
|
18,519
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/facilities/datacenters.py
|
Datacenters.add
|
def add(self, information, timeout=-1):
"""
Adds a data center resource based upon the attributes specified.
Args:
information: Data center information
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Added data center.
"""
return self._client.create(information, timeout=timeout)
|
python
|
def add(self, information, timeout=-1):
"""
Adds a data center resource based upon the attributes specified.
Args:
information: Data center information
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Added data center.
"""
return self._client.create(information, timeout=timeout)
|
[
"def",
"add",
"(",
"self",
",",
"information",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"return",
"self",
".",
"_client",
".",
"create",
"(",
"information",
",",
"timeout",
"=",
"timeout",
")"
] |
Adds a data center resource based upon the attributes specified.
Args:
information: Data center information
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Added data center.
|
[
"Adds",
"a",
"data",
"center",
"resource",
"based",
"upon",
"the",
"attributes",
"specified",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/facilities/datacenters.py#L138-L150
|
18,520
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/facilities/datacenters.py
|
Datacenters.update
|
def update(self, resource, timeout=-1):
"""
Updates the specified data center resource.
Args:
resource (dict): Object to update.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Updated data center.
"""
return self._client.update(resource, timeout=timeout)
|
python
|
def update(self, resource, timeout=-1):
"""
Updates the specified data center resource.
Args:
resource (dict): Object to update.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Updated data center.
"""
return self._client.update(resource, timeout=timeout)
|
[
"def",
"update",
"(",
"self",
",",
"resource",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"return",
"self",
".",
"_client",
".",
"update",
"(",
"resource",
",",
"timeout",
"=",
"timeout",
")"
] |
Updates the specified data center resource.
Args:
resource (dict): Object to update.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Updated data center.
|
[
"Updates",
"the",
"specified",
"data",
"center",
"resource",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/facilities/datacenters.py#L152-L164
|
18,521
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/facilities/datacenters.py
|
Datacenters.remove_all
|
def remove_all(self, filter, force=False, timeout=-1):
"""
Deletes the set of datacenters according to the specified parameters. A filter is required to identify the set
of resources to be deleted.
Args:
filter:
A general filter/query string to narrow the list of items that will be removed.
force:
If set to true, the operation completes despite any problems with
network connectivity or errors on the resource itself. The default is false.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
bool: operation success
"""
return self._client.delete_all(filter=filter, force=force, timeout=timeout)
|
python
|
def remove_all(self, filter, force=False, timeout=-1):
"""
Deletes the set of datacenters according to the specified parameters. A filter is required to identify the set
of resources to be deleted.
Args:
filter:
A general filter/query string to narrow the list of items that will be removed.
force:
If set to true, the operation completes despite any problems with
network connectivity or errors on the resource itself. The default is false.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
bool: operation success
"""
return self._client.delete_all(filter=filter, force=force, timeout=timeout)
|
[
"def",
"remove_all",
"(",
"self",
",",
"filter",
",",
"force",
"=",
"False",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"return",
"self",
".",
"_client",
".",
"delete_all",
"(",
"filter",
"=",
"filter",
",",
"force",
"=",
"force",
",",
"timeout",
"=",
"timeout",
")"
] |
Deletes the set of datacenters according to the specified parameters. A filter is required to identify the set
of resources to be deleted.
Args:
filter:
A general filter/query string to narrow the list of items that will be removed.
force:
If set to true, the operation completes despite any problems with
network connectivity or errors on the resource itself. The default is false.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
bool: operation success
|
[
"Deletes",
"the",
"set",
"of",
"datacenters",
"according",
"to",
"the",
"specified",
"parameters",
".",
"A",
"filter",
"is",
"required",
"to",
"identify",
"the",
"set",
"of",
"resources",
"to",
"be",
"deleted",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/facilities/datacenters.py#L166-L184
|
18,522
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/storage/drive_enclosures.py
|
DriveEnclosures.get_by
|
def get_by(self, field, value):
"""
Gets all drive enclosures that match the filter.
The search is case-insensitive.
Args:
Field: field name to filter.
Value: value to filter.
Returns:
list: A list of drive enclosures.
"""
return self._client.get_by(field=field, value=value)
|
python
|
def get_by(self, field, value):
"""
Gets all drive enclosures that match the filter.
The search is case-insensitive.
Args:
Field: field name to filter.
Value: value to filter.
Returns:
list: A list of drive enclosures.
"""
return self._client.get_by(field=field, value=value)
|
[
"def",
"get_by",
"(",
"self",
",",
"field",
",",
"value",
")",
":",
"return",
"self",
".",
"_client",
".",
"get_by",
"(",
"field",
"=",
"field",
",",
"value",
"=",
"value",
")"
] |
Gets all drive enclosures that match the filter.
The search is case-insensitive.
Args:
Field: field name to filter.
Value: value to filter.
Returns:
list: A list of drive enclosures.
|
[
"Gets",
"all",
"drive",
"enclosures",
"that",
"match",
"the",
"filter",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/drive_enclosures.py#L91-L104
|
18,523
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/storage/drive_enclosures.py
|
DriveEnclosures.refresh_state
|
def refresh_state(self, id_or_uri, configuration, timeout=-1):
"""
Refreshes a drive enclosure.
Args:
id_or_uri: Can be either the resource ID or the resource URI.
configuration: Configuration
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Drive Enclosure
"""
uri = self._client.build_uri(id_or_uri) + self.REFRESH_STATE_PATH
return self._client.update(resource=configuration, uri=uri, timeout=timeout)
|
python
|
def refresh_state(self, id_or_uri, configuration, timeout=-1):
"""
Refreshes a drive enclosure.
Args:
id_or_uri: Can be either the resource ID or the resource URI.
configuration: Configuration
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Drive Enclosure
"""
uri = self._client.build_uri(id_or_uri) + self.REFRESH_STATE_PATH
return self._client.update(resource=configuration, uri=uri, timeout=timeout)
|
[
"def",
"refresh_state",
"(",
"self",
",",
"id_or_uri",
",",
"configuration",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"id_or_uri",
")",
"+",
"self",
".",
"REFRESH_STATE_PATH",
"return",
"self",
".",
"_client",
".",
"update",
"(",
"resource",
"=",
"configuration",
",",
"uri",
"=",
"uri",
",",
"timeout",
"=",
"timeout",
")"
] |
Refreshes a drive enclosure.
Args:
id_or_uri: Can be either the resource ID or the resource URI.
configuration: Configuration
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Drive Enclosure
|
[
"Refreshes",
"a",
"drive",
"enclosure",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/drive_enclosures.py#L119-L133
|
18,524
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/uncategorized/os_deployment_servers.py
|
OsDeploymentServers.get_all
|
def get_all(self, start=0, count=-1, filter='', fields='', query='', sort='', view=''):
"""
Gets a list of Deployment Servers based on optional sorting and filtering, and constrained by start and count
parameters.
Args:
start:
The first item to return, using 0-based indexing.
If not specified, the default is 0 - start with the first available item.
count:
The number of resources to return. A count of -1 requests all items.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter (list or str):
A general filter/query string to narrow the list of items returned. The
default is no filter; all resources are returned.
fields:
Specifies which fields should be returned in the result set.
query:
A general query string to narrow the list of resources returned. The default
is no query - all resources are returned.
sort:
The sort order of the returned data set. By default, the sort order is based
on create time with the oldest entry first.
view:
Return 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.
Returns:
list: Os Deployment Servers
"""
return self._client.get_all(start, count, filter=filter, sort=sort, query=query, fields=fields, view=view)
|
python
|
def get_all(self, start=0, count=-1, filter='', fields='', query='', sort='', view=''):
"""
Gets a list of Deployment Servers based on optional sorting and filtering, and constrained by start and count
parameters.
Args:
start:
The first item to return, using 0-based indexing.
If not specified, the default is 0 - start with the first available item.
count:
The number of resources to return. A count of -1 requests all items.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter (list or str):
A general filter/query string to narrow the list of items returned. The
default is no filter; all resources are returned.
fields:
Specifies which fields should be returned in the result set.
query:
A general query string to narrow the list of resources returned. The default
is no query - all resources are returned.
sort:
The sort order of the returned data set. By default, the sort order is based
on create time with the oldest entry first.
view:
Return 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.
Returns:
list: Os Deployment Servers
"""
return self._client.get_all(start, count, filter=filter, sort=sort, query=query, fields=fields, view=view)
|
[
"def",
"get_all",
"(",
"self",
",",
"start",
"=",
"0",
",",
"count",
"=",
"-",
"1",
",",
"filter",
"=",
"''",
",",
"fields",
"=",
"''",
",",
"query",
"=",
"''",
",",
"sort",
"=",
"''",
",",
"view",
"=",
"''",
")",
":",
"return",
"self",
".",
"_client",
".",
"get_all",
"(",
"start",
",",
"count",
",",
"filter",
"=",
"filter",
",",
"sort",
"=",
"sort",
",",
"query",
"=",
"query",
",",
"fields",
"=",
"fields",
",",
"view",
"=",
"view",
")"
] |
Gets a list of Deployment Servers based on optional sorting and filtering, and constrained by start and count
parameters.
Args:
start:
The first item to return, using 0-based indexing.
If not specified, the default is 0 - start with the first available item.
count:
The number of resources to return. A count of -1 requests all items.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter (list or str):
A general filter/query string to narrow the list of items returned. The
default is no filter; all resources are returned.
fields:
Specifies which fields should be returned in the result set.
query:
A general query string to narrow the list of resources returned. The default
is no query - all resources are returned.
sort:
The sort order of the returned data set. By default, the sort order is based
on create time with the oldest entry first.
view:
Return 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.
Returns:
list: Os Deployment Servers
|
[
"Gets",
"a",
"list",
"of",
"Deployment",
"Servers",
"based",
"on",
"optional",
"sorting",
"and",
"filtering",
"and",
"constrained",
"by",
"start",
"and",
"count",
"parameters",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/uncategorized/os_deployment_servers.py#L43-L75
|
18,525
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/uncategorized/os_deployment_servers.py
|
OsDeploymentServers.delete
|
def delete(self, resource, force=False, timeout=-1):
"""
Deletes a Deployment Server object based on its UUID or URI.
Args:
resource (dict):
Object to delete.
force:
If set to true, the operation completes despite any problems with
network connectivity or errors on the resource itself. The default is false.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
bool: Indicates if the volume was successfully deleted.
"""
return self._client.delete(resource, force=force, timeout=timeout)
|
python
|
def delete(self, resource, force=False, timeout=-1):
"""
Deletes a Deployment Server object based on its UUID or URI.
Args:
resource (dict):
Object to delete.
force:
If set to true, the operation completes despite any problems with
network connectivity or errors on the resource itself. The default is false.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
bool: Indicates if the volume was successfully deleted.
"""
return self._client.delete(resource, force=force, timeout=timeout)
|
[
"def",
"delete",
"(",
"self",
",",
"resource",
",",
"force",
"=",
"False",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"return",
"self",
".",
"_client",
".",
"delete",
"(",
"resource",
",",
"force",
"=",
"force",
",",
"timeout",
"=",
"timeout",
")"
] |
Deletes a Deployment Server object based on its UUID or URI.
Args:
resource (dict):
Object to delete.
force:
If set to true, the operation completes despite any problems with
network connectivity or errors on the resource itself. The default is false.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
bool: Indicates if the volume was successfully deleted.
|
[
"Deletes",
"a",
"Deployment",
"Server",
"object",
"based",
"on",
"its",
"UUID",
"or",
"URI",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/uncategorized/os_deployment_servers.py#L153-L171
|
18,526
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/uncategorized/os_deployment_servers.py
|
OsDeploymentServers.get_appliances
|
def get_appliances(self, start=0, count=-1, filter='', fields='', query='', sort='', view=''):
"""
Gets a list of all the Image Streamer resources based on optional sorting and filtering, and constrained
by start and count parameters.
Args:
start:
The first item to return, using 0-based indexing.
If not specified, the default is 0 - start with the first available item.
count:
The number of resources to return. A count of -1 requests all items.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter (list or str):
A general filter/query string to narrow the list of items returned. The
default is no filter; all resources are returned.
fields:
Specifies which fields should be returned in the result set.
query:
A general query string to narrow the list of resources returned. The default
is no query - all resources are returned.
sort:
The sort order of the returned data set. By default, the sort order is based
on create time with the oldest entry first.
view:
Return 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.
Returns:
list: Image Streamer resources associated with the Deployment Servers.
"""
uri = self.URI + '/image-streamer-appliances'
return self._client.get_all(start, count, filter=filter, sort=sort, query=query, fields=fields, view=view,
uri=uri)
|
python
|
def get_appliances(self, start=0, count=-1, filter='', fields='', query='', sort='', view=''):
"""
Gets a list of all the Image Streamer resources based on optional sorting and filtering, and constrained
by start and count parameters.
Args:
start:
The first item to return, using 0-based indexing.
If not specified, the default is 0 - start with the first available item.
count:
The number of resources to return. A count of -1 requests all items.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter (list or str):
A general filter/query string to narrow the list of items returned. The
default is no filter; all resources are returned.
fields:
Specifies which fields should be returned in the result set.
query:
A general query string to narrow the list of resources returned. The default
is no query - all resources are returned.
sort:
The sort order of the returned data set. By default, the sort order is based
on create time with the oldest entry first.
view:
Return 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.
Returns:
list: Image Streamer resources associated with the Deployment Servers.
"""
uri = self.URI + '/image-streamer-appliances'
return self._client.get_all(start, count, filter=filter, sort=sort, query=query, fields=fields, view=view,
uri=uri)
|
[
"def",
"get_appliances",
"(",
"self",
",",
"start",
"=",
"0",
",",
"count",
"=",
"-",
"1",
",",
"filter",
"=",
"''",
",",
"fields",
"=",
"''",
",",
"query",
"=",
"''",
",",
"sort",
"=",
"''",
",",
"view",
"=",
"''",
")",
":",
"uri",
"=",
"self",
".",
"URI",
"+",
"'/image-streamer-appliances'",
"return",
"self",
".",
"_client",
".",
"get_all",
"(",
"start",
",",
"count",
",",
"filter",
"=",
"filter",
",",
"sort",
"=",
"sort",
",",
"query",
"=",
"query",
",",
"fields",
"=",
"fields",
",",
"view",
"=",
"view",
",",
"uri",
"=",
"uri",
")"
] |
Gets a list of all the Image Streamer resources based on optional sorting and filtering, and constrained
by start and count parameters.
Args:
start:
The first item to return, using 0-based indexing.
If not specified, the default is 0 - start with the first available item.
count:
The number of resources to return. A count of -1 requests all items.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter (list or str):
A general filter/query string to narrow the list of items returned. The
default is no filter; all resources are returned.
fields:
Specifies which fields should be returned in the result set.
query:
A general query string to narrow the list of resources returned. The default
is no query - all resources are returned.
sort:
The sort order of the returned data set. By default, the sort order is based
on create time with the oldest entry first.
view:
Return 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.
Returns:
list: Image Streamer resources associated with the Deployment Servers.
|
[
"Gets",
"a",
"list",
"of",
"all",
"the",
"Image",
"Streamer",
"resources",
"based",
"on",
"optional",
"sorting",
"and",
"filtering",
"and",
"constrained",
"by",
"start",
"and",
"count",
"parameters",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/uncategorized/os_deployment_servers.py#L183-L217
|
18,527
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/uncategorized/os_deployment_servers.py
|
OsDeploymentServers.get_appliance
|
def get_appliance(self, id_or_uri, fields=''):
"""
Gets the particular Image Streamer resource based on its ID or URI.
Args:
id_or_uri:
Can be either the Os Deployment Server ID or the URI
fields:
Specifies which fields should be returned in the result.
Returns:
dict: Image Streamer resource.
"""
uri = self.URI + '/image-streamer-appliances/' + extract_id_from_uri(id_or_uri)
if fields:
uri += '?fields=' + fields
return self._client.get(uri)
|
python
|
def get_appliance(self, id_or_uri, fields=''):
"""
Gets the particular Image Streamer resource based on its ID or URI.
Args:
id_or_uri:
Can be either the Os Deployment Server ID or the URI
fields:
Specifies which fields should be returned in the result.
Returns:
dict: Image Streamer resource.
"""
uri = self.URI + '/image-streamer-appliances/' + extract_id_from_uri(id_or_uri)
if fields:
uri += '?fields=' + fields
return self._client.get(uri)
|
[
"def",
"get_appliance",
"(",
"self",
",",
"id_or_uri",
",",
"fields",
"=",
"''",
")",
":",
"uri",
"=",
"self",
".",
"URI",
"+",
"'/image-streamer-appliances/'",
"+",
"extract_id_from_uri",
"(",
"id_or_uri",
")",
"if",
"fields",
":",
"uri",
"+=",
"'?fields='",
"+",
"fields",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"uri",
")"
] |
Gets the particular Image Streamer resource based on its ID or URI.
Args:
id_or_uri:
Can be either the Os Deployment Server ID or the URI
fields:
Specifies which fields should be returned in the result.
Returns:
dict: Image Streamer resource.
|
[
"Gets",
"the",
"particular",
"Image",
"Streamer",
"resource",
"based",
"on",
"its",
"ID",
"or",
"URI",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/uncategorized/os_deployment_servers.py#L219-L236
|
18,528
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/uncategorized/os_deployment_servers.py
|
OsDeploymentServers.get_appliance_by_name
|
def get_appliance_by_name(self, appliance_name):
"""
Gets the particular Image Streamer resource based on its name.
Args:
appliance_name:
The Image Streamer resource name.
Returns:
dict: Image Streamer resource.
"""
appliances = self.get_appliances()
if appliances:
for appliance in appliances:
if appliance['name'] == appliance_name:
return appliance
return None
|
python
|
def get_appliance_by_name(self, appliance_name):
"""
Gets the particular Image Streamer resource based on its name.
Args:
appliance_name:
The Image Streamer resource name.
Returns:
dict: Image Streamer resource.
"""
appliances = self.get_appliances()
if appliances:
for appliance in appliances:
if appliance['name'] == appliance_name:
return appliance
return None
|
[
"def",
"get_appliance_by_name",
"(",
"self",
",",
"appliance_name",
")",
":",
"appliances",
"=",
"self",
".",
"get_appliances",
"(",
")",
"if",
"appliances",
":",
"for",
"appliance",
"in",
"appliances",
":",
"if",
"appliance",
"[",
"'name'",
"]",
"==",
"appliance_name",
":",
"return",
"appliance",
"return",
"None"
] |
Gets the particular Image Streamer resource based on its name.
Args:
appliance_name:
The Image Streamer resource name.
Returns:
dict: Image Streamer resource.
|
[
"Gets",
"the",
"particular",
"Image",
"Streamer",
"resource",
"based",
"on",
"its",
"name",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/uncategorized/os_deployment_servers.py#L238-L255
|
18,529
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/storage/storage_systems.py
|
StorageSystems.get_managed_ports
|
def get_managed_ports(self, id_or_uri, port_id_or_uri=''):
"""
Gets all ports or a specific managed target port for the specified storage system.
Args:
id_or_uri: Can be either the storage system id or the storage system uri.
port_id_or_uri: Can be either the port id or the port uri.
Returns:
dict: Managed ports.
"""
if port_id_or_uri:
uri = self._client.build_uri(port_id_or_uri)
if "/managedPorts" not in uri:
uri = self._client.build_uri(id_or_uri) + "/managedPorts" + "/" + port_id_or_uri
else:
uri = self._client.build_uri(id_or_uri) + "/managedPorts"
return self._client.get_collection(uri)
|
python
|
def get_managed_ports(self, id_or_uri, port_id_or_uri=''):
"""
Gets all ports or a specific managed target port for the specified storage system.
Args:
id_or_uri: Can be either the storage system id or the storage system uri.
port_id_or_uri: Can be either the port id or the port uri.
Returns:
dict: Managed ports.
"""
if port_id_or_uri:
uri = self._client.build_uri(port_id_or_uri)
if "/managedPorts" not in uri:
uri = self._client.build_uri(id_or_uri) + "/managedPorts" + "/" + port_id_or_uri
else:
uri = self._client.build_uri(id_or_uri) + "/managedPorts"
return self._client.get_collection(uri)
|
[
"def",
"get_managed_ports",
"(",
"self",
",",
"id_or_uri",
",",
"port_id_or_uri",
"=",
"''",
")",
":",
"if",
"port_id_or_uri",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"port_id_or_uri",
")",
"if",
"\"/managedPorts\"",
"not",
"in",
"uri",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"id_or_uri",
")",
"+",
"\"/managedPorts\"",
"+",
"\"/\"",
"+",
"port_id_or_uri",
"else",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"id_or_uri",
")",
"+",
"\"/managedPorts\"",
"return",
"self",
".",
"_client",
".",
"get_collection",
"(",
"uri",
")"
] |
Gets all ports or a specific managed target port for the specified storage system.
Args:
id_or_uri: Can be either the storage system id or the storage system uri.
port_id_or_uri: Can be either the port id or the port uri.
Returns:
dict: Managed ports.
|
[
"Gets",
"all",
"ports",
"or",
"a",
"specific",
"managed",
"target",
"port",
"for",
"the",
"specified",
"storage",
"system",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/storage_systems.py#L163-L182
|
18,530
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/storage/storage_systems.py
|
StorageSystems.get_by_ip_hostname
|
def get_by_ip_hostname(self, ip_hostname):
"""
Retrieve a storage system by its IP.
Works only with API version <= 300.
Args:
ip_hostname: Storage system IP or hostname.
Returns:
dict
"""
resources = self._client.get_all()
resources_filtered = [x for x in resources if x['credentials']['ip_hostname'] == ip_hostname]
if resources_filtered:
return resources_filtered[0]
else:
return None
|
python
|
def get_by_ip_hostname(self, ip_hostname):
"""
Retrieve a storage system by its IP.
Works only with API version <= 300.
Args:
ip_hostname: Storage system IP or hostname.
Returns:
dict
"""
resources = self._client.get_all()
resources_filtered = [x for x in resources if x['credentials']['ip_hostname'] == ip_hostname]
if resources_filtered:
return resources_filtered[0]
else:
return None
|
[
"def",
"get_by_ip_hostname",
"(",
"self",
",",
"ip_hostname",
")",
":",
"resources",
"=",
"self",
".",
"_client",
".",
"get_all",
"(",
")",
"resources_filtered",
"=",
"[",
"x",
"for",
"x",
"in",
"resources",
"if",
"x",
"[",
"'credentials'",
"]",
"[",
"'ip_hostname'",
"]",
"==",
"ip_hostname",
"]",
"if",
"resources_filtered",
":",
"return",
"resources_filtered",
"[",
"0",
"]",
"else",
":",
"return",
"None"
] |
Retrieve a storage system by its IP.
Works only with API version <= 300.
Args:
ip_hostname: Storage system IP or hostname.
Returns:
dict
|
[
"Retrieve",
"a",
"storage",
"system",
"by",
"its",
"IP",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/storage_systems.py#L211-L230
|
18,531
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/storage/storage_systems.py
|
StorageSystems.get_by_hostname
|
def get_by_hostname(self, hostname):
"""
Retrieve a storage system by its hostname.
Works only in API500 onwards.
Args:
hostname: Storage system hostname.
Returns:
dict
"""
resources = self._client.get_all()
resources_filtered = [x for x in resources if x['hostname'] == hostname]
if resources_filtered:
return resources_filtered[0]
else:
return None
|
python
|
def get_by_hostname(self, hostname):
"""
Retrieve a storage system by its hostname.
Works only in API500 onwards.
Args:
hostname: Storage system hostname.
Returns:
dict
"""
resources = self._client.get_all()
resources_filtered = [x for x in resources if x['hostname'] == hostname]
if resources_filtered:
return resources_filtered[0]
else:
return None
|
[
"def",
"get_by_hostname",
"(",
"self",
",",
"hostname",
")",
":",
"resources",
"=",
"self",
".",
"_client",
".",
"get_all",
"(",
")",
"resources_filtered",
"=",
"[",
"x",
"for",
"x",
"in",
"resources",
"if",
"x",
"[",
"'hostname'",
"]",
"==",
"hostname",
"]",
"if",
"resources_filtered",
":",
"return",
"resources_filtered",
"[",
"0",
"]",
"else",
":",
"return",
"None"
] |
Retrieve a storage system by its hostname.
Works only in API500 onwards.
Args:
hostname: Storage system hostname.
Returns:
dict
|
[
"Retrieve",
"a",
"storage",
"system",
"by",
"its",
"hostname",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/storage_systems.py#L232-L251
|
18,532
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/storage/storage_systems.py
|
StorageSystems.get_reachable_ports
|
def get_reachable_ports(self, id_or_uri, start=0, count=-1, filter='', query='', sort='', networks=[]):
"""
Gets the storage ports that are connected on the specified networks
based on the storage system port's expected network connectivity.
Returns:
list: Reachable Storage Port List.
"""
uri = self._client.build_uri(id_or_uri) + "/reachable-ports"
if networks:
elements = "\'"
for n in networks:
elements += n + ','
elements = elements[:-1] + "\'"
uri = uri + "?networks=" + elements
return self._client.get(self._client.build_query_uri(start=start, count=count, filter=filter, query=query,
sort=sort, uri=uri))
|
python
|
def get_reachable_ports(self, id_or_uri, start=0, count=-1, filter='', query='', sort='', networks=[]):
"""
Gets the storage ports that are connected on the specified networks
based on the storage system port's expected network connectivity.
Returns:
list: Reachable Storage Port List.
"""
uri = self._client.build_uri(id_or_uri) + "/reachable-ports"
if networks:
elements = "\'"
for n in networks:
elements += n + ','
elements = elements[:-1] + "\'"
uri = uri + "?networks=" + elements
return self._client.get(self._client.build_query_uri(start=start, count=count, filter=filter, query=query,
sort=sort, uri=uri))
|
[
"def",
"get_reachable_ports",
"(",
"self",
",",
"id_or_uri",
",",
"start",
"=",
"0",
",",
"count",
"=",
"-",
"1",
",",
"filter",
"=",
"''",
",",
"query",
"=",
"''",
",",
"sort",
"=",
"''",
",",
"networks",
"=",
"[",
"]",
")",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"id_or_uri",
")",
"+",
"\"/reachable-ports\"",
"if",
"networks",
":",
"elements",
"=",
"\"\\'\"",
"for",
"n",
"in",
"networks",
":",
"elements",
"+=",
"n",
"+",
"','",
"elements",
"=",
"elements",
"[",
":",
"-",
"1",
"]",
"+",
"\"\\'\"",
"uri",
"=",
"uri",
"+",
"\"?networks=\"",
"+",
"elements",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"self",
".",
"_client",
".",
"build_query_uri",
"(",
"start",
"=",
"start",
",",
"count",
"=",
"count",
",",
"filter",
"=",
"filter",
",",
"query",
"=",
"query",
",",
"sort",
"=",
"sort",
",",
"uri",
"=",
"uri",
")",
")"
] |
Gets the storage ports that are connected on the specified networks
based on the storage system port's expected network connectivity.
Returns:
list: Reachable Storage Port List.
|
[
"Gets",
"the",
"storage",
"ports",
"that",
"are",
"connected",
"on",
"the",
"specified",
"networks",
"based",
"on",
"the",
"storage",
"system",
"port",
"s",
"expected",
"network",
"connectivity",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/storage_systems.py#L253-L271
|
18,533
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/storage/storage_systems.py
|
StorageSystems.get_templates
|
def get_templates(self, id_or_uri, start=0, count=-1, filter='', query='', sort=''):
"""
Gets a list of volume templates. Returns a list of storage templates belonging to the storage system.
Returns:
list: Storage Template List.
"""
uri = self._client.build_uri(id_or_uri) + "/templates"
return self._client.get(self._client.build_query_uri(start=start, count=count, filter=filter,
query=query, sort=sort, uri=uri))
|
python
|
def get_templates(self, id_or_uri, start=0, count=-1, filter='', query='', sort=''):
"""
Gets a list of volume templates. Returns a list of storage templates belonging to the storage system.
Returns:
list: Storage Template List.
"""
uri = self._client.build_uri(id_or_uri) + "/templates"
return self._client.get(self._client.build_query_uri(start=start, count=count, filter=filter,
query=query, sort=sort, uri=uri))
|
[
"def",
"get_templates",
"(",
"self",
",",
"id_or_uri",
",",
"start",
"=",
"0",
",",
"count",
"=",
"-",
"1",
",",
"filter",
"=",
"''",
",",
"query",
"=",
"''",
",",
"sort",
"=",
"''",
")",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"id_or_uri",
")",
"+",
"\"/templates\"",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"self",
".",
"_client",
".",
"build_query_uri",
"(",
"start",
"=",
"start",
",",
"count",
"=",
"count",
",",
"filter",
"=",
"filter",
",",
"query",
"=",
"query",
",",
"sort",
"=",
"sort",
",",
"uri",
"=",
"uri",
")",
")"
] |
Gets a list of volume templates. Returns a list of storage templates belonging to the storage system.
Returns:
list: Storage Template List.
|
[
"Gets",
"a",
"list",
"of",
"volume",
"templates",
".",
"Returns",
"a",
"list",
"of",
"storage",
"templates",
"belonging",
"to",
"the",
"storage",
"system",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/storage_systems.py#L273-L282
|
18,534
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/networking/fabrics.py
|
Fabrics.get_reserved_vlan_range
|
def get_reserved_vlan_range(self, id_or_uri):
"""
Gets the reserved vlan ID range for the fabric.
Note:
This method is only available on HPE Synergy.
Args:
id_or_uri: ID or URI of fabric.
Returns:
dict: vlan-pool
"""
uri = self._client.build_uri(id_or_uri) + "/reserved-vlan-range"
return self._client.get(uri)
|
python
|
def get_reserved_vlan_range(self, id_or_uri):
"""
Gets the reserved vlan ID range for the fabric.
Note:
This method is only available on HPE Synergy.
Args:
id_or_uri: ID or URI of fabric.
Returns:
dict: vlan-pool
"""
uri = self._client.build_uri(id_or_uri) + "/reserved-vlan-range"
return self._client.get(uri)
|
[
"def",
"get_reserved_vlan_range",
"(",
"self",
",",
"id_or_uri",
")",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"id_or_uri",
")",
"+",
"\"/reserved-vlan-range\"",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"uri",
")"
] |
Gets the reserved vlan ID range for the fabric.
Note:
This method is only available on HPE Synergy.
Args:
id_or_uri: ID or URI of fabric.
Returns:
dict: vlan-pool
|
[
"Gets",
"the",
"reserved",
"vlan",
"ID",
"range",
"for",
"the",
"fabric",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/fabrics.py#L107-L121
|
18,535
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/networking/fabrics.py
|
Fabrics.update_reserved_vlan_range
|
def update_reserved_vlan_range(self, id_or_uri, vlan_pool, force=False):
"""
Updates the reserved vlan ID range for the fabric.
Note:
This method is only available on HPE Synergy.
Args:
id_or_uri: ID or URI of fabric.
vlan_pool (dict): vlan-pool data to update.
force: If set to true, the operation completes despite any problems with network connectivity or errors
on the resource itself. The default is false.
Returns:
dict: The fabric
"""
uri = self._client.build_uri(id_or_uri) + "/reserved-vlan-range"
return self._client.update(resource=vlan_pool, uri=uri, force=force, default_values=self.DEFAULT_VALUES)
|
python
|
def update_reserved_vlan_range(self, id_or_uri, vlan_pool, force=False):
"""
Updates the reserved vlan ID range for the fabric.
Note:
This method is only available on HPE Synergy.
Args:
id_or_uri: ID or URI of fabric.
vlan_pool (dict): vlan-pool data to update.
force: If set to true, the operation completes despite any problems with network connectivity or errors
on the resource itself. The default is false.
Returns:
dict: The fabric
"""
uri = self._client.build_uri(id_or_uri) + "/reserved-vlan-range"
return self._client.update(resource=vlan_pool, uri=uri, force=force, default_values=self.DEFAULT_VALUES)
|
[
"def",
"update_reserved_vlan_range",
"(",
"self",
",",
"id_or_uri",
",",
"vlan_pool",
",",
"force",
"=",
"False",
")",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"id_or_uri",
")",
"+",
"\"/reserved-vlan-range\"",
"return",
"self",
".",
"_client",
".",
"update",
"(",
"resource",
"=",
"vlan_pool",
",",
"uri",
"=",
"uri",
",",
"force",
"=",
"force",
",",
"default_values",
"=",
"self",
".",
"DEFAULT_VALUES",
")"
] |
Updates the reserved vlan ID range for the fabric.
Note:
This method is only available on HPE Synergy.
Args:
id_or_uri: ID or URI of fabric.
vlan_pool (dict): vlan-pool data to update.
force: If set to true, the operation completes despite any problems with network connectivity or errors
on the resource itself. The default is false.
Returns:
dict: The fabric
|
[
"Updates",
"the",
"reserved",
"vlan",
"ID",
"range",
"for",
"the",
"fabric",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/fabrics.py#L123-L140
|
18,536
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/security/roles.py
|
Roles.get
|
def get(self, name_or_uri):
"""
Get the role by its URI or Name.
Args:
name_or_uri:
Can be either the Name or the URI.
Returns:
dict: Role
"""
name_or_uri = quote(name_or_uri)
return self._client.get(name_or_uri)
|
python
|
def get(self, name_or_uri):
"""
Get the role by its URI or Name.
Args:
name_or_uri:
Can be either the Name or the URI.
Returns:
dict: Role
"""
name_or_uri = quote(name_or_uri)
return self._client.get(name_or_uri)
|
[
"def",
"get",
"(",
"self",
",",
"name_or_uri",
")",
":",
"name_or_uri",
"=",
"quote",
"(",
"name_or_uri",
")",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"name_or_uri",
")"
] |
Get the role by its URI or Name.
Args:
name_or_uri:
Can be either the Name or the URI.
Returns:
dict: Role
|
[
"Get",
"the",
"role",
"by",
"its",
"URI",
"or",
"Name",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/security/roles.py#L74-L86
|
18,537
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/storage/sas_logical_jbods.py
|
SasLogicalJbods.get_drives
|
def get_drives(self, id_or_uri):
"""
Gets the list of drives allocated to this SAS logical JBOD.
Args:
id_or_uri: Can be either the SAS logical JBOD ID or the SAS logical JBOD URI.
Returns:
list: A list of Drives
"""
uri = self._client.build_uri(id_or_uri=id_or_uri) + self.DRIVES_PATH
return self._client.get(id_or_uri=uri)
|
python
|
def get_drives(self, id_or_uri):
"""
Gets the list of drives allocated to this SAS logical JBOD.
Args:
id_or_uri: Can be either the SAS logical JBOD ID or the SAS logical JBOD URI.
Returns:
list: A list of Drives
"""
uri = self._client.build_uri(id_or_uri=id_or_uri) + self.DRIVES_PATH
return self._client.get(id_or_uri=uri)
|
[
"def",
"get_drives",
"(",
"self",
",",
"id_or_uri",
")",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"id_or_uri",
"=",
"id_or_uri",
")",
"+",
"self",
".",
"DRIVES_PATH",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"id_or_uri",
"=",
"uri",
")"
] |
Gets the list of drives allocated to this SAS logical JBOD.
Args:
id_or_uri: Can be either the SAS logical JBOD ID or the SAS logical JBOD URI.
Returns:
list: A list of Drives
|
[
"Gets",
"the",
"list",
"of",
"drives",
"allocated",
"to",
"this",
"SAS",
"logical",
"JBOD",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/sas_logical_jbods.py#L104-L115
|
18,538
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/servers/id_pools_ranges.py
|
IdPoolsRanges.enable
|
def enable(self, information, id_or_uri, timeout=-1):
"""
Enables or disables a range.
Args:
information (dict): Information to update.
id_or_uri: ID or URI of range.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Updated resource.
"""
uri = self._client.build_uri(id_or_uri)
return self._client.update(information, uri, timeout=timeout)
|
python
|
def enable(self, information, id_or_uri, timeout=-1):
"""
Enables or disables a range.
Args:
information (dict): Information to update.
id_or_uri: ID or URI of range.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Updated resource.
"""
uri = self._client.build_uri(id_or_uri)
return self._client.update(information, uri, timeout=timeout)
|
[
"def",
"enable",
"(",
"self",
",",
"information",
",",
"id_or_uri",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"id_or_uri",
")",
"return",
"self",
".",
"_client",
".",
"update",
"(",
"information",
",",
"uri",
",",
"timeout",
"=",
"timeout",
")"
] |
Enables or disables a range.
Args:
information (dict): Information to update.
id_or_uri: ID or URI of range.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Updated resource.
|
[
"Enables",
"or",
"disables",
"a",
"range",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/id_pools_ranges.py#L86-L102
|
18,539
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/servers/id_pools_ranges.py
|
IdPoolsRanges.get_allocated_fragments
|
def get_allocated_fragments(self, id_or_uri, count=-1, start=0):
"""
Gets all fragments that have been allocated in range.
Args:
id_or_uri:
ID or URI of range.
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.
Returns:
list: A list with the allocated fragements.
"""
uri = self._client.build_uri(id_or_uri) + "/allocated-fragments?start={0}&count={1}".format(start, count)
return self._client.get_collection(uri)
|
python
|
def get_allocated_fragments(self, id_or_uri, count=-1, start=0):
"""
Gets all fragments that have been allocated in range.
Args:
id_or_uri:
ID or URI of range.
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.
Returns:
list: A list with the allocated fragements.
"""
uri = self._client.build_uri(id_or_uri) + "/allocated-fragments?start={0}&count={1}".format(start, count)
return self._client.get_collection(uri)
|
[
"def",
"get_allocated_fragments",
"(",
"self",
",",
"id_or_uri",
",",
"count",
"=",
"-",
"1",
",",
"start",
"=",
"0",
")",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"id_or_uri",
")",
"+",
"\"/allocated-fragments?start={0}&count={1}\"",
".",
"format",
"(",
"start",
",",
"count",
")",
"return",
"self",
".",
"_client",
".",
"get_collection",
"(",
"uri",
")"
] |
Gets all fragments that have been allocated in range.
Args:
id_or_uri:
ID or URI of range.
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.
Returns:
list: A list with the allocated fragements.
|
[
"Gets",
"all",
"fragments",
"that",
"have",
"been",
"allocated",
"in",
"range",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/id_pools_ranges.py#L123-L142
|
18,540
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/networking/logical_interconnects.py
|
LogicalInterconnects.get_all
|
def get_all(self, start=0, count=-1, sort=''):
"""
Gets a list of logical interconnects based on optional sorting and filtering and is constrained by start
and count parameters.
Args:
start:
The first item to return, using 0-based indexing.
If not specified, the default is 0 - start with the first available item.
count:
The number of resources to return. A count of -1 requests all items.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
sort:
The sort order of the returned data set. By default, the sort order is based
on create time with the oldest entry first.
Returns:
list: A list of logical interconnects.
"""
return self._helper.get_all(start, count, sort=sort)
|
python
|
def get_all(self, start=0, count=-1, sort=''):
"""
Gets a list of logical interconnects based on optional sorting and filtering and is constrained by start
and count parameters.
Args:
start:
The first item to return, using 0-based indexing.
If not specified, the default is 0 - start with the first available item.
count:
The number of resources to return. A count of -1 requests all items.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
sort:
The sort order of the returned data set. By default, the sort order is based
on create time with the oldest entry first.
Returns:
list: A list of logical interconnects.
"""
return self._helper.get_all(start, count, sort=sort)
|
[
"def",
"get_all",
"(",
"self",
",",
"start",
"=",
"0",
",",
"count",
"=",
"-",
"1",
",",
"sort",
"=",
"''",
")",
":",
"return",
"self",
".",
"_helper",
".",
"get_all",
"(",
"start",
",",
"count",
",",
"sort",
"=",
"sort",
")"
] |
Gets a list of logical interconnects based on optional sorting and filtering and is constrained by start
and count parameters.
Args:
start:
The first item to return, using 0-based indexing.
If not specified, the default is 0 - start with the first available item.
count:
The number of resources to return. A count of -1 requests all items.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
sort:
The sort order of the returned data set. By default, the sort order is based
on create time with the oldest entry first.
Returns:
list: A list of logical interconnects.
|
[
"Gets",
"a",
"list",
"of",
"logical",
"interconnects",
"based",
"on",
"optional",
"sorting",
"and",
"filtering",
"and",
"is",
"constrained",
"by",
"start",
"and",
"count",
"parameters",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L89-L109
|
18,541
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/networking/logical_interconnects.py
|
LogicalInterconnects.update_compliance
|
def update_compliance(self, timeout=-1):
"""
Returns logical interconnects to a consistent state. The current logical interconnect state is
compared to the associated logical interconnect group.
Any differences identified are corrected, bringing the logical interconnect back to a consistent
state. Changes are asynchronously applied to all managed interconnects. Note that if the changes detected
involve differences in the interconnect map between the logical interconnect group and the logical interconnect,
the process of bringing the logical interconnect back to a consistent state might involve automatically removing
existing interconnects from management and/or adding new interconnects for management.
Args:
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Logical Interconnect.
"""
uri = "{}/compliance".format(self.data["uri"])
return self._helper.update(None, uri, timeout=timeout)
|
python
|
def update_compliance(self, timeout=-1):
"""
Returns logical interconnects to a consistent state. The current logical interconnect state is
compared to the associated logical interconnect group.
Any differences identified are corrected, bringing the logical interconnect back to a consistent
state. Changes are asynchronously applied to all managed interconnects. Note that if the changes detected
involve differences in the interconnect map between the logical interconnect group and the logical interconnect,
the process of bringing the logical interconnect back to a consistent state might involve automatically removing
existing interconnects from management and/or adding new interconnects for management.
Args:
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Logical Interconnect.
"""
uri = "{}/compliance".format(self.data["uri"])
return self._helper.update(None, uri, timeout=timeout)
|
[
"def",
"update_compliance",
"(",
"self",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"\"{}/compliance\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
")",
"return",
"self",
".",
"_helper",
".",
"update",
"(",
"None",
",",
"uri",
",",
"timeout",
"=",
"timeout",
")"
] |
Returns logical interconnects to a consistent state. The current logical interconnect state is
compared to the associated logical interconnect group.
Any differences identified are corrected, bringing the logical interconnect back to a consistent
state. Changes are asynchronously applied to all managed interconnects. Note that if the changes detected
involve differences in the interconnect map between the logical interconnect group and the logical interconnect,
the process of bringing the logical interconnect back to a consistent state might involve automatically removing
existing interconnects from management and/or adding new interconnects for management.
Args:
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Logical Interconnect.
|
[
"Returns",
"logical",
"interconnects",
"to",
"a",
"consistent",
"state",
".",
"The",
"current",
"logical",
"interconnect",
"state",
"is",
"compared",
"to",
"the",
"associated",
"logical",
"interconnect",
"group",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L131-L150
|
18,542
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/networking/logical_interconnects.py
|
LogicalInterconnects.update_ethernet_settings
|
def update_ethernet_settings(self, configuration, force=False, timeout=-1):
"""
Updates the Ethernet interconnect settings for the logical interconnect.
Args:
configuration: Ethernet interconnect settings.
force: If set to true, the operation completes despite any problems with network connectivity or errors
on the resource itself. The default is false.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Logical Interconnect.
"""
uri = "{}/ethernetSettings".format(self.data["uri"])
return self._helper.update(configuration, uri=uri, force=force, timeout=timeout)
|
python
|
def update_ethernet_settings(self, configuration, force=False, timeout=-1):
"""
Updates the Ethernet interconnect settings for the logical interconnect.
Args:
configuration: Ethernet interconnect settings.
force: If set to true, the operation completes despite any problems with network connectivity or errors
on the resource itself. The default is false.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Logical Interconnect.
"""
uri = "{}/ethernetSettings".format(self.data["uri"])
return self._helper.update(configuration, uri=uri, force=force, timeout=timeout)
|
[
"def",
"update_ethernet_settings",
"(",
"self",
",",
"configuration",
",",
"force",
"=",
"False",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"\"{}/ethernetSettings\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
")",
"return",
"self",
".",
"_helper",
".",
"update",
"(",
"configuration",
",",
"uri",
"=",
"uri",
",",
"force",
"=",
"force",
",",
"timeout",
"=",
"timeout",
")"
] |
Updates the Ethernet interconnect settings for the logical interconnect.
Args:
configuration: Ethernet interconnect settings.
force: If set to true, the operation completes despite any problems with network connectivity or errors
on the resource itself. The default is false.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Logical Interconnect.
|
[
"Updates",
"the",
"Ethernet",
"interconnect",
"settings",
"for",
"the",
"logical",
"interconnect",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L153-L168
|
18,543
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/networking/logical_interconnects.py
|
LogicalInterconnects.update_internal_networks
|
def update_internal_networks(self, network_uri_list, force=False, timeout=-1):
"""
Updates internal networks on the logical interconnect.
Args:
network_uri_list: List of Ethernet network uris.
force: If set to true, the operation completes despite any problems with network connectivity or errors
on the resource itself. The default is false.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Logical Interconnect.
"""
uri = "{}/internalNetworks".format(self.data["uri"])
return self._helper.update(network_uri_list, uri=uri, force=force, timeout=timeout)
|
python
|
def update_internal_networks(self, network_uri_list, force=False, timeout=-1):
"""
Updates internal networks on the logical interconnect.
Args:
network_uri_list: List of Ethernet network uris.
force: If set to true, the operation completes despite any problems with network connectivity or errors
on the resource itself. The default is false.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Logical Interconnect.
"""
uri = "{}/internalNetworks".format(self.data["uri"])
return self._helper.update(network_uri_list, uri=uri, force=force, timeout=timeout)
|
[
"def",
"update_internal_networks",
"(",
"self",
",",
"network_uri_list",
",",
"force",
"=",
"False",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"\"{}/internalNetworks\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
")",
"return",
"self",
".",
"_helper",
".",
"update",
"(",
"network_uri_list",
",",
"uri",
"=",
"uri",
",",
"force",
"=",
"force",
",",
"timeout",
"=",
"timeout",
")"
] |
Updates internal networks on the logical interconnect.
Args:
network_uri_list: List of Ethernet network uris.
force: If set to true, the operation completes despite any problems with network connectivity or errors
on the resource itself. The default is false.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Logical Interconnect.
|
[
"Updates",
"internal",
"networks",
"on",
"the",
"logical",
"interconnect",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L171-L186
|
18,544
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/networking/logical_interconnects.py
|
LogicalInterconnects.update_configuration
|
def update_configuration(self, timeout=-1):
"""
Asynchronously applies or re-applies the logical interconnect configuration to all managed interconnects.
Args:
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Logical Interconnect.
"""
uri = "{}/configuration".format(self.data["uri"])
return self._helper.update(None, uri=uri, timeout=timeout)
|
python
|
def update_configuration(self, timeout=-1):
"""
Asynchronously applies or re-applies the logical interconnect configuration to all managed interconnects.
Args:
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Logical Interconnect.
"""
uri = "{}/configuration".format(self.data["uri"])
return self._helper.update(None, uri=uri, timeout=timeout)
|
[
"def",
"update_configuration",
"(",
"self",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"\"{}/configuration\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
")",
"return",
"self",
".",
"_helper",
".",
"update",
"(",
"None",
",",
"uri",
"=",
"uri",
",",
"timeout",
"=",
"timeout",
")"
] |
Asynchronously applies or re-applies the logical interconnect configuration to all managed interconnects.
Args:
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Logical Interconnect.
|
[
"Asynchronously",
"applies",
"or",
"re",
"-",
"applies",
"the",
"logical",
"interconnect",
"configuration",
"to",
"all",
"managed",
"interconnects",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L232-L244
|
18,545
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/networking/logical_interconnects.py
|
LogicalInterconnects.get_snmp_configuration
|
def get_snmp_configuration(self):
"""
Gets the SNMP configuration for a logical interconnect.
Returns:
dict: SNMP configuration.
"""
uri = "{}{}".format(self.data["uri"], self.SNMP_CONFIGURATION_PATH)
return self._helper.do_get(uri)
|
python
|
def get_snmp_configuration(self):
"""
Gets the SNMP configuration for a logical interconnect.
Returns:
dict: SNMP configuration.
"""
uri = "{}{}".format(self.data["uri"], self.SNMP_CONFIGURATION_PATH)
return self._helper.do_get(uri)
|
[
"def",
"get_snmp_configuration",
"(",
"self",
")",
":",
"uri",
"=",
"\"{}{}\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
",",
"self",
".",
"SNMP_CONFIGURATION_PATH",
")",
"return",
"self",
".",
"_helper",
".",
"do_get",
"(",
"uri",
")"
] |
Gets the SNMP configuration for a logical interconnect.
Returns:
dict: SNMP configuration.
|
[
"Gets",
"the",
"SNMP",
"configuration",
"for",
"a",
"logical",
"interconnect",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L247-L255
|
18,546
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/networking/logical_interconnects.py
|
LogicalInterconnects.update_snmp_configuration
|
def update_snmp_configuration(self, configuration, timeout=-1):
"""
Updates the SNMP configuration of a logical interconnect. Changes to the SNMP configuration are asynchronously
applied to all managed interconnects.
Args:
configuration: snmp configuration.
Returns:
dict: The Logical Interconnect.
"""
data = configuration.copy()
if 'type' not in data:
data['type'] = 'snmp-configuration'
uri = "{}{}".format(self.data["uri"], self.SNMP_CONFIGURATION_PATH)
return self._helper.update(data, uri=uri, timeout=timeout)
|
python
|
def update_snmp_configuration(self, configuration, timeout=-1):
"""
Updates the SNMP configuration of a logical interconnect. Changes to the SNMP configuration are asynchronously
applied to all managed interconnects.
Args:
configuration: snmp configuration.
Returns:
dict: The Logical Interconnect.
"""
data = configuration.copy()
if 'type' not in data:
data['type'] = 'snmp-configuration'
uri = "{}{}".format(self.data["uri"], self.SNMP_CONFIGURATION_PATH)
return self._helper.update(data, uri=uri, timeout=timeout)
|
[
"def",
"update_snmp_configuration",
"(",
"self",
",",
"configuration",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"data",
"=",
"configuration",
".",
"copy",
"(",
")",
"if",
"'type'",
"not",
"in",
"data",
":",
"data",
"[",
"'type'",
"]",
"=",
"'snmp-configuration'",
"uri",
"=",
"\"{}{}\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
",",
"self",
".",
"SNMP_CONFIGURATION_PATH",
")",
"return",
"self",
".",
"_helper",
".",
"update",
"(",
"data",
",",
"uri",
"=",
"uri",
",",
"timeout",
"=",
"timeout",
")"
] |
Updates the SNMP configuration of a logical interconnect. Changes to the SNMP configuration are asynchronously
applied to all managed interconnects.
Args:
configuration: snmp configuration.
Returns:
dict: The Logical Interconnect.
|
[
"Updates",
"the",
"SNMP",
"configuration",
"of",
"a",
"logical",
"interconnect",
".",
"Changes",
"to",
"the",
"SNMP",
"configuration",
"are",
"asynchronously",
"applied",
"to",
"all",
"managed",
"interconnects",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L258-L274
|
18,547
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/networking/logical_interconnects.py
|
LogicalInterconnects.get_unassigned_ports
|
def get_unassigned_ports(self):
"""
Gets the collection ports from the member interconnects
which are eligible for assignment to an anlyzer port
Returns:
dict: Collection of ports
"""
uri = "{}/unassignedPortsForPortMonitor".format(self.data["uri"])
response = self._helper.do_get(uri)
return self._helper.get_members(response)
|
python
|
def get_unassigned_ports(self):
"""
Gets the collection ports from the member interconnects
which are eligible for assignment to an anlyzer port
Returns:
dict: Collection of ports
"""
uri = "{}/unassignedPortsForPortMonitor".format(self.data["uri"])
response = self._helper.do_get(uri)
return self._helper.get_members(response)
|
[
"def",
"get_unassigned_ports",
"(",
"self",
")",
":",
"uri",
"=",
"\"{}/unassignedPortsForPortMonitor\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
")",
"response",
"=",
"self",
".",
"_helper",
".",
"do_get",
"(",
"uri",
")",
"return",
"self",
".",
"_helper",
".",
"get_members",
"(",
"response",
")"
] |
Gets the collection ports from the member interconnects
which are eligible for assignment to an anlyzer port
Returns:
dict: Collection of ports
|
[
"Gets",
"the",
"collection",
"ports",
"from",
"the",
"member",
"interconnects",
"which",
"are",
"eligible",
"for",
"assignment",
"to",
"an",
"anlyzer",
"port"
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L277-L288
|
18,548
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/networking/logical_interconnects.py
|
LogicalInterconnects.get_port_monitor
|
def get_port_monitor(self):
"""
Gets the port monitor configuration of a logical interconnect.
Returns:
dict: The Logical Interconnect.
"""
uri = "{}{}".format(self.data["uri"], self.PORT_MONITOR_PATH)
return self._helper.do_get(uri)
|
python
|
def get_port_monitor(self):
"""
Gets the port monitor configuration of a logical interconnect.
Returns:
dict: The Logical Interconnect.
"""
uri = "{}{}".format(self.data["uri"], self.PORT_MONITOR_PATH)
return self._helper.do_get(uri)
|
[
"def",
"get_port_monitor",
"(",
"self",
")",
":",
"uri",
"=",
"\"{}{}\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
",",
"self",
".",
"PORT_MONITOR_PATH",
")",
"return",
"self",
".",
"_helper",
".",
"do_get",
"(",
"uri",
")"
] |
Gets the port monitor configuration of a logical interconnect.
Returns:
dict: The Logical Interconnect.
|
[
"Gets",
"the",
"port",
"monitor",
"configuration",
"of",
"a",
"logical",
"interconnect",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L306-L314
|
18,549
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/networking/logical_interconnects.py
|
LogicalInterconnects.update_port_monitor
|
def update_port_monitor(self, resource, timeout=-1):
"""
Updates the port monitor configuration of a logical interconnect.
Args:
resource: Port monitor configuration.
Returns:
dict: Port monitor configuration.
"""
data = resource.copy()
if 'type' not in data:
data['type'] = 'port-monitor'
uri = "{}{}".format(self.data["uri"], self.PORT_MONITOR_PATH)
return self._helper.update(data, uri=uri, timeout=timeout)
|
python
|
def update_port_monitor(self, resource, timeout=-1):
"""
Updates the port monitor configuration of a logical interconnect.
Args:
resource: Port monitor configuration.
Returns:
dict: Port monitor configuration.
"""
data = resource.copy()
if 'type' not in data:
data['type'] = 'port-monitor'
uri = "{}{}".format(self.data["uri"], self.PORT_MONITOR_PATH)
return self._helper.update(data, uri=uri, timeout=timeout)
|
[
"def",
"update_port_monitor",
"(",
"self",
",",
"resource",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"data",
"=",
"resource",
".",
"copy",
"(",
")",
"if",
"'type'",
"not",
"in",
"data",
":",
"data",
"[",
"'type'",
"]",
"=",
"'port-monitor'",
"uri",
"=",
"\"{}{}\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
",",
"self",
".",
"PORT_MONITOR_PATH",
")",
"return",
"self",
".",
"_helper",
".",
"update",
"(",
"data",
",",
"uri",
"=",
"uri",
",",
"timeout",
"=",
"timeout",
")"
] |
Updates the port monitor configuration of a logical interconnect.
Args:
resource: Port monitor configuration.
Returns:
dict: Port monitor configuration.
|
[
"Updates",
"the",
"port",
"monitor",
"configuration",
"of",
"a",
"logical",
"interconnect",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L317-L332
|
18,550
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/networking/logical_interconnects.py
|
LogicalInterconnects.create_interconnect
|
def create_interconnect(self, location_entries, timeout=-1):
"""
Creates an interconnect at the given location.
Warning:
It does not create the LOGICAL INTERCONNECT itself.
It will fail if no interconnect is already present on the specified position.
Args:
location_entries (dict): Dictionary with location entries.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Created interconnect.
"""
return self._helper.create(location_entries, uri=self.locations_uri, timeout=timeout)
|
python
|
def create_interconnect(self, location_entries, timeout=-1):
"""
Creates an interconnect at the given location.
Warning:
It does not create the LOGICAL INTERCONNECT itself.
It will fail if no interconnect is already present on the specified position.
Args:
location_entries (dict): Dictionary with location entries.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Created interconnect.
"""
return self._helper.create(location_entries, uri=self.locations_uri, timeout=timeout)
|
[
"def",
"create_interconnect",
"(",
"self",
",",
"location_entries",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"return",
"self",
".",
"_helper",
".",
"create",
"(",
"location_entries",
",",
"uri",
"=",
"self",
".",
"locations_uri",
",",
"timeout",
"=",
"timeout",
")"
] |
Creates an interconnect at the given location.
Warning:
It does not create the LOGICAL INTERCONNECT itself.
It will fail if no interconnect is already present on the specified position.
Args:
location_entries (dict): Dictionary with location entries.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Created interconnect.
|
[
"Creates",
"an",
"interconnect",
"at",
"the",
"given",
"location",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L334-L351
|
18,551
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/networking/logical_interconnects.py
|
LogicalInterconnects.delete_interconnect
|
def delete_interconnect(self, enclosure_uri, bay, timeout=-1):
"""
Deletes an interconnect from a location.
Warning:
This won't delete the LOGICAL INTERCONNECT itself and might cause inconsistency between the enclosure
and Logical Interconnect Group.
Args:
enclosure_uri: URI of the Enclosure
bay: Bay
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
bool: Indicating if the interconnect was successfully deleted.
"""
uri = "{path}?location=Enclosure:{enclosure_uri},Bay:{bay}".format(path=self.LOCATIONS_PATH,
enclosure_uri=enclosure_uri,
bay=bay)
return self._helper.delete(uri, timeout=timeout)
|
python
|
def delete_interconnect(self, enclosure_uri, bay, timeout=-1):
"""
Deletes an interconnect from a location.
Warning:
This won't delete the LOGICAL INTERCONNECT itself and might cause inconsistency between the enclosure
and Logical Interconnect Group.
Args:
enclosure_uri: URI of the Enclosure
bay: Bay
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
bool: Indicating if the interconnect was successfully deleted.
"""
uri = "{path}?location=Enclosure:{enclosure_uri},Bay:{bay}".format(path=self.LOCATIONS_PATH,
enclosure_uri=enclosure_uri,
bay=bay)
return self._helper.delete(uri, timeout=timeout)
|
[
"def",
"delete_interconnect",
"(",
"self",
",",
"enclosure_uri",
",",
"bay",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"\"{path}?location=Enclosure:{enclosure_uri},Bay:{bay}\"",
".",
"format",
"(",
"path",
"=",
"self",
".",
"LOCATIONS_PATH",
",",
"enclosure_uri",
"=",
"enclosure_uri",
",",
"bay",
"=",
"bay",
")",
"return",
"self",
".",
"_helper",
".",
"delete",
"(",
"uri",
",",
"timeout",
"=",
"timeout",
")"
] |
Deletes an interconnect from a location.
Warning:
This won't delete the LOGICAL INTERCONNECT itself and might cause inconsistency between the enclosure
and Logical Interconnect Group.
Args:
enclosure_uri: URI of the Enclosure
bay: Bay
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
bool: Indicating if the interconnect was successfully deleted.
|
[
"Deletes",
"an",
"interconnect",
"from",
"a",
"location",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L353-L374
|
18,552
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/networking/logical_interconnects.py
|
LogicalInterconnects.get_firmware
|
def get_firmware(self):
"""
Gets the installed firmware for a logical interconnect.
Returns:
dict: LIFirmware.
"""
firmware_uri = self._helper.build_subresource_uri(self.data["uri"], subresource_path=self.FIRMWARE_PATH)
return self._helper.do_get(firmware_uri)
|
python
|
def get_firmware(self):
"""
Gets the installed firmware for a logical interconnect.
Returns:
dict: LIFirmware.
"""
firmware_uri = self._helper.build_subresource_uri(self.data["uri"], subresource_path=self.FIRMWARE_PATH)
return self._helper.do_get(firmware_uri)
|
[
"def",
"get_firmware",
"(",
"self",
")",
":",
"firmware_uri",
"=",
"self",
".",
"_helper",
".",
"build_subresource_uri",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
",",
"subresource_path",
"=",
"self",
".",
"FIRMWARE_PATH",
")",
"return",
"self",
".",
"_helper",
".",
"do_get",
"(",
"firmware_uri",
")"
] |
Gets the installed firmware for a logical interconnect.
Returns:
dict: LIFirmware.
|
[
"Gets",
"the",
"installed",
"firmware",
"for",
"a",
"logical",
"interconnect",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L377-L385
|
18,553
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/networking/logical_interconnects.py
|
LogicalInterconnects.get_forwarding_information_base
|
def get_forwarding_information_base(self, filter=''):
"""
Gets the forwarding information base data for a logical interconnect. A maximum of 100 entries is returned.
Optional filtering criteria might be specified.
Args:
filter (list or str):
Filtering criteria may be specified using supported attributes: interconnectUri, macAddress,
internalVlan, externalVlan, and supported relation = (Equals). macAddress is 12 hexadecimal digits with
a colon between each pair of digits (upper case or lower case).
The default is no filter; all resources are returned.
Returns:
list: A set of interconnect MAC address entries.
"""
uri = "{}{}".format(self.data["uri"], self.FORWARDING_INFORMATION_PATH)
return self._helper.get_collection(uri, filter=filter)
|
python
|
def get_forwarding_information_base(self, filter=''):
"""
Gets the forwarding information base data for a logical interconnect. A maximum of 100 entries is returned.
Optional filtering criteria might be specified.
Args:
filter (list or str):
Filtering criteria may be specified using supported attributes: interconnectUri, macAddress,
internalVlan, externalVlan, and supported relation = (Equals). macAddress is 12 hexadecimal digits with
a colon between each pair of digits (upper case or lower case).
The default is no filter; all resources are returned.
Returns:
list: A set of interconnect MAC address entries.
"""
uri = "{}{}".format(self.data["uri"], self.FORWARDING_INFORMATION_PATH)
return self._helper.get_collection(uri, filter=filter)
|
[
"def",
"get_forwarding_information_base",
"(",
"self",
",",
"filter",
"=",
"''",
")",
":",
"uri",
"=",
"\"{}{}\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
",",
"self",
".",
"FORWARDING_INFORMATION_PATH",
")",
"return",
"self",
".",
"_helper",
".",
"get_collection",
"(",
"uri",
",",
"filter",
"=",
"filter",
")"
] |
Gets the forwarding information base data for a logical interconnect. A maximum of 100 entries is returned.
Optional filtering criteria might be specified.
Args:
filter (list or str):
Filtering criteria may be specified using supported attributes: interconnectUri, macAddress,
internalVlan, externalVlan, and supported relation = (Equals). macAddress is 12 hexadecimal digits with
a colon between each pair of digits (upper case or lower case).
The default is no filter; all resources are returned.
Returns:
list: A set of interconnect MAC address entries.
|
[
"Gets",
"the",
"forwarding",
"information",
"base",
"data",
"for",
"a",
"logical",
"interconnect",
".",
"A",
"maximum",
"of",
"100",
"entries",
"is",
"returned",
".",
"Optional",
"filtering",
"criteria",
"might",
"be",
"specified",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L404-L420
|
18,554
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/networking/logical_interconnects.py
|
LogicalInterconnects.create_forwarding_information_base
|
def create_forwarding_information_base(self, timeout=-1):
"""
Generates the forwarding information base dump file for a logical interconnect.
Args:
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns: Interconnect Forwarding Information Base DataInfo.
"""
uri = "{}{}".format(self.data["uri"], self.FORWARDING_INFORMATION_PATH)
return self._helper.do_post(uri, None, timeout, None)
|
python
|
def create_forwarding_information_base(self, timeout=-1):
"""
Generates the forwarding information base dump file for a logical interconnect.
Args:
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns: Interconnect Forwarding Information Base DataInfo.
"""
uri = "{}{}".format(self.data["uri"], self.FORWARDING_INFORMATION_PATH)
return self._helper.do_post(uri, None, timeout, None)
|
[
"def",
"create_forwarding_information_base",
"(",
"self",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"\"{}{}\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
",",
"self",
".",
"FORWARDING_INFORMATION_PATH",
")",
"return",
"self",
".",
"_helper",
".",
"do_post",
"(",
"uri",
",",
"None",
",",
"timeout",
",",
"None",
")"
] |
Generates the forwarding information base dump file for a logical interconnect.
Args:
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns: Interconnect Forwarding Information Base DataInfo.
|
[
"Generates",
"the",
"forwarding",
"information",
"base",
"dump",
"file",
"for",
"a",
"logical",
"interconnect",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L423-L435
|
18,555
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/networking/logical_interconnects.py
|
LogicalInterconnects.get_qos_aggregated_configuration
|
def get_qos_aggregated_configuration(self):
"""
Gets the QoS aggregated configuration for the logical interconnect.
Returns:
dict: QoS Configuration.
"""
uri = "{}{}".format(self.data["uri"], self.QOS_AGGREGATED_CONFIGURATION)
return self._helper.do_get(uri)
|
python
|
def get_qos_aggregated_configuration(self):
"""
Gets the QoS aggregated configuration for the logical interconnect.
Returns:
dict: QoS Configuration.
"""
uri = "{}{}".format(self.data["uri"], self.QOS_AGGREGATED_CONFIGURATION)
return self._helper.do_get(uri)
|
[
"def",
"get_qos_aggregated_configuration",
"(",
"self",
")",
":",
"uri",
"=",
"\"{}{}\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
",",
"self",
".",
"QOS_AGGREGATED_CONFIGURATION",
")",
"return",
"self",
".",
"_helper",
".",
"do_get",
"(",
"uri",
")"
] |
Gets the QoS aggregated configuration for the logical interconnect.
Returns:
dict: QoS Configuration.
|
[
"Gets",
"the",
"QoS",
"aggregated",
"configuration",
"for",
"the",
"logical",
"interconnect",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L438-L446
|
18,556
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/networking/logical_interconnects.py
|
LogicalInterconnects.update_qos_aggregated_configuration
|
def update_qos_aggregated_configuration(self, qos_configuration, timeout=-1):
"""
Updates the QoS aggregated configuration for the logical interconnect.
Args:
qos_configuration:
QOS configuration.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
dict: Logical Interconnect.
"""
uri = "{}{}".format(self.data["uri"], self.QOS_AGGREGATED_CONFIGURATION)
return self._helper.update(qos_configuration, uri=uri, timeout=timeout)
|
python
|
def update_qos_aggregated_configuration(self, qos_configuration, timeout=-1):
"""
Updates the QoS aggregated configuration for the logical interconnect.
Args:
qos_configuration:
QOS configuration.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
dict: Logical Interconnect.
"""
uri = "{}{}".format(self.data["uri"], self.QOS_AGGREGATED_CONFIGURATION)
return self._helper.update(qos_configuration, uri=uri, timeout=timeout)
|
[
"def",
"update_qos_aggregated_configuration",
"(",
"self",
",",
"qos_configuration",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"\"{}{}\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
",",
"self",
".",
"QOS_AGGREGATED_CONFIGURATION",
")",
"return",
"self",
".",
"_helper",
".",
"update",
"(",
"qos_configuration",
",",
"uri",
"=",
"uri",
",",
"timeout",
"=",
"timeout",
")"
] |
Updates the QoS aggregated configuration for the logical interconnect.
Args:
qos_configuration:
QOS configuration.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
dict: Logical Interconnect.
|
[
"Updates",
"the",
"QoS",
"aggregated",
"configuration",
"for",
"the",
"logical",
"interconnect",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L449-L464
|
18,557
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/networking/logical_interconnects.py
|
LogicalInterconnects.update_telemetry_configurations
|
def update_telemetry_configurations(self, configuration, timeout=-1):
"""
Updates the telemetry configuration of a logical interconnect. Changes to the telemetry configuration are
asynchronously applied to all managed interconnects.
Args:
configuration:
The telemetry configuration for the logical interconnect.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
dict: The Logical Interconnect.
"""
telemetry_conf_uri = self._get_telemetry_configuration_uri()
default_values = self._get_default_values(self.SETTINGS_TELEMETRY_CONFIG_DEFAULT_VALUES)
configuration = self._helper.update_resource_fields(configuration, default_values)
return self._helper.update(configuration, uri=telemetry_conf_uri, timeout=timeout)
|
python
|
def update_telemetry_configurations(self, configuration, timeout=-1):
"""
Updates the telemetry configuration of a logical interconnect. Changes to the telemetry configuration are
asynchronously applied to all managed interconnects.
Args:
configuration:
The telemetry configuration for the logical interconnect.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
dict: The Logical Interconnect.
"""
telemetry_conf_uri = self._get_telemetry_configuration_uri()
default_values = self._get_default_values(self.SETTINGS_TELEMETRY_CONFIG_DEFAULT_VALUES)
configuration = self._helper.update_resource_fields(configuration, default_values)
return self._helper.update(configuration, uri=telemetry_conf_uri, timeout=timeout)
|
[
"def",
"update_telemetry_configurations",
"(",
"self",
",",
"configuration",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"telemetry_conf_uri",
"=",
"self",
".",
"_get_telemetry_configuration_uri",
"(",
")",
"default_values",
"=",
"self",
".",
"_get_default_values",
"(",
"self",
".",
"SETTINGS_TELEMETRY_CONFIG_DEFAULT_VALUES",
")",
"configuration",
"=",
"self",
".",
"_helper",
".",
"update_resource_fields",
"(",
"configuration",
",",
"default_values",
")",
"return",
"self",
".",
"_helper",
".",
"update",
"(",
"configuration",
",",
"uri",
"=",
"telemetry_conf_uri",
",",
"timeout",
"=",
"timeout",
")"
] |
Updates the telemetry configuration of a logical interconnect. Changes to the telemetry configuration are
asynchronously applied to all managed interconnects.
Args:
configuration:
The telemetry configuration for the logical interconnect.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
dict: The Logical Interconnect.
|
[
"Updates",
"the",
"telemetry",
"configuration",
"of",
"a",
"logical",
"interconnect",
".",
"Changes",
"to",
"the",
"telemetry",
"configuration",
"are",
"asynchronously",
"applied",
"to",
"all",
"managed",
"interconnects",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L485-L504
|
18,558
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/networking/logical_interconnects.py
|
LogicalInterconnects.get_ethernet_settings
|
def get_ethernet_settings(self):
"""
Gets the Ethernet interconnect settings for the Logical Interconnect.
Returns:
dict: Ethernet Interconnect Settings
"""
uri = "{}/ethernetSettings".format(self.data["uri"])
return self._helper.do_get(uri)
|
python
|
def get_ethernet_settings(self):
"""
Gets the Ethernet interconnect settings for the Logical Interconnect.
Returns:
dict: Ethernet Interconnect Settings
"""
uri = "{}/ethernetSettings".format(self.data["uri"])
return self._helper.do_get(uri)
|
[
"def",
"get_ethernet_settings",
"(",
"self",
")",
":",
"uri",
"=",
"\"{}/ethernetSettings\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
")",
"return",
"self",
".",
"_helper",
".",
"do_get",
"(",
"uri",
")"
] |
Gets the Ethernet interconnect settings for the Logical Interconnect.
Returns:
dict: Ethernet Interconnect Settings
|
[
"Gets",
"the",
"Ethernet",
"interconnect",
"settings",
"for",
"the",
"Logical",
"Interconnect",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnects.py#L507-L515
|
18,559
|
HewlettPackard/python-hpOneView
|
hpOneView/image_streamer/resources/os_volumes.py
|
OsVolumes.download_archive
|
def download_archive(self, name, file_path):
"""
Download archived logs of the OS Volume.
Args:
name: Name of the OS Volume.
file_path (str): Destination file path.
Returns:
bool: Indicates if the resource was successfully downloaded.
"""
uri = self.URI + "/archive/" + name
return self._client.download(uri, file_path)
|
python
|
def download_archive(self, name, file_path):
"""
Download archived logs of the OS Volume.
Args:
name: Name of the OS Volume.
file_path (str): Destination file path.
Returns:
bool: Indicates if the resource was successfully downloaded.
"""
uri = self.URI + "/archive/" + name
return self._client.download(uri, file_path)
|
[
"def",
"download_archive",
"(",
"self",
",",
"name",
",",
"file_path",
")",
":",
"uri",
"=",
"self",
".",
"URI",
"+",
"\"/archive/\"",
"+",
"name",
"return",
"self",
".",
"_client",
".",
"download",
"(",
"uri",
",",
"file_path",
")"
] |
Download archived logs of the OS Volume.
Args:
name: Name of the OS Volume.
file_path (str): Destination file path.
Returns:
bool: Indicates if the resource was successfully downloaded.
|
[
"Download",
"archived",
"logs",
"of",
"the",
"OS",
"Volume",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/resources/os_volumes.py#L110-L122
|
18,560
|
HewlettPackard/python-hpOneView
|
hpOneView/image_streamer/resources/os_volumes.py
|
OsVolumes.get_storage
|
def get_storage(self, id_or_uri):
"""
Get storage details of an OS Volume.
Args:
id_or_uri: ID or URI of the OS Volume.
Returns:
dict: Storage details
"""
uri = self.URI + "/{}/storage".format(extract_id_from_uri(id_or_uri))
return self._client.get(uri)
|
python
|
def get_storage(self, id_or_uri):
"""
Get storage details of an OS Volume.
Args:
id_or_uri: ID or URI of the OS Volume.
Returns:
dict: Storage details
"""
uri = self.URI + "/{}/storage".format(extract_id_from_uri(id_or_uri))
return self._client.get(uri)
|
[
"def",
"get_storage",
"(",
"self",
",",
"id_or_uri",
")",
":",
"uri",
"=",
"self",
".",
"URI",
"+",
"\"/{}/storage\"",
".",
"format",
"(",
"extract_id_from_uri",
"(",
"id_or_uri",
")",
")",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"uri",
")"
] |
Get storage details of an OS Volume.
Args:
id_or_uri: ID or URI of the OS Volume.
Returns:
dict: Storage details
|
[
"Get",
"storage",
"details",
"of",
"an",
"OS",
"Volume",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/image_streamer/resources/os_volumes.py#L124-L135
|
18,561
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/facilities/racks.py
|
Racks.get_device_topology
|
def get_device_topology(self, id_or_uri):
"""
Retrieves the topology information for the rack resource specified by ID or URI.
Args:
id_or_uri: Can be either the resource ID or the resource URI.
Return:
dict: Device topology.
"""
uri = self._client.build_uri(id_or_uri) + "/deviceTopology"
return self._client.get(uri)
|
python
|
def get_device_topology(self, id_or_uri):
"""
Retrieves the topology information for the rack resource specified by ID or URI.
Args:
id_or_uri: Can be either the resource ID or the resource URI.
Return:
dict: Device topology.
"""
uri = self._client.build_uri(id_or_uri) + "/deviceTopology"
return self._client.get(uri)
|
[
"def",
"get_device_topology",
"(",
"self",
",",
"id_or_uri",
")",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"id_or_uri",
")",
"+",
"\"/deviceTopology\"",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"uri",
")"
] |
Retrieves the topology information for the rack resource specified by ID or URI.
Args:
id_or_uri: Can be either the resource ID or the resource URI.
Return:
dict: Device topology.
|
[
"Retrieves",
"the",
"topology",
"information",
"for",
"the",
"rack",
"resource",
"specified",
"by",
"ID",
"or",
"URI",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/facilities/racks.py#L91-L102
|
18,562
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/fc_sans/managed_sans.py
|
ManagedSANs.get_by_name
|
def get_by_name(self, name):
"""
Gets a Managed SAN by name.
Args:
name: Name of the Managed SAN
Returns:
dict: Managed SAN.
"""
managed_sans = self.get_all()
result = [x for x in managed_sans if x['name'] == name]
resource = result[0] if result else None
if resource:
resource = self.new(self._connection, resource)
return resource
|
python
|
def get_by_name(self, name):
"""
Gets a Managed SAN by name.
Args:
name: Name of the Managed SAN
Returns:
dict: Managed SAN.
"""
managed_sans = self.get_all()
result = [x for x in managed_sans if x['name'] == name]
resource = result[0] if result else None
if resource:
resource = self.new(self._connection, resource)
return resource
|
[
"def",
"get_by_name",
"(",
"self",
",",
"name",
")",
":",
"managed_sans",
"=",
"self",
".",
"get_all",
"(",
")",
"result",
"=",
"[",
"x",
"for",
"x",
"in",
"managed_sans",
"if",
"x",
"[",
"'name'",
"]",
"==",
"name",
"]",
"resource",
"=",
"result",
"[",
"0",
"]",
"if",
"result",
"else",
"None",
"if",
"resource",
":",
"resource",
"=",
"self",
".",
"new",
"(",
"self",
".",
"_connection",
",",
"resource",
")",
"return",
"resource"
] |
Gets a Managed SAN by name.
Args:
name: Name of the Managed SAN
Returns:
dict: Managed SAN.
|
[
"Gets",
"a",
"Managed",
"SAN",
"by",
"name",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/fc_sans/managed_sans.py#L71-L88
|
18,563
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/fc_sans/managed_sans.py
|
ManagedSANs.get_endpoints
|
def get_endpoints(self, start=0, count=-1, filter='', sort=''):
"""
Gets a list of endpoints in a SAN.
Args:
start:
The first item to return, using 0-based indexing.
If not specified, the default is 0 - start with the first available item.
count:
The number of resources to return. A count of -1 requests all items.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter (list or str):
A general filter/query string to narrow the list of items returned. The
default is no filter; all resources are returned.
sort:
The sort order of the returned data set. By default, the sort order is based
on create time with the oldest entry first.
Returns:
list: A list of endpoints.
"""
uri = "{}/endpoints/".format(self.data["uri"])
return self._helper.get_all(start, count, filter=filter, sort=sort, uri=uri)
|
python
|
def get_endpoints(self, start=0, count=-1, filter='', sort=''):
"""
Gets a list of endpoints in a SAN.
Args:
start:
The first item to return, using 0-based indexing.
If not specified, the default is 0 - start with the first available item.
count:
The number of resources to return. A count of -1 requests all items.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter (list or str):
A general filter/query string to narrow the list of items returned. The
default is no filter; all resources are returned.
sort:
The sort order of the returned data set. By default, the sort order is based
on create time with the oldest entry first.
Returns:
list: A list of endpoints.
"""
uri = "{}/endpoints/".format(self.data["uri"])
return self._helper.get_all(start, count, filter=filter, sort=sort, uri=uri)
|
[
"def",
"get_endpoints",
"(",
"self",
",",
"start",
"=",
"0",
",",
"count",
"=",
"-",
"1",
",",
"filter",
"=",
"''",
",",
"sort",
"=",
"''",
")",
":",
"uri",
"=",
"\"{}/endpoints/\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
")",
"return",
"self",
".",
"_helper",
".",
"get_all",
"(",
"start",
",",
"count",
",",
"filter",
"=",
"filter",
",",
"sort",
"=",
"sort",
",",
"uri",
"=",
"uri",
")"
] |
Gets a list of endpoints in a SAN.
Args:
start:
The first item to return, using 0-based indexing.
If not specified, the default is 0 - start with the first available item.
count:
The number of resources to return. A count of -1 requests all items.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter (list or str):
A general filter/query string to narrow the list of items returned. The
default is no filter; all resources are returned.
sort:
The sort order of the returned data set. By default, the sort order is based
on create time with the oldest entry first.
Returns:
list: A list of endpoints.
|
[
"Gets",
"a",
"list",
"of",
"endpoints",
"in",
"a",
"SAN",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/fc_sans/managed_sans.py#L99-L122
|
18,564
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/fc_sans/managed_sans.py
|
ManagedSANs.create_endpoints_csv_file
|
def create_endpoints_csv_file(self, timeout=-1):
"""
Creates an endpoints CSV file for a SAN.
Args:
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
dict: Endpoint CSV File Response.
"""
uri = "{}/endpoints/".format(self.data["uri"])
return self._helper.do_post(uri, {}, timeout, None)
|
python
|
def create_endpoints_csv_file(self, timeout=-1):
"""
Creates an endpoints CSV file for a SAN.
Args:
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
dict: Endpoint CSV File Response.
"""
uri = "{}/endpoints/".format(self.data["uri"])
return self._helper.do_post(uri, {}, timeout, None)
|
[
"def",
"create_endpoints_csv_file",
"(",
"self",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"\"{}/endpoints/\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
")",
"return",
"self",
".",
"_helper",
".",
"do_post",
"(",
"uri",
",",
"{",
"}",
",",
"timeout",
",",
"None",
")"
] |
Creates an endpoints CSV file for a SAN.
Args:
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
dict: Endpoint CSV File Response.
|
[
"Creates",
"an",
"endpoints",
"CSV",
"file",
"for",
"a",
"SAN",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/fc_sans/managed_sans.py#L125-L138
|
18,565
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/fc_sans/managed_sans.py
|
ManagedSANs.create_issues_report
|
def create_issues_report(self, timeout=-1):
"""
Creates an unexpected zoning report for a SAN.
Args:
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
list: A list of FCIssueResponse dict.
"""
uri = "{}/issues/".format(self.data["uri"])
return self._helper.create_report(uri, timeout)
|
python
|
def create_issues_report(self, timeout=-1):
"""
Creates an unexpected zoning report for a SAN.
Args:
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
list: A list of FCIssueResponse dict.
"""
uri = "{}/issues/".format(self.data["uri"])
return self._helper.create_report(uri, timeout)
|
[
"def",
"create_issues_report",
"(",
"self",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"\"{}/issues/\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
")",
"return",
"self",
".",
"_helper",
".",
"create_report",
"(",
"uri",
",",
"timeout",
")"
] |
Creates an unexpected zoning report for a SAN.
Args:
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
list: A list of FCIssueResponse dict.
|
[
"Creates",
"an",
"unexpected",
"zoning",
"report",
"for",
"a",
"SAN",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/fc_sans/managed_sans.py#L141-L154
|
18,566
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/settings/appliance_device_snmp_v1_trap_destinations.py
|
ApplianceDeviceSNMPv1TrapDestinations.create
|
def create(self, resource, id=None, timeout=-1):
"""
Adds the specified trap forwarding destination.
The trap destination associated with the specified id will be created if trap destination with that id does not exists.
The id can only be an integer greater than 0.
Args:
resource (dict): Object to create.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView, just stop waiting for its completion.
Returns:
dict: Created resource.
"""
if not id:
available_id = self.__get_first_available_id()
uri = '%s/%s' % (self.URI, str(available_id))
else:
uri = '%s/%s' % (self.URI, str(id))
return self._client.create(resource, uri=uri, timeout=timeout)
|
python
|
def create(self, resource, id=None, timeout=-1):
"""
Adds the specified trap forwarding destination.
The trap destination associated with the specified id will be created if trap destination with that id does not exists.
The id can only be an integer greater than 0.
Args:
resource (dict): Object to create.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView, just stop waiting for its completion.
Returns:
dict: Created resource.
"""
if not id:
available_id = self.__get_first_available_id()
uri = '%s/%s' % (self.URI, str(available_id))
else:
uri = '%s/%s' % (self.URI, str(id))
return self._client.create(resource, uri=uri, timeout=timeout)
|
[
"def",
"create",
"(",
"self",
",",
"resource",
",",
"id",
"=",
"None",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"if",
"not",
"id",
":",
"available_id",
"=",
"self",
".",
"__get_first_available_id",
"(",
")",
"uri",
"=",
"'%s/%s'",
"%",
"(",
"self",
".",
"URI",
",",
"str",
"(",
"available_id",
")",
")",
"else",
":",
"uri",
"=",
"'%s/%s'",
"%",
"(",
"self",
".",
"URI",
",",
"str",
"(",
"id",
")",
")",
"return",
"self",
".",
"_client",
".",
"create",
"(",
"resource",
",",
"uri",
"=",
"uri",
",",
"timeout",
"=",
"timeout",
")"
] |
Adds the specified trap forwarding destination.
The trap destination associated with the specified id will be created if trap destination with that id does not exists.
The id can only be an integer greater than 0.
Args:
resource (dict): Object to create.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView, just stop waiting for its completion.
Returns:
dict: Created resource.
|
[
"Adds",
"the",
"specified",
"trap",
"forwarding",
"destination",
".",
"The",
"trap",
"destination",
"associated",
"with",
"the",
"specified",
"id",
"will",
"be",
"created",
"if",
"trap",
"destination",
"with",
"that",
"id",
"does",
"not",
"exists",
".",
"The",
"id",
"can",
"only",
"be",
"an",
"integer",
"greater",
"than",
"0",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/settings/appliance_device_snmp_v1_trap_destinations.py#L46-L67
|
18,567
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/settings/appliance_device_snmp_v1_trap_destinations.py
|
ApplianceDeviceSNMPv1TrapDestinations.__findFirstMissing
|
def __findFirstMissing(self, array, start, end):
"""
Find the smallest elements missing in a sorted array.
Returns:
int: The smallest element missing.
"""
if (start > end):
return end + 1
if (start != array[start]):
return start
mid = int((start + end) / 2)
if (array[mid] == mid):
return self.__findFirstMissing(array, mid + 1, end)
return self.__findFirstMissing(array, start, mid)
|
python
|
def __findFirstMissing(self, array, start, end):
"""
Find the smallest elements missing in a sorted array.
Returns:
int: The smallest element missing.
"""
if (start > end):
return end + 1
if (start != array[start]):
return start
mid = int((start + end) / 2)
if (array[mid] == mid):
return self.__findFirstMissing(array, mid + 1, end)
return self.__findFirstMissing(array, start, mid)
|
[
"def",
"__findFirstMissing",
"(",
"self",
",",
"array",
",",
"start",
",",
"end",
")",
":",
"if",
"(",
"start",
">",
"end",
")",
":",
"return",
"end",
"+",
"1",
"if",
"(",
"start",
"!=",
"array",
"[",
"start",
"]",
")",
":",
"return",
"start",
"mid",
"=",
"int",
"(",
"(",
"start",
"+",
"end",
")",
"/",
"2",
")",
"if",
"(",
"array",
"[",
"mid",
"]",
"==",
"mid",
")",
":",
"return",
"self",
".",
"__findFirstMissing",
"(",
"array",
",",
"mid",
"+",
"1",
",",
"end",
")",
"return",
"self",
".",
"__findFirstMissing",
"(",
"array",
",",
"start",
",",
"mid",
")"
] |
Find the smallest elements missing in a sorted array.
Returns:
int: The smallest element missing.
|
[
"Find",
"the",
"smallest",
"elements",
"missing",
"in",
"a",
"sorted",
"array",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/settings/appliance_device_snmp_v1_trap_destinations.py#L69-L87
|
18,568
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/settings/appliance_device_snmp_v1_trap_destinations.py
|
ApplianceDeviceSNMPv1TrapDestinations.__get_first_available_id
|
def __get_first_available_id(self):
"""
Private method to get the first available id.
The id can only be an integer greater than 0.
Returns:
int: The first available id
"""
traps = self.get_all()
if traps:
used_ids = [0]
for trap in traps:
used_uris = trap.get('uri')
used_ids.append(int(used_uris.split('/')[-1]))
used_ids.sort()
return self.__findFirstMissing(used_ids, 0, len(used_ids) - 1)
else:
return 1
|
python
|
def __get_first_available_id(self):
"""
Private method to get the first available id.
The id can only be an integer greater than 0.
Returns:
int: The first available id
"""
traps = self.get_all()
if traps:
used_ids = [0]
for trap in traps:
used_uris = trap.get('uri')
used_ids.append(int(used_uris.split('/')[-1]))
used_ids.sort()
return self.__findFirstMissing(used_ids, 0, len(used_ids) - 1)
else:
return 1
|
[
"def",
"__get_first_available_id",
"(",
"self",
")",
":",
"traps",
"=",
"self",
".",
"get_all",
"(",
")",
"if",
"traps",
":",
"used_ids",
"=",
"[",
"0",
"]",
"for",
"trap",
"in",
"traps",
":",
"used_uris",
"=",
"trap",
".",
"get",
"(",
"'uri'",
")",
"used_ids",
".",
"append",
"(",
"int",
"(",
"used_uris",
".",
"split",
"(",
"'/'",
")",
"[",
"-",
"1",
"]",
")",
")",
"used_ids",
".",
"sort",
"(",
")",
"return",
"self",
".",
"__findFirstMissing",
"(",
"used_ids",
",",
"0",
",",
"len",
"(",
"used_ids",
")",
"-",
"1",
")",
"else",
":",
"return",
"1"
] |
Private method to get the first available id.
The id can only be an integer greater than 0.
Returns:
int: The first available id
|
[
"Private",
"method",
"to",
"get",
"the",
"first",
"available",
"id",
".",
"The",
"id",
"can",
"only",
"be",
"an",
"integer",
"greater",
"than",
"0",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/settings/appliance_device_snmp_v1_trap_destinations.py#L89-L106
|
18,569
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/servers/id_pools_ipv4_ranges.py
|
IdPoolsIpv4Ranges.update
|
def update(self, information, timeout=-1):
"""
Edit an IPv4 Range.
Args:
information (dict): Information to update.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Updated IPv4 range.
"""
return self._client.update(information, timeout=timeout)
|
python
|
def update(self, information, timeout=-1):
"""
Edit an IPv4 Range.
Args:
information (dict): Information to update.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Updated IPv4 range.
"""
return self._client.update(information, timeout=timeout)
|
[
"def",
"update",
"(",
"self",
",",
"information",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"return",
"self",
".",
"_client",
".",
"update",
"(",
"information",
",",
"timeout",
"=",
"timeout",
")"
] |
Edit an IPv4 Range.
Args:
information (dict): Information to update.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Updated IPv4 range.
|
[
"Edit",
"an",
"IPv4",
"Range",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/id_pools_ipv4_ranges.py#L92-L105
|
18,570
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/task_monitor.py
|
TaskMonitor.wait_for_task
|
def wait_for_task(self, task, timeout=-1):
"""
Wait for task execution and return associated resource.
Args:
task: task dict
timeout: timeout in seconds
Returns:
Associated resource when creating or updating; True when deleting.
"""
self.__wait_task_completion(task, timeout)
task = self.get(task)
logger.debug("Waiting for task. Percentage complete: " + str(task.get('computedPercentComplete')))
logger.debug("Waiting for task. Task state: " + str(task.get('taskState')))
task_response = self.__get_task_response(task)
logger.debug('Task completed')
return task_response
|
python
|
def wait_for_task(self, task, timeout=-1):
"""
Wait for task execution and return associated resource.
Args:
task: task dict
timeout: timeout in seconds
Returns:
Associated resource when creating or updating; True when deleting.
"""
self.__wait_task_completion(task, timeout)
task = self.get(task)
logger.debug("Waiting for task. Percentage complete: " + str(task.get('computedPercentComplete')))
logger.debug("Waiting for task. Task state: " + str(task.get('taskState')))
task_response = self.__get_task_response(task)
logger.debug('Task completed')
return task_response
|
[
"def",
"wait_for_task",
"(",
"self",
",",
"task",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"self",
".",
"__wait_task_completion",
"(",
"task",
",",
"timeout",
")",
"task",
"=",
"self",
".",
"get",
"(",
"task",
")",
"logger",
".",
"debug",
"(",
"\"Waiting for task. Percentage complete: \"",
"+",
"str",
"(",
"task",
".",
"get",
"(",
"'computedPercentComplete'",
")",
")",
")",
"logger",
".",
"debug",
"(",
"\"Waiting for task. Task state: \"",
"+",
"str",
"(",
"task",
".",
"get",
"(",
"'taskState'",
")",
")",
")",
"task_response",
"=",
"self",
".",
"__get_task_response",
"(",
"task",
")",
"logger",
".",
"debug",
"(",
"'Task completed'",
")",
"return",
"task_response"
] |
Wait for task execution and return associated resource.
Args:
task: task dict
timeout: timeout in seconds
Returns:
Associated resource when creating or updating; True when deleting.
|
[
"Wait",
"for",
"task",
"execution",
"and",
"return",
"associated",
"resource",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/task_monitor.py#L70-L90
|
18,571
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/task_monitor.py
|
TaskMonitor.get_completed_task
|
def get_completed_task(self, task, timeout=-1):
"""
Waits until the task is completed and returns the task resource.
Args:
task: TaskResource
timeout: Timeout in seconds
Returns:
dict: TaskResource
"""
self.__wait_task_completion(task, timeout)
return self.get(task)
|
python
|
def get_completed_task(self, task, timeout=-1):
"""
Waits until the task is completed and returns the task resource.
Args:
task: TaskResource
timeout: Timeout in seconds
Returns:
dict: TaskResource
"""
self.__wait_task_completion(task, timeout)
return self.get(task)
|
[
"def",
"get_completed_task",
"(",
"self",
",",
"task",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"self",
".",
"__wait_task_completion",
"(",
"task",
",",
"timeout",
")",
"return",
"self",
".",
"get",
"(",
"task",
")"
] |
Waits until the task is completed and returns the task resource.
Args:
task: TaskResource
timeout: Timeout in seconds
Returns:
dict: TaskResource
|
[
"Waits",
"until",
"the",
"task",
"is",
"completed",
"and",
"returns",
"the",
"task",
"resource",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/task_monitor.py#L92-L105
|
18,572
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/task_monitor.py
|
TaskMonitor.get_associated_resource
|
def get_associated_resource(self, task):
"""
Retrieve a resource associated with a task.
Args:
task: task dict
Returns:
tuple: task (updated), the entity found (dict)
"""
if not task:
raise HPOneViewUnknownType(MSG_INVALID_TASK)
if task['category'] != 'tasks' and task['category'] != 'backups':
# it is an error if type is not in obj, so let the except flow
raise HPOneViewUnknownType(MSG_UNKNOWN_OBJECT_TYPE)
if task['type'] == 'TaskResourceV2':
resource_uri = task['associatedResource']['resourceUri']
if resource_uri and resource_uri.startswith("/rest/appliance/support-dumps/"):
# Specific for support dumps
return task, resource_uri
elif task['type'] == 'BACKUP':
task = self._connection.get(task['taskUri'])
resource_uri = task['uri']
else:
raise HPOneViewInvalidResource(MSG_TASK_TYPE_UNRECONIZED % task['type'])
entity = {}
if resource_uri:
entity = self._connection.get(resource_uri)
return task, entity
|
python
|
def get_associated_resource(self, task):
"""
Retrieve a resource associated with a task.
Args:
task: task dict
Returns:
tuple: task (updated), the entity found (dict)
"""
if not task:
raise HPOneViewUnknownType(MSG_INVALID_TASK)
if task['category'] != 'tasks' and task['category'] != 'backups':
# it is an error if type is not in obj, so let the except flow
raise HPOneViewUnknownType(MSG_UNKNOWN_OBJECT_TYPE)
if task['type'] == 'TaskResourceV2':
resource_uri = task['associatedResource']['resourceUri']
if resource_uri and resource_uri.startswith("/rest/appliance/support-dumps/"):
# Specific for support dumps
return task, resource_uri
elif task['type'] == 'BACKUP':
task = self._connection.get(task['taskUri'])
resource_uri = task['uri']
else:
raise HPOneViewInvalidResource(MSG_TASK_TYPE_UNRECONIZED % task['type'])
entity = {}
if resource_uri:
entity = self._connection.get(resource_uri)
return task, entity
|
[
"def",
"get_associated_resource",
"(",
"self",
",",
"task",
")",
":",
"if",
"not",
"task",
":",
"raise",
"HPOneViewUnknownType",
"(",
"MSG_INVALID_TASK",
")",
"if",
"task",
"[",
"'category'",
"]",
"!=",
"'tasks'",
"and",
"task",
"[",
"'category'",
"]",
"!=",
"'backups'",
":",
"# it is an error if type is not in obj, so let the except flow",
"raise",
"HPOneViewUnknownType",
"(",
"MSG_UNKNOWN_OBJECT_TYPE",
")",
"if",
"task",
"[",
"'type'",
"]",
"==",
"'TaskResourceV2'",
":",
"resource_uri",
"=",
"task",
"[",
"'associatedResource'",
"]",
"[",
"'resourceUri'",
"]",
"if",
"resource_uri",
"and",
"resource_uri",
".",
"startswith",
"(",
"\"/rest/appliance/support-dumps/\"",
")",
":",
"# Specific for support dumps",
"return",
"task",
",",
"resource_uri",
"elif",
"task",
"[",
"'type'",
"]",
"==",
"'BACKUP'",
":",
"task",
"=",
"self",
".",
"_connection",
".",
"get",
"(",
"task",
"[",
"'taskUri'",
"]",
")",
"resource_uri",
"=",
"task",
"[",
"'uri'",
"]",
"else",
":",
"raise",
"HPOneViewInvalidResource",
"(",
"MSG_TASK_TYPE_UNRECONIZED",
"%",
"task",
"[",
"'type'",
"]",
")",
"entity",
"=",
"{",
"}",
"if",
"resource_uri",
":",
"entity",
"=",
"self",
".",
"_connection",
".",
"get",
"(",
"resource_uri",
")",
"return",
"task",
",",
"entity"
] |
Retrieve a resource associated with a task.
Args:
task: task dict
Returns:
tuple: task (updated), the entity found (dict)
|
[
"Retrieve",
"a",
"resource",
"associated",
"with",
"a",
"task",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/task_monitor.py#L225-L261
|
18,573
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/settings/backups.py
|
Backups.update_config
|
def update_config(self, config, timeout=-1):
"""
Updates the remote server configuration and the automatic backup schedule for backup.
Args:
config (dict): Object to update.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView, just stop waiting for its completion.
Returns:
dict: Backup details.
"""
return self._client.update(config, uri=self.URI + "/config", timeout=timeout)
|
python
|
def update_config(self, config, timeout=-1):
"""
Updates the remote server configuration and the automatic backup schedule for backup.
Args:
config (dict): Object to update.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView, just stop waiting for its completion.
Returns:
dict: Backup details.
"""
return self._client.update(config, uri=self.URI + "/config", timeout=timeout)
|
[
"def",
"update_config",
"(",
"self",
",",
"config",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"return",
"self",
".",
"_client",
".",
"update",
"(",
"config",
",",
"uri",
"=",
"self",
".",
"URI",
"+",
"\"/config\"",
",",
"timeout",
"=",
"timeout",
")"
] |
Updates the remote server configuration and the automatic backup schedule for backup.
Args:
config (dict): Object to update.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView, just stop waiting for its completion.
Returns:
dict: Backup details.
|
[
"Updates",
"the",
"remote",
"server",
"configuration",
"and",
"the",
"automatic",
"backup",
"schedule",
"for",
"backup",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/settings/backups.py#L125-L139
|
18,574
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/settings/backups.py
|
Backups.update_remote_archive
|
def update_remote_archive(self, save_uri, timeout=-1):
"""
Saves a backup of the appliance to a previously-configured remote location.
Args:
save_uri (dict): The URI for saving the backup to a previously configured location.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView, just stop waiting for its completion.
Returns:
dict: Backup details.
"""
return self._client.update_with_zero_body(uri=save_uri, timeout=timeout)
|
python
|
def update_remote_archive(self, save_uri, timeout=-1):
"""
Saves a backup of the appliance to a previously-configured remote location.
Args:
save_uri (dict): The URI for saving the backup to a previously configured location.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView, just stop waiting for its completion.
Returns:
dict: Backup details.
"""
return self._client.update_with_zero_body(uri=save_uri, timeout=timeout)
|
[
"def",
"update_remote_archive",
"(",
"self",
",",
"save_uri",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"return",
"self",
".",
"_client",
".",
"update_with_zero_body",
"(",
"uri",
"=",
"save_uri",
",",
"timeout",
"=",
"timeout",
")"
] |
Saves a backup of the appliance to a previously-configured remote location.
Args:
save_uri (dict): The URI for saving the backup to a previously configured location.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView, just stop waiting for its completion.
Returns:
dict: Backup details.
|
[
"Saves",
"a",
"backup",
"of",
"the",
"appliance",
"to",
"a",
"previously",
"-",
"configured",
"remote",
"location",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/settings/backups.py#L141-L155
|
18,575
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/networking/uplink_sets.py
|
UplinkSets.get_ethernet_networks
|
def get_ethernet_networks(self):
"""
Gets a list of associated ethernet networks of an uplink set.
Args:
id_or_uri: Can be either the uplink set id or the uplink set uri.
Returns:
list: Associated ethernet networks.
"""
network_uris = self.data.get('networkUris')
networks = []
if network_uris:
for uri in network_uris:
networks.append(self._ethernet_networks.get_by_uri(uri))
return networks
|
python
|
def get_ethernet_networks(self):
"""
Gets a list of associated ethernet networks of an uplink set.
Args:
id_or_uri: Can be either the uplink set id or the uplink set uri.
Returns:
list: Associated ethernet networks.
"""
network_uris = self.data.get('networkUris')
networks = []
if network_uris:
for uri in network_uris:
networks.append(self._ethernet_networks.get_by_uri(uri))
return networks
|
[
"def",
"get_ethernet_networks",
"(",
"self",
")",
":",
"network_uris",
"=",
"self",
".",
"data",
".",
"get",
"(",
"'networkUris'",
")",
"networks",
"=",
"[",
"]",
"if",
"network_uris",
":",
"for",
"uri",
"in",
"network_uris",
":",
"networks",
".",
"append",
"(",
"self",
".",
"_ethernet_networks",
".",
"get_by_uri",
"(",
"uri",
")",
")",
"return",
"networks"
] |
Gets a list of associated ethernet networks of an uplink set.
Args:
id_or_uri: Can be either the uplink set id or the uplink set uri.
Returns:
list: Associated ethernet networks.
|
[
"Gets",
"a",
"list",
"of",
"associated",
"ethernet",
"networks",
"of",
"an",
"uplink",
"set",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/uplink_sets.py#L60-L75
|
18,576
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/networking/uplink_sets.py
|
UplinkSets.__set_ethernet_uris
|
def __set_ethernet_uris(self, ethernet_names, operation="add"):
"""Updates network uris."""
if not isinstance(ethernet_names, list):
ethernet_names = [ethernet_names]
associated_enets = self.data.get('networkUris', [])
ethernet_uris = []
for i, enet in enumerate(ethernet_names):
enet_exists = self._ethernet_networks.get_by_name(enet)
if enet_exists:
ethernet_uris.append(enet_exists.data['uri'])
else:
raise HPOneViewResourceNotFound("Ethernet: {} does not exist".foramt(enet))
if operation == "remove":
enets_to_update = sorted(list(set(associated_enets) - set(ethernet_uris)))
elif operation == "add":
enets_to_update = sorted(list(set(associated_enets).union(set(ethernet_uris))))
else:
raise ValueError("Value {} is not supported as operation. The supported values are: ['add', 'remove']")
if set(enets_to_update) != set(associated_enets):
updated_network = {'networkUris': enets_to_update}
self.update(updated_network)
|
python
|
def __set_ethernet_uris(self, ethernet_names, operation="add"):
"""Updates network uris."""
if not isinstance(ethernet_names, list):
ethernet_names = [ethernet_names]
associated_enets = self.data.get('networkUris', [])
ethernet_uris = []
for i, enet in enumerate(ethernet_names):
enet_exists = self._ethernet_networks.get_by_name(enet)
if enet_exists:
ethernet_uris.append(enet_exists.data['uri'])
else:
raise HPOneViewResourceNotFound("Ethernet: {} does not exist".foramt(enet))
if operation == "remove":
enets_to_update = sorted(list(set(associated_enets) - set(ethernet_uris)))
elif operation == "add":
enets_to_update = sorted(list(set(associated_enets).union(set(ethernet_uris))))
else:
raise ValueError("Value {} is not supported as operation. The supported values are: ['add', 'remove']")
if set(enets_to_update) != set(associated_enets):
updated_network = {'networkUris': enets_to_update}
self.update(updated_network)
|
[
"def",
"__set_ethernet_uris",
"(",
"self",
",",
"ethernet_names",
",",
"operation",
"=",
"\"add\"",
")",
":",
"if",
"not",
"isinstance",
"(",
"ethernet_names",
",",
"list",
")",
":",
"ethernet_names",
"=",
"[",
"ethernet_names",
"]",
"associated_enets",
"=",
"self",
".",
"data",
".",
"get",
"(",
"'networkUris'",
",",
"[",
"]",
")",
"ethernet_uris",
"=",
"[",
"]",
"for",
"i",
",",
"enet",
"in",
"enumerate",
"(",
"ethernet_names",
")",
":",
"enet_exists",
"=",
"self",
".",
"_ethernet_networks",
".",
"get_by_name",
"(",
"enet",
")",
"if",
"enet_exists",
":",
"ethernet_uris",
".",
"append",
"(",
"enet_exists",
".",
"data",
"[",
"'uri'",
"]",
")",
"else",
":",
"raise",
"HPOneViewResourceNotFound",
"(",
"\"Ethernet: {} does not exist\"",
".",
"foramt",
"(",
"enet",
")",
")",
"if",
"operation",
"==",
"\"remove\"",
":",
"enets_to_update",
"=",
"sorted",
"(",
"list",
"(",
"set",
"(",
"associated_enets",
")",
"-",
"set",
"(",
"ethernet_uris",
")",
")",
")",
"elif",
"operation",
"==",
"\"add\"",
":",
"enets_to_update",
"=",
"sorted",
"(",
"list",
"(",
"set",
"(",
"associated_enets",
")",
".",
"union",
"(",
"set",
"(",
"ethernet_uris",
")",
")",
")",
")",
"else",
":",
"raise",
"ValueError",
"(",
"\"Value {} is not supported as operation. The supported values are: ['add', 'remove']\"",
")",
"if",
"set",
"(",
"enets_to_update",
")",
"!=",
"set",
"(",
"associated_enets",
")",
":",
"updated_network",
"=",
"{",
"'networkUris'",
":",
"enets_to_update",
"}",
"self",
".",
"update",
"(",
"updated_network",
")"
] |
Updates network uris.
|
[
"Updates",
"network",
"uris",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/uplink_sets.py#L110-L134
|
18,577
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/networking/logical_interconnect_groups.py
|
LogicalInterconnectGroups.get_settings
|
def get_settings(self):
"""
Gets the interconnect settings for a logical interconnect group.
Returns:
dict: Interconnect Settings.
"""
uri = "{}/settings".format(self.data["uri"])
return self._helper.do_get(uri)
|
python
|
def get_settings(self):
"""
Gets the interconnect settings for a logical interconnect group.
Returns:
dict: Interconnect Settings.
"""
uri = "{}/settings".format(self.data["uri"])
return self._helper.do_get(uri)
|
[
"def",
"get_settings",
"(",
"self",
")",
":",
"uri",
"=",
"\"{}/settings\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"\"uri\"",
"]",
")",
"return",
"self",
".",
"_helper",
".",
"do_get",
"(",
"uri",
")"
] |
Gets the interconnect settings for a logical interconnect group.
Returns:
dict: Interconnect Settings.
|
[
"Gets",
"the",
"interconnect",
"settings",
"for",
"a",
"logical",
"interconnect",
"group",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/networking/logical_interconnect_groups.py#L93-L101
|
18,578
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/settings/firmware_bundles.py
|
FirmwareBundles.upload
|
def upload(self, file_path, timeout=-1):
"""
Upload an SPP ISO image file or a hotfix file to the appliance.
The API supports upload of one hotfix at a time into the system.
For the successful upload of a hotfix, ensure its original name and extension are not altered.
Args:
file_path: Full path to firmware.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Information about the updated firmware bundle.
"""
return self._client.upload(file_path, timeout=timeout)
|
python
|
def upload(self, file_path, timeout=-1):
"""
Upload an SPP ISO image file or a hotfix file to the appliance.
The API supports upload of one hotfix at a time into the system.
For the successful upload of a hotfix, ensure its original name and extension are not altered.
Args:
file_path: Full path to firmware.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Information about the updated firmware bundle.
"""
return self._client.upload(file_path, timeout=timeout)
|
[
"def",
"upload",
"(",
"self",
",",
"file_path",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"return",
"self",
".",
"_client",
".",
"upload",
"(",
"file_path",
",",
"timeout",
"=",
"timeout",
")"
] |
Upload an SPP ISO image file or a hotfix file to the appliance.
The API supports upload of one hotfix at a time into the system.
For the successful upload of a hotfix, ensure its original name and extension are not altered.
Args:
file_path: Full path to firmware.
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: Information about the updated firmware bundle.
|
[
"Upload",
"an",
"SPP",
"ISO",
"image",
"file",
"or",
"a",
"hotfix",
"file",
"to",
"the",
"appliance",
".",
"The",
"API",
"supports",
"upload",
"of",
"one",
"hotfix",
"at",
"a",
"time",
"into",
"the",
"system",
".",
"For",
"the",
"successful",
"upload",
"of",
"a",
"hotfix",
"ensure",
"its",
"original",
"name",
"and",
"extension",
"are",
"not",
"altered",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/settings/firmware_bundles.py#L48-L62
|
18,579
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/search/index_resources.py
|
IndexResources.get
|
def get(self, uri):
"""
Gets an index resource by URI.
Args:
uri: The resource URI.
Returns:
dict: The index resource.
"""
uri = self.URI + uri
return self._client.get(uri)
|
python
|
def get(self, uri):
"""
Gets an index resource by URI.
Args:
uri: The resource URI.
Returns:
dict: The index resource.
"""
uri = self.URI + uri
return self._client.get(uri)
|
[
"def",
"get",
"(",
"self",
",",
"uri",
")",
":",
"uri",
"=",
"self",
".",
"URI",
"+",
"uri",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"uri",
")"
] |
Gets an index resource by URI.
Args:
uri: The resource URI.
Returns:
dict: The index resource.
|
[
"Gets",
"an",
"index",
"resource",
"by",
"URI",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/search/index_resources.py#L104-L115
|
18,580
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/storage/storage_pools.py
|
StoragePools.get_reachable_storage_pools
|
def get_reachable_storage_pools(self, start=0, count=-1, filter='', query='', sort='',
networks=None, scope_exclusions=None, scope_uris=''):
"""
Gets the storage pools that are connected on the specified networks
based on the storage system port's expected network connectivity.
Args:
start: The first item to return, using 0-based indexing. If not specified,
the default is 0 - start with the first available item.
count: The number of resources to return. A count of -1 requests all items.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter: A general filter/query string to narrow the list of items returned.
The default is no filter - all resources are returned.
sort: The sort order of the returned data set. By default, the sort order
is based on create time with the oldest entry first.
query: A general query string to narrow the list of resources returned.
The default is no query - all resources are returned.
networks: Specifies the comma-separated list of network URIs used by the
reachable storage pools.
scope_exclusions: Specifies the comma-separated list of storage-pools URIs
that will be excluded from the scope validation checks.
scope_uris: Specifies the comma-separated list of scope URIs used by the
reachable storage pools.
Returns:
list: Reachable Storage Pools List.
"""
uri = self.URI + "/reachable-storage-pools"
if networks:
elements = "\'"
for n in networks:
elements += n + ','
elements = elements[:-1] + "\'"
uri = uri + "?networks=" + elements
if scope_exclusions:
storage_pools_uris = ",".join(scope_exclusions)
uri = uri + "?" if "?" not in uri else uri + "&"
uri += "scopeExclusions={}".format(storage_pools_uris)
return self._client.get(self._client.build_query_uri(start=start, count=count, filter=filter, query=query,
sort=sort, uri=uri, scope_uris=scope_uris))
|
python
|
def get_reachable_storage_pools(self, start=0, count=-1, filter='', query='', sort='',
networks=None, scope_exclusions=None, scope_uris=''):
"""
Gets the storage pools that are connected on the specified networks
based on the storage system port's expected network connectivity.
Args:
start: The first item to return, using 0-based indexing. If not specified,
the default is 0 - start with the first available item.
count: The number of resources to return. A count of -1 requests all items.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter: A general filter/query string to narrow the list of items returned.
The default is no filter - all resources are returned.
sort: The sort order of the returned data set. By default, the sort order
is based on create time with the oldest entry first.
query: A general query string to narrow the list of resources returned.
The default is no query - all resources are returned.
networks: Specifies the comma-separated list of network URIs used by the
reachable storage pools.
scope_exclusions: Specifies the comma-separated list of storage-pools URIs
that will be excluded from the scope validation checks.
scope_uris: Specifies the comma-separated list of scope URIs used by the
reachable storage pools.
Returns:
list: Reachable Storage Pools List.
"""
uri = self.URI + "/reachable-storage-pools"
if networks:
elements = "\'"
for n in networks:
elements += n + ','
elements = elements[:-1] + "\'"
uri = uri + "?networks=" + elements
if scope_exclusions:
storage_pools_uris = ",".join(scope_exclusions)
uri = uri + "?" if "?" not in uri else uri + "&"
uri += "scopeExclusions={}".format(storage_pools_uris)
return self._client.get(self._client.build_query_uri(start=start, count=count, filter=filter, query=query,
sort=sort, uri=uri, scope_uris=scope_uris))
|
[
"def",
"get_reachable_storage_pools",
"(",
"self",
",",
"start",
"=",
"0",
",",
"count",
"=",
"-",
"1",
",",
"filter",
"=",
"''",
",",
"query",
"=",
"''",
",",
"sort",
"=",
"''",
",",
"networks",
"=",
"None",
",",
"scope_exclusions",
"=",
"None",
",",
"scope_uris",
"=",
"''",
")",
":",
"uri",
"=",
"self",
".",
"URI",
"+",
"\"/reachable-storage-pools\"",
"if",
"networks",
":",
"elements",
"=",
"\"\\'\"",
"for",
"n",
"in",
"networks",
":",
"elements",
"+=",
"n",
"+",
"','",
"elements",
"=",
"elements",
"[",
":",
"-",
"1",
"]",
"+",
"\"\\'\"",
"uri",
"=",
"uri",
"+",
"\"?networks=\"",
"+",
"elements",
"if",
"scope_exclusions",
":",
"storage_pools_uris",
"=",
"\",\"",
".",
"join",
"(",
"scope_exclusions",
")",
"uri",
"=",
"uri",
"+",
"\"?\"",
"if",
"\"?\"",
"not",
"in",
"uri",
"else",
"uri",
"+",
"\"&\"",
"uri",
"+=",
"\"scopeExclusions={}\"",
".",
"format",
"(",
"storage_pools_uris",
")",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"self",
".",
"_client",
".",
"build_query_uri",
"(",
"start",
"=",
"start",
",",
"count",
"=",
"count",
",",
"filter",
"=",
"filter",
",",
"query",
"=",
"query",
",",
"sort",
"=",
"sort",
",",
"uri",
"=",
"uri",
",",
"scope_uris",
"=",
"scope_uris",
")",
")"
] |
Gets the storage pools that are connected on the specified networks
based on the storage system port's expected network connectivity.
Args:
start: The first item to return, using 0-based indexing. If not specified,
the default is 0 - start with the first available item.
count: The number of resources to return. A count of -1 requests all items.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter: A general filter/query string to narrow the list of items returned.
The default is no filter - all resources are returned.
sort: The sort order of the returned data set. By default, the sort order
is based on create time with the oldest entry first.
query: A general query string to narrow the list of resources returned.
The default is no query - all resources are returned.
networks: Specifies the comma-separated list of network URIs used by the
reachable storage pools.
scope_exclusions: Specifies the comma-separated list of storage-pools URIs
that will be excluded from the scope validation checks.
scope_uris: Specifies the comma-separated list of scope URIs used by the
reachable storage pools.
Returns:
list: Reachable Storage Pools List.
|
[
"Gets",
"the",
"storage",
"pools",
"that",
"are",
"connected",
"on",
"the",
"specified",
"networks",
"based",
"on",
"the",
"storage",
"system",
"port",
"s",
"expected",
"network",
"connectivity",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/storage_pools.py#L138-L181
|
18,581
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/security/certificate_rabbitmq.py
|
CertificateRabbitMQ.generate
|
def generate(self, information, timeout=-1):
"""
Generates a self signed certificate or an internal CA signed certificate for RabbitMQ clients.
Args:
information (dict): Information to generate the certificate for RabbitMQ clients.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: RabbitMQ certificate generated
"""
return self._client.create(information, timeout=timeout)
|
python
|
def generate(self, information, timeout=-1):
"""
Generates a self signed certificate or an internal CA signed certificate for RabbitMQ clients.
Args:
information (dict): Information to generate the certificate for RabbitMQ clients.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: RabbitMQ certificate generated
"""
return self._client.create(information, timeout=timeout)
|
[
"def",
"generate",
"(",
"self",
",",
"information",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"return",
"self",
".",
"_client",
".",
"create",
"(",
"information",
",",
"timeout",
"=",
"timeout",
")"
] |
Generates a self signed certificate or an internal CA signed certificate for RabbitMQ clients.
Args:
information (dict): Information to generate the certificate for RabbitMQ clients.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
dict: RabbitMQ certificate generated
|
[
"Generates",
"a",
"self",
"signed",
"certificate",
"or",
"an",
"internal",
"CA",
"signed",
"certificate",
"for",
"RabbitMQ",
"clients",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/security/certificate_rabbitmq.py#L44-L57
|
18,582
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/security/certificate_rabbitmq.py
|
CertificateRabbitMQ.get_key_pair
|
def get_key_pair(self, alias_name):
"""
Retrieves the public and private key pair associated with the specified alias name.
Args:
alias_name: Key pair associated with the RabbitMQ
Returns:
dict: RabbitMQ certificate
"""
uri = self.URI + "/keypair/" + alias_name
return self._client.get(uri)
|
python
|
def get_key_pair(self, alias_name):
"""
Retrieves the public and private key pair associated with the specified alias name.
Args:
alias_name: Key pair associated with the RabbitMQ
Returns:
dict: RabbitMQ certificate
"""
uri = self.URI + "/keypair/" + alias_name
return self._client.get(uri)
|
[
"def",
"get_key_pair",
"(",
"self",
",",
"alias_name",
")",
":",
"uri",
"=",
"self",
".",
"URI",
"+",
"\"/keypair/\"",
"+",
"alias_name",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"uri",
")"
] |
Retrieves the public and private key pair associated with the specified alias name.
Args:
alias_name: Key pair associated with the RabbitMQ
Returns:
dict: RabbitMQ certificate
|
[
"Retrieves",
"the",
"public",
"and",
"private",
"key",
"pair",
"associated",
"with",
"the",
"specified",
"alias",
"name",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/security/certificate_rabbitmq.py#L71-L82
|
18,583
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/security/certificate_rabbitmq.py
|
CertificateRabbitMQ.get_keys
|
def get_keys(self, alias_name, key_format):
"""
Retrieves the contents of PKCS12 file in the format specified.
This PKCS12 formatted file contains both the certificate as well as the key file data.
Valid key formats are Base64 and PKCS12.
Args:
alias_name: Key pair associated with the RabbitMQ
key_format: Valid key formats are Base64 and PKCS12.
Returns:
dict: RabbitMQ certificate
"""
uri = self.URI + "/keys/" + alias_name + "?format=" + key_format
return self._client.get(uri)
|
python
|
def get_keys(self, alias_name, key_format):
"""
Retrieves the contents of PKCS12 file in the format specified.
This PKCS12 formatted file contains both the certificate as well as the key file data.
Valid key formats are Base64 and PKCS12.
Args:
alias_name: Key pair associated with the RabbitMQ
key_format: Valid key formats are Base64 and PKCS12.
Returns:
dict: RabbitMQ certificate
"""
uri = self.URI + "/keys/" + alias_name + "?format=" + key_format
return self._client.get(uri)
|
[
"def",
"get_keys",
"(",
"self",
",",
"alias_name",
",",
"key_format",
")",
":",
"uri",
"=",
"self",
".",
"URI",
"+",
"\"/keys/\"",
"+",
"alias_name",
"+",
"\"?format=\"",
"+",
"key_format",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"uri",
")"
] |
Retrieves the contents of PKCS12 file in the format specified.
This PKCS12 formatted file contains both the certificate as well as the key file data.
Valid key formats are Base64 and PKCS12.
Args:
alias_name: Key pair associated with the RabbitMQ
key_format: Valid key formats are Base64 and PKCS12.
Returns:
dict: RabbitMQ certificate
|
[
"Retrieves",
"the",
"contents",
"of",
"PKCS12",
"file",
"in",
"the",
"format",
"specified",
".",
"This",
"PKCS12",
"formatted",
"file",
"contains",
"both",
"the",
"certificate",
"as",
"well",
"as",
"the",
"key",
"file",
"data",
".",
"Valid",
"key",
"formats",
"are",
"Base64",
"and",
"PKCS12",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/security/certificate_rabbitmq.py#L84-L97
|
18,584
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/servers/id_pools.py
|
IdPools.validate_id_pool
|
def validate_id_pool(self, id_or_uri, ids_pools):
"""
Validates an ID pool.
Args:
id_or_uri:
ID or URI of range.
ids_pools (list):
List of Id Pools.
Returns:
dict: A dict containing a list with IDs.
"""
uri = self._client.build_uri(id_or_uri) + "/validate?idList=" + "&idList=".join(ids_pools)
return self._client.get(uri)
|
python
|
def validate_id_pool(self, id_or_uri, ids_pools):
"""
Validates an ID pool.
Args:
id_or_uri:
ID or URI of range.
ids_pools (list):
List of Id Pools.
Returns:
dict: A dict containing a list with IDs.
"""
uri = self._client.build_uri(id_or_uri) + "/validate?idList=" + "&idList=".join(ids_pools)
return self._client.get(uri)
|
[
"def",
"validate_id_pool",
"(",
"self",
",",
"id_or_uri",
",",
"ids_pools",
")",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"id_or_uri",
")",
"+",
"\"/validate?idList=\"",
"+",
"\"&idList=\"",
".",
"join",
"(",
"ids_pools",
")",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"uri",
")"
] |
Validates an ID pool.
Args:
id_or_uri:
ID or URI of range.
ids_pools (list):
List of Id Pools.
Returns:
dict: A dict containing a list with IDs.
|
[
"Validates",
"an",
"ID",
"pool",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/id_pools.py#L73-L87
|
18,585
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/servers/id_pools.py
|
IdPools.generate
|
def generate(self, id_or_uri):
"""
Generates and returns a random range.
Args:
id_or_uri:
ID or URI of range.
Returns:
dict: A dict containing a list with IDs.
"""
uri = self._client.build_uri(id_or_uri) + "/generate"
return self._client.get(uri)
|
python
|
def generate(self, id_or_uri):
"""
Generates and returns a random range.
Args:
id_or_uri:
ID or URI of range.
Returns:
dict: A dict containing a list with IDs.
"""
uri = self._client.build_uri(id_or_uri) + "/generate"
return self._client.get(uri)
|
[
"def",
"generate",
"(",
"self",
",",
"id_or_uri",
")",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"id_or_uri",
")",
"+",
"\"/generate\"",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"uri",
")"
] |
Generates and returns a random range.
Args:
id_or_uri:
ID or URI of range.
Returns:
dict: A dict containing a list with IDs.
|
[
"Generates",
"and",
"returns",
"a",
"random",
"range",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/id_pools.py#L169-L181
|
18,586
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/storage/storage_volume_templates.py
|
StorageVolumeTemplates.get_connectable_volume_templates
|
def get_connectable_volume_templates(self, start=0, count=-1, filter='', query='', sort=''):
"""
Gets the storage volume templates that are available on the specified networks based on the storage system
port's expected network connectivity. If there are no storage volume templates that meet the specified
connectivity criteria, an empty collection will be returned.
Returns:
list: Storage volume templates.
"""
uri = self.URI + "/connectable-volume-templates"
get_uri = self._client.build_query_uri(start=start, count=count, filter=filter,
query=query, sort=sort, uri=uri)
return self._client.get(get_uri)
|
python
|
def get_connectable_volume_templates(self, start=0, count=-1, filter='', query='', sort=''):
"""
Gets the storage volume templates that are available on the specified networks based on the storage system
port's expected network connectivity. If there are no storage volume templates that meet the specified
connectivity criteria, an empty collection will be returned.
Returns:
list: Storage volume templates.
"""
uri = self.URI + "/connectable-volume-templates"
get_uri = self._client.build_query_uri(start=start, count=count, filter=filter,
query=query, sort=sort, uri=uri)
return self._client.get(get_uri)
|
[
"def",
"get_connectable_volume_templates",
"(",
"self",
",",
"start",
"=",
"0",
",",
"count",
"=",
"-",
"1",
",",
"filter",
"=",
"''",
",",
"query",
"=",
"''",
",",
"sort",
"=",
"''",
")",
":",
"uri",
"=",
"self",
".",
"URI",
"+",
"\"/connectable-volume-templates\"",
"get_uri",
"=",
"self",
".",
"_client",
".",
"build_query_uri",
"(",
"start",
"=",
"start",
",",
"count",
"=",
"count",
",",
"filter",
"=",
"filter",
",",
"query",
"=",
"query",
",",
"sort",
"=",
"sort",
",",
"uri",
"=",
"uri",
")",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"get_uri",
")"
] |
Gets the storage volume templates that are available on the specified networks based on the storage system
port's expected network connectivity. If there are no storage volume templates that meet the specified
connectivity criteria, an empty collection will be returned.
Returns:
list: Storage volume templates.
|
[
"Gets",
"the",
"storage",
"volume",
"templates",
"that",
"are",
"available",
"on",
"the",
"specified",
"networks",
"based",
"on",
"the",
"storage",
"system",
"port",
"s",
"expected",
"network",
"connectivity",
".",
"If",
"there",
"are",
"no",
"storage",
"volume",
"templates",
"that",
"meet",
"the",
"specified",
"connectivity",
"criteria",
"an",
"empty",
"collection",
"will",
"be",
"returned",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/storage_volume_templates.py#L107-L120
|
18,587
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/storage/storage_volume_templates.py
|
StorageVolumeTemplates.get_reachable_volume_templates
|
def get_reachable_volume_templates(self, start=0, count=-1, filter='', query='', sort='',
networks=None, scope_uris='', private_allowed_only=False):
"""
Gets the storage templates that are connected on the specified networks based on the storage system
port's expected network connectivity.
Returns:
list: Storage volume templates.
"""
uri = self.URI + "/reachable-volume-templates"
uri += "?networks={}&privateAllowedOnly={}".format(networks, private_allowed_only)
get_uri = self._client.build_query_uri(start=start, count=count, filter=filter,
query=query, sort=sort, uri=uri, scope_uris=scope_uris)
return self._client.get(get_uri)
|
python
|
def get_reachable_volume_templates(self, start=0, count=-1, filter='', query='', sort='',
networks=None, scope_uris='', private_allowed_only=False):
"""
Gets the storage templates that are connected on the specified networks based on the storage system
port's expected network connectivity.
Returns:
list: Storage volume templates.
"""
uri = self.URI + "/reachable-volume-templates"
uri += "?networks={}&privateAllowedOnly={}".format(networks, private_allowed_only)
get_uri = self._client.build_query_uri(start=start, count=count, filter=filter,
query=query, sort=sort, uri=uri, scope_uris=scope_uris)
return self._client.get(get_uri)
|
[
"def",
"get_reachable_volume_templates",
"(",
"self",
",",
"start",
"=",
"0",
",",
"count",
"=",
"-",
"1",
",",
"filter",
"=",
"''",
",",
"query",
"=",
"''",
",",
"sort",
"=",
"''",
",",
"networks",
"=",
"None",
",",
"scope_uris",
"=",
"''",
",",
"private_allowed_only",
"=",
"False",
")",
":",
"uri",
"=",
"self",
".",
"URI",
"+",
"\"/reachable-volume-templates\"",
"uri",
"+=",
"\"?networks={}&privateAllowedOnly={}\"",
".",
"format",
"(",
"networks",
",",
"private_allowed_only",
")",
"get_uri",
"=",
"self",
".",
"_client",
".",
"build_query_uri",
"(",
"start",
"=",
"start",
",",
"count",
"=",
"count",
",",
"filter",
"=",
"filter",
",",
"query",
"=",
"query",
",",
"sort",
"=",
"sort",
",",
"uri",
"=",
"uri",
",",
"scope_uris",
"=",
"scope_uris",
")",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"get_uri",
")"
] |
Gets the storage templates that are connected on the specified networks based on the storage system
port's expected network connectivity.
Returns:
list: Storage volume templates.
|
[
"Gets",
"the",
"storage",
"templates",
"that",
"are",
"connected",
"on",
"the",
"specified",
"networks",
"based",
"on",
"the",
"storage",
"system",
"port",
"s",
"expected",
"network",
"connectivity",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/storage_volume_templates.py#L122-L137
|
18,588
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/storage/storage_volume_templates.py
|
StorageVolumeTemplates.get_compatible_systems
|
def get_compatible_systems(self, id_or_uri):
"""
Retrieves a collection of all storage systems that is applicable to this storage volume template.
Args:
id_or_uri:
Can be either the power device id or the uri
Returns:
list: Storage systems.
"""
uri = self._client.build_uri(id_or_uri) + "/compatible-systems"
return self._client.get(uri)
|
python
|
def get_compatible_systems(self, id_or_uri):
"""
Retrieves a collection of all storage systems that is applicable to this storage volume template.
Args:
id_or_uri:
Can be either the power device id or the uri
Returns:
list: Storage systems.
"""
uri = self._client.build_uri(id_or_uri) + "/compatible-systems"
return self._client.get(uri)
|
[
"def",
"get_compatible_systems",
"(",
"self",
",",
"id_or_uri",
")",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"id_or_uri",
")",
"+",
"\"/compatible-systems\"",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"uri",
")"
] |
Retrieves a collection of all storage systems that is applicable to this storage volume template.
Args:
id_or_uri:
Can be either the power device id or the uri
Returns:
list: Storage systems.
|
[
"Retrieves",
"a",
"collection",
"of",
"all",
"storage",
"systems",
"that",
"is",
"applicable",
"to",
"this",
"storage",
"volume",
"template",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/storage_volume_templates.py#L139-L151
|
18,589
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/storage/volumes.py
|
Volumes.add_from_existing
|
def add_from_existing(self, resource, timeout=-1):
"""
Adds a volume that already exists in the Storage system
Args:
resource (dict):
Object to create.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView, just stop waiting for its completion.
Returns:
dict: Added resource.
"""
uri = self.URI + "/from-existing"
return self._client.create(resource, uri=uri, timeout=timeout)
|
python
|
def add_from_existing(self, resource, timeout=-1):
"""
Adds a volume that already exists in the Storage system
Args:
resource (dict):
Object to create.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView, just stop waiting for its completion.
Returns:
dict: Added resource.
"""
uri = self.URI + "/from-existing"
return self._client.create(resource, uri=uri, timeout=timeout)
|
[
"def",
"add_from_existing",
"(",
"self",
",",
"resource",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"self",
".",
"URI",
"+",
"\"/from-existing\"",
"return",
"self",
".",
"_client",
".",
"create",
"(",
"resource",
",",
"uri",
"=",
"uri",
",",
"timeout",
"=",
"timeout",
")"
] |
Adds a volume that already exists in the Storage system
Args:
resource (dict):
Object to create.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView, just stop waiting for its completion.
Returns:
dict: Added resource.
|
[
"Adds",
"a",
"volume",
"that",
"already",
"exists",
"in",
"the",
"Storage",
"system"
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/volumes.py#L136-L151
|
18,590
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/storage/volumes.py
|
Volumes.create_from_snapshot
|
def create_from_snapshot(self, data, timeout=-1):
"""
Creates a new volume on the storage system from a snapshot of a volume.
A volume template must also be specified when creating a volume from a snapshot.
The global setting "StorageVolumeTemplateRequired" controls whether or
not root volume templates can be used to provision volumes.
The value of this setting defaults to "false".
If the value is set to "true", then only templates with an "isRoot" value of "false"
can be used to provision a volume.
Args:
data (dict):
Object to create.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView, just stop waiting for its completion.
Returns:
dict: Created data.
"""
uri = self.URI + "/from-snapshot"
return self._client.create(data, uri=uri, timeout=timeout)
|
python
|
def create_from_snapshot(self, data, timeout=-1):
"""
Creates a new volume on the storage system from a snapshot of a volume.
A volume template must also be specified when creating a volume from a snapshot.
The global setting "StorageVolumeTemplateRequired" controls whether or
not root volume templates can be used to provision volumes.
The value of this setting defaults to "false".
If the value is set to "true", then only templates with an "isRoot" value of "false"
can be used to provision a volume.
Args:
data (dict):
Object to create.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView, just stop waiting for its completion.
Returns:
dict: Created data.
"""
uri = self.URI + "/from-snapshot"
return self._client.create(data, uri=uri, timeout=timeout)
|
[
"def",
"create_from_snapshot",
"(",
"self",
",",
"data",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"self",
".",
"URI",
"+",
"\"/from-snapshot\"",
"return",
"self",
".",
"_client",
".",
"create",
"(",
"data",
",",
"uri",
"=",
"uri",
",",
"timeout",
"=",
"timeout",
")"
] |
Creates a new volume on the storage system from a snapshot of a volume.
A volume template must also be specified when creating a volume from a snapshot.
The global setting "StorageVolumeTemplateRequired" controls whether or
not root volume templates can be used to provision volumes.
The value of this setting defaults to "false".
If the value is set to "true", then only templates with an "isRoot" value of "false"
can be used to provision a volume.
Args:
data (dict):
Object to create.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView, just stop waiting for its completion.
Returns:
dict: Created data.
|
[
"Creates",
"a",
"new",
"volume",
"on",
"the",
"storage",
"system",
"from",
"a",
"snapshot",
"of",
"a",
"volume",
".",
"A",
"volume",
"template",
"must",
"also",
"be",
"specified",
"when",
"creating",
"a",
"volume",
"from",
"a",
"snapshot",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/volumes.py#L153-L175
|
18,591
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/storage/volumes.py
|
Volumes.delete
|
def delete(self, resource, force=False, export_only=None, suppress_device_updates=None, timeout=-1):
"""
Deletes a managed volume.
Args:
resource (dict):
Object to delete.
force:
If set to true, the operation completes despite any problems with
network connectivity or errors on the resource itself. The default is false.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
export_only:
Valid prior to API500. By default, volumes will be deleted from OneView, and storage system.
To delete the volume from OneView only, you must set its value to True.
Setting its value to False has the same behavior as the default behavior.
suppress_device_updates:
Valid API500 onwards. By default, volumes will be deleted from OneView, and storage system.
To delete the volume from OneView only, you must set its value to True.
Setting its value to False has the same behavior as the default behavior.
Returns:
bool: Indicates if the volume was successfully deleted.
"""
custom_headers = {'If-Match': '*'}
if 'uri' in resource:
uri = resource['uri']
else:
uri = self._client.build_uri(resource)
if suppress_device_updates:
uri += '?suppressDeviceUpdates=true'
if export_only:
custom_headers['exportOnly'] = True
return self._client.delete(uri, force=force, timeout=timeout, custom_headers=custom_headers)
|
python
|
def delete(self, resource, force=False, export_only=None, suppress_device_updates=None, timeout=-1):
"""
Deletes a managed volume.
Args:
resource (dict):
Object to delete.
force:
If set to true, the operation completes despite any problems with
network connectivity or errors on the resource itself. The default is false.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
export_only:
Valid prior to API500. By default, volumes will be deleted from OneView, and storage system.
To delete the volume from OneView only, you must set its value to True.
Setting its value to False has the same behavior as the default behavior.
suppress_device_updates:
Valid API500 onwards. By default, volumes will be deleted from OneView, and storage system.
To delete the volume from OneView only, you must set its value to True.
Setting its value to False has the same behavior as the default behavior.
Returns:
bool: Indicates if the volume was successfully deleted.
"""
custom_headers = {'If-Match': '*'}
if 'uri' in resource:
uri = resource['uri']
else:
uri = self._client.build_uri(resource)
if suppress_device_updates:
uri += '?suppressDeviceUpdates=true'
if export_only:
custom_headers['exportOnly'] = True
return self._client.delete(uri, force=force, timeout=timeout, custom_headers=custom_headers)
|
[
"def",
"delete",
"(",
"self",
",",
"resource",
",",
"force",
"=",
"False",
",",
"export_only",
"=",
"None",
",",
"suppress_device_updates",
"=",
"None",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"custom_headers",
"=",
"{",
"'If-Match'",
":",
"'*'",
"}",
"if",
"'uri'",
"in",
"resource",
":",
"uri",
"=",
"resource",
"[",
"'uri'",
"]",
"else",
":",
"uri",
"=",
"self",
".",
"_client",
".",
"build_uri",
"(",
"resource",
")",
"if",
"suppress_device_updates",
":",
"uri",
"+=",
"'?suppressDeviceUpdates=true'",
"if",
"export_only",
":",
"custom_headers",
"[",
"'exportOnly'",
"]",
"=",
"True",
"return",
"self",
".",
"_client",
".",
"delete",
"(",
"uri",
",",
"force",
"=",
"force",
",",
"timeout",
"=",
"timeout",
",",
"custom_headers",
"=",
"custom_headers",
")"
] |
Deletes a managed volume.
Args:
resource (dict):
Object to delete.
force:
If set to true, the operation completes despite any problems with
network connectivity or errors on the resource itself. The default is false.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
export_only:
Valid prior to API500. By default, volumes will be deleted from OneView, and storage system.
To delete the volume from OneView only, you must set its value to True.
Setting its value to False has the same behavior as the default behavior.
suppress_device_updates:
Valid API500 onwards. By default, volumes will be deleted from OneView, and storage system.
To delete the volume from OneView only, you must set its value to True.
Setting its value to False has the same behavior as the default behavior.
Returns:
bool: Indicates if the volume was successfully deleted.
|
[
"Deletes",
"a",
"managed",
"volume",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/volumes.py#L197-L231
|
18,592
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/storage/volumes.py
|
Volumes.get_snapshots
|
def get_snapshots(self, volume_id_or_uri, start=0, count=-1, filter='', sort=''):
"""
Gets all snapshots of a volume. Returns a list of snapshots based on optional sorting and filtering, and
constrained by start and count parameters.
Args:
volume_id_or_uri:
Can be either the volume id or the volume uri.
start:
The first item to return, using 0-based indexing.
If not specified, the default is 0 - start with the first available item.
count:
The number of resources to return. A count of -1 requests all items.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter (list or str):
A general filter/query string to narrow the list of items returned. The
default is no filter; all resources are returned.
sort:
The sort order of the returned data set. By default, the sort order is based
on create time with the oldest entry first.
Returns:
list: A list of snapshots.
"""
uri = self.__build_volume_snapshot_uri(volume_id_or_uri)
return self._client.get_all(start, count, filter=filter, sort=sort, uri=uri)
|
python
|
def get_snapshots(self, volume_id_or_uri, start=0, count=-1, filter='', sort=''):
"""
Gets all snapshots of a volume. Returns a list of snapshots based on optional sorting and filtering, and
constrained by start and count parameters.
Args:
volume_id_or_uri:
Can be either the volume id or the volume uri.
start:
The first item to return, using 0-based indexing.
If not specified, the default is 0 - start with the first available item.
count:
The number of resources to return. A count of -1 requests all items.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter (list or str):
A general filter/query string to narrow the list of items returned. The
default is no filter; all resources are returned.
sort:
The sort order of the returned data set. By default, the sort order is based
on create time with the oldest entry first.
Returns:
list: A list of snapshots.
"""
uri = self.__build_volume_snapshot_uri(volume_id_or_uri)
return self._client.get_all(start, count, filter=filter, sort=sort, uri=uri)
|
[
"def",
"get_snapshots",
"(",
"self",
",",
"volume_id_or_uri",
",",
"start",
"=",
"0",
",",
"count",
"=",
"-",
"1",
",",
"filter",
"=",
"''",
",",
"sort",
"=",
"''",
")",
":",
"uri",
"=",
"self",
".",
"__build_volume_snapshot_uri",
"(",
"volume_id_or_uri",
")",
"return",
"self",
".",
"_client",
".",
"get_all",
"(",
"start",
",",
"count",
",",
"filter",
"=",
"filter",
",",
"sort",
"=",
"sort",
",",
"uri",
"=",
"uri",
")"
] |
Gets all snapshots of a volume. Returns a list of snapshots based on optional sorting and filtering, and
constrained by start and count parameters.
Args:
volume_id_or_uri:
Can be either the volume id or the volume uri.
start:
The first item to return, using 0-based indexing.
If not specified, the default is 0 - start with the first available item.
count:
The number of resources to return. A count of -1 requests all items.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter (list or str):
A general filter/query string to narrow the list of items returned. The
default is no filter; all resources are returned.
sort:
The sort order of the returned data set. By default, the sort order is based
on create time with the oldest entry first.
Returns:
list: A list of snapshots.
|
[
"Gets",
"all",
"snapshots",
"of",
"a",
"volume",
".",
"Returns",
"a",
"list",
"of",
"snapshots",
"based",
"on",
"optional",
"sorting",
"and",
"filtering",
"and",
"constrained",
"by",
"start",
"and",
"count",
"parameters",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/volumes.py#L242-L268
|
18,593
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/storage/volumes.py
|
Volumes.create_snapshot
|
def create_snapshot(self, volume_id_or_uri, snapshot, timeout=-1):
"""
Creates a snapshot for the specified volume.
Args:
volume_id_or_uri:
Can be either the volume ID or the volume URI.
snapshot (dict):
Object to create.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
dict: Storage volume.
"""
uri = self.__build_volume_snapshot_uri(volume_id_or_uri)
return self._client.create(snapshot, uri=uri, timeout=timeout, default_values=self.DEFAULT_VALUES_SNAPSHOT)
|
python
|
def create_snapshot(self, volume_id_or_uri, snapshot, timeout=-1):
"""
Creates a snapshot for the specified volume.
Args:
volume_id_or_uri:
Can be either the volume ID or the volume URI.
snapshot (dict):
Object to create.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
dict: Storage volume.
"""
uri = self.__build_volume_snapshot_uri(volume_id_or_uri)
return self._client.create(snapshot, uri=uri, timeout=timeout, default_values=self.DEFAULT_VALUES_SNAPSHOT)
|
[
"def",
"create_snapshot",
"(",
"self",
",",
"volume_id_or_uri",
",",
"snapshot",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"self",
".",
"__build_volume_snapshot_uri",
"(",
"volume_id_or_uri",
")",
"return",
"self",
".",
"_client",
".",
"create",
"(",
"snapshot",
",",
"uri",
"=",
"uri",
",",
"timeout",
"=",
"timeout",
",",
"default_values",
"=",
"self",
".",
"DEFAULT_VALUES_SNAPSHOT",
")"
] |
Creates a snapshot for the specified volume.
Args:
volume_id_or_uri:
Can be either the volume ID or the volume URI.
snapshot (dict):
Object to create.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
dict: Storage volume.
|
[
"Creates",
"a",
"snapshot",
"for",
"the",
"specified",
"volume",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/volumes.py#L270-L288
|
18,594
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/storage/volumes.py
|
Volumes.get_snapshot
|
def get_snapshot(self, snapshot_id_or_uri, volume_id_or_uri=None):
"""
Gets a snapshot of a volume.
Args:
volume_id_or_uri:
Can be either the volume ID or the volume URI. It is optional if it is passed a snapshot URI,
but required if it passed a snapshot ID.
snapshot_id_or_uri:
Can be either the snapshot ID or the snapshot URI.
Returns:
dict: The snapshot.
"""
uri = self.__build_volume_snapshot_uri(volume_id_or_uri, snapshot_id_or_uri)
return self._client.get(uri)
|
python
|
def get_snapshot(self, snapshot_id_or_uri, volume_id_or_uri=None):
"""
Gets a snapshot of a volume.
Args:
volume_id_or_uri:
Can be either the volume ID or the volume URI. It is optional if it is passed a snapshot URI,
but required if it passed a snapshot ID.
snapshot_id_or_uri:
Can be either the snapshot ID or the snapshot URI.
Returns:
dict: The snapshot.
"""
uri = self.__build_volume_snapshot_uri(volume_id_or_uri, snapshot_id_or_uri)
return self._client.get(uri)
|
[
"def",
"get_snapshot",
"(",
"self",
",",
"snapshot_id_or_uri",
",",
"volume_id_or_uri",
"=",
"None",
")",
":",
"uri",
"=",
"self",
".",
"__build_volume_snapshot_uri",
"(",
"volume_id_or_uri",
",",
"snapshot_id_or_uri",
")",
"return",
"self",
".",
"_client",
".",
"get",
"(",
"uri",
")"
] |
Gets a snapshot of a volume.
Args:
volume_id_or_uri:
Can be either the volume ID or the volume URI. It is optional if it is passed a snapshot URI,
but required if it passed a snapshot ID.
snapshot_id_or_uri:
Can be either the snapshot ID or the snapshot URI.
Returns:
dict: The snapshot.
|
[
"Gets",
"a",
"snapshot",
"of",
"a",
"volume",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/volumes.py#L290-L305
|
18,595
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/storage/volumes.py
|
Volumes.get_snapshot_by
|
def get_snapshot_by(self, volume_id_or_uri, field, value):
"""
Gets all snapshots that match the filter.
The search is case-insensitive.
Args:
volume_id_or_uri: Can be either the volume id or the volume uri.
field: Field name to filter.
value: Value to filter.
Returns:
list: Snapshots
"""
uri = self.__build_volume_snapshot_uri(volume_id_or_uri)
return self._client.get_by(field, value, uri=uri)
|
python
|
def get_snapshot_by(self, volume_id_or_uri, field, value):
"""
Gets all snapshots that match the filter.
The search is case-insensitive.
Args:
volume_id_or_uri: Can be either the volume id or the volume uri.
field: Field name to filter.
value: Value to filter.
Returns:
list: Snapshots
"""
uri = self.__build_volume_snapshot_uri(volume_id_or_uri)
return self._client.get_by(field, value, uri=uri)
|
[
"def",
"get_snapshot_by",
"(",
"self",
",",
"volume_id_or_uri",
",",
"field",
",",
"value",
")",
":",
"uri",
"=",
"self",
".",
"__build_volume_snapshot_uri",
"(",
"volume_id_or_uri",
")",
"return",
"self",
".",
"_client",
".",
"get_by",
"(",
"field",
",",
"value",
",",
"uri",
"=",
"uri",
")"
] |
Gets all snapshots that match the filter.
The search is case-insensitive.
Args:
volume_id_or_uri: Can be either the volume id or the volume uri.
field: Field name to filter.
value: Value to filter.
Returns:
list: Snapshots
|
[
"Gets",
"all",
"snapshots",
"that",
"match",
"the",
"filter",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/volumes.py#L327-L342
|
18,596
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/storage/volumes.py
|
Volumes.get_extra_managed_storage_volume_paths
|
def get_extra_managed_storage_volume_paths(self, start=0, count=-1, filter='', sort=''):
"""
Gets the list of extra managed storage volume paths.
Args:
start:
The first item to return, using 0-based indexing.
If not specified, the default is 0 - start with the first available item.
count:
The number of resources to return. A count of -1 requests all items.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter (list or str):
A general filter/query string to narrow the list of items returned. The
default is no filter; all resources are returned.
sort:
The sort order of the returned data set. By default, the sort order is based
on create time with the oldest entry first.
Returns:
list: A list of extra managed storage volume paths.
"""
uri = self.URI + '/repair?alertFixType=ExtraManagedStorageVolumePaths'
return self._client.get_all(start, count, filter=filter, sort=sort, uri=uri)
|
python
|
def get_extra_managed_storage_volume_paths(self, start=0, count=-1, filter='', sort=''):
"""
Gets the list of extra managed storage volume paths.
Args:
start:
The first item to return, using 0-based indexing.
If not specified, the default is 0 - start with the first available item.
count:
The number of resources to return. A count of -1 requests all items.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter (list or str):
A general filter/query string to narrow the list of items returned. The
default is no filter; all resources are returned.
sort:
The sort order of the returned data set. By default, the sort order is based
on create time with the oldest entry first.
Returns:
list: A list of extra managed storage volume paths.
"""
uri = self.URI + '/repair?alertFixType=ExtraManagedStorageVolumePaths'
return self._client.get_all(start, count, filter=filter, sort=sort, uri=uri)
|
[
"def",
"get_extra_managed_storage_volume_paths",
"(",
"self",
",",
"start",
"=",
"0",
",",
"count",
"=",
"-",
"1",
",",
"filter",
"=",
"''",
",",
"sort",
"=",
"''",
")",
":",
"uri",
"=",
"self",
".",
"URI",
"+",
"'/repair?alertFixType=ExtraManagedStorageVolumePaths'",
"return",
"self",
".",
"_client",
".",
"get_all",
"(",
"start",
",",
"count",
",",
"filter",
"=",
"filter",
",",
"sort",
"=",
"sort",
",",
"uri",
"=",
"uri",
")"
] |
Gets the list of extra managed storage volume paths.
Args:
start:
The first item to return, using 0-based indexing.
If not specified, the default is 0 - start with the first available item.
count:
The number of resources to return. A count of -1 requests all items.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter (list or str):
A general filter/query string to narrow the list of items returned. The
default is no filter; all resources are returned.
sort:
The sort order of the returned data set. By default, the sort order is based
on create time with the oldest entry first.
Returns:
list: A list of extra managed storage volume paths.
|
[
"Gets",
"the",
"list",
"of",
"extra",
"managed",
"storage",
"volume",
"paths",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/volumes.py#L344-L367
|
18,597
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/storage/volumes.py
|
Volumes.repair
|
def repair(self, volume_id_or_uri, timeout=-1):
"""
Removes extra presentations from a specified volume on the storage system.
Args:
volume_id_or_uri:
Can be either the volume id or the volume uri.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
dict: Storage volume.
"""
data = {
"type": "ExtraManagedStorageVolumePaths",
"resourceUri": self._client.build_uri(volume_id_or_uri)
}
custom_headers = {'Accept-Language': 'en_US'}
uri = self.URI + '/repair'
return self._client.create(data, uri=uri, timeout=timeout, custom_headers=custom_headers)
|
python
|
def repair(self, volume_id_or_uri, timeout=-1):
"""
Removes extra presentations from a specified volume on the storage system.
Args:
volume_id_or_uri:
Can be either the volume id or the volume uri.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
dict: Storage volume.
"""
data = {
"type": "ExtraManagedStorageVolumePaths",
"resourceUri": self._client.build_uri(volume_id_or_uri)
}
custom_headers = {'Accept-Language': 'en_US'}
uri = self.URI + '/repair'
return self._client.create(data, uri=uri, timeout=timeout, custom_headers=custom_headers)
|
[
"def",
"repair",
"(",
"self",
",",
"volume_id_or_uri",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"data",
"=",
"{",
"\"type\"",
":",
"\"ExtraManagedStorageVolumePaths\"",
",",
"\"resourceUri\"",
":",
"self",
".",
"_client",
".",
"build_uri",
"(",
"volume_id_or_uri",
")",
"}",
"custom_headers",
"=",
"{",
"'Accept-Language'",
":",
"'en_US'",
"}",
"uri",
"=",
"self",
".",
"URI",
"+",
"'/repair'",
"return",
"self",
".",
"_client",
".",
"create",
"(",
"data",
",",
"uri",
"=",
"uri",
",",
"timeout",
"=",
"timeout",
",",
"custom_headers",
"=",
"custom_headers",
")"
] |
Removes extra presentations from a specified volume on the storage system.
Args:
volume_id_or_uri:
Can be either the volume id or the volume uri.
timeout:
Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in
OneView, just stops waiting for its completion.
Returns:
dict: Storage volume.
|
[
"Removes",
"extra",
"presentations",
"from",
"a",
"specified",
"volume",
"on",
"the",
"storage",
"system",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/volumes.py#L369-L389
|
18,598
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/storage/volumes.py
|
Volumes.get_attachable_volumes
|
def get_attachable_volumes(self, start=0, count=-1, filter='', query='', sort='', scope_uris='', connections=''):
"""
Gets the volumes that are connected on the specified networks based on the storage system port's expected
network connectivity.
A volume is attachable if it satisfies either of the following conditions:
* The volume is shareable.
* The volume not shareable and not attached.
Args:
start:
The first item to return, using 0-based indexing.
If not specified, the default is 0 - start with the first available item.
count:
The number of resources to return. A count of -1 requests all items.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter (list or str):
A general filter/query string to narrow the list of items returned. The
default is no filter; all resources are returned.
query:
A general query string to narrow the list of resources returned. The default
is no query; all resources are returned.
sort:
The sort order of the returned data set. By default, the sort order is based
on create time with the oldest entry first.
connections:
A list of dicts specifics the connections used by the attachable volumes. Needs network uri, initiatoer
name and optional proxy name
scope_uris:
A list specifics the list of scope uris used by the attachable volumed.
Returns:
list: A list of attachable volumes that the appliance manages.
"""
uri = self.URI + '/attachable-volumes'
if connections:
uri += str('?' + 'connections=' + connections.__str__())
return self._client.get_all(start, count, filter=filter, query=query, sort=sort, uri=uri, scope_uris=scope_uris)
|
python
|
def get_attachable_volumes(self, start=0, count=-1, filter='', query='', sort='', scope_uris='', connections=''):
"""
Gets the volumes that are connected on the specified networks based on the storage system port's expected
network connectivity.
A volume is attachable if it satisfies either of the following conditions:
* The volume is shareable.
* The volume not shareable and not attached.
Args:
start:
The first item to return, using 0-based indexing.
If not specified, the default is 0 - start with the first available item.
count:
The number of resources to return. A count of -1 requests all items.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter (list or str):
A general filter/query string to narrow the list of items returned. The
default is no filter; all resources are returned.
query:
A general query string to narrow the list of resources returned. The default
is no query; all resources are returned.
sort:
The sort order of the returned data set. By default, the sort order is based
on create time with the oldest entry first.
connections:
A list of dicts specifics the connections used by the attachable volumes. Needs network uri, initiatoer
name and optional proxy name
scope_uris:
A list specifics the list of scope uris used by the attachable volumed.
Returns:
list: A list of attachable volumes that the appliance manages.
"""
uri = self.URI + '/attachable-volumes'
if connections:
uri += str('?' + 'connections=' + connections.__str__())
return self._client.get_all(start, count, filter=filter, query=query, sort=sort, uri=uri, scope_uris=scope_uris)
|
[
"def",
"get_attachable_volumes",
"(",
"self",
",",
"start",
"=",
"0",
",",
"count",
"=",
"-",
"1",
",",
"filter",
"=",
"''",
",",
"query",
"=",
"''",
",",
"sort",
"=",
"''",
",",
"scope_uris",
"=",
"''",
",",
"connections",
"=",
"''",
")",
":",
"uri",
"=",
"self",
".",
"URI",
"+",
"'/attachable-volumes'",
"if",
"connections",
":",
"uri",
"+=",
"str",
"(",
"'?'",
"+",
"'connections='",
"+",
"connections",
".",
"__str__",
"(",
")",
")",
"return",
"self",
".",
"_client",
".",
"get_all",
"(",
"start",
",",
"count",
",",
"filter",
"=",
"filter",
",",
"query",
"=",
"query",
",",
"sort",
"=",
"sort",
",",
"uri",
"=",
"uri",
",",
"scope_uris",
"=",
"scope_uris",
")"
] |
Gets the volumes that are connected on the specified networks based on the storage system port's expected
network connectivity.
A volume is attachable if it satisfies either of the following conditions:
* The volume is shareable.
* The volume not shareable and not attached.
Args:
start:
The first item to return, using 0-based indexing.
If not specified, the default is 0 - start with the first available item.
count:
The number of resources to return. A count of -1 requests all items.
The actual number of items in the response might differ from the requested
count if the sum of start and count exceeds the total number of items.
filter (list or str):
A general filter/query string to narrow the list of items returned. The
default is no filter; all resources are returned.
query:
A general query string to narrow the list of resources returned. The default
is no query; all resources are returned.
sort:
The sort order of the returned data set. By default, the sort order is based
on create time with the oldest entry first.
connections:
A list of dicts specifics the connections used by the attachable volumes. Needs network uri, initiatoer
name and optional proxy name
scope_uris:
A list specifics the list of scope uris used by the attachable volumed.
Returns:
list: A list of attachable volumes that the appliance manages.
|
[
"Gets",
"the",
"volumes",
"that",
"are",
"connected",
"on",
"the",
"specified",
"networks",
"based",
"on",
"the",
"storage",
"system",
"port",
"s",
"expected",
"network",
"connectivity",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/storage/volumes.py#L391-L429
|
18,599
|
HewlettPackard/python-hpOneView
|
hpOneView/resources/servers/enclosures.py
|
Enclosures.update_configuration
|
def update_configuration(self, timeout=-1):
"""
Reapplies the appliance's configuration on the enclosure. This includes running the same configure steps
that were performed as part of the enclosure add.
Args:
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
Enclosure
"""
uri = "{}/configuration".format(self.data['uri'])
return self.update_with_zero_body(uri=uri, timeout=timeout)
|
python
|
def update_configuration(self, timeout=-1):
"""
Reapplies the appliance's configuration on the enclosure. This includes running the same configure steps
that were performed as part of the enclosure add.
Args:
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
Enclosure
"""
uri = "{}/configuration".format(self.data['uri'])
return self.update_with_zero_body(uri=uri, timeout=timeout)
|
[
"def",
"update_configuration",
"(",
"self",
",",
"timeout",
"=",
"-",
"1",
")",
":",
"uri",
"=",
"\"{}/configuration\"",
".",
"format",
"(",
"self",
".",
"data",
"[",
"'uri'",
"]",
")",
"return",
"self",
".",
"update_with_zero_body",
"(",
"uri",
"=",
"uri",
",",
"timeout",
"=",
"timeout",
")"
] |
Reapplies the appliance's configuration on the enclosure. This includes running the same configure steps
that were performed as part of the enclosure add.
Args:
timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation
in OneView; it just stops waiting for its completion.
Returns:
Enclosure
|
[
"Reapplies",
"the",
"appliance",
"s",
"configuration",
"on",
"the",
"enclosure",
".",
"This",
"includes",
"running",
"the",
"same",
"configure",
"steps",
"that",
"were",
"performed",
"as",
"part",
"of",
"the",
"enclosure",
"add",
"."
] |
3c6219723ef25e6e0c83d44a89007f89bc325b89
|
https://github.com/HewlettPackard/python-hpOneView/blob/3c6219723ef25e6e0c83d44a89007f89bc325b89/hpOneView/resources/servers/enclosures.py#L106-L119
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.