executeAction method

Future<ExecuteActionResponse> executeAction({
  1. required String actionDefinitionId,
  2. required ActionPayload actionPayload,
  3. required TargetResource targetResource,
  4. String? clientToken,
  5. ResolveTo? resolveTo,
})

Executes an action on a target resource.

May throw ConflictingOperationException. May throw InternalFailureException. May throw InvalidRequestException. May throw LimitExceededException. May throw ResourceNotFoundException. May throw ThrottlingException.

Parameter actionDefinitionId : The ID of the action definition.

Parameter actionPayload : The JSON payload of the action.

Parameter targetResource : The resource the action will be taken on.

Parameter clientToken : A unique case-sensitive identifier that you can provide to ensure the idempotency of the request. Don't reuse this client token if a new idempotent request is required.

Parameter resolveTo : The detailed resource this action resolves to.

Implementation

Future<ExecuteActionResponse> executeAction({
  required String actionDefinitionId,
  required ActionPayload actionPayload,
  required TargetResource targetResource,
  String? clientToken,
  ResolveTo? resolveTo,
}) async {
  final $payload = <String, dynamic>{
    'actionDefinitionId': actionDefinitionId,
    'actionPayload': actionPayload,
    'targetResource': targetResource,
    if (clientToken != null) 'clientToken': clientToken,
    if (resolveTo != null) 'resolveTo': resolveTo,
  };
  final response = await _protocol.send(
    payload: $payload,
    method: 'POST',
    requestUri: '/actions',
    exceptionFnMap: _exceptionFns,
  );
  return ExecuteActionResponse.fromJson(response);
}