rename method

Future<GoogleLongrunningOperation> rename(
  1. String bucket,
  2. String sourceFolder,
  3. String destinationFolder, {
  4. String? ifSourceMetagenerationMatch,
  5. String? ifSourceMetagenerationNotMatch,
  6. String? $fields,
})

Renames a source folder to a destination folder.

Only applicable to buckets with hierarchical namespace enabled.

Request parameters:

bucket - Name of the bucket in which the folders are in.

sourceFolder - Name of the source folder.

destinationFolder - Name of the destination folder.

ifSourceMetagenerationMatch - Makes the operation conditional on whether the source object's current metageneration matches the given value.

ifSourceMetagenerationNotMatch - Makes the operation conditional on whether the source object's current metageneration does not match the given value.

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

Completes with a GoogleLongrunningOperation.

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<GoogleLongrunningOperation> rename(
  core.String bucket,
  core.String sourceFolder,
  core.String destinationFolder, {
  core.String? ifSourceMetagenerationMatch,
  core.String? ifSourceMetagenerationNotMatch,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (ifSourceMetagenerationMatch != null)
      'ifSourceMetagenerationMatch': [ifSourceMetagenerationMatch],
    if (ifSourceMetagenerationNotMatch != null)
      'ifSourceMetagenerationNotMatch': [ifSourceMetagenerationNotMatch],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'b/' +
      commons.escapeVariable('$bucket') +
      '/folders/' +
      commons.escapeVariable('$sourceFolder') +
      '/renameTo/folders/' +
      commons.escapeVariable('$destinationFolder');

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