1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package swf
4
5import (
6	"context"
7	awsmiddleware "github.com/aws/aws-sdk-go-v2/aws/middleware"
8	"github.com/aws/aws-sdk-go-v2/aws/signer/v4"
9	"github.com/aws/smithy-go/middleware"
10	smithyhttp "github.com/aws/smithy-go/transport/http"
11)
12
13// Used by workers to tell the service that the ActivityTask identified by the
14// taskToken was successfully canceled. Additional details can be provided using
15// the details argument. These details (if provided) appear in the
16// ActivityTaskCanceled event added to the workflow history. Only use this
17// operation if the canceled flag of a RecordActivityTaskHeartbeat request returns
18// true and if the activity can be safely undone or abandoned. A task is considered
19// open from the time that it is scheduled until it is closed. Therefore a task is
20// reported as open while a worker is processing it. A task is closed after it has
21// been specified in a call to RespondActivityTaskCompleted,
22// RespondActivityTaskCanceled, RespondActivityTaskFailed, or the task has timed
23// out
24// (https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dg-basic.html#swf-dev-timeout-types).
25// Access Control You can use IAM policies to control this action's access to
26// Amazon SWF resources as follows:
27//
28// * Use a Resource element with the domain name
29// to limit the action to only specified domains.
30//
31// * Use an Action element to allow
32// or deny permission to call this action.
33//
34// * You cannot use an IAM policy to
35// constrain this action's parameters.
36//
37// If the caller doesn't have sufficient
38// permissions to invoke the action, or the parameter values fall outside the
39// specified constraints, the action fails. The associated event attribute's cause
40// parameter is set to OPERATION_NOT_PERMITTED. For details and example IAM
41// policies, see Using IAM to Manage Access to Amazon SWF Workflows
42// (https://docs.aws.amazon.com/amazonswf/latest/developerguide/swf-dev-iam.html)
43// in the Amazon SWF Developer Guide.
44func (c *Client) RespondActivityTaskCanceled(ctx context.Context, params *RespondActivityTaskCanceledInput, optFns ...func(*Options)) (*RespondActivityTaskCanceledOutput, error) {
45	if params == nil {
46		params = &RespondActivityTaskCanceledInput{}
47	}
48
49	result, metadata, err := c.invokeOperation(ctx, "RespondActivityTaskCanceled", params, optFns, addOperationRespondActivityTaskCanceledMiddlewares)
50	if err != nil {
51		return nil, err
52	}
53
54	out := result.(*RespondActivityTaskCanceledOutput)
55	out.ResultMetadata = metadata
56	return out, nil
57}
58
59type RespondActivityTaskCanceledInput struct {
60
61	// The taskToken of the ActivityTask. taskToken is generated by the service and
62	// should be treated as an opaque value. If the task is passed to another process,
63	// its taskToken must also be passed. This enables it to provide its progress and
64	// respond with results.
65	//
66	// This member is required.
67	TaskToken *string
68
69	// Information about the cancellation.
70	Details *string
71}
72
73type RespondActivityTaskCanceledOutput struct {
74	// Metadata pertaining to the operation's result.
75	ResultMetadata middleware.Metadata
76}
77
78func addOperationRespondActivityTaskCanceledMiddlewares(stack *middleware.Stack, options Options) (err error) {
79	err = stack.Serialize.Add(&awsAwsjson10_serializeOpRespondActivityTaskCanceled{}, middleware.After)
80	if err != nil {
81		return err
82	}
83	err = stack.Deserialize.Add(&awsAwsjson10_deserializeOpRespondActivityTaskCanceled{}, middleware.After)
84	if err != nil {
85		return err
86	}
87	if err = addSetLoggerMiddleware(stack, options); err != nil {
88		return err
89	}
90	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
91		return err
92	}
93	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
94		return err
95	}
96	if err = addResolveEndpointMiddleware(stack, options); err != nil {
97		return err
98	}
99	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
100		return err
101	}
102	if err = addRetryMiddlewares(stack, options); err != nil {
103		return err
104	}
105	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
106		return err
107	}
108	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
109		return err
110	}
111	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
112		return err
113	}
114	if err = addClientUserAgent(stack); err != nil {
115		return err
116	}
117	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
118		return err
119	}
120	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
121		return err
122	}
123	if err = addOpRespondActivityTaskCanceledValidationMiddleware(stack); err != nil {
124		return err
125	}
126	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opRespondActivityTaskCanceled(options.Region), middleware.Before); err != nil {
127		return err
128	}
129	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
130		return err
131	}
132	if err = addResponseErrorMiddleware(stack); err != nil {
133		return err
134	}
135	if err = addRequestResponseLogging(stack, options); err != nil {
136		return err
137	}
138	return nil
139}
140
141func newServiceMetadataMiddleware_opRespondActivityTaskCanceled(region string) *awsmiddleware.RegisterServiceMetadata {
142	return &awsmiddleware.RegisterServiceMetadata{
143		Region:        region,
144		ServiceID:     ServiceID,
145		SigningName:   "swf",
146		OperationName: "RespondActivityTaskCanceled",
147	}
148}
149