Update properties from resource in body of ``api_response``

        :type resource: dict
        :param resource: variable representation returned from the API.
553448
def _set_properties(self, resource):
        
        self._properties.clear()
        cleaned = resource.copy()
        if "name" in cleaned:
            self.name = variable_name_from_full_name(cleaned.pop("name"))
        self._properties.update(cleaned)
604010
def update(self, *args, **kwargs):
        
        if request.method == 'PUT':
            logging.warning("Called not implemented resource method PUT")

        resource = super(JsonServerResource, self).update(*args, **kwargs)

        if resource:
            return resource
        else:
            return NOT_FOUND
982775
def _get_resources(self, resource, obj, params=None, map=None, **kwargs):
        """"""
        r = self._http_resource('GET', resource, params=params)
        d_items = self._resource_deserialize(r.content.decode("utf-8"))

        items =  [obj.new_from_dict(item, h=self, **kwargs) for item in d_items]

        if map is None:
            map = KeyedListResource

        list_resource = map(items=items)
        list_resource._h = self
        list_resource._obj = obj
        list_resource._kwargs = kwargs

        return list_resource
980943
def _update_details(self,data):
        ''''''
        for api_name in self._properties:
            if api_name in data:
                setattr(self, "_" + api_name, data[api_name])
            else:
                # Only set to blank if not initialized
                try:
                    getattr(self, "_" + api_name)
                except AttributeError:
                    setattr(self, "_" + api_name, '')
128692
def to_swagger(self, bound_resource=None):
        
        response_def = _to_swagger(
            description=self.description,
            resource=bound_resource if self.resource is DefaultResource else self.resource,
        )
        status = self.status if self.status == 'default' else self.status.value
        return status, response_def
1295576
def edit(self, resource):
        
        schema = JobSchema(exclude=('id', 'status', 'options', 'package_name', 'config_name', 'device_name', 'result_id', 'user_id', 'created', 'updated', 'automatic', 'run_at'))
        json = self.service.encode(schema, resource)

        schema = JobSchema()
        resp = self.service.edit(self.base, resource.name, json)
        return self.service.decode(schema, resp)
90853
def _update_from_api_repr(self, resource):
        """"""
        self.destination = resource["destination"]
        self.filter_ = resource.get("filter")
        self._writer_identity = resource.get("writerIdentity")
979090
public static base_responses update(nitro_service client, Interface resources[]) throws Exception {
		base_responses result = null;
		if (resources != null && resources.length > 0) {
			Interface updateresources[] = new Interface[resources.length];
			for (int i=0;i<resources.length;i++){
				updateresources[i] = new Interface();
				updateresources[i].id = resources[i].id;
				updateresources[i].speed = resources[i].speed;
				updateresources[i].duplex = resources[i].duplex;
				updateresources[i].flowctl = resources[i].flowctl;
				updateresources[i].autoneg = resources[i].autoneg;
				updateresources[i].hamonitor = resources[i].hamonitor;
				updateresources[i].tagall = resources[i].tagall;
				updateresources[i].trunk = resources[i].trunk;
				updateresources[i].lacpmode = resources[i].lacpmode;
				updateresources[i].lacpkey = resources[i].lacpkey;
				updateresources[i].lagtype = resources[i].lagtype;
				updateresources[i].lacppriority = resources[i].lacppriority;
				updateresources[i].lacptimeout = resources[i].lacptimeout;
				updateresources[i].ifalias = resources[i].ifalias;
				updateresources[i].throughput = resources[i].throughput;
				updateresources[i].bandwidthhigh = resources[i].bandwidthhigh;
				updateresources[i].bandwidthnormal = resources[i].bandwidthnormal;
			}
			result = update_bulk_request(client, updateresources);
		}
		return result;
	}
318055
def set_properties_from_api_repr(self, resource):
        """"""
        self.name = resource.get("name")
        self.number = resource["projectNumber"]
        self.labels = resource.get("labels", {})
        self.status = resource["lifecycleState"]
        if "parent" in resource:
            self.parent = resource["parent"]
181429
def from_api_repr(cls, resource):
        
        name = resource.get("name")
        type_ = resource["parameterType"]["type"]
        value = resource["parameterValue"]["value"]
        converted = _QUERY_PARAMS_FROM_JSON[type_](value, None)
        return cls(name, type_, converted)
884799
def _update_response_location_header(self, resource):
        
        location = resource_to_url(resource, request=self.request)
        loc_hdr = ('Location', location)
        hdr_names = [hdr[0].upper() for hdr in self.request.response.headerlist]
        try:
            idx = hdr_names.index('LOCATION')
        except ValueError:
            self.request.response.headerlist.append(loc_hdr)
        else:
            # Replace existing location header.
            # FIXME: It is not clear under which conditions this happens, so
            #        we do not have a test for it yet.
            self.request.response.headerlist[idx] = loc_hdr
843159
def edit(self, resource):
        
        schema = self.EDIT_SCHEMA
        json = self.service.encode(schema, resource)

        schema = self.GET_SCHEMA
        resp = self.service.edit(self.base, resource.id, json)
        return self.service.decode(schema, resp)
380432
def _set_properties(self, response):
        
        self._properties.clear()
        self._properties.update(response)
518835
def update_from_response(self, response):
        
        if 'Table' in response:
            self._dict.update(response['Table'])
        elif 'TableDescription' in response:
            self._dict.update(response['TableDescription'])
        if 'KeySchema' in self._dict:
            self._schema = Schema(self._dict['KeySchema'])
501163
def _generate_resource_dict(self):
        
        resource_dict = {}

        resource_dict['Type'] = self.resource_type

        if self.depends_on:
            resource_dict['DependsOn'] = self.depends_on

        resource_dict.update(self.resource_attributes)

        properties_dict = {}
        for name in self.property_types:
            value = getattr(self, name)
            if value is not None:
                properties_dict[name] = value

        resource_dict['Properties'] = properties_dict

        return resource_dict
955290
def _render_resource(self, resource):
        
        if not resource:
            return None
        # Must not render a resource that has same named
        # attributes as different model.
        if not isinstance(resource, self.model):
            raise TypeError(
                'Resource(s) type must be the same as the serializer model type.')

        top_level_members = {}
        try:
            top_level_members['id'] = str(getattr(resource, self.primary_key))
        except AttributeError:
            raise
        top_level_members['type'] = resource.__tablename__
        top_level_members['attributes'] = self._render_attributes(resource)
        top_level_members['relationships'] = self._render_relationships(
                                                resource)
        return top_level_members
294878
def update_resource(resource, incoming_request):
    
    resource.from_dict(get_resource_data(incoming_request))
    _perform_database_action('merge', resource)
    return no_content_response()