Google\Cloud\Storage\Bucket::update PHP Method

update() public method

Example: Enable logging on an existing bucket. $bucket->update([ 'logging' => [ 'logBucket' => 'myBucket', 'logObjectPrefix' => 'prefix' ] ]);
See also: https://cloud.google.com/storage/docs/json_api/v1/buckets/patch Buckets patch API documentation.
public update ( array $options = [] ) : array
$options array [optional] { Configuration options. @type string $ifMetagenerationMatch Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value. @type string $ifMetagenerationNotMatch Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value. @type string $predefinedAcl Apply a predefined set of access controls to this bucket. @type string $predefinedDefaultObjectAcl Apply a predefined set of default object access controls to this bucket. @type string $projection Determines which properties to return. May be either 'full' or 'noAcl'. @type string $fields Selector which will cause the response to only return the specified fields. @type array $acl Access controls on the bucket. @type array $cors The bucket's Cross-Origin Resource Sharing (CORS) configuration. @type array $defaultObjectAcl Default access controls to apply to new objects when no ACL is provided. @type array $lifecycle The bucket's lifecycle configuration. @type array $logging The bucket's logging configuration, which defines the destination bucket and optional name prefix for the current bucket's logs. @type array $versioning The bucket's versioning configuration. @type array $website The bucket's website configuration. }
return array
    public function update(array $options = [])
    {
        return $this->info = $this->connection->patchBucket($options + $this->identity);
    }

Usage Example

 public function testUpdatesData()
 {
     $versioningData = ['versioning' => ['enabled' => true]];
     $this->connection->patchBucket(Argument::any())->willReturn(['name' => 'bucket'] + $versioningData);
     $bucket = new Bucket($this->connection->reveal(), 'bucket', ['name' => 'bucket', 'versioning' => ['enabled' => false]]);
     $bucket->update($versioningData);
     $this->assertTrue($bucket->info()['versioning']['enabled']);
 }