createQuantumTask method

Future<CreateQuantumTaskResponse> createQuantumTask({
  1. required Object action,
  2. required String deviceArn,
  3. required String outputS3Bucket,
  4. required String outputS3KeyPrefix,
  5. required int shots,
  6. List<Association>? associations,
  7. String? clientToken,
  8. Object? deviceParameters,
  9. ExperimentalCapabilities? experimentalCapabilities,
  10. String? jobToken,
  11. Map<String, String>? tags,
})

Creates a quantum task.

May throw AccessDeniedException. May throw DeviceOfflineException. May throw DeviceRetiredException. May throw InternalServiceException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter action : The action associated with the quantum task.

Parameter deviceArn : The ARN of the device to run the quantum task on.

Parameter outputS3Bucket : The S3 bucket to store quantum task result files in.

Parameter outputS3KeyPrefix : The key prefix for the location in the S3 bucket to store quantum task results in.

Parameter shots : The number of shots to use for the quantum task.

Parameter associations : The list of Amazon Braket resources associated with the quantum task.

Parameter clientToken : The client token associated with the request.

Parameter deviceParameters : The parameters for the device to run the quantum task on.

Parameter experimentalCapabilities : Enable experimental capabilities for the quantum task.

Parameter jobToken : The token for an Amazon Braket hybrid job that associates it with the quantum task.

Parameter tags : Tags to be added to the quantum task you're creating.

Implementation

Future<CreateQuantumTaskResponse> createQuantumTask({
  required Object action,
  required String deviceArn,
  required String outputS3Bucket,
  required String outputS3KeyPrefix,
  required int shots,
  List<Association>? associations,
  String? clientToken,
  Object? deviceParameters,
  ExperimentalCapabilities? experimentalCapabilities,
  String? jobToken,
  Map<String, String>? tags,
}) async {
  final $payload = <String, dynamic>{
    'action': jsonEncode(action),
    'deviceArn': deviceArn,
    'outputS3Bucket': outputS3Bucket,
    'outputS3KeyPrefix': outputS3KeyPrefix,
    'shots': shots,
    if (associations != null) 'associations': associations,
    'clientToken': clientToken ?? _s.generateIdempotencyToken(),
    if (deviceParameters != null)
      'deviceParameters': jsonEncode(deviceParameters),
    if (experimentalCapabilities != null)
      'experimentalCapabilities': experimentalCapabilities,
    if (jobToken != null) 'jobToken': jobToken,
    if (tags != null) 'tags': tags,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/quantum-task',
    exceptionFnMap: _exceptionFns,
  );
  return CreateQuantumTaskResponse.fromJson(response);
}