compose method

Future<Object> compose(
  1. ComposeRequest request,
  2. String destinationBucket,
  3. String destinationObject, {
  4. String? destinationPredefinedAcl,
  5. String? ifGenerationMatch,
  6. String? ifMetagenerationMatch,
  7. String? kmsKeyName,
  8. String? userProject,
  9. 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.

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.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>>{
    if (destinationPredefinedAcl != null)
      'destinationPredefinedAcl': [destinationPredefinedAcl],
    if (ifGenerationMatch != null) 'ifGenerationMatch': [ifGenerationMatch],
    if (ifMetagenerationMatch != null)
      'ifMetagenerationMatch': [ifMetagenerationMatch],
    if (kmsKeyName != null) 'kmsKeyName': [kmsKeyName],
    if (userProject != null) 'userProject': [userProject],
    if ($fields != null) 'fields': [$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>);
}