Scalr\Service\Aws\S3\V20060301\S3Api::setBucketSubresource PHP Method

setBucketSubresource() public method

Puts bucket subresource
public setBucketSubresource ( string $bucketName, string $subresource, string $putData ) : boolean
$bucketName string A bucket name.
$subresource string A subresource name.
$putData string Put data. (xml or json formatted string, depends on subresource configuration)
return boolean Returns true on success or false if failure
    public function setBucketSubresource($bucketName, $subresource, $putData)
    {
        $result = false;
        $options = array('_subdomain' => (string) $bucketName, '_putData' => (string) $putData);
        $allowed = S3QueryClient::getAllowedSubResources();
        if (!in_array($subresource, $allowed)) {
            throw new \InvalidArgumentException(sprintf('Invalid subresource "%s" for the bucket. Allowed list are "%s"', $subresource, join('", "', $allowed)));
        }
        $response = $this->client->call('PUT', $options, '/?' . $subresource);
        if ($response->getError() === false) {
            $result = true;
        }
        return $result;
    }