Returns the location of the specified datacenter.

        :param string datacenter_name: The datacenter to create
                                       the loadbalancer in

        :returns: the location id of the given datacenter
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'
467285
def get_location(conn, vm_):
    '''
    
    '''
    locations = conn.list_locations()
    # Default to Dallas if not otherwise set
    loc = config.get_cloud_config_value('location', vm_, __opts__, default=2)
    for location in locations:
        if six.text_type(loc) in (six.text_type(location.id), six.text_type(location.name)):
            return location
954085
def get_name_servers(self, id_or_uri):
        

        uri = self._client.build_uri(id_or_uri) + "/nameServers"
        return self._client.get(uri)
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}
182913
def get_router_table(routers):
    
    table = formatting.Table(['Datacenter', 'Hostname', 'Backend Router Id'], "Available Routers")
    for router in routers:
        datacenter = router['topLevelLocation']['longName']
        table.add_row([datacenter, router['hostname'], router['id']])
    return table
372754
def get_node(service_name, host_name):
    
    return common_pb2.Node(
        identifier=common_pb2.ProcessIdentifier(
            host_name=socket.gethostname() if host_name is None
            else host_name,
            pid=os.getpid(),
            start_timestamp=proto_ts_from_datetime(
                datetime.datetime.utcnow())),
        library_info=common_pb2.LibraryInfo(
            language=common_pb2.LibraryInfo.Language.Value('PYTHON'),
            exporter_version=EXPORTER_VERSION,
            core_library_version=opencensus_version),
        service_info=common_pb2.ServiceInfo(name=service_name))
1290378
def list_loadbalancers(call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudSystemExit(
            'The avail_images function must be called with '
            '-f or --function, or with the --list-loadbalancers option'
        )

    ret = {}
    conn = get_conn()
    datacenter = get_datacenter(conn)

    for item in conn.list_loadbalancers(datacenter['id'])['items']:
        lb = {'id': item['id']}
        lb.update(item['properties'])
        ret[lb['name']] = lb

    return ret
601662
def GetGroupUUID(group,alias=None,location=None):
		
		if alias is None:  alias = clc.v1.Account.GetAlias()
		if location is None:  location = clc.v1.Account.GetLocation()
		r = Group.GetGroups(location,alias)
		for row in r:
			if row['Name'] == group:  return(row['UUID'])
		else:
			if clc.args:  clc.v1.output.Status("ERROR",3,"Group %s not found in account %s datacenter %s" % (group,alias,location))
			raise Exception("Group not found")
1225071
def Datacenters(alias=None, session=None):
		
		if not alias:  alias = clc.v2.Account.GetAlias(session=session)

		datacenters = []
		for r in clc.v2.API.Call('GET','datacenters/%s' % alias,{}, session=session):
			datacenters.append(Datacenter(location=r['id'],name=r['name'],alias=alias,session=session))

		return(datacenters)
709635
def get_location(self, location, depth=0):
        
        if not location:
            return []
        if location in self.aliases:
            res = []
            if depth > MAXALIASDEPTH:
                err_exit('Maximum alias depth exceeded: %(location)s' % locals())
            for loc in self.aliases[location]:
                res.extend(self.get_location(loc, depth+1))
            return res
        if self.is_server(location):
            return [location]
        if location == 'pypi':
            err_exit('No configuration found for server: pypi\n'
                     'Please create a ~/.pypirc file')
        if self.urlparser.is_url(location):
            return [location]
        if not self.has_host(location) and self.distbase:
            return [self.join(self.distbase, location)]
        return [location]
655675
def _get_datacenter_name():
    '''
    
    '''

    proxy_type = __salt__['vsphere.get_proxy_type']()
    details = None
    if proxy_type == 'esxcluster':
        details = __salt__['esxcluster.get_details']()
    elif proxy_type == 'esxdatacenter':
        details = __salt__['esxdatacenter.get_details']()
    if not details:
        raise salt.exceptions.CommandExecutionError(
            'details for proxy type \'{0}\' not loaded'.format(proxy_type))
    return details['datacenter']
840512
def avail_locations(call=None):
    '''
    
    '''
    if call == 'action':
        raise SaltCloudException(
            'The avail_locations function must be called with -f or --function.'
        )

    response = _query('avail', 'datacenters')

    ret = {}
    for item in response['DATA']:
        name = item['LOCATION']
        ret[name] = item

    return ret
8384
def get_local_hypervisor(self):
        
        # Look up hypervisors available filtered by my hostname
        host = self.get_my_hostname()
        hyp = self.get_all_hypervisor_ids(filter_by_host=host)
        if hyp:
            return hyp[0]
190719
def get(self, **params):
        '''
        
        '''
        return self.client.get('/v1/reference-data/locations/{0}'
                               .format(self.location_id), **params)
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)
730955
private String getServerId() {
        UUID fullServerId = null;
        WsLocationAdmin locationService = this.wsLocationAdmin;
        if (locationService != null) {
            fullServerId = locationService.getServerId();
        }
        if (fullServerId == null) {
            fullServerId = UUID.randomUUID(); // shouldn't get here, but be careful just in case
        }
        return fullServerId.toString().toLowerCase(); // clone IDs need to be in lower case for consistency with tWAS
    }
1065078
def get(self, name):
        
        if name not in self.clusters:
            raise ClusterNotFound("Cluster %s not found." % name)
        return self.clusters.get(name)