Scalr\Service\Aws\Ec2\V20150415\Ec2Api::createTags PHP Метод

createTags() публичный Метод

Adds or overwrites one or more tags for the specified EC2 resource or resources. Each resource can have a maximum of 10 tags. Each tag consists of a key and optional value. Tag keys must be unique per resource.
public createTags ( ListDataType $resourceIdList, Scalr\Service\Aws\Ec2\DataType\ResourceTagSetList $tagList ) : boolean
$resourceIdList Scalr\Service\Aws\DataType\ListDataType The ID of a resource to tag. For example, ami-1a2b3c4d. You can specify multiple resources to assign the tags to.
$tagList Scalr\Service\Aws\Ec2\DataType\ResourceTagSetList The key/value pair list of the Tags.
Результат boolean Returns true on success or throws an exception otherwise
    public function createTags(ListDataType $resourceIdList, ResourceTagSetList $tagList)
    {
        $result = false;
        $options = array_merge($resourceIdList->getQueryArrayBare('ResourceId'), $tagList->getQueryArrayBare('Tag'));
        $response = $this->client->call(ucfirst(__FUNCTION__), $options);
        if ($response->getError() === false) {
            //Success
            $sxml = simplexml_load_string($response->getRawContent());
            if ((string) $sxml->return != 'true') {
                throw new Ec2Exception(sprintf('Amazon Ec2 could not create the Tags. It returned "%s"', $sxml->return));
            }
            $result = true;
        }
        return $result;
    }
Ec2Api