createResourceSnapshotJob method

Future<CreateResourceSnapshotJobResponse> createResourceSnapshotJob({
  1. required String catalog,
  2. required String engagementIdentifier,
  3. required String resourceIdentifier,
  4. required String resourceSnapshotTemplateIdentifier,
  5. required ResourceType resourceType,
  6. String? clientToken,
  7. List<Tag>? tags,
})

Use this action to create a job to generate a snapshot of the specified resource within an engagement. It initiates an asynchronous process to create a resource snapshot. The job creates a new snapshot only if the resource state has changed, adhering to the same access control and immutability rules as direct snapshot creation.

May throw AccessDeniedException. May throw ConflictException. May throw InternalServerException. May throw ResourceNotFoundException. May throw ServiceQuotaExceededException. May throw ThrottlingException. May throw ValidationException.

Parameter catalog : Specifies the catalog in which to create the snapshot job. Valid values are AWS and Sandbox.

Parameter engagementIdentifier : Specifies the identifier of the engagement associated with the resource to be snapshotted.

Parameter resourceIdentifier : Specifies the identifier of the specific resource to be snapshotted. The format depends on the ResourceType.

Parameter resourceSnapshotTemplateIdentifier : Specifies the name of the template that defines the schema for the snapshot.

Parameter resourceType : The type of resource for which the snapshot job is being created. Must be one of the supported resource types i.e. Opportunity

Parameter clientToken : A client-generated UUID used for idempotency check. The token helps prevent duplicate job creations.

Parameter tags : A map of the key-value pairs of the tag or tags to assign.

Implementation

Future<CreateResourceSnapshotJobResponse> createResourceSnapshotJob({
  required String catalog,
  required String engagementIdentifier,
  required String resourceIdentifier,
  required String resourceSnapshotTemplateIdentifier,
  required ResourceType resourceType,
  String? clientToken,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AWSPartnerCentralSelling.CreateResourceSnapshotJob'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Catalog': catalog,
      'EngagementIdentifier': engagementIdentifier,
      'ResourceIdentifier': resourceIdentifier,
      'ResourceSnapshotTemplateIdentifier':
          resourceSnapshotTemplateIdentifier,
      'ResourceType': resourceType.value,
      'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (tags != null) 'Tags': tags,
    },
  );

  return CreateResourceSnapshotJobResponse.fromJson(jsonResponse.body);
}