Code
stringlengths
103
85.9k
Summary
listlengths
0
94
Please provide a description of the function:def remove(self, transport): recipients = copy.copy(self.recipients) for address, recManager in recipients.items(): recManager.remove(transport) if not len(recManager.transports): del self.recipients[address]
[ "\n removes a transport from all channels to which it belongs.\n " ]
Please provide a description of the function:def send(self, address, data_dict): if type(address) == list: recipients = [self.recipients.get(rec) for rec in address] else: recipients = [self.recipients.get(address)] if recipients: for recipient in r...
[ "\n address can either be a string or a list of strings\n\n data_dict gets sent along as is and could contain anything\n " ]
Please provide a description of the function:def subscribe(self, transport, data): self.add(transport, address=data.get('hx_subscribe').encode()) self.send( data['hx_subscribe'], {'message': "%r is listening" % transport} )
[ "\n adds a transport to a channel\n " ]
Please provide a description of the function:def cleanOptions(options): _reload = options.pop('reload') dev = options.pop('dev') opts = [] store_true = [ '--nocache', '--global_cache', '--quiet', '--loud' ] store_false = [] for key, value in options.items(): key = '--' +...
[ "\n Takes an options dict and returns a tuple containing the daemonize boolean,\n the reload boolean, and the parsed list of cleaned options as would be\n expected to be passed to hx\n " ]
Please provide a description of the function:def options(argv=[]): parser = HendrixOptionParser parsed_args = parser.parse_args(argv) return vars(parsed_args[0])
[ "\n A helper function that returns a dictionary of the default key-values pairs\n " ]
Please provide a description of the function: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, n...
[ "\n Unsubscribe this participant from all topic to which it is subscribed.\n " ]
Please provide a description of the function: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, ...
[]
Please provide a description of the function:def addResource(self, content, uri, headers): self.cache[uri] = CachedResource(content, headers)
[ "\n Adds the a hendrix.contrib.cache.resource.CachedResource to the\n ReverseProxy cache connection\n " ]
Please provide a description of the function:def compressBuffer(buffer): # http://jython.xhaus.com/http-compression-in-python-and-jython/ zbuf = cStringIO.StringIO() zfile = gzip.GzipFile(mode='wb', fileobj=zbuf, compresslevel=9) zfile.write(buffer) zfile.close() return zbuf.getvalue()
[ "\n Note that this code compresses into a buffer held in memory, rather\n than a disk file. This is done through the use of cStringIO.StringIO().\n " ]
Please provide a description of the function: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
[]
Please provide a description of the function: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 = in...
[]
Please provide a description of the function: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
[]
Please provide a description of the function:def getDate(self): "returns the GMT response datetime or None" date = self.headers.get('date') if date: date = self.convertTimeString(date) return date
[]
Please provide a description of the function: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.t...
[]
Please provide a description of the function:def _parse_config_options( config: Mapping[str, Union[ResourceOptions, Mapping[str, Any]]]=None): if config is None: return {} if not isinstance(config, collections.abc.Mapping): raise ValueError( "Config must be mapping, go...
[ "Parse CORS configuration (default or per-route)\n\n :param config:\n Mapping from Origin to Resource configuration (allowed headers etc)\n defined either as mapping or `ResourceOptions` instance.\n\n Raises `ValueError` if configuration is not correct.\n " ]
Please provide a description of the function:def add(self, routing_entity, config: _ConfigType=None): parsed_config = _parse_config_options(config) self._router_adapter.add_preflight_handler( routing_entity, self._preflight_handler) self._router_ada...
[ "Enable CORS for specific route or resource.\n\n If route is passed CORS is enabled for route's resource.\n\n :param routing_entity:\n Route or Resource for which CORS should be enabled.\n :param config:\n CORS options for the route.\n :return: `routing_entity`.\n ...
Please provide a description of the function: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_a...
[ "Non-preflight CORS request response processor.\n\n If request is done on CORS-enabled route, process request parameters\n and set appropriate CORS response headers.\n " ]
Please provide a description of the function:def add(self, routing_entity, config: _ConfigType = None, webview: bool=False): if webview: warnings.warn('webview argument is deprecated, ' 'views are handled authomatically without ...
[ "Enable CORS for specific route or resource.\n\n If route is passed CORS is enabled for route's resource.\n\n :param routing_entity:\n Route or Resource for which CORS should be enabled.\n :param config:\n CORS options for the route.\n :return: `routing_entity`.\n ...
Please provide a description of the function:def _is_proper_sequence(seq): return (isinstance(seq, collections.abc.Sequence) and not isinstance(seq, str))
[ "Returns is seq is sequence and not string." ]
Please provide a description of the function: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.\n\n To enable CORS for a resource you need to explicitly add route for\n that resource using `CorsConfig.add()` method::\n\n app = aiohttp.web.Application()\n cors = aiohttp_cors.setup(app)\n cors.add(\n app.router.add_route(\"GET\", ...
Please provide a description of the function: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: " "'Ac...
[ "Parse Access-Control-Request-Method header of the preflight request\n " ]
Please provide a description of the function: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 # H...
[ "Parse Access-Control-Request-Headers header or the preflight request\n\n Returns set of headers in upper case.\n " ]
Please provide a description of the function: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. ...
[ "CORS preflight request handler" ]
Please provide a description of the function:def add_preflight_handler( self, routing_entity: Union[web.Resource, web.StaticResource, web.ResourceRoute], handler): if isinstance(routing_entity, web.Resource): resource = ...
[ "Add OPTIONS handler for all routes defined by `routing_entity`.\n\n Does nothing if CORS handler already handles routing entity.\n Should fail if there are conflicting user-defined OPTIONS handlers.\n " ]
Please provide a description of the function: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." ]
Please provide a description of the function: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." ]
Please provide a description of the function:def set_config_for_routing_entity( self, routing_entity: Union[web.Resource, web.StaticResource, web.ResourceRoute], config): if isinstance(routing_entity, (web.Resource, web.StaticResour...
[ "Record configuration for resource or it's route." ]
Please provide a description of the function: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 a...
[ "Get stored CORS configuration for routing entity that handles\n specified request." ]
Please provide a description of the function:def get_visual_content(self, id_or_uri): uri = self._client.build_uri(id_or_uri) + "/visualContent" return self._client.get(uri)
[ "\n Gets a list of visual content objects describing each rack within the data center. The response aggregates data\n center and rack data with a specified metric (peak24HourTemp) to provide simplified access to display data for\n the data center.\n\n Args:\n id_or_uri: Can be...
Please provide a description of the function:def add(self, information, timeout=-1): return self._client.create(information, timeout=timeout)
[ "\n Adds a data center resource based upon the attributes specified.\n\n Args:\n information: Data center information\n timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation\n in OneView; it just stops waiting fo...
Please provide a description of the function:def update(self, resource, timeout=-1): return self._client.update(resource, timeout=timeout)
[ "\n Updates the specified data center resource.\n\n Args:\n resource (dict): Object to update.\n timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation\n in OneView; it just stops waiting for its completion.\n\n ...
Please provide a description of the function:def remove_all(self, filter, force=False, timeout=-1): return self._client.delete_all(filter=filter, force=force, timeout=timeout)
[ "\n Deletes the set of datacenters according to the specified parameters. A filter is required to identify the set\n of resources to be deleted.\n\n Args:\n filter:\n A general filter/query string to narrow the list of items that will be removed.\n force:\n...
Please provide a description of the function:def get_by(self, field, value): return self._client.get_by(field=field, value=value)
[ "\n Gets all drive enclosures that match the filter.\n\n The search is case-insensitive.\n\n Args:\n Field: field name to filter.\n Value: value to filter.\n\n Returns:\n list: A list of drive enclosures.\n " ]
Please provide a description of the function:def get_port_map(self, id_or_uri): uri = self._client.build_uri(id_or_uri) + self.PORT_MAP_PATH return self._client.get(id_or_uri=uri)
[ "\n Use to get the drive enclosure I/O adapter port to SAS interconnect port connectivity.\n\n Args:\n id_or_uri: Can be either the resource ID or the resource URI.\n\n Returns:\n dict: Drive Enclosure Port Map\n " ]
Please provide a description of the function: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)
[ "\n Refreshes a drive enclosure.\n\n Args:\n id_or_uri: Can be either the resource ID or the resource URI.\n configuration: Configuration\n timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation\n in On...
Please provide a description of the function: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)
[ "\n Gets a list of Deployment Servers based on optional sorting and filtering, and constrained by start and count\n parameters.\n\n Args:\n start:\n The first item to return, using 0-based indexing.\n If not specified, the default is 0 - start with the f...
Please provide a description of the function:def add(self, resource, timeout=-1): return self._client.create(resource, timeout=timeout)
[ "\n Adds a Deployment Server using the information provided in the request body. Note: The type of the Deployment\n Server is always assigned as \"Image streamer\".\n\n Args:\n resource (dict):\n Deployment Manager resource.\n timeout:\n Timeo...
Please provide a description of the function:def update(self, resource, force=False, timeout=-1): return self._client.update(resource, timeout=timeout, force=force)
[ "\n Updates the Deployment Server resource. The properties that are omitted (not included as part\n of the request body) are ignored.\n\n Args:\n resource (dict): Object to update.\n force:\n If set to true, the operation completes despite any problems with ...
Please provide a description of the function:def delete(self, resource, force=False, timeout=-1): return self._client.delete(resource, force=force, timeout=timeout)
[ "\n Deletes a Deployment Server object based on its UUID or URI.\n\n Args:\n resource (dict):\n Object to delete.\n force:\n If set to true, the operation completes despite any problems with\n network connectivity or errors on the re...
Please provide a description of the function: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, ...
[ "\n Gets a list of all the Image Streamer resources based on optional sorting and filtering, and constrained\n by start and count parameters.\n\n Args:\n start:\n The first item to return, using 0-based indexing.\n If not specified, the default is 0 - st...
Please provide a description of the function: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)
[ "\n Gets the particular Image Streamer resource based on its ID or URI.\n\n Args:\n id_or_uri:\n Can be either the Os Deployment Server ID or the URI\n fields:\n Specifies which fields should be returned in the result.\n\n Returns:\n ...
Please provide a description of the function: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 N...
[ "\n Gets the particular Image Streamer resource based on its name.\n\n Args:\n appliance_name:\n The Image Streamer resource name.\n\n Returns:\n dict: Image Streamer resource.\n " ]
Please provide a description of the function:def get_storage_pools(self, id_or_uri): uri = self._client.build_uri(id_or_uri) + "/storage-pools" return self._client.get(uri)
[ "\n Gets a list of Storage pools. Returns a list of storage pools belonging to the storage system referred by the\n Path property {ID} parameter or URI.\n\n Args:\n id_or_uri: Can be either the storage system ID (serial number) or the storage system URI.\n Returns:\n ...
Please provide a description of the function: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" + "/" ...
[ "\n Gets all ports or a specific managed target port for the specified storage system.\n\n Args:\n id_or_uri: Can be either the storage system id or the storage system uri.\n port_id_or_uri: Can be either the port id or the port uri.\n\n Returns:\n dict: Managed...
Please provide a description of the function: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] ...
[ "\n Retrieve a storage system by its IP.\n\n Works only with API version <= 300.\n\n Args:\n ip_hostname: Storage system IP or hostname.\n\n Returns:\n dict\n " ]
Please provide a description of the function: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: retur...
[ "\n Retrieve a storage system by its hostname.\n\n Works only in API500 onwards.\n\n Args:\n hostname: Storage system hostname.\n\n Returns:\n dict\n " ]
Please provide a description of the function: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: ...
[ "\n Gets the storage ports that are connected on the specified networks\n based on the storage system port's expected network connectivity.\n\n Returns:\n list: Reachable Storage Port List.\n " ]
Please provide a description of the function: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, ...
[ "\n Gets a list of volume templates. Returns a list of storage templates belonging to the storage system.\n\n Returns:\n list: Storage Template List.\n " ]
Please provide a description of the function: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)
[ "\n Gets the reserved vlan ID range for the fabric.\n\n Note:\n This method is only available on HPE Synergy.\n\n Args:\n id_or_uri: ID or URI of fabric.\n\n Returns:\n dict: vlan-pool\n " ]
Please provide a description of the function: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)
[ "\n Updates the reserved vlan ID range for the fabric.\n\n Note:\n This method is only available on HPE Synergy.\n\n Args:\n id_or_uri: ID or URI of fabric.\n vlan_pool (dict): vlan-pool data to update.\n force: If set to true, the operation complete...
Please provide a description of the function:def get(self, name_or_uri): name_or_uri = quote(name_or_uri) return self._client.get(name_or_uri)
[ "\n Get the role by its URI or Name.\n\n Args:\n name_or_uri:\n Can be either the Name or the URI.\n\n Returns:\n dict: Role\n " ]
Please provide a description of the function: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)
[ "\n Gets the list of drives allocated to this SAS logical JBOD.\n\n Args:\n id_or_uri: Can be either the SAS logical JBOD ID or the SAS logical JBOD URI.\n\n Returns:\n list: A list of Drives\n " ]
Please provide a description of the function: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)
[ "\n Enables or disables a range.\n\n Args:\n information (dict): Information to update.\n id_or_uri: ID or URI of range.\n timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation\n in OneView; it just st...
Please provide a description of the function: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)
[ "\n Gets all fragments that have been allocated in range.\n\n Args:\n id_or_uri:\n ID or URI of range.\n count:\n The number of resources to return. A count of -1 requests all items. The actual number of items in\n the response may d...
Please provide a description of the function:def get_all(self, start=0, count=-1, sort=''): return self._helper.get_all(start, count, sort=sort)
[ "\n Gets a list of logical interconnects based on optional sorting and filtering and is constrained by start\n and count parameters.\n\n Args:\n start:\n The first item to return, using 0-based indexing.\n If not specified, the default is 0 - start with ...
Please provide a description of the function:def update_compliance(self, timeout=-1): uri = "{}/compliance".format(self.data["uri"]) return self._helper.update(None, uri, timeout=timeout)
[ "\n Returns logical interconnects to a consistent state. The current logical interconnect state is\n compared to the associated logical interconnect group.\n\n Any differences identified are corrected, bringing the logical interconnect back to a consistent\n state. Changes are asynchrono...
Please provide a description of the function: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)
[ "\n Updates the Ethernet interconnect settings for the logical interconnect.\n\n Args:\n configuration: Ethernet interconnect settings.\n force: If set to true, the operation completes despite any problems with network connectivity or errors\n on the resource itse...
Please provide a description of the function: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)
[ "\n Updates internal networks on the logical interconnect.\n\n Args:\n network_uri_list: List of Ethernet network uris.\n force: If set to true, the operation completes despite any problems with network connectivity or errors\n on the resource itself. The default i...
Please provide a description of the function:def update_settings(self, settings, force=False, timeout=-1): data = settings.copy() if 'ethernetSettings' in data: ethernet_default_values = self._get_default_values(self.SETTINGS_ETHERNET_DEFAULT_VALUES) data['ethernetSetti...
[ "\n Updates interconnect settings on the logical interconnect. Changes to interconnect settings are asynchronously\n applied to all managed interconnects.\n (This method is not available from API version 600 onwards)\n Args:\n settings: Interconnect settings\n force...
Please provide a description of the function:def update_configuration(self, timeout=-1): uri = "{}/configuration".format(self.data["uri"]) return self._helper.update(None, uri=uri, timeout=timeout)
[ "\n Asynchronously applies or re-applies the logical interconnect configuration to all managed interconnects.\n\n Args:\n timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation\n in OneView; it just stops waiting for its com...
Please provide a description of the function:def get_snmp_configuration(self): uri = "{}{}".format(self.data["uri"], self.SNMP_CONFIGURATION_PATH) return self._helper.do_get(uri)
[ "\n Gets the SNMP configuration for a logical interconnect.\n\n Returns:\n dict: SNMP configuration.\n " ]
Please provide a description of the function: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) re...
[ "\n Updates the SNMP configuration of a logical interconnect. Changes to the SNMP configuration are asynchronously\n applied to all managed interconnects.\n\n Args:\n configuration: snmp configuration.\n\n Returns:\n dict: The Logical Interconnect.\n " ]
Please provide a description of the function:def get_unassigned_ports(self): uri = "{}/unassignedPortsForPortMonitor".format(self.data["uri"]) response = self._helper.do_get(uri) return self._helper.get_members(response)
[ "\n Gets the collection ports from the member interconnects\n which are eligible for assignment to an anlyzer port\n\n Returns:\n dict: Collection of ports\n " ]
Please provide a description of the function:def get_port_monitor(self): uri = "{}{}".format(self.data["uri"], self.PORT_MONITOR_PATH) return self._helper.do_get(uri)
[ "\n Gets the port monitor configuration of a logical interconnect.\n\n Returns:\n dict: The Logical Interconnect.\n " ]
Please provide a description of the function: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(dat...
[ "\n Updates the port monitor configuration of a logical interconnect.\n\n Args:\n resource: Port monitor configuration.\n\n Returns:\n dict: Port monitor configuration.\n " ]
Please provide a description of the function:def create_interconnect(self, location_entries, timeout=-1): return self._helper.create(location_entries, uri=self.locations_uri, timeout=timeout)
[ "\n Creates an interconnect at the given location.\n\n Warning:\n It does not create the LOGICAL INTERCONNECT itself.\n It will fail if no interconnect is already present on the specified position.\n\n Args:\n location_entries (dict): Dictionary with location en...
Please provide a description of the function: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...
[ "\n Deletes an interconnect from a location.\n\n Warning:\n This won't delete the LOGICAL INTERCONNECT itself and might cause inconsistency between the enclosure\n and Logical Interconnect Group.\n\n Args:\n enclosure_uri: URI of the Enclosure\n bay: ...
Please provide a description of the function: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)
[ "\n Gets the installed firmware for a logical interconnect.\n\n Returns:\n dict: LIFirmware.\n " ]
Please provide a description of the function:def install_firmware(self, firmware_information): firmware_uri = self._helper.build_subresource_uri(self.data["uri"], subresource_path=self.FIRMWARE_PATH) return self._helper.update(firmware_information, firmware_uri)
[ "\n Installs firmware to a logical interconnect. The three operations that are supported for the firmware\n update are Stage (uploads firmware to the interconnect), Activate (installs firmware on the interconnect),\n and Update (which does a Stage and Activate in a sequential manner).\n\n ...
Please provide a description of the function:def get_forwarding_information_base(self, filter=''): uri = "{}{}".format(self.data["uri"], self.FORWARDING_INFORMATION_PATH) return self._helper.get_collection(uri, filter=filter)
[ "\n Gets the forwarding information base data for a logical interconnect. A maximum of 100 entries is returned.\n Optional filtering criteria might be specified.\n\n Args:\n filter (list or str):\n Filtering criteria may be specified using supported attributes: interco...
Please provide a description of the function: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)
[ "\n Generates the forwarding information base dump file for a logical interconnect.\n\n Args:\n timeout:\n Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in\n OneView, just stops waiting for its completion.\n\n...
Please provide a description of the function:def get_qos_aggregated_configuration(self): uri = "{}{}".format(self.data["uri"], self.QOS_AGGREGATED_CONFIGURATION) return self._helper.do_get(uri)
[ "\n Gets the QoS aggregated configuration for the logical interconnect.\n\n Returns:\n dict: QoS Configuration.\n " ]
Please provide a description of the function: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)
[ "\n Updates the QoS aggregated configuration for the logical interconnect.\n\n Args:\n qos_configuration:\n QOS configuration.\n timeout:\n Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in\n ...
Please provide a description of the function: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._...
[ "\n Updates the telemetry configuration of a logical interconnect. Changes to the telemetry configuration are\n asynchronously applied to all managed interconnects.\n\n Args:\n configuration:\n The telemetry configuration for the logical interconnect.\n time...
Please provide a description of the function:def get_ethernet_settings(self): uri = "{}/ethernetSettings".format(self.data["uri"]) return self._helper.do_get(uri)
[ "\n Gets the Ethernet interconnect settings for the Logical Interconnect.\n\n Returns:\n dict: Ethernet Interconnect Settings\n " ]
Please provide a description of the function:def download_archive(self, name, file_path): uri = self.URI + "/archive/" + name return self._client.download(uri, file_path)
[ "\n Download archived logs of the OS Volume.\n\n Args:\n name: Name of the OS Volume.\n file_path (str): Destination file path.\n\n Returns:\n bool: Indicates if the resource was successfully downloaded.\n " ]
Please provide a description of the function:def get_storage(self, id_or_uri): uri = self.URI + "/{}/storage".format(extract_id_from_uri(id_or_uri)) return self._client.get(uri)
[ "\n Get storage details of an OS Volume.\n\n Args:\n id_or_uri: ID or URI of the OS Volume.\n\n Returns:\n dict: Storage details\n " ]
Please provide a description of the function:def get_device_topology(self, id_or_uri): uri = self._client.build_uri(id_or_uri) + "/deviceTopology" return self._client.get(uri)
[ "\n Retrieves the topology information for the rack resource specified by ID or URI.\n\n Args:\n id_or_uri: Can be either the resource ID or the resource URI.\n\n Return:\n dict: Device topology.\n " ]
Please provide a description of the function: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) ...
[ "\n Gets a Managed SAN by name.\n\n Args:\n name: Name of the Managed SAN\n\n Returns:\n dict: Managed SAN.\n " ]
Please provide a description of the function: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)
[ "\n Gets a list of endpoints in a SAN.\n\n Args:\n start:\n The first item to return, using 0-based indexing.\n If not specified, the default is 0 - start with the first available item.\n count:\n The number of resources to return. A c...
Please provide a description of the function:def create_endpoints_csv_file(self, timeout=-1): uri = "{}/endpoints/".format(self.data["uri"]) return self._helper.do_post(uri, {}, timeout, None)
[ "\n Creates an endpoints CSV file for a SAN.\n\n Args:\n timeout:\n Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in\n OneView, just stops waiting for its completion.\n\n Returns:\n dict: End...
Please provide a description of the function:def create_issues_report(self, timeout=-1): uri = "{}/issues/".format(self.data["uri"]) return self._helper.create_report(uri, timeout)
[ "\n Creates an unexpected zoning report for a SAN.\n\n Args:\n timeout:\n Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation in\n OneView, just stops waiting for its completion.\n\n Returns:\n lis...
Please provide a description of the function: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...
[ "\n Adds the specified trap forwarding destination.\n The trap destination associated with the specified id will be created if trap destination with that id does not exists.\n The id can only be an integer greater than 0.\n\n Args:\n resource (dict): Object to create.\n ...
Please provide a description of the function: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.__findF...
[ "\n Find the smallest elements missing in a sorted array.\n\n Returns:\n int: The smallest element missing.\n " ]
Please provide a description of the function: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...
[ "\n Private method to get the first available id.\n The id can only be an integer greater than 0.\n\n Returns:\n int: The first available id\n " ]
Please provide a description of the function:def delete(self, id_or_uri, timeout=-1): return self._client.delete(id_or_uri, timeout=timeout)
[ "\n Deletes SNMPv1 trap forwarding destination based on {Id}.\n\n Args:\n id_or_uri: dict object to delete\n timeout:\n Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation\n in OneView, just stop waiting ...
Please provide a description of the function:def update(self, information, timeout=-1): return self._client.update(information, timeout=timeout)
[ "\n Edit an IPv4 Range.\n\n Args:\n information (dict): Information to update.\n timeout: Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation\n in OneView; it just stops waiting for its completion.\n\n Returns:\n...
Please provide a description of the function: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...
[ "\n Wait for task execution and return associated resource.\n\n Args:\n task: task dict\n timeout: timeout in seconds\n\n Returns:\n Associated resource when creating or updating; True when deleting.\n " ]
Please provide a description of the function:def get_completed_task(self, task, timeout=-1): self.__wait_task_completion(task, timeout) return self.get(task)
[ "\n Waits until the task is completed and returns the task resource.\n\n Args:\n task: TaskResource\n timeout: Timeout in seconds\n\n Returns:\n dict: TaskResource\n " ]
Please provide a description of the function:def is_task_running(self, task, connection_failure_control=None): if 'uri' in task: try: task = self.get(task) if connection_failure_control: # Updates last success connectio...
[ "\n Check if a task is running according to: TASK_PENDING_STATES ['New', 'Starting',\n 'Pending', 'Running', 'Suspended', 'Stopping']\n\n Args:\n task (dict): OneView Task resource.\n connection_failure_control (dict):\n A dictionary instance that contains l...
Please provide a description of the function: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 f...
[ "\n Retrieve a resource associated with a task.\n\n Args:\n task: task dict\n\n Returns:\n tuple: task (updated), the entity found (dict)\n " ]
Please provide a description of the function:def update_config(self, config, timeout=-1): return self._client.update(config, uri=self.URI + "/config", timeout=timeout)
[ "\n Updates the remote server configuration and the automatic backup schedule for backup.\n\n Args:\n config (dict): Object to update.\n timeout:\n Timeout in seconds. Wait for task completion by default. The timeout does not abort the operation\n in...
Please provide a description of the function:def update_remote_archive(self, save_uri, timeout=-1): return self._client.update_with_zero_body(uri=save_uri, timeout=timeout)
[ "\n Saves a backup of the appliance to a previously-configured remote location.\n\n Args:\n save_uri (dict): The URI for saving the backup to a previously configured location.\n timeout:\n Timeout in seconds. Wait for task completion by default. The timeout does no...
Please provide a description of the function: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
[ "\n Gets a list of associated ethernet networks of an uplink set.\n\n Args:\n id_or_uri: Can be either the uplink set id or the uplink set uri.\n\n Returns:\n list: Associated ethernet networks.\n " ]
Please provide a description of the function: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, ene...
[ "Updates network uris." ]
Please provide a description of the function:def get_settings(self): uri = "{}/settings".format(self.data["uri"]) return self._helper.do_get(uri)
[ "\n Gets the interconnect settings for a logical interconnect group.\n\n Returns:\n dict: Interconnect Settings.\n " ]
Please provide a description of the function:def upload(self, file_path, timeout=-1): return self._client.upload(file_path, timeout=timeout)
[ "\n Upload an SPP ISO image file or a hotfix file to the appliance.\n The API supports upload of one hotfix at a time into the system.\n For the successful upload of a hotfix, ensure its original name and extension are not altered.\n\n Args:\n file_path: Full path to firmware....
Please provide a description of the function:def get_all(self, category='', count=-1, fields='', filter='', padding=0, query='', reference_uri='', sort='', start=0, user_query='', view=''): uri = self.URI + '?' uri += self.__list_or_str_to_query(category, 'category') ur...
[ "\n Gets a list of index resources based on optional sorting and filtering and is constrained by start\n and count parameters.\n\n Args:\n category (str or list):\n Category of resources. Multiple Category parameters are applied with OR condition.\n count (...
Please provide a description of the function:def get(self, uri): uri = self.URI + uri return self._client.get(uri)
[ "\n Gets an index resource by URI.\n\n Args:\n uri: The resource URI.\n\n Returns:\n dict: The index resource.\n " ]
Please provide a description of the function:def get_aggregated(self, attribute, category, child_limit=6, filter='', query='', user_query=''): uri = self.URI + '/aggregated?' # Add attribute to query uri += self.__list_or_str_to_query(attribute, 'attribute') uri += self.__list_...
[ "\n Gets a list of index resources based on optional sorting and filtering and is constrained by start\n and count parameters.\n\n Args:\n attribute (list or str):\n Attribute to pass in as query filter.\n category (str):\n Category of resourc...