Edit image related details.

        :param int image_id: The ID of the image
        :param string name: Name of the Image.
        :param string note: Note of the image.
        :param string tag: Tags of the image to be updated to.
196661
def edit(self, image_id, name=None, note=None, tag=None):
        
        obj = {}
        if name:
            obj['name'] = name
        if note:
            obj['note'] = note
        if obj:
            self.vgbdtg.editObject(obj, id=image_id)
        if tag:
            self.vgbdtg.setTags(str(tag), id=image_id)

        return bool(name or note or tag)
831556
def image(id, options={})
      params = options
      get(surl('image') + id, params).body
    end
1133518
def add_image(image)
      raise ArgumentError, "Invalid argument 'image'. Expected Image, got #{image.class}." unless image.is_a?(Image)
      @images << image unless @frame.image(image.uid)
      @slices[image.uid] = image.pos_slice
      @image_positions[image.pos_slice.round(2)] = image
      @sop_uids[image.pos_slice] = image.uid
      # The link between image uid and image instance is kept in the Frame, instead of the ImageSeries:
      @frame.add_image(image) unless @frame.image(image.uid)
    end
63051
def generate_img_id(profile, ext=None, label=None, tmp=False):
    
    if ext and not ext.startswith('.'):
        ext = '.' + ext
    if label:
        label = re.sub(r'[^a-z0-9_\-]', '', label, flags=re.I)
        label = re.sub(r'_+', '_', label)
        label = label[:60]
    return '{profile}:{tmp}{dtstr}_{rand}{label}{ext}'.format(
        profile=profile,
        tmp=(dju_settings.DJU_IMG_UPLOAD_TMP_PREFIX if tmp else ''),
        dtstr=datetime_to_dtstr(),
        rand=get_random_string(4, 'abcdefghijklmnopqrstuvwxyz0123456789'),
        label=(('_' + label) if label else ''),
        ext=(ext or ''),
    )
106839
def image_list(id=None, profile=None, name=None):  # pylint: disable=C0103
    '''
    
    '''
    g_client = _auth(profile)
    ret = []
    for image in g_client.images.list():
        if id is None and name is None:
            _add_image(ret, image)
        else:
            if id is not None and id == image.id:
                _add_image(ret, image)
                return ret
            if name == image.name:
                if name in ret and CUR_VER < BORON:
                    # Not really worth an exception
                    return {
                        'result': False,
                        'comment':
                            'More than one image with '
                            'name "{0}"'.format(name)
                        }
                _add_image(ret, image)
    log.debug('Returning images: %s', ret)
    return ret
393945
def add_attribute(self, tag, name, value):
        
        self.add_tag(tag)
        d = self._tags[tag]
        d[name] = value
867414
def delete_image(self, image_id):

        '''
            
        '''

        title = '%s.delete_image' % self.__class__.__name__

    # validate inputs
        input_fields = {
            'image_id': image_id
        }
        for key, value in input_fields.items():
            object_title = '%s(%s=%s)' % (title, key, str(value))
            self.fields.validate(value, '.%s' % key, object_title)

    # report query
        self.iam.printer('Removing image %s from AWS region %s.' % (image_id, self.iam.region_name))

    # retrieve state
        old_state = self.check_image_state(image_id)

    # discover snapshot id and tags associated with instance id
        image_details = self.read_image(image_id)
        tag_list = image_details['tags']
        snapshot_id = image_details['snapshot_id']

    # remove tags from instance
        try:
            delete_kwargs = {
                'Resources': [ image_id ],
                'Tags': self.iam.prepare(tag_list)
            }
            self.connection.delete_tags(**delete_kwargs)
            self.iam.printer('Tags have been deleted from %s.' % image_id)
        except:
            raise AWSConnectionError(title)

    # deregister image
        try:
            self.connection.deregister_image(
                ImageId=image_id
            )
        except:
            raise AWSConnectionError(title)
        self.iam.printer('Image %s has been deregistered.' % image_id)

    # delete snapshot
        try:
            response = self.connection.delete_snapshot(
                SnapshotId=snapshot_id
            )
        except:
            raise AWSConnectionError(title)
        self.iam.printer('Snapshot %s associated with image %s has been deleted.' % (snapshot_id, image_id))

        return response
748044
def image_present(name):
    '''
    
    '''
    ret = {'name': name,
           'changes': {},
           'result': None,
           'comment': ''}

    if _is_docker_uuid(name) and __salt__['imgadm.docker_to_uuid'](name):
        # docker image was imported
        ret['result'] = True
        ret['comment'] = 'image {0} ({1}) is present'.format(
            name,
            __salt__['imgadm.docker_to_uuid'](name),
        )
    elif name in __salt__['imgadm.list']():
        # image was already imported
        ret['result'] = True
        ret['comment'] = 'image {0} is present'.format(name)
    else:
        # add image
        if _is_docker_uuid(name):
            # NOTE: we cannot query available docker images
            available_images = [name]
        else:
            available_images = __salt__['imgadm.avail']()

        if name in available_images:
            if __opts__['test']:
                ret['result'] = True
                res = {}
                if _is_docker_uuid(name):
                    res['00000000-0000-0000-0000-000000000000'] = name
                else:
                    res[name] = available_images[name]
            else:
                res = __salt__['imgadm.import'](name)
                if _is_uuid(name):
                    ret['result'] = (name in res)
                elif _is_docker_uuid(name):
                    ret['result'] = __salt__['imgadm.docker_to_uuid'](name) is not None
            if ret['result']:
                ret['comment'] = 'image {0} imported'.format(name)
                ret['changes'] = res
            else:
                ret['comment'] = 'image {0} was unable to be imported'.format(name)
        else:
            ret['result'] = False
            ret['comment'] = 'image {0} does not exists'.format(name)

    return ret
1081987
def update(self, newinfo):
        ''''''
        self.imgstr = newinfo.imgstr
        self.width = newinfo.width
        self.height = newinfo.height
        if self.imgpanel is not None:
            self.imgpanel.set_image(self.img())
54957
def update_tag(self, name):
        # The `_tag` is to avoid conflicts with MutableMapping.update.
        
        api = self.doapi_manager
        return api._tag(api.request(self.url, method='PUT',
                                    data={"name": name})["tag"])
295410
def tag_image(self, image_id, tag_list):

        '''
            
        '''

        title = '%s.tag_image' % self.__class__.__name__

    # validate inputs
        input_fields = {
            'image_id': image_id,
            'tag_list': tag_list
        }
        for key, value in input_fields.items():
            object_title = '%s(%s=%s)' % (title, key, str(value))
            self.fields.validate(value, '.%s' % key, object_title)
    
    # retrieve tag list of image
        self.iam.printer_on = False
        image_details = self.read_image(image_id)
        self.iam.printer_on = True
        old_tags = image_details['tags']
    
    # determine tags to remove
        delete_list = []
        tag_map = {}
        for tag in tag_list:
            tag_map[tag['key']] = tag['value']
        for tag in old_tags:
            if tag['key'] not in tag_map.keys():
                delete_list.append(tag)
            elif tag['value'] != tag_map[tag['key']]:
                delete_list.append(tag)

    # convert tag list to camelcase
        delete_list = self.iam.prepare(delete_list)
        tag_list = self.iam.prepare(tag_list)
    
    # remove tags from instance
        if delete_list:
            try:
                delete_kwargs = {
                    'Resources': [ image_id ],
                    'Tags': delete_list
                }
                self.connection.delete_tags(**delete_kwargs)
            except:
                AWSConnectionError(title)
            
    # tag instance with updated tags
        try:
            create_kwargs = {
                'Resources': [ image_id ],
                'Tags': tag_list
            }
            response = self.connection.create_tags(**create_kwargs)
        except:
            raise AWSConnectionError(title)

        return response
336919
def _process_image_id(self):
        
        try:
            image_info = self.image_id.strip().split(':')
            self.image_publisher = image_info[0]
            self.image_offer = image_info[1]
            self.image_sku = image_info[2]
            self.image_version = image_info[3]
        except Exception:
            self.image_publisher = None
987015
def image_id(self):
        
        try:
            # docker >= 1.9
            image_id = self.data["ImageID"]
        except KeyError:
            # docker <= 1.8
            image_id = self.metadata_get(["Image"])
        return image_id
1178085
public function editImageStyle($style_id = null)
    {
        $this->setImageStyle($style_id);
        $this->setTitleEditImageStyle();
        $this->setBreadcrumbEditImageStyle();

        $this->setData('imagestyle', $this->data_imagestyle);
        $this->setData('actions', $this->getActionsImageStyle());
        $this->setData('can_delete', $this->canDeleteImageStyle());

        $this->submitEditImageStyle();
        $this->setDataEditImageStyle();

        $this->outputEditImageStyle();
    }
488234
def tag(self, name, action='ADD', params=None):
        
        if not name:
            self._tcex.handle_error(925, ['name', 'tag', 'name', 'name', name])

        if not self.can_update():
            self._tcex.handle_error(910, [self.type])

        if action in ['GET', 'ADD', 'DELETE']:
            return self.tc_requests.tag(
                self.api_type,
                self.api_sub_type,
                self.unique_id,
                name,
                action=action,
                owner=self.owner,
                params=params,
            )
        self._tcex.handle_error(925, ['action', 'tag', 'action', 'action', action])
        return None
1207609
def update(self, tag_id, name):
        
        name = to_text(name)
        return self._post(
            'tags/update',
            data={
                'tag': {
                    'id': int(tag_id),
                    'name': name
                }
            }
        )
1173691
def get_image_id_by_name(self, ami_name, region='us-east-1'):
        
        image_details = None
        detail_query_attempts = 0

        while image_details is None:
            describe_cmd = "aws ec2 describe-images --filters 'Name=name,Values={}' --profile '{}' --region {}"\
                .format(ami_name, self.aws_project, region)
            res = subprocess.check_output(shlex.split(describe_cmd))

            print "describe command returned: {}".format(res)

            image_details = parse_image_json(res)
            if not image_details:
                if detail_query_attempts > 5:
                    print "Tried to get image details 5 times and failed, exiting"
                    raise Exception("Unable to get AMI image id from AWS using the image name")
                time.sleep(10)
                print "No images defined returned yet, will try another query"
                detail_query_attempts += 1

        image_id = image_details['ImageId']
        print "located image id: {}".format(image_id)
        return image_id