update method

Future<Bucket> update(
  1. Bucket request,
  2. String bucket, {
  3. String? ifMetagenerationMatch,
  4. String? ifMetagenerationNotMatch,
  5. String? predefinedAcl,
  6. String? predefinedDefaultObjectAcl,
  7. String? projection,
  8. String? userProject,
  9. String? $fields,
})

Updates a bucket.

Changes to the bucket will be readable immediately after writing, but configuration changes may take time to propagate.

request - The metadata request object.

Request parameters:

bucket - Name of a bucket.

ifMetagenerationMatch - Makes the return of the bucket metadata conditional on whether the bucket's current metageneration matches the given value.

ifMetagenerationNotMatch - Makes the return of the bucket metadata conditional on whether the bucket's current metageneration does not match the given value.

predefinedAcl - Apply a predefined set of access controls to this bucket. Possible string values are:

  • "authenticatedRead" : Project team owners get OWNER access, and allAuthenticatedUsers get READER access.
  • "private" : Project team owners get OWNER access.
  • "projectPrivate" : Project team members get access according to their roles.
  • "publicRead" : Project team owners get OWNER access, and allUsers get READER access.
  • "publicReadWrite" : Project team owners get OWNER access, and allUsers get WRITER access.

predefinedDefaultObjectAcl - Apply a predefined set of default object access controls to this bucket. Possible string values are:

  • "authenticatedRead" : Object owner gets OWNER access, and allAuthenticatedUsers get READER access.
  • "bucketOwnerFullControl" : Object owner gets OWNER access, and project team owners get OWNER access.
  • "bucketOwnerRead" : Object owner gets OWNER access, and project team owners get READER access.
  • "private" : Object owner gets OWNER access.
  • "projectPrivate" : Object owner gets OWNER access, and project team members get access according to their roles.
  • "publicRead" : Object owner gets OWNER access, and allUsers get READER access.

projection - Set of properties to return. Defaults to full. Possible string values are:

  • "full" : Include all properties.
  • "noAcl" : Omit owner, acl and defaultObjectAcl properties.

userProject - The project to be billed for this request. Required for Requester Pays buckets.

$fields - Selector specifying which fields to include in a partial response.

Completes with a Bucket.

Completes with a commons.ApiRequestError if the API endpoint returned an error.

If the used http.Client completes with an error when making a REST call, this method will complete with the same error.

Implementation

async.Future<Bucket> update(
  Bucket request,
  core.String bucket, {
  core.String? ifMetagenerationMatch,
  core.String? ifMetagenerationNotMatch,
  core.String? predefinedAcl,
  core.String? predefinedDefaultObjectAcl,
  core.String? projection,
  core.String? userProject,
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if (ifMetagenerationMatch != null)
      'ifMetagenerationMatch': [ifMetagenerationMatch],
    if (ifMetagenerationNotMatch != null)
      'ifMetagenerationNotMatch': [ifMetagenerationNotMatch],
    if (predefinedAcl != null) 'predefinedAcl': [predefinedAcl],
    if (predefinedDefaultObjectAcl != null)
      'predefinedDefaultObjectAcl': [predefinedDefaultObjectAcl],
    if (projection != null) 'projection': [projection],
    if (userProject != null) 'userProject': [userProject],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'b/' + commons.escapeVariable('$bucket');

  final response_ = await _requester.request(
    url_,
    'PUT',
    body: body_,
    queryParams: queryParams_,
  );
  return Bucket.fromJson(response_ as core.Map<core.String, core.dynamic>);
}