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/aws-sdk-go-v2/service/swf/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Deprecates the specified activity type. After an activity type has been
15// deprecated, you cannot create new tasks of that activity type. Tasks of this
16// type that were scheduled before the type was deprecated continue to run. This
17// operation is eventually consistent. The results are best effort and may not
18// exactly reflect recent updates and changes. Access Control You can use IAM
19// policies to control this action's access to Amazon SWF resources as follows:
20//
21// *
22// Use a Resource element with the domain name to limit the action to only
23// specified domains.
24//
25// * Use an Action element to allow or deny permission to call
26// this action.
27//
28// * Constrain the following parameters by using a Condition element
29// with the appropriate keys.
30//
31// * activityType.name: String constraint. The key is
32// swf:activityType.name.
33//
34// * activityType.version: String constraint. The key is
35// swf:activityType.version.
36//
37// If the caller doesn't have sufficient permissions to
38// invoke the action, or the parameter values fall outside the specified
39// constraints, the action fails. The associated event attribute's cause parameter
40// is set to OPERATION_NOT_PERMITTED. For details and example IAM policies, see
41// 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) DeprecateActivityType(ctx context.Context, params *DeprecateActivityTypeInput, optFns ...func(*Options)) (*DeprecateActivityTypeOutput, error) {
45	if params == nil {
46		params = &DeprecateActivityTypeInput{}
47	}
48
49	result, metadata, err := c.invokeOperation(ctx, "DeprecateActivityType", params, optFns, addOperationDeprecateActivityTypeMiddlewares)
50	if err != nil {
51		return nil, err
52	}
53
54	out := result.(*DeprecateActivityTypeOutput)
55	out.ResultMetadata = metadata
56	return out, nil
57}
58
59type DeprecateActivityTypeInput struct {
60
61	// The activity type to deprecate.
62	//
63	// This member is required.
64	ActivityType *types.ActivityType
65
66	// The name of the domain in which the activity type is registered.
67	//
68	// This member is required.
69	Domain *string
70}
71
72type DeprecateActivityTypeOutput struct {
73	// Metadata pertaining to the operation's result.
74	ResultMetadata middleware.Metadata
75}
76
77func addOperationDeprecateActivityTypeMiddlewares(stack *middleware.Stack, options Options) (err error) {
78	err = stack.Serialize.Add(&awsAwsjson10_serializeOpDeprecateActivityType{}, middleware.After)
79	if err != nil {
80		return err
81	}
82	err = stack.Deserialize.Add(&awsAwsjson10_deserializeOpDeprecateActivityType{}, middleware.After)
83	if err != nil {
84		return err
85	}
86	if err = addSetLoggerMiddleware(stack, options); err != nil {
87		return err
88	}
89	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
90		return err
91	}
92	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
93		return err
94	}
95	if err = addResolveEndpointMiddleware(stack, options); err != nil {
96		return err
97	}
98	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
99		return err
100	}
101	if err = addRetryMiddlewares(stack, options); err != nil {
102		return err
103	}
104	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
105		return err
106	}
107	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
108		return err
109	}
110	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
111		return err
112	}
113	if err = addClientUserAgent(stack); err != nil {
114		return err
115	}
116	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
117		return err
118	}
119	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
120		return err
121	}
122	if err = addOpDeprecateActivityTypeValidationMiddleware(stack); err != nil {
123		return err
124	}
125	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opDeprecateActivityType(options.Region), middleware.Before); err != nil {
126		return err
127	}
128	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
129		return err
130	}
131	if err = addResponseErrorMiddleware(stack); err != nil {
132		return err
133	}
134	if err = addRequestResponseLogging(stack, options); err != nil {
135		return err
136	}
137	return nil
138}
139
140func newServiceMetadataMiddleware_opDeprecateActivityType(region string) *awsmiddleware.RegisterServiceMetadata {
141	return &awsmiddleware.RegisterServiceMetadata{
142		Region:        region,
143		ServiceID:     ServiceID,
144		SigningName:   "swf",
145		OperationName: "DeprecateActivityType",
146	}
147}
148