compose method

Future<Object> compose(
  1. ComposeRequest request,
  2. String destinationBucket,
  3. String destinationObject, {
  4. String? destinationPredefinedAcl,
  5. List<String>? dropContextGroups,
  6. String? ifGenerationMatch,
  7. String? ifMetagenerationMatch,
  8. String? kmsKeyName,
  9. String? userProject,
  10. String? $fields,
})

Concatenates a list of existing objects into a new object in the same bucket.

request - The metadata request object.

Request parameters:

destinationBucket - Name of the bucket containing the source objects. The destination object is stored in this bucket.

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

destinationPredefinedAcl - Apply a predefined set of access controls to the destination object. 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.

dropContextGroups - Specifies which groups of Object Contexts from the source object(s) should be dropped from the destination object.

ifGenerationMatch - Makes the operation conditional on whether the 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.

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

kmsKeyName - Resource name of the Cloud KMS key, of the form projects/my-project/locations/global/keyRings/my-kr/cryptoKeys/my-key, that will be used to encrypt the object. Overrides the object metadata's kms_key_name value, if any.

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> compose(
  ComposeRequest request,
  core.String destinationBucket,
  core.String destinationObject, {
  core.String? destinationPredefinedAcl,
  core.List<core.String>? dropContextGroups,
  core.String? ifGenerationMatch,
  core.String? ifMetagenerationMatch,
  core.String? kmsKeyName,
  core.String? userProject,
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    'destinationPredefinedAcl': ?destinationPredefinedAcl == null
        ? null
        : [destinationPredefinedAcl],
    'dropContextGroups': ?dropContextGroups,
    'ifGenerationMatch': ?ifGenerationMatch == null
        ? null
        : [ifGenerationMatch],
    'ifMetagenerationMatch': ?ifMetagenerationMatch == null
        ? null
        : [ifMetagenerationMatch],
    'kmsKeyName': ?kmsKeyName == null ? null : [kmsKeyName],
    'userProject': ?userProject == null ? null : [userProject],
    'fields': ?$fields == null ? null : [$fields],
  };

  final url_ =
      'b/' +
      commons.escapeVariable('$destinationBucket') +
      '/o/' +
      commons.escapeVariable('$destinationObject') +
      '/compose';

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