startEngagementFromOpportunityTask method

Future<StartEngagementFromOpportunityTaskResponse> startEngagementFromOpportunityTask({
  1. required AwsSubmission awsSubmission,
  2. required String catalog,
  3. required String identifier,
  4. String? clientToken,
  5. List<Tag>? tags,
})

Similar to StartEngagementByAcceptingInvitationTask, this action is asynchronous and performs multiple steps before completion. This action orchestrates a comprehensive workflow that combines multiple API operations into a single task to create and initiate an engagement from an existing opportunity. It automatically executes a sequence of operations including GetOpportunity, CreateEngagement (if it doesn't exist), CreateResourceSnapshot, CreateResourceSnapshotJob, CreateEngagementInvitation (if not already invited/accepted), and SubmitOpportunity.

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 the engagement is tracked. Acceptable values include AWS for production and Sandbox for testing environments.

Parameter identifier : The unique identifier of the opportunity from which the engagement task is to be initiated. This helps ensure that the task is applied to the correct opportunity.

Parameter clientToken : A unique token provided by the client to help ensure the idempotency of the request. It helps prevent the same task from being performed multiple times.

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

Implementation

Future<StartEngagementFromOpportunityTaskResponse>
    startEngagementFromOpportunityTask({
  required AwsSubmission awsSubmission,
  required String catalog,
  required String identifier,
  String? clientToken,
  List<Tag>? tags,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target':
        'AWSPartnerCentralSelling.StartEngagementFromOpportunityTask'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'AwsSubmission': awsSubmission,
      'Catalog': catalog,
      'Identifier': identifier,
      'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
      if (tags != null) 'Tags': tags,
    },
  );

  return StartEngagementFromOpportunityTaskResponse.fromJson(
      jsonResponse.body);
}