idx int64 0 252k | question stringlengths 48 5.28k | target stringlengths 5 1.23k |
|---|---|---|
234,400 | def order_duplicate_volume ( self , origin_volume_id , origin_snapshot_id = None , duplicate_size = None , duplicate_iops = None , duplicate_tier_level = None , duplicate_snapshot_size = None , hourly_billing_flag = False ) : block_mask = 'id,billingItem[location,hourlyFlag],snapshotCapacityGb,' 'storageType[keyName],c... | Places an order for a duplicate block volume . |
234,401 | def order_modified_volume ( self , volume_id , new_size = None , new_iops = None , new_tier_level = None ) : mask_items = [ 'id' , 'billingItem' , 'storageType[keyName]' , 'capacityGb' , 'provisionedIops' , 'storageTierLevel' , 'staasVersion' , 'hasEncryptionAtRest' , ] block_mask = ',' . join ( mask_items ) volume = s... | Places an order for modifying an existing block volume . |
234,402 | def order_block_volume ( self , storage_type , location , size , os_type , iops = None , tier_level = None , snapshot_size = None , service_offering = 'storage_as_a_service' , hourly_billing_flag = False ) : order = storage_utils . prepare_volume_order_object ( self , storage_type , location , size , iops , tier_level ... | Places an order for a block volume . |
234,403 | def create_snapshot ( self , volume_id , notes = '' , ** kwargs ) : return self . client . call ( 'Network_Storage' , 'createSnapshot' , notes , id = volume_id , ** kwargs ) | Creates a snapshot on the given block volume . |
234,404 | def order_snapshot_space ( self , volume_id , capacity , tier , upgrade , ** kwargs ) : block_mask = 'id,billingItem[location,hourlyFlag],' 'storageType[keyName],storageTierLevel,provisionedIops,' 'staasVersion,hasEncryptionAtRest' block_volume = self . get_block_volume_details ( volume_id , mask = block_mask , ** kwar... | Orders snapshot space for the given block volume . |
234,405 | def enable_snapshots ( self , volume_id , schedule_type , retention_count , minute , hour , day_of_week , ** kwargs ) : return self . client . call ( 'Network_Storage' , 'enableSnapshots' , schedule_type , retention_count , minute , hour , day_of_week , id = volume_id , ** kwargs ) | Enables snapshots for a specific block volume at a given schedule |
234,406 | def disable_snapshots ( self , volume_id , schedule_type ) : return self . client . call ( 'Network_Storage' , 'disableSnapshots' , schedule_type , id = volume_id ) | Disables snapshots for a specific block volume at a given schedule |
234,407 | def list_volume_schedules ( self , volume_id ) : volume_detail = self . client . call ( 'Network_Storage' , 'getObject' , id = volume_id , mask = 'schedules[type,properties[type]]' ) return utils . lookup ( volume_detail , 'schedules' ) | Lists schedules for a given volume |
234,408 | def restore_from_snapshot ( self , volume_id , snapshot_id ) : return self . client . call ( 'Network_Storage' , 'restoreFromSnapshot' , snapshot_id , id = volume_id ) | Restores a specific volume from a snapshot |
234,409 | def cancel_block_volume ( self , volume_id , reason = 'No longer needed' , immediate = False ) : block_volume = self . get_block_volume_details ( volume_id , mask = 'mask[id,billingItem[id,hourlyFlag]]' ) if 'billingItem' not in block_volume : raise exceptions . SoftLayerError ( "Block Storage was already cancelled" ) ... | Cancels the given block storage volume . |
234,410 | def failover_to_replicant ( self , volume_id , replicant_id , immediate = False ) : return self . client . call ( 'Network_Storage' , 'failoverToReplicant' , replicant_id , immediate , id = volume_id ) | Failover to a volume replicant . |
234,411 | def failback_from_replicant ( self , volume_id , replicant_id ) : return self . client . call ( 'Network_Storage' , 'failbackFromReplicant' , replicant_id , id = volume_id ) | Failback from a volume replicant . |
234,412 | def set_credential_password ( self , access_id , password ) : return self . client . call ( 'Network_Storage_Allowed_Host' , 'setCredentialPassword' , password , id = access_id ) | Sets the password for an access host |
234,413 | def create_or_update_lun_id ( self , volume_id , lun_id ) : return self . client . call ( 'Network_Storage' , 'createOrUpdateLunId' , lun_id , id = volume_id ) | Set the LUN ID on a volume . |
234,414 | def cli ( env , sortby ) : mgr = SoftLayer . NetworkManager ( env . client ) datacenters = mgr . summary_by_datacenter ( ) table = formatting . Table ( COLUMNS ) table . sortby = sortby for name , datacenter in datacenters . items ( ) : table . add_row ( [ name , datacenter [ 'hardware_count' ] , datacenter [ 'virtual_... | Account summary . |
234,415 | def get_packages_of_type ( self , package_types , mask = None ) : _filter = { 'type' : { 'keyName' : { 'operation' : 'in' , 'options' : [ { 'name' : 'data' , 'value' : package_types } ] , } , } , } packages = self . package_svc . getAllObjects ( mask = mask , filter = _filter ) packages = self . filter_outlet_packages ... | Get packages that match a certain type . |
234,416 | def filter_outlet_packages ( packages ) : non_outlet_packages = [ ] for package in packages : if all ( [ 'OUTLET' not in package . get ( 'description' , '' ) . upper ( ) , 'OUTLET' not in package . get ( 'name' , '' ) . upper ( ) ] ) : non_outlet_packages . append ( package ) return non_outlet_packages | Remove packages designated as OUTLET . |
234,417 | def get_only_active_packages ( packages ) : active_packages = [ ] for package in packages : if package [ 'isActive' ] : active_packages . append ( package ) return active_packages | Return only active packages . |
234,418 | def get_package_by_type ( self , package_type , mask = None ) : packages = self . get_packages_of_type ( [ package_type ] , mask ) if len ( packages ) == 0 : return None else : return packages . pop ( ) | Get a single package of a given type . |
234,419 | def get_package_id_by_type ( self , package_type ) : mask = "mask[id, name, description, isActive, type[keyName]]" package = self . get_package_by_type ( package_type , mask ) if package : return package [ 'id' ] else : raise ValueError ( "No package found for type: " + package_type ) | Return the package ID of a Product Package with a given type . |
234,420 | def get_quotes ( self ) : mask = "mask[order[id,items[id,package[id,keyName]]]]" quotes = self . client [ 'Account' ] . getActiveQuotes ( mask = mask ) return quotes | Retrieve a list of active quotes . |
234,421 | def get_quote_details ( self , quote_id ) : mask = "mask[order[id,items[package[id,keyName]]]]" quote = self . client [ 'Billing_Order_Quote' ] . getObject ( id = quote_id , mask = mask ) return quote | Retrieve quote details . |
234,422 | def get_order_container ( self , quote_id ) : quote = self . client [ 'Billing_Order_Quote' ] container = quote . getRecalculatedOrderContainer ( id = quote_id ) return container | Generate an order container from a quote object . |
234,423 | def generate_order_template ( self , quote_id , extra , quantity = 1 ) : if not isinstance ( extra , dict ) : raise ValueError ( "extra is not formatted properly" ) container = self . get_order_container ( quote_id ) container [ 'quantity' ] = quantity for key in extra . keys ( ) : container [ key ] = extra [ key ] ret... | Generate a complete order template . |
234,424 | def verify_quote ( self , quote_id , extra ) : container = self . generate_order_template ( quote_id , extra ) clean_container = { } for key in container . keys ( ) : if container . get ( key ) != '' : clean_container [ key ] = container [ key ] return self . client . call ( 'SoftLayer_Billing_Order_Quote' , 'verifyOrd... | Verifies that a quote order is valid . |
234,425 | def order_quote ( self , quote_id , extra ) : container = self . generate_order_template ( quote_id , extra ) return self . client . call ( 'SoftLayer_Billing_Order_Quote' , 'placeOrder' , container , id = quote_id ) | Places an order using a quote |
234,426 | def get_package_by_key ( self , package_keyname , mask = None ) : _filter = { 'keyName' : { 'operation' : package_keyname } } packages = self . package_svc . getAllObjects ( mask = mask , filter = _filter ) if len ( packages ) == 0 : raise exceptions . SoftLayerError ( "Package {} does not exist" . format ( package_key... | Get a single package with a given key . |
234,427 | def list_categories ( self , package_keyname , ** kwargs ) : get_kwargs = { } get_kwargs [ 'mask' ] = kwargs . get ( 'mask' , CATEGORY_MASK ) if 'filter' in kwargs : get_kwargs [ 'filter' ] = kwargs [ 'filter' ] package = self . get_package_by_key ( package_keyname , mask = 'id' ) categories = self . package_svc . getC... | List the categories for the given package . |
234,428 | def list_items ( self , package_keyname , ** kwargs ) : get_kwargs = { } get_kwargs [ 'mask' ] = kwargs . get ( 'mask' , ITEM_MASK ) if 'filter' in kwargs : get_kwargs [ 'filter' ] = kwargs [ 'filter' ] package = self . get_package_by_key ( package_keyname , mask = 'id' ) items = self . package_svc . getItems ( id = pa... | List the items for the given package . |
234,429 | def list_packages ( self , ** kwargs ) : get_kwargs = { } get_kwargs [ 'mask' ] = kwargs . get ( 'mask' , PACKAGE_MASK ) if 'filter' in kwargs : get_kwargs [ 'filter' ] = kwargs [ 'filter' ] packages = self . package_svc . getAllObjects ( ** get_kwargs ) return [ package for package in packages if package [ 'isActive' ... | List active packages . |
234,430 | def list_presets ( self , package_keyname , ** kwargs ) : get_kwargs = { } get_kwargs [ 'mask' ] = kwargs . get ( 'mask' , PRESET_MASK ) if 'filter' in kwargs : get_kwargs [ 'filter' ] = kwargs [ 'filter' ] package = self . get_package_by_key ( package_keyname , mask = 'id' ) acc_presets = self . package_svc . getAccou... | Gets active presets for the given package . |
234,431 | def get_preset_by_key ( self , package_keyname , preset_keyname , mask = None ) : preset_operation = '_= %s' % preset_keyname _filter = { 'activePresets' : { 'keyName' : { 'operation' : preset_operation } } , 'accountRestrictedActivePresets' : { 'keyName' : { 'operation' : preset_operation } } } presets = self . list_p... | Gets a single preset with the given key . |
234,432 | def get_price_id_list ( self , package_keyname , item_keynames , core = None ) : mask = 'id, itemCategory, keyName, prices[categories]' items = self . list_items ( package_keyname , mask = mask ) prices = [ ] category_dict = { "gpu0" : - 1 , "pcie_slot0" : - 1 } for item_keyname in item_keynames : try : matching_item =... | Converts a list of item keynames to a list of price IDs . |
234,433 | def get_item_price_id ( core , prices ) : price_id = None for price in prices : if not price [ 'locationGroupId' ] : capacity_min = int ( price . get ( 'capacityRestrictionMinimum' , - 1 ) ) capacity_max = int ( price . get ( 'capacityRestrictionMaximum' , - 1 ) ) if capacity_min == - 1 or core is None : price_id = pri... | get item price id |
234,434 | def get_preset_prices ( self , preset ) : mask = 'mask[prices[item]]' prices = self . package_preset . getObject ( id = preset , mask = mask ) return prices | Get preset item prices . |
234,435 | def get_item_prices ( self , package_id ) : mask = 'mask[pricingLocationGroup[locations]]' prices = self . package_svc . getItemPrices ( id = package_id , mask = mask ) return prices | Get item prices . |
234,436 | def verify_order ( self , package_keyname , location , item_keynames , complex_type = None , hourly = True , preset_keyname = None , extras = None , quantity = 1 ) : order = self . generate_order ( package_keyname , location , item_keynames , complex_type = complex_type , hourly = hourly , preset_keyname = preset_keyna... | Verifies an order with the given package and prices . |
234,437 | def place_order ( self , package_keyname , location , item_keynames , complex_type = None , hourly = True , preset_keyname = None , extras = None , quantity = 1 ) : order = self . generate_order ( package_keyname , location , item_keynames , complex_type = complex_type , hourly = hourly , preset_keyname = preset_keynam... | Places an order with the given package and prices . |
234,438 | def place_quote ( self , package_keyname , location , item_keynames , complex_type = None , preset_keyname = None , extras = None , quantity = 1 , quote_name = None , send_email = False ) : order = self . generate_order ( package_keyname , location , item_keynames , complex_type = complex_type , hourly = False , preset... | Place a quote with the given package and prices . |
234,439 | def generate_order ( self , package_keyname , location , item_keynames , complex_type = None , hourly = True , preset_keyname = None , extras = None , quantity = 1 ) : container = { } order = { } extras = extras or { } package = self . get_package_by_key ( package_keyname , mask = 'id' ) order . update ( extras ) order... | Generates an order with the given package and prices . |
234,440 | def package_locations ( self , package_keyname ) : mask = "mask[description, keyname, locations]" package = self . get_package_by_key ( package_keyname , mask = 'id' ) regions = self . package_svc . getRegions ( id = package [ 'id' ] , mask = mask ) return regions | List datacenter locations for a package keyname |
234,441 | def get_location_id ( self , location ) : if isinstance ( location , int ) : return location mask = "mask[id,name,regions[keyname]]" if match ( r'[a-zA-Z]{3}[0-9]{2}' , location ) is not None : search = { 'name' : { 'operation' : location } } else : search = { 'regions' : { 'keyname' : { 'operation' : location } } } da... | Finds the location ID of a given datacenter |
234,442 | def add_global_ip ( self , version = 4 , test_order = False ) : return self . add_subnet ( 'global' , version = version , test_order = test_order ) | Adds a global IP address to the account . |
234,443 | def add_securitygroup_rule ( self , group_id , remote_ip = None , remote_group = None , direction = None , ethertype = None , port_max = None , port_min = None , protocol = None ) : rule = { 'direction' : direction } if ethertype is not None : rule [ 'ethertype' ] = ethertype if port_max is not None : rule [ 'portRange... | Add a rule to a security group |
234,444 | def add_securitygroup_rules ( self , group_id , rules ) : if not isinstance ( rules , list ) : raise TypeError ( "The rules provided must be a list of dictionaries" ) return self . security_group . addRules ( rules , id = group_id ) | Add rules to a security group |
234,445 | def add_subnet ( self , subnet_type , quantity = None , vlan_id = None , version = 4 , test_order = False ) : package = self . client [ 'Product_Package' ] category = 'sov_sec_ip_addresses_priv' desc = '' if version == 4 : if subnet_type == 'global' : quantity = 0 category = 'global_ipv4' elif subnet_type == 'public' :... | Orders a new subnet |
234,446 | def assign_global_ip ( self , global_ip_id , target ) : return self . client [ 'Network_Subnet_IpAddress_Global' ] . route ( target , id = global_ip_id ) | Assigns a global IP address to a specified target . |
234,447 | def attach_securitygroup_components ( self , group_id , component_ids ) : return self . security_group . attachNetworkComponents ( component_ids , id = group_id ) | Attaches network components to a security group . |
234,448 | def cancel_global_ip ( self , global_ip_id ) : service = self . client [ 'Network_Subnet_IpAddress_Global' ] ip_address = service . getObject ( id = global_ip_id , mask = 'billingItem' ) billing_id = ip_address [ 'billingItem' ] [ 'id' ] return self . client [ 'Billing_Item' ] . cancelService ( id = billing_id ) | Cancels the specified global IP address . |
234,449 | def cancel_subnet ( self , subnet_id ) : subnet = self . get_subnet ( subnet_id , mask = 'id, billingItem.id' ) if "billingItem" not in subnet : raise exceptions . SoftLayerError ( "subnet %s can not be cancelled" " " % subnet_id ) billing_id = subnet [ 'billingItem' ] [ 'id' ] return self . client [ 'Billing_Item' ] .... | Cancels the specified subnet . |
234,450 | def create_securitygroup ( self , name = None , description = None ) : create_dict = { 'name' : name , 'description' : description } return self . security_group . createObject ( create_dict ) | Creates a security group . |
234,451 | def detach_securitygroup_components ( self , group_id , component_ids ) : return self . security_group . detachNetworkComponents ( component_ids , id = group_id ) | Detaches network components from a security group . |
234,452 | def edit_rwhois ( self , abuse_email = None , address1 = None , address2 = None , city = None , company_name = None , country = None , first_name = None , last_name = None , postal_code = None , private_residence = None , state = None ) : update = { } for key , value in [ ( 'abuseEmail' , abuse_email ) , ( 'address1' ,... | Edit rwhois record . |
234,453 | def edit_securitygroup ( self , group_id , name = None , description = None ) : successful = False obj = { } if name : obj [ 'name' ] = name if description : obj [ 'description' ] = description if obj : successful = self . security_group . editObject ( obj , id = group_id ) return successful | Edit security group details . |
234,454 | def edit_securitygroup_rule ( self , group_id , rule_id , remote_ip = None , remote_group = None , direction = None , ethertype = None , port_max = None , port_min = None , protocol = None ) : successful = False obj = { } if remote_ip is not None : obj [ 'remoteIp' ] = remote_ip if remote_group is not None : obj [ 'rem... | Edit a security group rule . |
234,455 | def ip_lookup ( self , ip_address ) : obj = self . client [ 'Network_Subnet_IpAddress' ] return obj . getByIpAddress ( ip_address , mask = 'hardware, virtualGuest' ) | Looks up an IP address and returns network information about it . |
234,456 | def get_securitygroup ( self , group_id , ** kwargs ) : if 'mask' not in kwargs : kwargs [ 'mask' ] = ( 'id,' 'name,' 'description,' ) return self . security_group . getObject ( id = group_id , ** kwargs ) | Returns the information about the given security group . |
234,457 | def get_subnet ( self , subnet_id , ** kwargs ) : if 'mask' not in kwargs : kwargs [ 'mask' ] = DEFAULT_SUBNET_MASK return self . subnet . getObject ( id = subnet_id , ** kwargs ) | Returns information about a single subnet . |
234,458 | def get_vlan ( self , vlan_id ) : return self . vlan . getObject ( id = vlan_id , mask = DEFAULT_GET_VLAN_MASK ) | Returns information about a single VLAN . |
234,459 | def list_global_ips ( self , version = None , identifier = None , ** kwargs ) : if 'mask' not in kwargs : mask = [ 'destinationIpAddress[hardware, virtualGuest]' , 'ipAddress' ] kwargs [ 'mask' ] = ',' . join ( mask ) _filter = utils . NestedDict ( { } ) if version : ver = utils . query_filter ( version ) _filter [ 'gl... | Returns a list of all global IP address records on the account . |
234,460 | def list_subnets ( self , identifier = None , datacenter = None , version = 0 , subnet_type = None , network_space = None , ** kwargs ) : if 'mask' not in kwargs : kwargs [ 'mask' ] = DEFAULT_SUBNET_MASK _filter = utils . NestedDict ( kwargs . get ( 'filter' ) or { } ) if identifier : _filter [ 'subnets' ] [ 'networkId... | Display a list of all subnets on the account . |
234,461 | def list_vlans ( self , datacenter = None , vlan_number = None , name = None , ** kwargs ) : _filter = utils . NestedDict ( kwargs . get ( 'filter' ) or { } ) if vlan_number : _filter [ 'networkVlans' ] [ 'vlanNumber' ] = ( utils . query_filter ( vlan_number ) ) if name : _filter [ 'networkVlans' ] [ 'name' ] = utils .... | Display a list of all VLANs on the account . |
234,462 | def list_securitygroup_rules ( self , group_id ) : return self . security_group . getRules ( id = group_id , iter = True ) | List security group rules associated with a security group . |
234,463 | def remove_securitygroup_rules ( self , group_id , rules ) : return self . security_group . removeRules ( rules , id = group_id ) | Remove rules from a security group . |
234,464 | def get_event_logs_by_request_id ( self , request_id ) : unfiltered_logs = self . _get_cci_event_logs ( ) + self . _get_security_group_event_logs ( ) filtered_logs = [ ] for unfiltered_log in unfiltered_logs : try : metadata = json . loads ( unfiltered_log [ 'metaData' ] ) if 'requestId' in metadata : if metadata [ 're... | Gets all event logs by the given request id |
234,465 | def summary_by_datacenter ( self ) : datacenters = collections . defaultdict ( lambda : { 'hardware_count' : 0 , 'public_ip_count' : 0 , 'subnet_count' : 0 , 'virtual_guest_count' : 0 , 'vlan_count' : 0 , } ) for vlan in self . list_vlans ( ) : name = utils . lookup ( vlan , 'primaryRouter' , 'datacenter' , 'name' ) da... | Summary of the networks on the account grouped by data center . |
234,466 | def _list_global_ips_by_identifier ( self , identifier ) : results = self . list_global_ips ( identifier = identifier , mask = 'id' ) return [ result [ 'id' ] for result in results ] | Returns a list of IDs of the global IP matching the identifier . |
234,467 | def _list_subnets_by_identifier ( self , identifier ) : identifier = identifier . split ( '/' , 1 ) [ 0 ] results = self . list_subnets ( identifier = identifier , mask = 'id' ) return [ result [ 'id' ] for result in results ] | Returns a list of IDs of the subnet matching the identifier . |
234,468 | def cli ( env , columns , sortby , volume_id ) : file_storage_manager = SoftLayer . FileStorageManager ( env . client ) legal_volumes = file_storage_manager . get_replication_partners ( volume_id ) if not legal_volumes : click . echo ( "There are no replication partners for the given volume." ) else : table = formattin... | List existing replicant volumes for a file volume . |
234,469 | def get_ticket_results ( mgr , ticket_id , update_count = 1 ) : ticket = mgr . get_ticket ( ticket_id ) table = formatting . KeyValueTable ( [ 'name' , 'value' ] ) table . align [ 'name' ] = 'r' table . align [ 'value' ] = 'l' table . add_row ( [ 'id' , ticket [ 'id' ] ] ) table . add_row ( [ 'title' , ticket [ 'title'... | Get output about a ticket . |
234,470 | def cli ( env , network , quantity , vlan_id , ipv6 , test ) : mgr = SoftLayer . NetworkManager ( env . client ) if not ( test or env . skip_confirmations ) : if not formatting . confirm ( "This action will incur charges on your " "account. Continue?" ) : raise exceptions . CLIAbort ( 'Cancelling order.' ) version = 4 ... | Add a new subnet to your account . Valid quantities vary by type . |
234,471 | def list_tickets ( self , open_status = True , closed_status = True ) : mask = call = 'getTickets' if not all ( [ open_status , closed_status ] ) : if open_status : call = 'getOpenTickets' elif closed_status : call = 'getClosedTickets' else : raise ValueError ( "open_status and closed_status cannot both be False" ) ret... | List all tickets . |
234,472 | def create_ticket ( self , title = None , body = None , subject = None , priority = None ) : current_user = self . account . getCurrentUser ( ) new_ticket = { 'subjectId' : subject , 'contents' : body , 'assignedUserId' : current_user [ 'id' ] , 'title' : title , } if priority is not None : new_ticket [ 'priority' ] = ... | Create a new ticket . |
234,473 | def update_ticket ( self , ticket_id = None , body = None ) : return self . ticket . addUpdate ( { 'entry' : body } , id = ticket_id ) | Update a ticket . |
234,474 | def upload_attachment ( self , ticket_id = None , file_path = None , file_name = None ) : file_content = None with open ( file_path , 'rb' ) as attached_file : file_content = attached_file . read ( ) file_object = { "filename" : file_name , "data" : file_content } return self . ticket . addAttachedFile ( file_object , ... | Upload an attachment to a ticket . |
234,475 | def attach_hardware ( self , ticket_id = None , hardware_id = None ) : return self . ticket . addAttachedHardware ( hardware_id , id = ticket_id ) | Attach hardware to a ticket . |
234,476 | def attach_virtual_server ( self , ticket_id = None , virtual_id = None ) : return self . ticket . addAttachedVirtualGuest ( virtual_id , id = ticket_id ) | Attach a virtual server to a ticket . |
234,477 | def detach_hardware ( self , ticket_id = None , hardware_id = None ) : return self . ticket . removeAttachedHardware ( hardware_id , id = ticket_id ) | Detach hardware from a ticket . |
234,478 | def detach_virtual_server ( self , ticket_id = None , virtual_id = None ) : return self . ticket . removeAttachedVirtualGuest ( virtual_id , id = ticket_id ) | Detach a virtual server from a ticket . |
234,479 | def cli ( env , identifier , no_vs , no_hardware ) : mgr = SoftLayer . NetworkManager ( env . client ) subnet_id = helpers . resolve_id ( mgr . resolve_subnet_ids , identifier , name = 'subnet' ) subnet = mgr . get_subnet ( subnet_id ) table = formatting . KeyValueTable ( [ 'name' , 'value' ] ) table . align [ 'name' ]... | Get subnet details . |
234,480 | def cli ( env , zonefile , dry_run ) : manager = SoftLayer . DNSManager ( env . client ) with open ( zonefile ) as zone_f : zone_contents = zone_f . read ( ) zone , records , bad_lines = parse_zone_details ( zone_contents ) env . out ( "Parsed: zone=%s" % zone ) for record in records : env . out ( "Parsed: %s" % RECORD... | Import zone based off a BIND zone file . |
234,481 | def parse_zone_details ( zone_contents ) : records = [ ] bad_lines = [ ] zone_lines = [ line . strip ( ) for line in zone_contents . split ( '\n' ) ] zone_search = re . search ( r'^\$ORIGIN (?P<zone>.*)\.' , zone_lines [ 0 ] ) zone = zone_search . group ( 'zone' ) for line in zone_lines [ 1 : ] : record_search = re . s... | Parses a zone file into python data - structures . |
234,482 | def cli ( env ) : mgr = SoftLayer . ObjectStorageManager ( env . client ) accounts = mgr . list_accounts ( ) table = formatting . Table ( [ 'id' , 'name' , 'apiType' ] ) table . sortby = 'id' api_type = None for account in accounts : if 'vendorName' in account and account [ 'vendorName' ] == 'Swift' : api_type = 'Swift... | List object storage accounts . |
234,483 | def cli ( env , zone ) : manager = SoftLayer . DNSManager ( env . client ) manager . create_zone ( zone ) | Create a zone . |
234,484 | def cli ( env , billing_id , datacenter ) : mgr = SoftLayer . LoadBalancerManager ( env . client ) if not formatting . confirm ( "This action will incur charges on your " "account. Continue?" ) : raise exceptions . CLIAbort ( 'Aborted.' ) mgr . add_local_lb ( billing_id , datacenter = datacenter ) env . fout ( "Load ba... | Adds a load balancer given the id returned from create - options . |
234,485 | def cli ( env , identifier ) : mgr = SoftLayer . LoadBalancerManager ( env . client ) loadbal_id , group_id = loadbal . parse_id ( identifier ) mgr . reset_service_group ( loadbal_id , group_id ) env . fout ( 'Load balancer service group connections are being reset!' ) | Reset connections on a certain service group . |
234,486 | def cli ( env , identifier , path , name ) : mgr = SoftLayer . TicketManager ( env . client ) ticket_id = helpers . resolve_id ( mgr . resolve_ids , identifier , 'ticket' ) if path is None : raise exceptions . ArgumentError ( "Missing argument --path" ) if not os . path . exists ( path ) : raise exceptions . ArgumentEr... | Adds an attachment to an existing ticket . |
234,487 | def has_firewall ( vlan ) : return bool ( vlan . get ( 'dedicatedFirewallFlag' , None ) or vlan . get ( 'highAvailabilityFirewallFlag' , None ) or vlan . get ( 'firewallInterfaces' , None ) or vlan . get ( 'firewallNetworkComponents' , None ) or vlan . get ( 'firewallGuestNetworkComponents' , None ) ) | Helper to determine whether or not a VLAN has a firewall . |
234,488 | def get_standard_package ( self , server_id , is_virt = True ) : firewall_port_speed = self . _get_fwl_port_speed ( server_id , is_virt ) _value = "%s%s" % ( firewall_port_speed , "Mbps Hardware Firewall" ) _filter = { 'items' : { 'description' : utils . query_filter ( _value ) } } return self . prod_pkg . getItems ( i... | Retrieves the standard firewall package for the virtual server . |
234,489 | def get_dedicated_package ( self , ha_enabled = False ) : fwl_filter = 'Hardware Firewall (Dedicated)' ha_fwl_filter = 'Hardware Firewall (High Availability)' _filter = utils . NestedDict ( { } ) if ha_enabled : _filter [ 'items' ] [ 'description' ] = utils . query_filter ( ha_fwl_filter ) else : _filter [ 'items' ] [ ... | Retrieves the dedicated firewall package . |
234,490 | def cancel_firewall ( self , firewall_id , dedicated = False ) : fwl_billing = self . _get_fwl_billing_item ( firewall_id , dedicated ) billing_item_service = self . client [ 'Billing_Item' ] return billing_item_service . cancelService ( id = fwl_billing [ 'id' ] ) | Cancels the specified firewall . |
234,491 | def add_vlan_firewall ( self , vlan_id , ha_enabled = False ) : package = self . get_dedicated_package ( ha_enabled ) product_order = { 'complexType' : 'SoftLayer_Container_Product_Order_Network_' 'Protection_Firewall_Dedicated' , 'quantity' : 1 , 'packageId' : 0 , 'vlanId' : vlan_id , 'prices' : [ { 'id' : package [ 0... | Creates a firewall for the specified vlan . |
234,492 | def _get_fwl_billing_item ( self , firewall_id , dedicated = False ) : mask = 'mask[id,billingItem[id]]' if dedicated : firewall_service = self . client [ 'Network_Vlan_Firewall' ] else : firewall_service = self . client [ 'Network_Component_Firewall' ] firewall = firewall_service . getObject ( id = firewall_id , mask ... | Retrieves the billing item of the firewall . |
234,493 | def _get_fwl_port_speed ( self , server_id , is_virt = True ) : fwl_port_speed = 0 if is_virt : mask = ( 'primaryNetworkComponent[maxSpeed]' ) svc = self . client [ 'Virtual_Guest' ] primary = svc . getObject ( mask = mask , id = server_id ) fwl_port_speed = primary [ 'primaryNetworkComponent' ] [ 'maxSpeed' ] else : m... | Determines the appropriate speed for a firewall . |
234,494 | def get_firewalls ( self ) : mask = ( 'firewallNetworkComponents,' 'networkVlanFirewall,' 'dedicatedFirewallFlag,' 'firewallGuestNetworkComponents,' 'firewallInterfaces,' 'firewallRules,' 'highAvailabilityFirewallFlag' ) return [ firewall for firewall in self . account . getNetworkVlans ( mask = mask ) if has_firewall ... | Returns a list of all firewalls on the account . |
234,495 | def get_standard_fwl_rules ( self , firewall_id ) : svc = self . client [ 'Network_Component_Firewall' ] return svc . getRules ( id = firewall_id , mask = RULE_MASK ) | Get the rules of a standard firewall . |
234,496 | def edit_dedicated_fwl_rules ( self , firewall_id , rules ) : mask = ( 'mask[networkVlan[firewallInterfaces' '[firewallContextAccessControlLists]]]' ) svc = self . client [ 'Network_Vlan_Firewall' ] fwl = svc . getObject ( id = firewall_id , mask = mask ) network_vlan = fwl [ 'networkVlan' ] for fwl1 in network_vlan [ ... | Edit the rules for dedicated firewall . |
234,497 | def edit_standard_fwl_rules ( self , firewall_id , rules ) : rule_svc = self . client [ 'Network_Firewall_Update_Request' ] template = { 'networkComponentFirewallId' : firewall_id , 'rules' : rules } return rule_svc . createObject ( template ) | Edit the rules for standard firewall . |
234,498 | def cli ( env , identifier , name , note , tag ) : image_mgr = SoftLayer . ImageManager ( env . client ) data = { } if name : data [ 'name' ] = name if note : data [ 'note' ] = note if tag : data [ 'tag' ] = tag image_id = helpers . resolve_id ( image_mgr . resolve_ids , identifier , 'image' ) if not image_mgr . edit (... | Edit details of an image . |
234,499 | def cli ( env , identifier , hardware_identifier , virtual_identifier ) : ticket_mgr = SoftLayer . TicketManager ( env . client ) if hardware_identifier and virtual_identifier : raise exceptions . ArgumentError ( "Cannot attach hardware and a virtual server at the same time" ) if hardware_identifier : hardware_mgr = So... | Attach devices to a ticket . |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.