createEngagementContext method

Future<CreateEngagementContextResponse> createEngagementContext({
  1. required String catalog,
  2. required String engagementIdentifier,
  3. required EngagementContextPayload payload,
  4. required EngagementContextType type,
  5. String? clientToken,
})

Creates a new context within an existing engagement. This action allows you to add contextual information such as customer projects or documents to an engagement, providing additional details that help facilitate collaboration between engagement members.

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 associated with the engagement context request. This field takes a string value from a predefined list: AWS or Sandbox. The catalog determines which environment the engagement context is created in. Use AWS to create contexts in the production environment, and Sandbox for testing in secure, isolated environments.

Parameter engagementIdentifier : The unique identifier of the Engagement for which the context is being created. This parameter ensures the context is associated with the correct engagement and provides the necessary linkage between the engagement and its contextual information.

Parameter type : Specifies the type of context being created for the engagement. This field determines the structure and content of the context payload. Valid values include CustomerProject for customer project-related contexts. The type field ensures that the context is properly categorized and processed according to its intended purpose.

Parameter clientToken : A unique, case-sensitive identifier provided by the client to ensure that the request is handled exactly once. This token helps prevent duplicate context creations and must not exceed sixty-four alphanumeric characters. Use a UUID or other unique string to ensure idempotency.

Implementation

Future<CreateEngagementContextResponse> createEngagementContext({
  required String catalog,
  required String engagementIdentifier,
  required EngagementContextPayload payload,
  required EngagementContextType type,
  String? clientToken,
}) async {
  final headers = <String, String>{
    'Content-Type': 'application/x-amz-json-1.0',
    'X-Amz-Target': 'AWSPartnerCentralSelling.CreateEngagementContext'
  };
  final jsonResponse = await _protocol.send(
    method: 'POST',
    requestUri: '/',
    exceptionFnMap: _exceptionFns,
    // TODO queryParams
    headers: headers,
    payload: {
      'Catalog': catalog,
      'EngagementIdentifier': engagementIdentifier,
      'Payload': payload,
      'Type': type.value,
      'ClientToken': clientToken ?? _s.generateIdempotencyToken(),
    },
  );

  return CreateEngagementContextResponse.fromJson(jsonResponse.body);
}