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	"time"
13)
14
15// Creates a trial component, which is a stage of a machine learning trial. A trial
16// is composed of one or more trial components. A trial component can be used in
17// multiple trials. Trial components include pre-processing jobs, training jobs,
18// and batch transform jobs. When you use Amazon SageMaker Studio or the Amazon
19// SageMaker Python SDK, all experiments, trials, and trial components are
20// automatically tracked, logged, and indexed. When you use the AWS SDK for Python
21// (Boto), you must use the logging APIs provided by the SDK. You can add tags to a
22// trial component and then use the Search API to search for the tags.
23// CreateTrialComponent can only be invoked from within an Amazon SageMaker managed
24// environment. This includes Amazon SageMaker training jobs, processing jobs,
25// transform jobs, and Amazon SageMaker notebooks. A call to CreateTrialComponent
26// from outside one of these environments results in an error.
27func (c *Client) CreateTrialComponent(ctx context.Context, params *CreateTrialComponentInput, optFns ...func(*Options)) (*CreateTrialComponentOutput, error) {
28	if params == nil {
29		params = &CreateTrialComponentInput{}
30	}
31
32	result, metadata, err := c.invokeOperation(ctx, "CreateTrialComponent", params, optFns, addOperationCreateTrialComponentMiddlewares)
33	if err != nil {
34		return nil, err
35	}
36
37	out := result.(*CreateTrialComponentOutput)
38	out.ResultMetadata = metadata
39	return out, nil
40}
41
42type CreateTrialComponentInput struct {
43
44	// The name of the component. The name must be unique in your AWS account and is
45	// not case-sensitive.
46	//
47	// This member is required.
48	TrialComponentName *string
49
50	// The name of the component as displayed. The name doesn't need to be unique. If
51	// DisplayName isn't specified, TrialComponentName is displayed.
52	DisplayName *string
53
54	// When the component ended.
55	EndTime *time.Time
56
57	// The input artifacts for the component. Examples of input artifacts are datasets,
58	// algorithms, hyperparameters, source code, and instance types.
59	InputArtifacts map[string]types.TrialComponentArtifact
60
61	// Metadata properties of the tracking entity, trial, or trial component.
62	MetadataProperties *types.MetadataProperties
63
64	// The output artifacts for the component. Examples of output artifacts are
65	// metrics, snapshots, logs, and images.
66	OutputArtifacts map[string]types.TrialComponentArtifact
67
68	// The hyperparameters for the component.
69	Parameters map[string]types.TrialComponentParameterValue
70
71	// When the component started.
72	StartTime *time.Time
73
74	// The status of the component. States include:
75	//
76	// * InProgress
77	//
78	// * Completed
79	//
80	// *
81	// Failed
82	Status *types.TrialComponentStatus
83
84	// A list of tags to associate with the component. You can use Search API to search
85	// on the tags.
86	Tags []types.Tag
87}
88
89type CreateTrialComponentOutput struct {
90
91	// The Amazon Resource Name (ARN) of the trial component.
92	TrialComponentArn *string
93
94	// Metadata pertaining to the operation's result.
95	ResultMetadata middleware.Metadata
96}
97
98func addOperationCreateTrialComponentMiddlewares(stack *middleware.Stack, options Options) (err error) {
99	err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateTrialComponent{}, middleware.After)
100	if err != nil {
101		return err
102	}
103	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateTrialComponent{}, middleware.After)
104	if err != nil {
105		return err
106	}
107	if err = addSetLoggerMiddleware(stack, options); err != nil {
108		return err
109	}
110	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
111		return err
112	}
113	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
114		return err
115	}
116	if err = addResolveEndpointMiddleware(stack, options); err != nil {
117		return err
118	}
119	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
120		return err
121	}
122	if err = addRetryMiddlewares(stack, options); err != nil {
123		return err
124	}
125	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
126		return err
127	}
128	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
129		return err
130	}
131	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
132		return err
133	}
134	if err = addClientUserAgent(stack); err != nil {
135		return err
136	}
137	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
138		return err
139	}
140	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
141		return err
142	}
143	if err = addOpCreateTrialComponentValidationMiddleware(stack); err != nil {
144		return err
145	}
146	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateTrialComponent(options.Region), middleware.Before); err != nil {
147		return err
148	}
149	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
150		return err
151	}
152	if err = addResponseErrorMiddleware(stack); err != nil {
153		return err
154	}
155	if err = addRequestResponseLogging(stack, options); err != nil {
156		return err
157	}
158	return nil
159}
160
161func newServiceMetadataMiddleware_opCreateTrialComponent(region string) *awsmiddleware.RegisterServiceMetadata {
162	return &awsmiddleware.RegisterServiceMetadata{
163		Region:        region,
164		ServiceID:     ServiceID,
165		SigningName:   "sagemaker",
166		OperationName: "CreateTrialComponent",
167	}
168}
169