getResourceSnapshot method

Future<GetResourceSnapshotResponse> getResourceSnapshot({
  1. required String catalog,
  2. required String engagementIdentifier,
  3. required String resourceIdentifier,
  4. required String resourceSnapshotTemplateIdentifier,
  5. required ResourceType resourceType,
  6. int? revision,
})

Use this action to retrieve a specific snapshot record.

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

Parameter catalog : Specifies the catalog related to the request. Valid values are:

  • AWS: Retrieves the snapshot from the production AWS environment.
  • Sandbox: Retrieves the snapshot from a sandbox environment used for testing or development purposes.

Parameter engagementIdentifier : The unique identifier of the engagement associated with the snapshot. This field links the snapshot to a specific engagement context.

Parameter resourceIdentifier : The unique identifier of the specific resource that was snapshotted. The format and constraints of this identifier depend on the ResourceType specified. For Opportunity type, it will be an opportunity ID

Parameter resourceSnapshotTemplateIdentifier : he name of the template that defines the schema for the snapshot. This template determines which subset of the resource data is included in the snapshot and must correspond to an existing and valid template for the specified ResourceType.

Parameter resourceType : Specifies the type of resource that was snapshotted. This field determines the structure and content of the snapshot payload. Valid value includes:Opportunity: For opportunity-related data.

Parameter revision : Specifies which revision of the snapshot to retrieve. If omitted returns the latest revision.

Implementation

Future<GetResourceSnapshotResponse> getResourceSnapshot({
  required String catalog,
  required String engagementIdentifier,
  required String resourceIdentifier,
  required String resourceSnapshotTemplateIdentifier,
  required ResourceType resourceType,
  int? revision,
}) async {
  _s.validateNumRange(
    'revision',
    revision,
    1,
    1152921504606846976,
  );
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AWSPartnerCentralSelling.GetResourceSnapshot'
  };
  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,
      if (revision != null) 'Revision': revision,
    },
  );

  return GetResourceSnapshotResponse.fromJson(jsonResponse.body);
}