idx
int64
0
63k
question
stringlengths
61
4.03k
target
stringlengths
6
1.23k
45,500
def get_image ( self , image_id , ** kwargs ) : if 'mask' not in kwargs : kwargs [ 'mask' ] = IMAGE_MASK return self . vgbdtg . getObject ( id = image_id , ** kwargs )
Get details about an image .
45,501
def list_private_images ( self , guid = None , name = None , ** kwargs ) : if 'mask' not in kwargs : kwargs [ 'mask' ] = IMAGE_MASK _filter = utils . NestedDict ( kwargs . get ( 'filter' ) or { } ) if name : _filter [ 'privateBlockDeviceTemplateGroups' ] [ 'name' ] = ( utils . query_filter ( name ) ) if guid : _filter ...
List all private images .
45,502
def list_public_images ( self , guid = None , name = None , ** kwargs ) : if 'mask' not in kwargs : kwargs [ 'mask' ] = IMAGE_MASK _filter = utils . NestedDict ( kwargs . get ( 'filter' ) or { } ) if name : _filter [ 'name' ] = utils . query_filter ( name ) if guid : _filter [ 'globalIdentifier' ] = utils . query_filte...
List all public images .
45,503
def _get_ids_from_name_public ( self , name ) : results = self . list_public_images ( name = name ) return [ result [ 'id' ] for result in results ]
Get public images which match the given name .
45,504
def _get_ids_from_name_private ( self , name ) : results = self . list_private_images ( name = name ) return [ result [ 'id' ] for result in results ]
Get private images which match the given name .
45,505
def edit ( self , image_id , name = None , note = None , tag = None ) : obj = { } if name : obj [ 'name' ] = name if note : obj [ 'note' ] = note if obj : self . vgbdtg . editObject ( obj , id = image_id ) if tag : self . vgbdtg . setTags ( str ( tag ) , id = image_id ) return bool ( name or note or tag )
Edit image related details .
45,506
def import_image_from_uri ( self , name , uri , os_code = None , note = None , ibm_api_key = None , root_key_crn = None , wrapped_dek = None , cloud_init = False , byol = False , is_encrypted = False ) : if 'cos://' in uri : return self . vgbdtg . createFromIcos ( { 'name' : name , 'note' : note , 'operatingSystemRefer...
Import a new image from object storage .
45,507
def export_image_to_uri ( self , image_id , uri , ibm_api_key = None ) : if 'cos://' in uri : return self . vgbdtg . copyToIcos ( { 'uri' : uri , 'ibmApiKey' : ibm_api_key } , id = image_id ) else : return self . vgbdtg . copyToExternalSource ( { 'uri' : uri } , id = image_id )
Export image into the given object storage
45,508
def cli ( env , identifier , credential_id ) : mgr = SoftLayer . ObjectStorageManager ( env . client ) credential = mgr . delete_credential ( identifier , credential_id = credential_id ) env . fout ( credential )
Delete the credential of an Object Storage Account .
45,509
def list ( self ) : mask = results = self . client . call ( 'Account' , 'getReservedCapacityGroups' , mask = mask ) return results
List Reserved Capacities
45,510
def get_object ( self , identifier , mask = None ) : if mask is None : mask = "mask[instances[billingItem[item[keyName],category], guest], backendRouter[datacenter]]" result = self . client . call ( self . rcg_service , 'getObject' , id = identifier , mask = mask ) return result
Get a Reserved Capacity Group
45,511
def get_create_options ( self ) : mask = "mask[attributes,prices[pricingLocationGroup]]" results = self . ordering_manager . list_items ( self . capacity_package , mask = mask ) return results
List available reserved capacity plans
45,512
def get_available_routers ( self , dc = None ) : mask = "mask[locations]" package = self . ordering_manager . get_package_by_key ( self . capacity_package , mask = "id" ) regions = self . client . call ( 'Product_Package' , 'getRegions' , id = package [ 'id' ] , mask = mask , iter = True ) _filter = None routers = { } ...
Pulls down all backendRouterIds that are available
45,513
def create ( self , name , backend_router_id , flavor , instances , test = False ) : args = ( self . capacity_package , 0 , [ flavor ] ) extras = { "backendRouterId" : backend_router_id , "name" : name } kwargs = { 'extras' : extras , 'quantity' : instances , 'complex_type' : 'SoftLayer_Container_Product_Order_Virtual_...
Orders a Virtual_ReservedCapacityGroup
45,514
def create_guest ( self , capacity_id , test , guest_object ) : vs_manager = VSManager ( self . client ) mask = "mask[instances[id, billingItem[id, item[id,keyName]]], backendRouter[id, datacenter[name]]]" capacity = self . get_object ( capacity_id , mask = mask ) try : capacity_flavor = capacity [ 'instances' ] [ 0 ] ...
Turns an empty Reserve Capacity into a real Virtual Guest
45,515
def cli ( env ) : manager = CapacityManager ( env . client ) result = manager . list ( ) table = formatting . Table ( [ "ID" , "Name" , "Capacity" , "Flavor" , "Location" , "Created" ] , title = "Reserved Capacity" ) for r_c in result : occupied_string = "#" * int ( r_c . get ( 'occupiedInstanceCount' , 0 ) ) available...
List Reserved Capacity groups .
45,516
def cli ( env , package_keyname , location , preset , name , send_email , complex_type , extras , order_items ) : manager = ordering . OrderingManager ( env . client ) if extras : try : extras = json . loads ( extras ) except ValueError as err : raise exceptions . CLIAbort ( "There was an error when parsing the --extra...
Place a quote .
45,517
def cli ( env ) : table = formatting . Table ( [ 'Id' , 'Name' , 'Created' , 'Expiration' , 'Status' , 'Package Name' , 'Package Id' ] ) table . align [ 'Name' ] = 'l' table . align [ 'Package Name' ] = 'r' table . align [ 'Package Id' ] = 'l' manager = ordering . OrderingManager ( env . client ) items = manager . get_...
List all active quotes on an account
45,518
def cli ( env , identifier ) : image_mgr = SoftLayer . ImageManager ( env . client ) image_id = helpers . resolve_id ( image_mgr . resolve_ids , identifier , 'image' ) image_mgr . delete_image ( image_id )
Delete an image .
45,519
def cli ( env , identifier , enabled , port , weight , healthcheck_type , ip_address ) : mgr = SoftLayer . LoadBalancerManager ( env . client ) loadbal_id , group_id = loadbal . parse_id ( identifier ) ip_address_id = None if ip_address : ip_service = env . client [ 'Network_Subnet_IpAddress' ] ip_record = ip_service ....
Adds a new load balancer service .
45,520
def cli ( ctx , env ) : env = copy . deepcopy ( env ) env . load_modules_from_python ( routes . ALL_ROUTES ) env . aliases . update ( routes . ALL_ALIASES ) env . vars [ 'global_args' ] = ctx . parent . params env . vars [ 'is_shell' ] = True env . vars [ 'last_exit_code' ] = 0 app_path = click . get_app_dir ( 'softlay...
Enters a shell for slcli .
45,521
def get_env_args ( env ) : for arg , val in env . vars . get ( 'global_args' , { } ) . items ( ) : if val is True : yield '--%s' % arg elif isinstance ( val , int ) : for _ in range ( val ) : yield '--%s' % arg elif val is None : continue else : yield '--%s=%s' % ( arg , val )
Yield options to inject into the slcli command from the environment .
45,522
def cli ( env , identifier , purge ) : manager = PlacementManager ( env . client ) group_id = helpers . resolve_id ( manager . resolve_ids , identifier , 'placement_group' ) if purge : placement_group = manager . get_object ( group_id ) guest_list = ', ' . join ( [ guest [ 'fullyQualifiedDomainName' ] for guest in plac...
Delete a placement group .
45,523
def cli ( env , context_id , translation_id , static_ip , remote_ip , note ) : manager = SoftLayer . IPSECManager ( env . client ) succeeded = manager . update_translation ( context_id , translation_id , static_ip = static_ip , remote_ip = remote_ip , notes = note ) if succeeded : env . out ( 'Updated translation #{}' ...
Update an address translation for an IPSEC tunnel context .
45,524
def cli ( ctx , env ) : env . out ( "Welcome to the SoftLayer shell." ) env . out ( "" ) formatter = formatting . HelpFormatter ( ) commands = [ ] shell_commands = [ ] for name in cli_core . cli . list_commands ( ctx ) : command = cli_core . cli . get_command ( ctx , name ) if command . short_help is None : command . s...
Print shell help text .
45,525
def cli ( env , identifier , postinstall , key ) : hardware = SoftLayer . HardwareManager ( env . client ) hardware_id = helpers . resolve_id ( hardware . resolve_ids , identifier , 'hardware' ) key_list = [ ] if key : for single_key in key : resolver = SoftLayer . SshKeyManager ( env . client ) . resolve_ids key_id = ...
Reload operating system on a server .
45,526
def cli ( env , identifier , enabled , port , weight , healthcheck_type , ip_address ) : mgr = SoftLayer . LoadBalancerManager ( env . client ) loadbal_id , service_id = loadbal . parse_id ( identifier ) if ( ( not any ( [ ip_address , weight , port , healthcheck_type ] ) ) and enabled is None ) : raise exceptions . CL...
Edit the properties of a service group .
45,527
def cli ( env , sortby , datacenter , identifier , subnet_type , network_space , ipv4 , ipv6 ) : mgr = SoftLayer . NetworkManager ( env . client ) table = formatting . Table ( [ 'id' , 'identifier' , 'type' , 'network_space' , 'datacenter' , 'vlan_id' , 'IPs' , 'hardware' , 'vs' , ] ) table . sortby = sortby version = ...
List subnets .
45,528
def cli ( env , target , firewall_type , high_availability ) : mgr = SoftLayer . FirewallManager ( env . client ) if not env . skip_confirmations : if firewall_type == 'vlan' : pkg = mgr . get_dedicated_package ( ha_enabled = high_availability ) elif firewall_type == 'vs' : pkg = mgr . get_standard_package ( target , i...
Create new firewall .
45,529
def cli ( env , account_id , content_url ) : manager = SoftLayer . CDNManager ( env . client ) content_list = manager . purge_content ( account_id , content_url ) table = formatting . Table ( [ 'url' , 'status' ] ) for content in content_list : table . add_row ( [ content [ 'url' ] , content [ 'statusCode' ] ] ) env . ...
Purge cached files from all edge nodes .
45,530
def cli ( env , package_keyname ) : manager = ordering . OrderingManager ( env . client ) table = formatting . Table ( COLUMNS ) locations = manager . package_locations ( package_keyname ) for region in locations : for datacenter in region [ 'locations' ] : table . add_row ( [ datacenter [ 'location' ] [ 'id' ] , datac...
List Datacenters a package can be ordered in .
45,531
def cli ( env , abuse , address1 , address2 , city , company , country , firstname , lastname , postal , public , state ) : mgr = SoftLayer . NetworkManager ( env . client ) update = { 'abuse_email' : abuse , 'address1' : address1 , 'address2' : address2 , 'company_name' : company , 'city' : city , 'country' : country ...
Edit the RWhois data on the account .
45,532
def cli ( env , quote , ** args ) : table = formatting . Table ( [ 'Id' , 'Name' , 'Created' , 'Expiration' , 'Status' ] ) create_args = _parse_create_args ( env . client , args ) manager = ordering . OrderingManager ( env . client ) quote_details = manager . get_quote_details ( quote ) package = quote_details [ 'order...
View and Order a quote
45,533
def authorize_host_to_volume ( self , volume_id , hardware_ids = None , virtual_guest_ids = None , ip_address_ids = None , ** kwargs ) : host_templates = [ ] storage_utils . populate_host_templates ( host_templates , hardware_ids , virtual_guest_ids , ip_address_ids , None ) return self . client . call ( 'Network_Stora...
Authorizes hosts to Block Storage Volumes
45,534
def order_replicant_volume ( self , volume_id , snapshot_schedule , location , tier = None , os_type = None ) : block_mask = 'billingItem[activeChildren,hourlyFlag],' 'storageTierLevel,osType,staasVersion,' 'hasEncryptionAtRest,snapshotCapacityGb,schedules,' 'intervalSchedule,hourlySchedule,dailySchedule,' 'weeklySched...
Places an order for a replicant block volume .
45,535
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 .
45,536
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 .
45,537
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 .
45,538
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 .
45,539
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 .
45,540
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
45,541
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
45,542
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
45,543
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
45,544
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 .
45,545
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 .
45,546
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 .
45,547
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
45,548
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 .
45,549
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 .
45,550
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 .
45,551
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 .
45,552
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 .
45,553
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 .
45,554
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 .
45,555
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 .
45,556
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 .
45,557
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 .
45,558
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 .
45,559
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 .
45,560
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
45,561
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 .
45,562
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 .
45,563
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 .
45,564
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 .
45,565
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 .
45,566
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 .
45,567
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 .
45,568
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
45,569
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 .
45,570
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 .
45,571
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 .
45,572
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 .
45,573
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 .
45,574
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 .
45,575
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
45,576
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
45,577
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 .
45,578
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
45,579
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
45,580
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
45,581
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 .
45,582
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 .
45,583
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 .
45,584
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 .
45,585
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 .
45,586
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 .
45,587
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 .
45,588
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 .
45,589
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 .
45,590
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 .
45,591
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 .
45,592
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 .
45,593
def get_vlan ( self , vlan_id ) : return self . vlan . getObject ( id = vlan_id , mask = DEFAULT_GET_VLAN_MASK )
Returns information about a single VLAN .
45,594
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 .
45,595
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 .
45,596
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 .
45,597
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 .
45,598
def remove_securitygroup_rules ( self , group_id , rules ) : return self . security_group . removeRules ( rules , id = group_id )
Remove rules from a security group .
45,599
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