List Datacenters a package can be ordered in.

    Use the location Key Name to place orders
17512
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'],
                datacenter['location']['name'],
                region['description'],
                region['keyname']
            ])
    env.fout(table)
1031343
def avail_locations(call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The avail_locations function must be called with '
            '-f or --function, or with the --list-locations option'
        )

    # could also use the get_resources_nodes but speed is ~the same
    nodes = query('get', 'nodes')

    ret = {}
    for node in nodes:
        name = node['node']
        ret[name] = node

    return ret
1232062
def list_modifier_lists(location_id, opts = {})
      data, _status_code, _headers = list_modifier_lists_with_http_info(location_id, opts)
      return data
    end
551976
def list_datacenters(conn=None, call=None):
    '''
    
    '''
    if call != 'function':
        raise SaltCloudSystemExit(
            'The list_datacenters function must be called with '
            '-f or --function.'
        )

    datacenters = []

    if not conn:
        conn = get_conn()

    for item in conn.list_datacenters()['items']:
        datacenter = {'id': item['id']}
        datacenter.update(item['properties'])
        datacenters.append({item['properties']['name']: datacenter})

    return {'Datacenters': datacenters}
483565
def _get_location(self, datacenter_name):
        

        datacenters = self.client['Location'].getDataCenters()
        for datacenter in datacenters:
            if datacenter['name'] == datacenter_name:
                return datacenter['id']
        return 'FIRST_AVAILABLE'
1169528
def _cache_provider_details(conn=None):
    '''
    
    '''
    DETAILS['avail_locations'] = {}
    DETAILS['avail_sizes'] = {}
    DETAILS['avail_images'] = {}
    locations = avail_locations(conn)
    images = avail_images(conn)
    sizes = avail_sizes(conn)

    for key, location in six.iteritems(locations):
        DETAILS['avail_locations'][location['name']] = location
        DETAILS['avail_locations'][key] = location

    for key, image in six.iteritems(images):
        DETAILS['avail_images'][image['name']] = image
        DETAILS['avail_images'][key] = image

    for key, vm_size in six.iteritems(sizes):
        DETAILS['avail_sizes'][vm_size['name']] = vm_size
        DETAILS['avail_sizes'][key] = vm_size
1014813
def cli(env, sortby, datacenter):
    """"""
    file_manager = SoftLayer.FileStorageManager(env.client)
    mask = "mask[serviceResource[datacenter[name]],"\
           "replicationPartners[serviceResource[datacenter[name]]]]"
    file_volumes = file_manager.list_file_volumes(datacenter=datacenter,
                                                  mask=mask)

    datacenters = dict()
    for volume in file_volumes:
        service_resource = volume['serviceResource']
        if 'datacenter' in service_resource:
            datacenter_name = service_resource['datacenter']['name']
            if datacenter_name not in datacenters.keys():
                datacenters[datacenter_name] = 1
            else:
                datacenters[datacenter_name] += 1

    table = formatting.KeyValueTable(DEFAULT_COLUMNS)
    table.sortby = sortby
    for datacenter_name in datacenters:
        table.add_row([datacenter_name, datacenters[datacenter_name]])
    env.fout(table)
224205
def avail_locations(call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The avail_locations function must be called with '
            '-f or --function, or with the --list-locations option'
        )

    params = {'Action': 'DescribeRegions'}
    items = query(params=params)

    ret = {}
    for region in items['Regions']['Region']:
        ret[region['RegionId']] = {}
        for item in region:
            ret[region['RegionId']][item] = six.text_type(region[item])

    return ret
638017
def avail_locations(call=None):
    '''
    

    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The avail_locations function must be called with '
            '-f or --function, or with the --list-locations option.'
        )

    server, user, password = _get_xml_rpc()
    auth = ':'.join([user, password])
    host_pool = server.one.hostpool.info(auth)[1]

    locations = {}
    for host in _get_xml(host_pool):
        locations[host.find('NAME').text] = _xml_to_dict(host)

    return locations
904927
def list_locations(access_token, subscription_id):
    '''
    '''
    endpoint = ''.join([get_rm_endpoint(),
                        '/subscriptions/', subscription_id,
                        '/locations?api-version=', BASE_API])
    return do_get(endpoint, access_token)
1045963
def avail_locations(call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The avail_locations function must be called with '
            '-f or --function, or with the --list-locations option'
        )

    ret = {}
    conn = get_conn(service='SoftLayer_Product_Package')

    locations = conn.getLocations(id=50)
    for location in locations:
        ret[location['id']] = {
            'id': location['id'],
            'name': location['name'],
            'location': location['longName'],
        }

    available = conn.getAvailableLocations(id=50)
    for location in available:
        if location.get('isAvailable', 0) is 0:
            continue
        ret[location['locationId']]['available'] = True

    return ret
114470
def _get_location(self, regions, datacenter):
        """"""
        for region in regions:
            # list of locations
            if region['location']['location']['name'] == datacenter:
                return region

        raise SoftLayer.SoftLayerError("Could not find valid location for: '%s'" % datacenter)
922379
def cli(env, sortby, columns, datacenter, username, storage_type):
    """"""
    block_manager = SoftLayer.BlockStorageManager(env.client)
    block_volumes = block_manager.list_block_volumes(datacenter=datacenter,
                                                     username=username,
                                                     storage_type=storage_type,
                                                     mask=columns.mask())

    table = formatting.Table(columns.columns)
    table.sortby = sortby

    for block_volume in block_volumes:
        table.add_row([value or formatting.blank()
                       for value in columns.row(block_volume)])

    env.fout(table)
188870
def placeOrder(self, id, contract, order):
        """"""
        return _swigibpy.EClient_placeOrder(self, id, contract, order)
1120238
def cli(env):
    """"""

    hardware_manager = hardware.HardwareManager(env.client)
    options = hardware_manager.get_create_options()

    tables = []

    # Datacenters
    dc_table = formatting.Table(['datacenter', 'value'])
    dc_table.sortby = 'value'
    for location in options['locations']:
        dc_table.add_row([location['name'], location['key']])
    tables.append(dc_table)

    # Presets
    preset_table = formatting.Table(['size', 'value'])
    preset_table.sortby = 'value'
    for size in options['sizes']:
        preset_table.add_row([size['name'], size['key']])
    tables.append(preset_table)

    # Operating systems
    os_table = formatting.Table(['operating_system', 'value'])
    os_table.sortby = 'value'
    for operating_system in options['operating_systems']:
        os_table.add_row([operating_system['name'], operating_system['key']])
    tables.append(os_table)

    # Port speed
    port_speed_table = formatting.Table(['port_speed', 'value'])
    port_speed_table.sortby = 'value'
    for speed in options['port_speeds']:
        port_speed_table.add_row([speed['name'], speed['key']])
    tables.append(port_speed_table)

    # Extras
    extras_table = formatting.Table(['extras', 'value'])
    extras_table.sortby = 'value'
    for extra in options['extras']:
        extras_table.add_row([extra['name'], extra['key']])
    tables.append(extras_table)

    env.fout(formatting.listing(tables, separator='\n'))
708812
def avail_locations(call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The avail_locations function must be called with '
            '-f or --function, or with the --list-locations option'
        )

    ret = {}

    params = {'Action': 'DescribeRegions'}
    result = aws.query(params,
                       location=get_location(),
                       provider=get_provider(),
                       opts=__opts__,
                       sigver='4')

    for region in result:
        ret[region['regionName']] = {
            'name': region['regionName'],
            'endpoint': region['regionEndpoint'],
        }

    return ret
665369
def cli(env, sortby, columns, datacenter, username, storage_type):
    """"""
    file_manager = SoftLayer.FileStorageManager(env.client)
    file_volumes = file_manager.list_file_volumes(datacenter=datacenter,
                                                  username=username,
                                                  storage_type=storage_type,
                                                  mask=columns.mask())

    table = formatting.Table(columns.columns)
    table.sortby = sortby

    for file_volume in file_volumes:
        table.add_row([value or formatting.blank()
                       for value in columns.row(file_volume)])

    env.fout(table)