createReturnShippingLabel method

Future<CreateReturnShippingLabelResult> createReturnShippingLabel({
  1. required String jobId,
  2. ShippingOption? shippingOption,
})

Creates a shipping label that will be used to return the Snow device to AWS.

May throw InvalidResourceException. May throw InvalidJobStateException. May throw InvalidInputCombinationException. May throw ConflictException. May throw ReturnShippingLabelAlreadyExistsException.

Parameter jobId : The ID for a job that you want to create the return shipping label for. For example JID123e4567-e89b-12d3-a456-426655440000.

Parameter shippingOption : The shipping speed for a particular job. This speed doesn't dictate how soon the device is returned to AWS. This speed represents how quickly it moves to its destination while in transit. Regional shipping speeds are as follows:

Implementation

Future<CreateReturnShippingLabelResult> createReturnShippingLabel({
  required String jobId,
  ShippingOption? shippingOption,
}) async {
  ArgumentError.checkNotNull(jobId, 'jobId');
  _s.validateStringLength(
    'jobId',
    jobId,
    39,
    39,
    isRequired: true,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.1',
    'X-Amz-Target':
        'AWSIESnowballJobManagementService.CreateReturnShippingLabel'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'JobId': jobId,
      if (shippingOption != null) 'ShippingOption': shippingOption.toValue(),
    },
  );

  return CreateReturnShippingLabelResult.fromJson(jsonResponse.body);
}