idx
int64
0
63k
question
stringlengths
61
4.03k
target
stringlengths
6
1.23k
62,600
def update_resource_assignments ( self , id_or_uri , resource_assignments , timeout = - 1 ) : uri = self . _client . build_uri ( id_or_uri ) + "/resource-assignments" headers = { 'Content-Type' : 'application/json' } return self . _client . patch_request ( uri , resource_assignments , timeout = timeout , custom_headers = headers )
Modifies scope membership by adding or removing resource assignments .
62,601
def golden_images ( self ) : if not self . __golden_images : self . __golden_images = GoldenImages ( self . __connection ) return self . __golden_images
Gets the Golden Images API client .
62,602
def plan_scripts ( self ) : if not self . __plan_scripts : self . __plan_scripts = PlanScripts ( self . __connection ) return self . __plan_scripts
Gets the Plan Scripts API client .
62,603
def build_plans ( self ) : if not self . __build_plans : self . __build_plans = BuildPlans ( self . __connection ) return self . __build_plans
Gets the Build Plans API client .
62,604
def os_volumes ( self ) : if not self . __os_volumes : self . __os_volumes = OsVolumes ( self . __connection ) return self . __os_volumes
Gets the OS Volumes API client .
62,605
def deployment_plans ( self ) : if not self . __deployment_plans : self . __deployment_plans = DeploymentPlans ( self . __connection ) return self . __deployment_plans
Gets the Deployment Plans API client .
62,606
def artifact_bundles ( self ) : if not self . __artifact_bundles : self . __artifact_bundles = ArtifactBundles ( self . __connection ) return self . __artifact_bundles
Gets the Artifact Bundles API client .
62,607
def deployment_groups ( self ) : if not self . __deployment_groups : self . __deployment_groups = DeploymentGroups ( self . __connection ) return self . __deployment_groups
Gets the Deployment Groups API client .
62,608
def create ( self , resource , timeout = - 1 ) : data = self . __default_values . copy ( ) data . update ( resource ) return self . _client . create ( data , timeout = timeout )
Creates a Golden Image resource from the deployed OS Volume as per the attributes specified .
62,609
def upload ( self , file_path , golden_image_info ) : uri = "{0}?name={1}&description={2}" . format ( self . URI , quote ( golden_image_info . get ( 'name' , '' ) ) , quote ( golden_image_info . get ( 'description' , '' ) ) ) return self . _client . upload ( file_path , uri )
Adds a Golden Image resource from the file that is uploaded from a local drive . Only the . zip format file can be used for the upload .
62,610
def download_archive ( self , id_or_uri , file_path ) : uri = self . URI + "/archive/" + extract_id_from_uri ( id_or_uri ) return self . _client . download ( uri , file_path )
Download the details of the Golden Image capture logs which has been archived based on the specific attribute ID .
62,611
def update ( self , resource , id_or_uri = None , timeout = - 1 ) : uri = resource . pop ( 'uri' , None ) if not uri : if not id_or_uri : raise ValueError ( "URI was not provided" ) uri = self . _client . build_uri ( id_or_uri ) return self . _client . update ( resource = resource , uri = uri , timeout = timeout )
Updates the specified alert resource .
62,612
def delete_alert_change_log ( self , id_or_uri ) : uri = self . URI + "/AlertChangeLog/" + extract_id_from_uri ( id_or_uri ) resource = { "uri" : uri } self . _client . delete ( resource )
Deletes alert change log by alert ID or URI .
62,613
def add_multiple_servers ( self , information , timeout = - 1 ) : uri = "{}/discovery" . format ( self . URI ) return self . create ( information , uri = uri , timeout = timeout )
Adds multiple rack - mount servers for management by the appliance . This API initiates the asynchronous addition of supported server models .
62,614
def get_firmware ( self ) : uri = "{}/firmware" . format ( self . data [ "uri" ] ) return self . _helper . do_get ( uri )
Get the firmware inventory of a server .
62,615
def update_mp_firware_version ( self , timeout = - 1 ) : uri = "{}/mpFirmwareVersion" . format ( self . data [ "uri" ] ) return self . _helper . do_put ( uri , None , timeout , None )
Updates the iLO firmware on a physical server to a minimum ILO firmware version required by OneView to manage the server .
62,616
def get_physical_server_hardware ( self ) : uri = "{}/physicalServerHardware" . format ( self . data [ "uri" ] ) return self . _helper . do_get ( uri )
Information describing an SDX partition including a list of physical server blades represented by a server hardware . Used with SDX enclosures only .
62,617
def update ( self , resource , timeout = - 1 ) : self . __set_default_values ( resource ) uri = self . _client . build_uri ( resource [ 'logicalSwitch' ] [ 'uri' ] ) return self . _client . update ( resource , uri = uri , timeout = timeout )
Updates a Logical Switch .
62,618
def refresh ( self , id_or_uri , timeout = - 1 ) : uri = self . _client . build_uri ( id_or_uri ) + "/refresh" return self . _client . update_with_zero_body ( uri , timeout = timeout )
The Refresh action reclaims the top - of - rack switches in a logical switch .
62,619
def patch ( self , id_or_uri , operation , path , value , timeout = - 1 ) : return self . _client . patch ( id_or_uri , operation , path , value , timeout = timeout )
Uses the PATCH to update a resource for a given logical switch group .
62,620
def migrate ( self , id_or_uri , timeout = - 1 ) : migrationInformation = { 'migrationState' : 'Migrated' , 'type' : 'migratable-vc-domains' , 'category' : 'migratable-vc-domains' } complete_uri = self . _client . build_uri ( id_or_uri ) return self . _client . update ( migrationInformation , uri = complete_uri , timeout = timeout )
Initiates a migration of an enclosure specified by the ID or URI of a migration report .
62,621
def get_by_resource ( self , resource_uri ) : uri = self . URI + self . RESOURCES_PATH + '/' + resource_uri return self . _client . get ( id_or_uri = uri )
Gets all the labels for the specified resource
62,622
def create ( self , resource ) : uri = self . URI + self . RESOURCES_PATH return self . _client . create ( resource = resource , uri = uri )
Set all the labels for a resource .
62,623
def delete ( self , resource , timeout = - 1 ) : self . _client . delete ( resource = resource , timeout = timeout )
Delete all the labels for a resource .
62,624
def update ( self , resource , timeout = - 1 ) : return self . _client . update ( resource , timeout = timeout , default_values = self . DEFAULT_VALUES , uri = self . URI )
Updates a User .
62,625
def get_by ( self , field , value ) : if field == 'userName' or field == 'name' : return self . _client . get ( self . URI + '/' + value ) elif field == 'role' : value = value . replace ( " " , "%20" ) return self . _client . get ( self . URI + '/roles/users/' + value ) [ 'members' ] else : raise HPOneViewException ( 'Only userName, name and role can be queried for this resource.' )
Gets all Users that match the filter .
62,626
def validate_user_name ( self , user_name , timeout = - 1 ) : uri = self . URI + '/validateLoginName/' + user_name return self . _client . create_with_zero_body ( uri = uri , timeout = timeout )
Verifies if a userName is already in use .
62,627
def validate_full_name ( self , full_name , timeout = - 1 ) : uri = self . URI + '/validateUserName/' + full_name return self . _client . create_with_zero_body ( uri = uri , timeout = timeout )
Verifies if a fullName is already in use .
62,628
def add_ipdu ( self , information , timeout = - 1 ) : uri = self . URI + "/discover" return self . _client . create ( information , uri = uri , timeout = timeout )
Add an HP iPDU and bring all components under management by discovery of its management module . Bring the management module under exclusive management by the appliance configure any management or data collection settings and create a private set of administrative credentials to enable ongoing communication and management of the iPDU . Use force to claim the device even if claimed by another management appliance
62,629
def update_power_state ( self , id_or_uri , power_state ) : uri = self . _client . build_uri ( id_or_uri ) + "/powerState" return self . _client . update ( power_state , uri )
Sets the power state of the specified power delivery device . The device must be an HP Intelligent Outlet .
62,630
def update_refresh_state ( self , id_or_uri , refresh_state_data ) : uri = self . _client . build_uri ( id_or_uri ) + "/refreshState" return self . _client . update ( refresh_state_data , uri = uri )
Refreshes a given intelligent power delivery device .
62,631
def get_utilization ( self , id_or_uri , fields = None , filter = None , refresh = False , view = None ) : return self . _client . get_utilization ( id_or_uri , fields , filter , refresh , view )
Retrieves historical utilization data for the specified metrics and time span . The device must be a component of an HPE iPDU .
62,632
def retrieve_differences ( self , id_or_uri , content , timeout = - 1 ) : uri = self . URI + "/differences/" + extract_id_from_uri ( id_or_uri ) return self . _client . create ( content , uri = uri , timeout = timeout )
Retrieves the modified contents of the selected Plan Script according to the provided content object as per the selected attributes .
62,633
def get_usedby_and_readonly ( self , id ) : uri = self . URI + "/" + id + "/usedby/readonly" return self . _client . get ( uri )
Gets the build plans details os teh selected plan script as per the selected attributes .
62,634
def get_osdp ( self , id_or_uri ) : uri = self . _client . build_subresource_uri ( resource_id_or_uri = id_or_uri , subresource_path = "osdp" ) return self . _client . get ( uri )
Retrieves facts about Server Profiles and Server Profile Templates that are using Deployment Plan based on the ID or URI provided .
62,635
def get_compliance_preview ( self ) : uri = '{}/compliance-preview' . format ( self . data [ "uri" ] ) return self . _helper . do_get ( uri )
Gets the preview of manual and automatic updates required to make the server profile consistent with its template .
62,636
def get_profile_ports ( self , ** kwargs ) : uri = self . _helper . build_uri_with_query_string ( kwargs , '/profile-ports' ) return self . _helper . do_get ( uri )
Retrieves the port model associated with a server or server hardware type and enclosure group .
62,637
def get_messages ( self ) : uri = '{}/messages' . format ( self . data [ "uri" ] ) return self . _helper . do_get ( uri )
Retrieves the error or status messages associated with the specified profile .
62,638
def get_available_networks ( self , ** kwargs ) : uri = self . _helper . build_uri_with_query_string ( kwargs , '/available-networks' ) return self . _helper . do_get ( uri )
Retrieves the list of Ethernet networks Fiber Channel networks and network sets that are available to a server profile along with their respective ports .
62,639
def get_available_servers ( self , ** kwargs ) : uri = self . _helper . build_uri_with_query_string ( kwargs , '/available-servers' ) return self . _helper . do_get ( uri )
Retrieves the list of available servers .
62,640
def get_available_storage_system ( self , ** kwargs ) : uri = self . _helper . build_uri_with_query_string ( kwargs , '/available-storage-system' ) return self . _helper . do_get ( uri )
Retrieves a specific storage system and its associated volumes available to the server profile based on the given server hardware type and enclosure group .
62,641
def get_available_storage_systems ( self , start = 0 , count = - 1 , filter = '' , sort = '' , ** kwargs ) : uri = self . _helper . build_uri_with_query_string ( kwargs , '/available-storage-systems' ) return self . _helper . get_all ( start = start , count = count , filter = filter , sort = sort , uri = uri )
Retrieves the list of the storage systems and their associated volumes available to the server profile based on the given server hardware type and enclosure group .
62,642
def get_available_targets ( self , ** kwargs ) : uri = self . _helper . build_uri_with_query_string ( kwargs , '/available-targets' ) return self . _helper . do_get ( uri )
Retrieves a list of the target servers and empty device bays that are available for assignment to the server profile .
62,643
def get_new_profile_template ( self ) : uri = '{}/new-profile-template' . format ( self . data [ "uri" ] ) return self . _helper . do_get ( uri )
Retrieves the profile template for a given server profile .
62,644
def update_script ( self , script_body ) : uri = "{}/script" . format ( self . data [ 'uri' ] ) return self . _helper . update ( script_body , uri = uri )
Updates the configuration script of the enclosure - group with the specified URI .
62,645
def remove_extra_presentations ( self , resource , timeout = - 1 ) : uri = self . URI + "/repair" custom_headers = { 'Accept-Language' : 'en_US' } return self . _client . create ( resource , uri = uri , timeout = timeout , custom_headers = custom_headers )
Removes extra presentations from a specified server profile .
62,646
def get_paths ( self , id_or_uri , path_id_or_uri = '' ) : if path_id_or_uri : uri = self . _client . build_uri ( path_id_or_uri ) if "/paths" not in uri : uri = self . _client . build_uri ( id_or_uri ) + "/paths" + "/" + path_id_or_uri else : uri = self . _client . build_uri ( id_or_uri ) + "/paths" return self . _client . get ( uri )
Gets all paths or a specific attachment path for the specified volume attachment .
62,647
def get_backup ( self , id_or_uri ) : uri = self . BACKUPS_PATH + '/' + extract_id_from_uri ( id_or_uri ) return self . _client . get ( id_or_uri = uri )
Get the details for the backup from an Artifact Bundle .
62,648
def download_archive_artifact_bundle ( self , id_or_uri , file_path ) : uri = self . BACKUP_ARCHIVE_PATH + '/' + extract_id_from_uri ( id_or_uri ) return self . _client . download ( uri , file_path )
Downloads an archive for the Artifact Bundle .
62,649
def download_artifact_bundle ( self , id_or_uri , file_path ) : uri = self . DOWNLOAD_PATH + '/' + extract_id_from_uri ( id_or_uri ) return self . _client . download ( uri , file_path )
Download the Artifact Bundle .
62,650
def create_backup ( self , resource , timeout = - 1 ) : return self . _client . create ( resource , uri = self . BACKUPS_PATH , timeout = timeout )
Creates a backup bundle with all the artifacts present on the appliance . At any given point only one backup bundle will exist on the appliance .
62,651
def upload_backup_bundle_from_file ( self , file_path , deployment_groups_id_or_uri ) : deployment_groups_uri = deployment_groups_id_or_uri if self . DEPLOYMENT_GROUPS_URI not in deployment_groups_id_or_uri : deployment_groups_uri = self . DEPLOYMENT_GROUPS_URI + deployment_groups_id_or_uri uri = self . BACKUP_ARCHIVE_PATH + "?deploymentGrpUri=" + deployment_groups_uri return self . _client . upload ( file_path , uri )
Restore an Artifact Bundle from a backup file .
62,652
def update ( self , resource , timeout = - 1 ) : return self . _client . update ( resource , timeout = timeout , default_values = self . DEFAULT_VALUES )
Updates only name for the Artifact Bundle .
62,653
def extract_bundle ( self , resource , timeout = - 1 ) : return self . _client . update ( resource , timeout = timeout , custom_headers = { "Content-Type" : "text/plain" } )
Extracts the existing bundle on the appliance and creates all the artifacts .
62,654
def extract_backup_bundle ( self , resource , timeout = - 1 ) : return self . _client . update ( resource , uri = self . BACKUP_ARCHIVE_PATH , timeout = timeout )
Extracts the existing backup bundle on the appliance and creates all the artifacts .
62,655
def stop_artifact_creation ( self , id_or_uri , task_uri ) : data = { "taskUri" : task_uri } uri = self . URI + '/' + extract_id_from_uri ( id_or_uri ) + self . STOP_CREATION_PATH return self . _client . update ( data , uri = uri )
Stops creation of the selected Artifact Bundle .
62,656
def get_script ( self ) : uri = "{}/script" . format ( self . data [ "uri" ] ) return self . _helper . do_get ( uri )
Gets the configuration script of the logical enclosure by ID or URI .
62,657
def update_script ( self , information , timeout = - 1 ) : uri = "{}/script" . format ( self . data [ "uri" ] ) return self . _helper . update ( information , uri = uri , timeout = timeout )
Updates the configuration script of the logical enclosure and on all enclosures in the logical enclosure with the specified ID .
62,658
def generate_support_dump ( self , information , timeout = - 1 ) : uri = "{}/support-dumps" . format ( self . data [ "uri" ] ) return self . _helper . create ( information , uri = uri , timeout = timeout )
Generates a support dump for the logical enclosure with the specified ID . A logical enclosure support dump includes content for logical interconnects associated with that logical enclosure . By default it also contains appliance support dump content .
62,659
def update_from_group ( self , data = None , timeout = - 1 ) : uri = "{}/updateFromGroup" . format ( self . data [ "uri" ] ) return self . _helper . update ( data , uri , timeout = timeout )
Use this action to make a logical enclosure consistent with the enclosure group when the logical enclosure is in the Inconsistent state .
62,660
def create_bulk ( self , resource , timeout = - 1 ) : uri = self . URI + '/bulk' default_values = self . _get_default_values ( self . BULK_DEFAULT_VALUES ) updated_data = self . _helper . update_resource_fields ( resource , default_values ) self . _helper . create ( updated_data , uri = uri , timeout = timeout ) return self . get_range ( resource [ 'namePrefix' ] , resource [ 'vlanIdRange' ] )
Creates bulk Ethernet networks .
62,661
def get_range ( self , name_prefix , vlan_id_range ) : filter = '"\'name\' matches \'{}\_%\'"' . format ( name_prefix ) ethernet_networks = self . get_all ( filter = filter , sort = 'vlanId:ascending' ) vlan_ids = self . dissociate_values_or_ranges ( vlan_id_range ) for net in ethernet_networks [ : ] : if int ( net [ 'vlanId' ] ) not in vlan_ids : ethernet_networks . remove ( net ) return ethernet_networks
Gets a list of Ethernet Networks that match the given name_prefix and the vlan_id_range .
62,662
def get_associated_profiles ( self ) : uri = "{}/associatedProfiles" . format ( self . data [ 'uri' ] ) return self . _helper . do_get ( uri )
Gets the URIs of profiles which are using an Ethernet network .
62,663
def get_associated_uplink_groups ( self ) : uri = "{}/associatedUplinkGroups" . format ( self . data [ 'uri' ] ) return self . _helper . do_get ( uri )
Gets the uplink sets which are using an Ethernet network .
62,664
def merge_resources ( resource1 , resource2 ) : merged = resource1 . copy ( ) merged . update ( resource2 ) return merged
Updates a copy of resource1 with resource2 values and returns the merged dictionary .
62,665
def merge_default_values ( resource_list , default_values ) : def merge_item ( resource ) : return merge_resources ( default_values , resource ) return lmap ( merge_item , resource_list )
Generate a new list where each item of original resource_list will be merged with the default_values .
62,666
def ensure_resource_data ( self , update_data = False ) : if not any ( key in self . data for key in self . UNIQUE_IDENTIFIERS ) : raise exceptions . HPOneViewMissingUniqueIdentifiers ( MISSING_UNIQUE_IDENTIFIERS ) if not update_data : return resource_data = None if 'uri' in self . UNIQUE_IDENTIFIERS and self . data . get ( 'uri' ) : resource_data = self . _helper . do_get ( self . data [ 'uri' ] ) else : for identifier in self . UNIQUE_IDENTIFIERS : identifier_value = self . data . get ( identifier ) if identifier_value : result = self . get_by ( identifier , identifier_value ) if result and isinstance ( result , list ) : resource_data = result [ 0 ] break if resource_data : self . data . update ( resource_data ) else : raise exceptions . HPOneViewResourceNotFound ( RESOURCE_DOES_NOT_EXIST )
Retrieves data from OneView and updates resource object .
62,667
def get_by ( self , field , value ) : if not field : logger . exception ( RESOURCE_CLIENT_INVALID_FIELD ) raise ValueError ( RESOURCE_CLIENT_INVALID_FIELD ) filter = "\"{0}='{1}'\"" . format ( field , value ) results = self . get_all ( filter = filter ) if "." not in field : results = [ item for item in results if str ( item . get ( field , "" ) ) . lower ( ) == value . lower ( ) ] return results
Get the resource by passing a field and its value .
62,668
def get_by_name ( self , name ) : result = self . get_by ( "name" , name ) if result : data = result [ 0 ] new_resource = self . new ( self . _connection , data ) else : new_resource = None return new_resource
Retrieves a resource by its name .
62,669
def get_by_uri ( self , uri ) : self . _helper . validate_resource_uri ( uri ) data = self . _helper . do_get ( uri ) if data : new_resource = self . new ( self . _connection , data ) else : new_resource = None return new_resource
Retrieves a resource by its URI
62,670
def _get_default_values ( self , default_values = None ) : if not default_values : default_values = self . DEFAULT_VALUES if default_values : api_version = str ( self . _connection . _apiVersion ) values = default_values . get ( api_version , { } ) . copy ( ) else : values = { } return values
Gets the default values set for a resource
62,671
def _merge_default_values ( self ) : values = self . _get_default_values ( ) for key , value in values . items ( ) : if not self . data . get ( key ) : self . data [ key ] = value
Merge default values with resource data .
62,672
def create_report ( self , uri , timeout = - 1 ) : logger . debug ( 'Creating Report (uri = %s)' . format ( uri ) ) task , _ = self . _connection . post ( uri , { } ) if not task : raise exceptions . HPOneViewException ( RESOURCE_CLIENT_TASK_EXPECTED ) task = self . _task_monitor . get_completed_task ( task , timeout ) return task [ 'taskOutput' ]
Creates a report and returns the output .
62,673
def build_query_uri ( self , uri = None , start = 0 , count = - 1 , filter = '' , query = '' , sort = '' , view = '' , fields = '' , scope_uris = '' ) : if filter : filter = self . make_query_filter ( filter ) if query : query = "&query=" + quote ( query ) if sort : sort = "&sort=" + quote ( sort ) if view : view = "&view=" + quote ( view ) if fields : fields = "&fields=" + quote ( fields ) if scope_uris : scope_uris = "&scopeUris=" + quote ( scope_uris ) path = uri if uri else self . _base_uri self . validate_resource_uri ( path ) symbol = '?' if '?' not in path else '&' uri = "{0}{1}start={2}&count={3}{4}{5}{6}{7}{8}{9}" . format ( path , symbol , start , count , filter , query , sort , view , fields , scope_uris ) return uri
Builds the URI from given parameters .
62,674
def build_uri ( self , id_or_uri ) : if not id_or_uri : logger . exception ( RESOURCE_CLIENT_INVALID_ID ) raise ValueError ( RESOURCE_CLIENT_INVALID_ID ) if "/" in id_or_uri : self . validate_resource_uri ( id_or_uri ) return id_or_uri else : return self . _base_uri + "/" + id_or_uri
Helps to build the URI from resource id and validate the URI .
62,675
def build_subresource_uri ( self , resource_id_or_uri = None , subresource_id_or_uri = None , subresource_path = '' ) : if subresource_id_or_uri and "/" in subresource_id_or_uri : return subresource_id_or_uri else : if not resource_id_or_uri : raise exceptions . HPOneViewValueError ( RESOURCE_ID_OR_URI_REQUIRED ) resource_uri = self . build_uri ( resource_id_or_uri ) uri = "{}/{}/{}" . format ( resource_uri , subresource_path , str ( subresource_id_or_uri or '' ) ) uri = uri . replace ( "//" , "/" ) if uri . endswith ( "/" ) : uri = uri [ : - 1 ] return uri
Helps to build a URI with resource path and its sub resource path .
62,676
def validate_resource_uri ( self , path ) : if self . _base_uri not in path : logger . exception ( 'Get by uri : unrecognized uri: (%s)' % path ) raise exceptions . HPOneViewUnknownType ( UNRECOGNIZED_URI )
Helper method to validate URI of the resource .
62,677
def do_requests_to_getall ( self , uri , requested_count ) : items = [ ] while uri : logger . debug ( 'Making HTTP request to get all resources. Uri: {0}' . format ( uri ) ) response = self . _connection . get ( uri ) members = self . get_members ( response ) items += members logger . debug ( "Response getAll: nextPageUri = {0}, members list length: {1}" . format ( uri , str ( len ( members ) ) ) ) uri = self . get_next_page ( response , items , requested_count ) logger . debug ( 'Total # of members found = {0}' . format ( str ( len ( items ) ) ) ) return items
Helps to make http request for get_all method .
62,678
def do_get ( self , uri ) : self . validate_resource_uri ( uri ) return self . _connection . get ( uri )
Helps to make get requests
62,679
def do_post ( self , uri , resource , timeout , custom_headers ) : self . validate_resource_uri ( uri ) task , entity = self . _connection . post ( uri , resource , custom_headers = custom_headers ) if not task : return entity return self . _task_monitor . wait_for_task ( task , timeout )
Helps to make post requests .
62,680
def do_put ( self , uri , resource , timeout , custom_headers ) : self . validate_resource_uri ( uri ) task , body = self . _connection . put ( uri , resource , custom_headers = custom_headers ) if not task : return body return self . _task_monitor . wait_for_task ( task , timeout )
Helps to make put requests .
62,681
def download ( self , uri , file_path ) : with open ( file_path , 'wb' ) as file : return self . _connection . download_to_stream ( file , uri )
Downloads the contents of the requested URI to a stream .
62,682
def build_query_uri ( self , start = 0 , count = - 1 , filter = '' , query = '' , sort = '' , view = '' , fields = '' , uri = None , scope_uris = '' ) : if filter : filter = self . __make_query_filter ( filter ) if query : query = "&query=" + quote ( query ) if sort : sort = "&sort=" + quote ( sort ) if view : view = "&view=" + quote ( view ) if fields : fields = "&fields=" + quote ( fields ) if scope_uris : scope_uris = "&scopeUris=" + quote ( scope_uris ) path = uri if uri else self . _uri self . __validate_resource_uri ( path ) symbol = '?' if '?' not in path else '&' uri = "{0}{1}start={2}&count={3}{4}{5}{6}{7}{8}{9}" . format ( path , symbol , start , count , filter , query , sort , view , fields , scope_uris ) return uri
Builds the URI given the parameters .
62,683
def upload ( self , file_path , uri = None , timeout = - 1 ) : if not uri : uri = self . _uri upload_file_name = os . path . basename ( file_path ) task , entity = self . _connection . post_multipart_with_response_handling ( uri , file_path , upload_file_name ) if not task : return entity return self . _task_monitor . wait_for_task ( task , timeout )
Makes a multipart request .
62,684
def get_by ( self , field , value , uri = None ) : if not field : logger . exception ( RESOURCE_CLIENT_INVALID_FIELD ) raise ValueError ( RESOURCE_CLIENT_INVALID_FIELD ) if not uri : uri = self . _uri self . __validate_resource_uri ( uri ) logger . debug ( 'Get by (uri = %s, field = %s, value = %s)' % ( uri , field , str ( value ) ) ) filter = "\"{0}='{1}'\"" . format ( field , value ) results = self . get_all ( filter = filter , uri = uri ) if "." not in field : results = [ item for item in results if str ( item . get ( field , '' ) ) . lower ( ) == value . lower ( ) ] return results
This function uses get_all passing a filter .
62,685
def get_by ( self , field , value ) : firmwares = self . get_all ( ) matches = [ ] for item in firmwares : if item . get ( field ) == value : matches . append ( item ) return matches
Gets the list of firmware baseline resources managed by the appliance . Optional parameters can be used to filter the list of resources returned .
62,686
def get_statistics ( self , id_or_uri , port_name = '' ) : uri = self . _client . build_uri ( id_or_uri ) + "/statistics" if port_name : uri = uri + "/" + port_name return self . _client . get ( uri )
Gets the statistics from an interconnect .
62,687
def get_subport_statistics ( self , id_or_uri , port_name , subport_number ) : uri = self . _client . build_uri ( id_or_uri ) + "/statistics/{0}/subport/{1}" . format ( port_name , subport_number ) return self . _client . get ( uri )
Gets the subport statistics on an interconnect .
62,688
def get_name_servers ( self , id_or_uri ) : uri = self . _client . build_uri ( id_or_uri ) + "/nameServers" return self . _client . get ( uri )
Gets the named servers for an interconnect .
62,689
def update_port ( self , port_information , id_or_uri , timeout = - 1 ) : uri = self . _client . build_uri ( id_or_uri ) + "/ports" return self . _client . update ( port_information , uri , timeout )
Updates an interconnect port .
62,690
def update_ports ( self , ports , id_or_uri , timeout = - 1 ) : resources = merge_default_values ( ports , { 'type' : 'port' } ) uri = self . _client . build_uri ( id_or_uri ) + "/update-ports" return self . _client . update ( resources , uri , timeout )
Updates the interconnect ports .
62,691
def reset_port_protection ( self , id_or_uri , timeout = - 1 ) : uri = self . _client . build_uri ( id_or_uri ) + "/resetportprotection" return self . _client . update_with_zero_body ( uri , timeout )
Triggers a reset of port protection .
62,692
def get_ports ( self , id_or_uri , start = 0 , count = - 1 ) : uri = self . _client . build_subresource_uri ( resource_id_or_uri = id_or_uri , subresource_path = "ports" ) return self . _client . get_all ( start , count , uri = uri )
Gets all interconnect ports .
62,693
def get_port ( self , id_or_uri , port_id_or_uri ) : uri = self . _client . build_subresource_uri ( id_or_uri , port_id_or_uri , "ports" ) return self . _client . get ( uri )
Gets an interconnect port .
62,694
def get_pluggable_module_information ( self , id_or_uri ) : uri = self . _client . build_uri ( id_or_uri ) + "/pluggableModuleInformation" return self . _client . get ( uri )
Gets all the pluggable module information .
62,695
def update_configuration ( self , id_or_uri , timeout = - 1 ) : uri = self . _client . build_uri ( id_or_uri ) + "/configuration" return self . _client . update_with_zero_body ( uri , timeout = timeout )
Reapplies the appliance s configuration on the interconnect . This includes running the same configure steps that were performed as part of the interconnect add by the enclosure .
62,696
def update ( self , resource , id_or_uri ) : return self . _client . update ( resource = resource , uri = id_or_uri )
Updates a registered Device Manager .
62,697
def add ( self , resource , provider_uri_or_id , timeout = - 1 ) : uri = self . _provider_client . build_uri ( provider_uri_or_id ) + "/device-managers" return self . _client . create ( resource = resource , uri = uri , timeout = timeout )
Adds a Device Manager under the specified provider .
62,698
def get_provider_uri ( self , provider_display_name ) : providers = self . _provider_client . get_by ( 'displayName' , provider_display_name ) return providers [ 0 ] [ 'uri' ] if providers else None
Gets uri for a specific provider .
62,699
def get_default_connection_info ( self , provider_name ) : provider = self . _provider_client . get_by_name ( provider_name ) if provider : return provider [ 'defaultConnectionInfo' ] else : return { }
Gets default connection info for a specific provider .