Gets a single exchange which requires a vhost and name.

        :param string vhost: The vhost containing the target exchange
        :param string name: The name of the exchange
        :returns: dict
7723
def get_exchange(self, vhost, name):
        
        vhost = quote(vhost, '')
        name = quote(name, '')
        path = Client.urls['exchange_by_name'] % (vhost, name)
        exch = self._call(path, 'GET')
        return exch
971494
def exchange_reference(root_url, service, version):
    """"""
    root_url = root_url.rstrip('/')
    if root_url == OLD_ROOT_URL:
        return 'https://references.taskcluster.net/{}/{}/exchanges.json'.format(service, version)
    else:
        return '{}/references/{}/{}/exchanges.json'.format(root_url, service, version)
1029566
public static vpntrafficpolicy_binding get(nitro_service service, String name) throws Exception{
		vpntrafficpolicy_binding obj = new vpntrafficpolicy_binding();
		obj.set_name(name);
		vpntrafficpolicy_binding response = (vpntrafficpolicy_binding) obj.get_resource(service);
		return response;
	}
964379
def _get_vm(name=None, session=None):
    '''
    
    '''
    if session is None:
        session = _get_session()
    vms = session.xenapi.VM.get_by_name_label(name)
    if len(vms) == 1:
        return vms[0]
    return None
852510
def get_vcenter_vm_uuid_by_name(host, user, password, vm_name):
    
    vc = VcenterInterface(host, user, password)
    vmi = VmInterface(vc, vm_name)
    return vmi.get_instance_uuid()
1130180
public List<BindingInfo> getBindingsBySource(String vhost, String exchange) {
    final String x = exchange.equals("") ? "amq.default" : exchange;
    final URI uri = uriWithPath("./exchanges/" + encodePathSegment(vhost) +
        "/" + encodePathSegment(x) + "/bindings/source");
    return Arrays.asList(this.rt.getForObject(uri, BindingInfo[].class));
  }
529938
def vhost_exists(name, runas=None):
    '''
    
    '''
    if runas is None and not salt.utils.platform.is_windows():
        runas = salt.utils.user.get_user()
    return name in list_vhosts(runas=runas)
1108912
def getheader(self, name, default=None):
        
        return self.response.headers.get(name, default)
477291
public function destinationBindings($vhost, $name)
    {
        return $this->client->send(sprintf('/api/exchanges/%s/%s/bindings/destination', urlencode($vhost), urlencode($name)));
    }
461293
def create_vhost(self, name, tracing=False):
        
        data = {'tracing': True} if tracing else {}
        self._api_put(
            '/api/vhosts/{0}'.format(urllib.parse.quote_plus(name)),
            data=data,
        )
851948
def get_by_name(self, name):
        
        scopes = self._client.get_all()
        result = [x for x in scopes if x['name'] == name]
        return result[0] if result else None
271764
def get_vm_by_name(content, name, regex=False):
    '''
    
    '''
    return get_object_by_name(content, vim.VirtualMachine, name, regex)
786911
def get_exchanges(self, vhost=None):
        
        if vhost:
            vhost = quote(vhost, '')
            path = Client.urls['exchanges_by_vhost'] % vhost
        else:
            path = Client.urls['all_exchanges']

        exchanges = self._call(path, 'GET')
        return exchanges
357523
def _parse_hostname(self):
        
        value = 'localhost'
        match = re.search(r'^hostname ([^\s]+)$', self.config, re.M)
        if match:
            value = match.group(1)
        return dict(hostname=value)
1313307
def get_name(default: str = 'no name set'):
    
    try:
        with open('/etc/machine-info') as emi:
            contents = emi.read()
    except OSError:
        LOG.exception(
            "Couldn't read /etc/machine-info")
        contents = ''
    for line in contents.split('\n'):
        if line.startswith('PRETTY_HOSTNAME='):
            return '='.join(line.split('=')[1:])
    LOG.warning(f"No PRETTY_HOSTNAME in {contents}, defaulting to {default}")
    try:
        _update_pretty_hostname(default)
    except OSError:
        LOG.exception("Could not write new pretty hostname!")
    return default
379029
def host(name, ip4=True, ip6=True, **kwargs):
    '''
    
    '''
    res = {}
    if ip6:
        ip6 = lookup(name, 'AAAA', **kwargs)
        if ip6:
            res['ip6'] = ip6
    if ip4:
        ip4 = lookup(name, 'A', **kwargs)
        if ip4:
            res['ip4'] = ip4

    return res
254446
def get_name(self):
        
        if not self.is_tpl():
            try:
                return self.host_name
            except AttributeError:  # outch, no hostname
                return 'UNNAMEDHOST'
        else:
            try:
                return self.name
            except AttributeError:  # outch, no name for this template
                return 'UNNAMEDHOSTTEMPLATE'