Returns a resource instance.
199324
def _make_resource(self):
        
        with self._lock:
            for i in self._unavailable_range():
                if self._reference_queue[i] is None:
                    rtracker = _ResourceTracker(
                        self._factory(**self._factory_arguments))

                    self._reference_queue[i] = rtracker
                    self._size += 1

                    return rtracker

            raise PoolFullError
1286664
def _build_resource(self):
        """"""
        resource = {"name": self.name}

        if self.dns_name is not None:
            resource["dnsName"] = self.dns_name

        if self.description is not None:
            resource["description"] = self.description

        if self.name_server_set is not None:
            resource["nameServerSet"] = self.name_server_set

        return resource
1051547
def instance(cls, *args, **kwgs):
        """"""
        if not hasattr(cls, "_instance"):
            cls._instance = cls(*args, **kwgs)
        return cls._instance
1005970
def get(self, resource_id=None):
        
        if request.path.endswith('meta'):
            return self._meta()

        if resource_id is None:
            error_message = is_valid_method(self.__model__)
            if error_message:
                raise BadRequestException(error_message)

            if 'export' in request.args: 
                return self._export(self._all_resources())

            return flask.jsonify({
                self.__json_collection_name__: self._all_resources()
                })
        else:
            resource = self._resource(resource_id)
            error_message = is_valid_method(self.__model__, resource)
            if error_message:
                raise BadRequestException(error_message)
            return jsonify(resource)
1295580
@VisibleForTesting
	@Nullable
	public Instance getInstance(ResourceID resourceId) {
		for (Instance instance : allInstances) {
			if (Objects.equals(resourceId, instance.getTaskManagerID())) {
				return instance;
			}
		}
		return null;
	}
1112098
public function resource()
    {
        if (!is_resource($this->value)) {
            throw new InvalidResourceException($this->name, $this->value);
        }

        return $this;
    }
156578
def resource(self):
        
        if self._resource:
            return self._resource
        elif self.binding:
            return self.binding.resource
297048
def _resource(self, resource_id):
        
        resource = self.__model__.query.get(resource_id)
        if not resource:
            raise NotFoundException()
        return resource
21276
public Resource.Iterator get(Resource resource) {
		Integer key = Integer.valueOf(System.identityHashCode(resource));
		return map.get(key);
	}
733420
def _get_instance(self):
        """"""
        resource = self._connect()

        try:
            instance = resource.Instance(self.running_instance_id)
        except Exception:
            raise EC2CloudException(
                'Instance with ID: {instance_id} not found.'.format(
                    instance_id=self.running_instance_id
                )
            )
        return instance
1036162
public static Resource getResource(String resourceId)
    {
        for(Datatype datatype : miriam.getDatatype()) {
			for (Resource resource : getResources(datatype)) {
				if (resource.getId().equalsIgnoreCase(resourceId))
					return resource;
			}
        }
        
        throw new IllegalArgumentException("Resource not found : " + resourceId);
    }
48537
def retrieve(self):
        

        data = self.resource(self.id).get()
        self.data = data

        return data
877174
def open_resource(self, resource, *mode):
        
        return self.open(self.resource_name(resource), *mode)
714823
def get_instance(uri):
    """"""
    global _instances
    try:
        instance = _instances[uri]
    except KeyError:
        instance = MediaFile(
            uri,
            client.get_instance()
        )
        _instances[uri] = instance

    return instance
45745
def get(method, hmc, uri, uri_parms, logon_required):
        """"""
        try:
            resource = hmc.lookup_by_uri(uri)
        except KeyError:
            raise InvalidResourceError(method, uri)
        return resource.properties
1068620
def resource(self, *resources):
        
        resources = tuple(self.resources) + resources
        return Resource(self.client, resources)
361010
def _get_resource(resource, name=None, resource_id=None, region=None,
                  key=None, keyid=None, profile=None):
    '''
    
    '''

    if not _exactly_one((name, resource_id)):
        raise SaltInvocationError('One (but not both) of name or id must be '
                                  'provided.')

    conn = _get_conn(region=region, key=key, keyid=keyid, profile=profile)

    f = 'get_all_{0}'.format(resource)
    if not f.endswith('s'):
        f = f + 's'
    get_resources = getattr(conn, f)
    filter_parameters = {}

    if name:
        filter_parameters['filters'] = {'tag:Name': name}
    if resource_id:
        filter_parameters['{0}_ids'.format(resource)] = resource_id

    try:
        r = get_resources(**filter_parameters)
    except BotoServerError as e:
        if e.code.endswith('.NotFound'):
            return None
        raise

    if r:
        if len(r) == 1:
            if name:
                _cache_id(name, sub_resource=resource,
                          resource_id=r[0].id,
                          region=region,
                          key=key, keyid=keyid,
                          profile=profile)
            return r[0]
        else:
            raise CommandExecutionError('Found more than one '
                                        '{0} named "{1}"'.format(
                                            resource, name))
    else:
        return None