generateUploadUrl method

Generates a signed URL for uploading an Archive zip file to Google Cloud Storage.

Once the upload is complete, the signed URL should be passed to CreateArchiveDeployment. When uploading to the generated signed URL, please follow these restrictions: * Source file type should be a zip file.

  • Source file size should not exceed 1GB limit. * No credentials should be attached - the signed URLs provide access to the target bucket using internal service identity; if credentials were attached, the identity from the credentials would be used, but that identity does not have permissions to upload files to the URL. When making a HTTP PUT request, these two headers need to be specified: * content-type: application/zip * x-goog-content-length-range: 0,1073741824 And this header SHOULD NOT be specified: * Authorization: Bearer YOUR_TOKEN

request - The metadata request object.

Request parameters:

parent - Required. The organization and environment to upload to. Value must have pattern ^organizations/\[^/\]+/environments/\[^/\]+$.

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

Completes with a GoogleCloudApigeeV1GenerateUploadUrlResponse.

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<GoogleCloudApigeeV1GenerateUploadUrlResponse> generateUploadUrl(
  GoogleCloudApigeeV1GenerateUploadUrlRequest request,
  core.String parent, {
  core.String? $fields,
}) async {
  final body_ = convert.json.encode(request);
  final queryParams_ = <core.String, core.List<core.String>>{
    if ($fields != null) 'fields': [$fields],
  };

  final url_ = 'v1/' +
      core.Uri.encodeFull('$parent') +
      '/archiveDeployments:generateUploadUrl';

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