Get an instance of Api Vrf services facade.
185576
def create_api_vrf(self):
        """"""
        return ApiVrf(
            self.networkapi_url,
            self.user,
            self.password,
            self.user_ldap)
726505
def from_api(cls, api):
        
        ux = TodoUX(api)
        from .pseudorpc import PseudoRpc

        rpc = PseudoRpc(api)

        return cls({ViaAPI: api, ViaUX: ux, ViaRPC: rpc})
1114415
def _from_api_repr(cls, resource):
        """"""
        job_id = resource.get("jobId")
        project = resource.get("projectId")
        location = resource.get("location")
        job_ref = cls(job_id, project, location)
        return job_ref
772637
def get_network_instances(self, name=""):
        """"""

        output = self._show_vrf()
        vrfs = {}
        all_vrf_interfaces = {}
        for vrf in output:
            if (
                vrf.get("route_distinguisher", "") == "<not set>"
                or vrf.get("route_distinguisher", "") == "None"
            ):
                vrf["route_distinguisher"] = ""
            else:
                vrf["route_distinguisher"] = py23_compat.text_type(
                    vrf["route_distinguisher"]
                )
            interfaces = {}
            for interface_raw in vrf.get("interfaces", []):
                interface = interface_raw.split(",")
                for line in interface:
                    if line.strip() != "":
                        interfaces[py23_compat.text_type(line.strip())] = {}
                        all_vrf_interfaces[py23_compat.text_type(line.strip())] = {}

            vrfs[py23_compat.text_type(vrf["name"])] = {
                "name": py23_compat.text_type(vrf["name"]),
                "type": "L3VRF",
                "state": {"route_distinguisher": vrf["route_distinguisher"]},
                "interfaces": {"interface": interfaces},
            }
        all_interfaces = self.get_interfaces_ip().keys()
        vrfs["default"] = {
            "name": "default",
            "type": "DEFAULT_INSTANCE",
            "state": {"route_distinguisher": ""},
            "interfaces": {
                "interface": {
                    k: {} for k in all_interfaces if k not in all_vrf_interfaces.keys()
                }
            },
        }

        if name:
            if name in vrfs:
                return {py23_compat.text_type(name): vrfs[name]}
            return {}
        else:
            return vrfs
703288
def get_instance(self, payload):
        
        return UsageInstance(self._version, payload, account_sid=self._solution['account_sid'], )
684622
def get_current_vrfs(self):
        

        # Verify that all currently selected VRFs still exists
        cur_vrfs = session.get('current_vrfs', {}).items()
        if len(cur_vrfs) > 0:
            q = {
                'operator': 'equals',
                'val1': 'id',
                'val2': cur_vrfs[0][0]
            }

            if len(cur_vrfs) > 1:
                for vrf_id, vrf in cur_vrfs[1:]:
                    q = {
                        'operator': 'or',
                        'val1': q,
                        'val2': {
                            'operator': 'equals',
                            'val1': 'id',
                            'val2': vrf_id
                        }
                    }

            res = VRF.search(q)

            session['current_vrfs'] = {}
            for vrf in res['result']:
                session['current_vrfs'][vrf.id] = { 'id': vrf.id, 'rt': vrf.rt,
                    'name': vrf.name, 'description': vrf.description }

            session.save()

        return json.dumps(session.get('current_vrfs', {}))
1088649
def get_instance(self, payload):
        
        return ShortCodeInstance(self._version, payload, service_sid=self._solution['service_sid'], )
1056876
def get_instance(self, payload):
        
        return BuildInstance(self._version, payload, service_sid=self._solution['service_sid'], )
815281
def get_instance(self, payload):
        
        return WebhookInstance(
            self._version,
            payload,
            service_sid=self._solution['service_sid'],
            channel_sid=self._solution['channel_sid'],
        )
436982
def get_instance_type(self, port):
        """"""
        if port[portbindings.VNIC_TYPE] == portbindings.VNIC_BAREMETAL:
            return a_const.BAREMETAL_RESOURCE
        owner_to_type = {
            n_const.DEVICE_OWNER_DHCP: a_const.DHCP_RESOURCE,
            n_const.DEVICE_OWNER_DVR_INTERFACE: a_const.ROUTER_RESOURCE,
            trunk_consts.TRUNK_SUBPORT_OWNER: a_const.VM_RESOURCE}
        if port['device_owner'] in owner_to_type.keys():
            return owner_to_type[port['device_owner']]
        elif port['device_owner'].startswith(
                n_const.DEVICE_OWNER_COMPUTE_PREFIX):
            return a_const.VM_RESOURCE
        return None
420936
def list(cls, vrf=None):
        

        if vrf is None:
            vrf = {}

        xmlrpc = XMLRPCConnection()
        try:
            vrf_list = xmlrpc.connection.list_vrf(
                {
                    'vrf': vrf,
                    'auth': AuthOptions().options
                })
        except xmlrpclib.Fault as xml_fault:
            raise _fault_to_exception(xml_fault)

        res = list()
        for v in vrf_list:
            res.append(VRF.from_dict(v))

        return res
861663
async def get_instances(self, **kwargs) -> List[ApiResource]:
        """"""
        raw_resources = await self.get_resources(**kwargs)
        _instances = [
            self._resource_factory(_raw)
            for _raw in self._loop_raw(raw_resources)
        ]
        return _instances
466246
def get_api_endpoints(self, apiname):
        """"""
        try:
            return self.services_by_name\
                    .get(apiname)\
                    .get("endpoints")\
                    .copy()
        except AttributeError:
            raise Exception(f"Couldn't find the API endpoints")
1060695
def get_instance(self, payload):
        
        return UserInstance(self._version, payload, service_sid=self._solution['service_sid'], )
750222
def get_instance(self, payload):
        
        return CallInstance(self._version, payload, account_sid=self._solution['account_sid'], )
970695
def _api_get(self):
        
        json = self._client.get(type(self).api_endpoint, model=self)
        self._populate(json)
1165129
def get_instance(self, payload):
        
        return DefaultsInstance(self._version, payload, assistant_sid=self._solution['assistant_sid'], )