1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package sagemaker
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/sagemaker/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Creates an action. An action is a lineage tracking entity that represents an
15// action or activity. For example, a model deployment or an HPO job. Generally, an
16// action involves at least one input or output artifact. For more information, see
17// Amazon SageMaker ML Lineage Tracking
18// (https://docs.aws.amazon.com/sagemaker/latest/dg/lineage-tracking.html).
19func (c *Client) CreateAction(ctx context.Context, params *CreateActionInput, optFns ...func(*Options)) (*CreateActionOutput, error) {
20	if params == nil {
21		params = &CreateActionInput{}
22	}
23
24	result, metadata, err := c.invokeOperation(ctx, "CreateAction", params, optFns, addOperationCreateActionMiddlewares)
25	if err != nil {
26		return nil, err
27	}
28
29	out := result.(*CreateActionOutput)
30	out.ResultMetadata = metadata
31	return out, nil
32}
33
34type CreateActionInput struct {
35
36	// The name of the action. Must be unique to your account in an AWS Region.
37	//
38	// This member is required.
39	ActionName *string
40
41	// The action type.
42	//
43	// This member is required.
44	ActionType *string
45
46	// The source type, ID, and URI.
47	//
48	// This member is required.
49	Source *types.ActionSource
50
51	// The description of the action.
52	Description *string
53
54	// Metadata properties of the tracking entity, trial, or trial component.
55	MetadataProperties *types.MetadataProperties
56
57	// A list of properties to add to the action.
58	Properties map[string]string
59
60	// The status of the action.
61	Status types.ActionStatus
62
63	// A list of tags to apply to the action.
64	Tags []types.Tag
65}
66
67type CreateActionOutput struct {
68
69	// The Amazon Resource Name (ARN) of the action.
70	ActionArn *string
71
72	// Metadata pertaining to the operation's result.
73	ResultMetadata middleware.Metadata
74}
75
76func addOperationCreateActionMiddlewares(stack *middleware.Stack, options Options) (err error) {
77	err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateAction{}, middleware.After)
78	if err != nil {
79		return err
80	}
81	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateAction{}, middleware.After)
82	if err != nil {
83		return err
84	}
85	if err = addSetLoggerMiddleware(stack, options); err != nil {
86		return err
87	}
88	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
89		return err
90	}
91	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
92		return err
93	}
94	if err = addResolveEndpointMiddleware(stack, options); err != nil {
95		return err
96	}
97	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
98		return err
99	}
100	if err = addRetryMiddlewares(stack, options); err != nil {
101		return err
102	}
103	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
104		return err
105	}
106	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
107		return err
108	}
109	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
110		return err
111	}
112	if err = addClientUserAgent(stack); err != nil {
113		return err
114	}
115	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
116		return err
117	}
118	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
119		return err
120	}
121	if err = addOpCreateActionValidationMiddleware(stack); err != nil {
122		return err
123	}
124	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateAction(options.Region), middleware.Before); err != nil {
125		return err
126	}
127	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
128		return err
129	}
130	if err = addResponseErrorMiddleware(stack); err != nil {
131		return err
132	}
133	if err = addRequestResponseLogging(stack, options); err != nil {
134		return err
135	}
136	return nil
137}
138
139func newServiceMetadataMiddleware_opCreateAction(region string) *awsmiddleware.RegisterServiceMetadata {
140	return &awsmiddleware.RegisterServiceMetadata{
141		Region:        region,
142		ServiceID:     ServiceID,
143		SigningName:   "sagemaker",
144		OperationName: "CreateAction",
145	}
146}
147