def process_alerts_settings(host, username, passwd): config = Configuration() config.host = "https://" + host config.username = username config.password = passwd config.verify_ssl = False #If verify_ssl is true then the certificate file should me made available. #This avoids insecure request warnings. Make the certificate available as illustrated below #config.ssl_ca_cert = "C:/prox-cert-export.pem" #Create a client object to use with the above defined configuration. api_client = ApiClient() config.api_client = api_client diag_api = DiagnosticsApi(api_client) try: #Get the config info dev_alert_cfg = diag_api.get_alert_configuration( "1") # system_id=1 for embedded except ApiException as ae: print("There was an exception: {}.".format(ae.reason)) sys.exit() print dev_alert_cfg print "---------------------" #Now Update config info #Populate the required fileds as necessary and then call update_asup_configuration() #The below example is for illustration only. change/populate updt_req fileds as necessary. updt_req = DeviceAlertConfiguration() updt_req.alerting_enabled = False updt_req.email_sender_address = "" updt_req.email_server_address = "" updt_req.send_additional_contact_information = False updt_req.additional_contact_information = "" updt_req.recipient_email_addresses = [] try: #Update config info config_resp = diag_api.update_alert_configuration("1", updt_req) except ApiException as ae: print("There was an exception: {}.".format(ae.reason)) sys.exit()
def process_asup_settings(host, username, passwd): config = Configuration() config.host = "https://" + host config.username = username config.password = passwd config.verify_ssl = False #If verify_ssl is true then the certificate file should me made available. #This avoids insecure request warnings. Make the certificate available as illustrated below #config.ssl_ca_cert = "C:/prox-cert-export.pem" #Create a client object to use with the above defined configuration. api_client = ApiClient() config.api_client = api_client dev_asup = DeviceASUPApi(api_client) try: #Get the config info dev_asup_config = dev_asup.get_asup_configuration() except ApiException as ae: print("There was an exception: {}.".format(ae.reason)) sys.exit() print dev_asup_config print "---------------------" #Now Update config info #Populate the required fileds as necessary and then call update_asup_configuration() #The below example is for illustration only. change/populate asup_updt_req fileds as necessary. asup_updt_req = DeviceAsupUpdateRequest() asup_updt_req.asup_enabled = True try: #Update config info asup_resp = dev_asup.update_asup_configuration(body=asup_updt_req) except ApiException as ae: print("There was an exception: {}.".format(ae.reason)) sys.exit()
sys.exit() # This will disable warnings for unverified HTTPS requests. # This is not recommended, but added here to clean up output. urllib3.disable_warnings() # Create a configuration object and set the appropriate parameters api_configuration = Configuration() api_configuration.password = args.password api_configuration.host = args.proxy # For demonstration purposes, let's disable SSL verification api_configuration.verify_ssl = False # Now create the generic ApiClient object # The ApiClient will utilize the Configuration object automatically client = ApiClient() # remove this prior to release #print("client:\n{}".format(client.__dict__)) storage_api = StorageSystemsApi() # remove this prior to release #print("storage_api: \n{}".format(storage_api.__dict__)) diagnostics_api = DiagnosticsApi() data_request = SupportDataRequest() # type, filename data_request.type = "supportBundle" data_request.filename = "sampledata" try: initial_response = diagnostics_api.start_support_data_retrieval_request( args.systemid, body=data_request) except ApiException: print("An error occurred retrieving the support bundle.") sys.exit()
from netapp.santricity.api.v2.volumes_api import VolumesApi from netapp.santricity.api.v2.hardware_api import HardwareApi from netapp.santricity.models.v2.drive_selection_request import DriveSelectionRequest from netapp.santricity.models.v2.storage_pool_create_request import StoragePoolCreateRequest from netapp.santricity.models.v2.volume_create_request import VolumeCreateRequest from netapp.santricity.models.v2.volume_mapping_create_request import VolumeMappingCreateRequest from pprint import pprint import csv config = Configuration() config.host = "http://<E-Series Address>:18080" config.username = "******" config.password = "******" api_client = ApiClient() config.api_client = api_client storage_system = StorageSystemsApi(api_client=api_client) ssr = storage_system.get_all_storage_systems() print ssr vol_api = VolumesApi(api_client=api_client) file = open('multipath.conf', 'w') file.write('multipaths {\n') vol_a = vol_api.get_all_volumes( system_id='1c57c70c-bc5f-4f8c-a6a7-34cdb2cafc3a')