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 job that uses workers to label the data objects in your input dataset.
15// You can use the labeled data to train machine learning models. You can select
16// your workforce from one of three providers:
17//
18// * A private workforce that you
19// create. It can include employees, contractors, and outside experts. Use a
20// private workforce when want the data to stay within your organization or when a
21// specific set of skills is required.
22//
23// * One or more vendors that you select from
24// the AWS Marketplace. Vendors provide expertise in specific areas.
25//
26// * The Amazon
27// Mechanical Turk workforce. This is the largest workforce, but it should only be
28// used for public data or data that has been stripped of any personally
29// identifiable information.
30//
31// You can also use automated data labeling to reduce
32// the number of data objects that need to be labeled by a human. Automated data
33// labeling uses active learning to determine if a data object can be labeled by
34// machine or if it needs to be sent to a human worker. For more information, see
35// Using Automated Data Labeling
36// (https://docs.aws.amazon.com/sagemaker/latest/dg/sms-automated-labeling.html).
37// The data objects to be labeled are contained in an Amazon S3 bucket. You create
38// a manifest file that describes the location of each object. For more
39// information, see Using Input and Output Data
40// (https://docs.aws.amazon.com/sagemaker/latest/dg/sms-data.html). The output can
41// be used as the manifest file for another labeling job or as training data for
42// your machine learning models. You can use this operation to create a static
43// labeling job or a streaming labeling job. A static labeling job stops if all
44// data objects in the input manifest file identified in ManifestS3Uri have been
45// labeled. A streaming labeling job runs perpetually until it is manually stopped,
46// or remains idle for 10 days. You can send new data objects to an active
47// (InProgress) streaming labeling job in real time. To learn how to create a
48// static labeling job, see Create a Labeling Job (API)
49// (https://docs.aws.amazon.com/sagemaker/latest/dg/sms-create-labeling-job-api.html)
50// in the Amazon SageMaker Developer Guide. To learn how to create a streaming
51// labeling job, see Create a Streaming Labeling Job
52// (https://docs.aws.amazon.com/sagemaker/latest/dg/sms-streaming-create-job.html).
53func (c *Client) CreateLabelingJob(ctx context.Context, params *CreateLabelingJobInput, optFns ...func(*Options)) (*CreateLabelingJobOutput, error) {
54	if params == nil {
55		params = &CreateLabelingJobInput{}
56	}
57
58	result, metadata, err := c.invokeOperation(ctx, "CreateLabelingJob", params, optFns, addOperationCreateLabelingJobMiddlewares)
59	if err != nil {
60		return nil, err
61	}
62
63	out := result.(*CreateLabelingJobOutput)
64	out.ResultMetadata = metadata
65	return out, nil
66}
67
68type CreateLabelingJobInput struct {
69
70	// Configures the labeling task and how it is presented to workers; including, but
71	// not limited to price, keywords, and batch size (task count).
72	//
73	// This member is required.
74	HumanTaskConfig *types.HumanTaskConfig
75
76	// Input data for the labeling job, such as the Amazon S3 location of the data
77	// objects and the location of the manifest file that describes the data objects.
78	// You must specify at least one of the following: S3DataSource or
79	// SnsDataSource.
80	//
81	// * Use SnsDataSource to specify an SNS input topic for a
82	// streaming labeling job. If you do not specify and SNS input topic ARN, Ground
83	// Truth will create a one-time labeling job that stops after all data objects in
84	// the input manifest file have been labeled.
85	//
86	// * Use S3DataSource to specify an
87	// input manifest file for both streaming and one-time labeling jobs. Adding an
88	// S3DataSource is optional if you use SnsDataSource to create a streaming labeling
89	// job.
90	//
91	// If you use the Amazon Mechanical Turk workforce, your input data should
92	// not include confidential information, personal information or protected health
93	// information. Use ContentClassifiers to specify that your data is free of
94	// personally identifiable information and adult content.
95	//
96	// This member is required.
97	InputConfig *types.LabelingJobInputConfig
98
99	// The attribute name to use for the label in the output manifest file. This is the
100	// key for the key/value pair formed with the label that a worker assigns to the
101	// object. The LabelAttributeName must meet the following requirements.
102	//
103	// * The name
104	// can't end with "-metadata".
105	//
106	// * If you are using one of the following built-in
107	// task types
108	// (https://docs.aws.amazon.com/sagemaker/latest/dg/sms-task-types.html), the
109	// attribute name must end with "-ref". If the task type you are using is not
110	// listed below, the attribute name must not end with "-ref".
111	//
112	// * Image semantic
113	// segmentation (SemanticSegmentation), and adjustment
114	// (AdjustmentSemanticSegmentation) and verification
115	// (VerificationSemanticSegmentation) labeling jobs for this task type.
116	//
117	// * Video
118	// frame object detection (VideoObjectDetection), and adjustment and verification
119	// (AdjustmentVideoObjectDetection) labeling jobs for this task type.
120	//
121	// * Video
122	// frame object tracking (VideoObjectTracking), and adjustment and verification
123	// (AdjustmentVideoObjectTracking) labeling jobs for this task type.
124	//
125	// * 3D point
126	// cloud semantic segmentation (3DPointCloudSemanticSegmentation), and adjustment
127	// and verification (Adjustment3DPointCloudSemanticSegmentation) labeling jobs for
128	// this task type.
129	//
130	// * 3D point cloud object tracking (3DPointCloudObjectTracking),
131	// and adjustment and verification (Adjustment3DPointCloudObjectTracking) labeling
132	// jobs for this task type.
133	//
134	// If you are creating an adjustment or verification
135	// labeling job, you must use a different LabelAttributeName than the one used in
136	// the original labeling job. The original labeling job is the Ground Truth
137	// labeling job that produced the labels that you want verified or adjusted. To
138	// learn more about adjustment and verification labeling jobs, see Verify and
139	// Adjust Labels
140	// (https://docs.aws.amazon.com/sagemaker/latest/dg/sms-verification-data.html).
141	//
142	// This member is required.
143	LabelAttributeName *string
144
145	// The name of the labeling job. This name is used to identify the job in a list of
146	// labeling jobs. Labeling job names must be unique within an AWS account and
147	// region. LabelingJobName is not case sensitive. For example, Example-job and
148	// example-job are considered the same labeling job name by Ground Truth.
149	//
150	// This member is required.
151	LabelingJobName *string
152
153	// The location of the output data and the AWS Key Management Service key ID for
154	// the key used to encrypt the output data, if any.
155	//
156	// This member is required.
157	OutputConfig *types.LabelingJobOutputConfig
158
159	// The Amazon Resource Number (ARN) that Amazon SageMaker assumes to perform tasks
160	// on your behalf during data labeling. You must grant this role the necessary
161	// permissions so that Amazon SageMaker can successfully complete data labeling.
162	//
163	// This member is required.
164	RoleArn *string
165
166	// The S3 URI of the file, referred to as a label category configuration file, that
167	// defines the categories used to label the data objects. For 3D point cloud and
168	// video frame task types, you can add label category attributes and frame
169	// attributes to your label category configuration file. To learn how, see Create a
170	// Labeling Category Configuration File for 3D Point Cloud Labeling Jobs
171	// (https://docs.aws.amazon.com/sagemaker/latest/dg/sms-point-cloud-label-category-config.html).
172	// For all other built-in task types
173	// (https://docs.aws.amazon.com/sagemaker/latest/dg/sms-task-types.html) and custom
174	// tasks
175	// (https://docs.aws.amazon.com/sagemaker/latest/dg/sms-custom-templates.html),
176	// your label category configuration file must be a JSON file in the following
177	// format. Identify the labels you want to use by replacing label_1,
178	// label_2,...,label_n with your label categories. {
179	//     "document-version":
180	// "2018-11-28",
181	//
182	//     "labels": [{"label": "label_1"},{"label":
183	// "label_2"},...{"label": "label_n"}]
184	//
185	// } Note the following about the label
186	// category configuration file:
187	//
188	// * For image classification and text classification
189	// (single and multi-label) you must specify at least two label categories. For all
190	// other task types, the minimum number of label categories required is one.
191	//
192	// *
193	// Each label category must be unique, you cannot specify duplicate label
194	// categories.
195	//
196	// * If you create a 3D point cloud or video frame adjustment or
197	// verification labeling job, you must include auditLabelAttributeName in the label
198	// category configuration. Use this parameter to enter the LabelAttributeName
199	// (https://docs.aws.amazon.com/sagemaker/latest/APIReference/API_CreateLabelingJob.html#sagemaker-CreateLabelingJob-request-LabelAttributeName)
200	// of the labeling job you want to adjust or verify annotations of.
201	LabelCategoryConfigS3Uri *string
202
203	// Configures the information required to perform automated data labeling.
204	LabelingJobAlgorithmsConfig *types.LabelingJobAlgorithmsConfig
205
206	// A set of conditions for stopping the labeling job. If any of the conditions are
207	// met, the job is automatically stopped. You can use these conditions to control
208	// the cost of data labeling.
209	StoppingConditions *types.LabelingJobStoppingConditions
210
211	// An array of key/value pairs. For more information, see Using Cost Allocation
212	// Tags
213	// (https://docs.aws.amazon.com/awsaccountbilling/latest/aboutv2/cost-alloc-tags.html#allocation-what)
214	// in the AWS Billing and Cost Management User Guide.
215	Tags []types.Tag
216}
217
218type CreateLabelingJobOutput struct {
219
220	// The Amazon Resource Name (ARN) of the labeling job. You use this ARN to identify
221	// the labeling job.
222	//
223	// This member is required.
224	LabelingJobArn *string
225
226	// Metadata pertaining to the operation's result.
227	ResultMetadata middleware.Metadata
228}
229
230func addOperationCreateLabelingJobMiddlewares(stack *middleware.Stack, options Options) (err error) {
231	err = stack.Serialize.Add(&awsAwsjson11_serializeOpCreateLabelingJob{}, middleware.After)
232	if err != nil {
233		return err
234	}
235	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpCreateLabelingJob{}, middleware.After)
236	if err != nil {
237		return err
238	}
239	if err = addSetLoggerMiddleware(stack, options); err != nil {
240		return err
241	}
242	if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil {
243		return err
244	}
245	if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil {
246		return err
247	}
248	if err = addResolveEndpointMiddleware(stack, options); err != nil {
249		return err
250	}
251	if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil {
252		return err
253	}
254	if err = addRetryMiddlewares(stack, options); err != nil {
255		return err
256	}
257	if err = addHTTPSignerV4Middleware(stack, options); err != nil {
258		return err
259	}
260	if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil {
261		return err
262	}
263	if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil {
264		return err
265	}
266	if err = addClientUserAgent(stack); err != nil {
267		return err
268	}
269	if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil {
270		return err
271	}
272	if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil {
273		return err
274	}
275	if err = addOpCreateLabelingJobValidationMiddleware(stack); err != nil {
276		return err
277	}
278	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opCreateLabelingJob(options.Region), middleware.Before); err != nil {
279		return err
280	}
281	if err = addRequestIDRetrieverMiddleware(stack); err != nil {
282		return err
283	}
284	if err = addResponseErrorMiddleware(stack); err != nil {
285		return err
286	}
287	if err = addRequestResponseLogging(stack, options); err != nil {
288		return err
289	}
290	return nil
291}
292
293func newServiceMetadataMiddleware_opCreateLabelingJob(region string) *awsmiddleware.RegisterServiceMetadata {
294	return &awsmiddleware.RegisterServiceMetadata{
295		Region:        region,
296		ServiceID:     ServiceID,
297		SigningName:   "sagemaker",
298		OperationName: "CreateLabelingJob",
299	}
300}
301