initiateJob method

Future<InitiateJobOutput> initiateJob({
  1. required String accountId,
  2. required String vaultName,
  3. JobParameters? jobParameters,
})

This operation initiates a job of the specified type, which can be a select, an archival retrieval, or a vault retrieval. For more information about using this operation, see the documentation for the underlying REST API Initiate a Job.

May throw ResourceNotFoundException. May throw PolicyEnforcedException. May throw InvalidParameterValueException. May throw MissingParameterValueException. May throw InsufficientCapacityException. May throw ServiceUnavailableException.

Parameter accountId : The AccountId value is the AWS account ID of the account that owns the vault. You can either specify an AWS account ID or optionally a single '-' (hyphen), in which case Amazon S3 Glacier uses the AWS account ID associated with the credentials used to sign the request. If you use an account ID, do not include any hyphens ('-') in the ID.

Parameter vaultName : The name of the vault.

Parameter jobParameters : Provides options for specifying job information.

Implementation

Future<InitiateJobOutput> initiateJob({
  required String accountId,
  required String vaultName,
  JobParameters? jobParameters,
}) async {
  ArgumentError.checkNotNull(accountId, 'accountId');
  ArgumentError.checkNotNull(vaultName, 'vaultName');
  final response = await _protocol.sendRaw(
    payload: jobParameters,
    method: 'POST',
    requestUri:
        '/${Uri.encodeComponent(accountId)}/vaults/${Uri.encodeComponent(vaultName)}/jobs',
    exceptionFnMap: _exceptionFns,
  );
  final $json = await _s.jsonFromResponse(response);
  return InitiateJobOutput(
    jobId: _s.extractHeaderStringValue(response.headers, 'x-amz-job-id'),
    jobOutputPath: _s.extractHeaderStringValue(
        response.headers, 'x-amz-job-output-path'),
    location: _s.extractHeaderStringValue(response.headers, 'Location'),
  );
}