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 a flow definition.
15func (c *Client) CreateFlowDefinition(ctx context.Context, params *CreateFlowDefinitionInput, optFns ...func(*Options)) (*CreateFlowDefinitionOutput, error) {
16	if params == nil {
17		params = &CreateFlowDefinitionInput{}
18	}
19
20	result, metadata, err := c.invokeOperation(ctx, "CreateFlowDefinition", params, optFns, addOperationCreateFlowDefinitionMiddlewares)
21	if err != nil {
22		return nil, err
23	}
24
25	out := result.(*CreateFlowDefinitionOutput)
26	out.ResultMetadata = metadata
27	return out, nil
28}
29
30type CreateFlowDefinitionInput struct {
31
32	// The name of your flow definition.
33	//
34	// This member is required.
35	FlowDefinitionName *string
36
37	// An object containing information about the tasks the human reviewers will
38	// perform.
39	//
40	// This member is required.
41	HumanLoopConfig *types.HumanLoopConfig
42
43	// An object containing information about where the human review results will be
44	// uploaded.
45	//
46	// This member is required.
47	OutputConfig *types.FlowDefinitionOutputConfig
48
49	// The Amazon Resource Name (ARN) of the role needed to call other services on your
50	// behalf. For example,
51	// arn:aws:iam::1234567890:role/service-role/AmazonSageMaker-ExecutionRole-20180111T151298.
52	//
53	// This member is required.
54	RoleArn *string
55
56	// An object containing information about the events that trigger a human workflow.
57	HumanLoopActivationConfig *types.HumanLoopActivationConfig
58
59	// Container for configuring the source of human task requests. Use to specify if
60	// Amazon Rekognition or Amazon Textract is used as an integration source.
61	HumanLoopRequestSource *types.HumanLoopRequestSource
62
63	// An array of key-value pairs that contain metadata to help you categorize and
64	// organize a flow definition. Each tag consists of a key and a value, both of
65	// which you define.
66	Tags []types.Tag
67}
68
69type CreateFlowDefinitionOutput struct {
70
71	// The Amazon Resource Name (ARN) of the flow definition you create.
72	//
73	// This member is required.
74	FlowDefinitionArn *string
75
76	// Metadata pertaining to the operation's result.
77	ResultMetadata middleware.Metadata
78}
79
80func addOperationCreateFlowDefinitionMiddlewares(stack *middleware.Stack, options Options) (err error) {
81	err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateFlowDefinition{}, middleware.After)
82	if err != nil {
83		return err
84	}
85	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateFlowDefinition{}, middleware.After)
86	if err != nil {
87		return err
88	}
89	if err = addSetLoggerMiddleware(stack, options); err != nil {
90		return err
91	}
92	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
93		return err
94	}
95	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
96		return err
97	}
98	if err = addResolveEndpointMiddleware(stack, options); err != nil {
99		return err
100	}
101	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
102		return err
103	}
104	if err = addRetryMiddlewares(stack, options); err != nil {
105		return err
106	}
107	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
108		return err
109	}
110	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
111		return err
112	}
113	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
114		return err
115	}
116	if err = addClientUserAgent(stack); err != nil {
117		return err
118	}
119	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
120		return err
121	}
122	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
123		return err
124	}
125	if err = addOpCreateFlowDefinitionValidationMiddleware(stack); err != nil {
126		return err
127	}
128	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateFlowDefinition(options.Region), middleware.Before); err != nil {
129		return err
130	}
131	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
132		return err
133	}
134	if err = addResponseErrorMiddleware(stack); err != nil {
135		return err
136	}
137	if err = addRequestResponseLogging(stack, options); err != nil {
138		return err
139	}
140	return nil
141}
142
143func newServiceMetadataMiddleware_opCreateFlowDefinition(region string) *awsmiddleware.RegisterServiceMetadata {
144	return &awsmiddleware.RegisterServiceMetadata{
145		Region:        region,
146		ServiceID:     ServiceID,
147		SigningName:   "sagemaker",
148		OperationName: "CreateFlowDefinition",
149	}
150}
151