move method

Future<Object> move(
  1. String bucket,
  2. String sourceObject,
  3. String destinationObject, {
  4. String? ifGenerationMatch,
  5. String? ifGenerationNotMatch,
  6. String? ifMetagenerationMatch,
  7. String? ifMetagenerationNotMatch,
  8. String? ifSourceGenerationMatch,
  9. String? ifSourceGenerationNotMatch,
  10. String? ifSourceMetagenerationMatch,
  11. String? ifSourceMetagenerationNotMatch,
  12. String? userProject,
  13. String? $fields,
})

Moves the source object to the destination object in the same bucket.

Request parameters:

bucket - Name of the bucket in which the object resides.

sourceObject - Name of the source object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.

destinationObject - Name of the destination object. For information about how to URL encode object names to be path safe, see Encoding URI Path Parts.

ifGenerationMatch - Makes the operation conditional on whether the destination object's current generation matches the given value. Setting to 0 makes the operation succeed only if there are no live versions of the object. ifGenerationMatch and ifGenerationNotMatch conditions are mutually exclusive: it's an error for both of them to be set in the request.

ifGenerationNotMatch - Makes the operation conditional on whether the destination object's current generation does not match the given value. If no live object exists, the precondition fails. Setting to 0 makes the operation succeed only if there is a live version of the object.ifGenerationMatch and ifGenerationNotMatch conditions are mutually exclusive: it's an error for both of them to be set in the request.

ifMetagenerationMatch - Makes the operation conditional on whether the destination object's current metageneration matches the given value. ifMetagenerationMatch and ifMetagenerationNotMatch conditions are mutually exclusive: it's an error for both of them to be set in the request.

ifMetagenerationNotMatch - Makes the operation conditional on whether the destination object's current metageneration does not match the given value. ifMetagenerationMatch and ifMetagenerationNotMatch conditions are mutually exclusive: it's an error for both of them to be set in the request.

ifSourceGenerationMatch - Makes the operation conditional on whether the source object's current generation matches the given value. ifSourceGenerationMatch and ifSourceGenerationNotMatch conditions are mutually exclusive: it's an error for both of them to be set in the request.

ifSourceGenerationNotMatch - Makes the operation conditional on whether the source object's current generation does not match the given value. ifSourceGenerationMatch and ifSourceGenerationNotMatch conditions are mutually exclusive: it's an error for both of them to be set in the request.

ifSourceMetagenerationMatch - Makes the operation conditional on whether the source object's current metageneration matches the given value. ifSourceMetagenerationMatch and ifSourceMetagenerationNotMatch conditions are mutually exclusive: it's an error for both of them to be set in the request.

ifSourceMetagenerationNotMatch - Makes the operation conditional on whether the source object's current metageneration does not match the given value. ifSourceMetagenerationMatch and ifSourceMetagenerationNotMatch conditions are mutually exclusive: it's an error for both of them to be set in the request.

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 Object.

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<Object> move(
  core.String bucket,
  core.String sourceObject,
  core.String destinationObject, {
  core.String? ifGenerationMatch,
  core.String? ifGenerationNotMatch,
  core.String? ifMetagenerationMatch,
  core.String? ifMetagenerationNotMatch,
  core.String? ifSourceGenerationMatch,
  core.String? ifSourceGenerationNotMatch,
  core.String? ifSourceMetagenerationMatch,
  core.String? ifSourceMetagenerationNotMatch,
  core.String? userProject,
  core.String? $fields,
}) async {
  final queryParams_ = <core.String, core.List<core.String>>{
    if (ifGenerationMatch != null) 'ifGenerationMatch': [ifGenerationMatch],
    if (ifGenerationNotMatch != null)
      'ifGenerationNotMatch': [ifGenerationNotMatch],
    if (ifMetagenerationMatch != null)
      'ifMetagenerationMatch': [ifMetagenerationMatch],
    if (ifMetagenerationNotMatch != null)
      'ifMetagenerationNotMatch': [ifMetagenerationNotMatch],
    if (ifSourceGenerationMatch != null)
      'ifSourceGenerationMatch': [ifSourceGenerationMatch],
    if (ifSourceGenerationNotMatch != null)
      'ifSourceGenerationNotMatch': [ifSourceGenerationNotMatch],
    if (ifSourceMetagenerationMatch != null)
      'ifSourceMetagenerationMatch': [ifSourceMetagenerationMatch],
    if (ifSourceMetagenerationNotMatch != null)
      'ifSourceMetagenerationNotMatch': [ifSourceMetagenerationNotMatch],
    if (userProject != null) 'userProject': [userProject],
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'b/' +
      commons.escapeVariable('$bucket') +
      '/o/' +
      commons.escapeVariable('$sourceObject') +
      '/moveTo/o/' +
      commons.escapeVariable('$destinationObject');

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