1// Code generated by smithy-go-codegen DO NOT EDIT.
2
3package rekognition
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/rekognition/types"
10	"github.com/aws/smithy-go/middleware"
11	smithyhttp "github.com/aws/smithy-go/transport/http"
12)
13
14// Starts asynchronous detection of faces in a stored video. Amazon Rekognition
15// Video can detect faces in a video stored in an Amazon S3 bucket. Use Video to
16// specify the bucket name and the filename of the video. StartFaceDetection
17// returns a job identifier (JobId) that you use to get the results of the
18// operation. When face detection is finished, Amazon Rekognition Video publishes a
19// completion status to the Amazon Simple Notification Service topic that you
20// specify in NotificationChannel. To get the results of the face detection
21// operation, first check that the status value published to the Amazon SNS topic
22// is SUCCEEDED. If so, call GetFaceDetection and pass the job identifier (JobId)
23// from the initial call to StartFaceDetection. For more information, see Detecting
24// Faces in a Stored Video in the Amazon Rekognition Developer Guide.
25func (c *Client) StartFaceDetection(ctx context.Context, params *StartFaceDetectionInput, optFns ...func(*Options)) (*StartFaceDetectionOutput, error) {
26	if params == nil {
27		params = &StartFaceDetectionInput{}
28	}
29
30	result, metadata, err := c.invokeOperation(ctx, "StartFaceDetection", params, optFns, addOperationStartFaceDetectionMiddlewares)
31	if err != nil {
32		return nil, err
33	}
34
35	out := result.(*StartFaceDetectionOutput)
36	out.ResultMetadata = metadata
37	return out, nil
38}
39
40type StartFaceDetectionInput struct {
41
42	// The video in which you want to detect faces. The video must be stored in an
43	// Amazon S3 bucket.
44	//
45	// This member is required.
46	Video *types.Video
47
48	// Idempotent token used to identify the start request. If you use the same token
49	// with multiple StartFaceDetection requests, the same JobId is returned. Use
50	// ClientRequestToken to prevent the same job from being accidently started more
51	// than once.
52	ClientRequestToken *string
53
54	// The face attributes you want returned. DEFAULT - The following subset of facial
55	// attributes are returned: BoundingBox, Confidence, Pose, Quality and Landmarks.
56	// ALL - All facial attributes are returned.
57	FaceAttributes types.FaceAttributes
58
59	// An identifier you specify that's returned in the completion notification that's
60	// published to your Amazon Simple Notification Service topic. For example, you can
61	// use JobTag to group related jobs and identify them in the completion
62	// notification.
63	JobTag *string
64
65	// The ARN of the Amazon SNS topic to which you want Amazon Rekognition Video to
66	// publish the completion status of the face detection operation.
67	NotificationChannel *types.NotificationChannel
68}
69
70type StartFaceDetectionOutput struct {
71
72	// The identifier for the face detection job. Use JobId to identify the job in a
73	// subsequent call to GetFaceDetection.
74	JobId *string
75
76	// Metadata pertaining to the operation's result.
77	ResultMetadata middleware.Metadata
78}
79
80func addOperationStartFaceDetectionMiddlewares(stack *middleware.Stack, options Options) (err error) {
81	err = stack.Serialize.Add(&awsAwsjson11_serializeOpStartFaceDetection{}, middleware.After)
82	if err != nil {
83		return err
84	}
85	err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpStartFaceDetection{}, 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 = addOpStartFaceDetectionValidationMiddleware(stack); err != nil {
126		return err
127	}
128	if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartFaceDetection(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_opStartFaceDetection(region string) *awsmiddleware.RegisterServiceMetadata {
144	return &awsmiddleware.RegisterServiceMetadata{
145		Region:        region,
146		ServiceID:     ServiceID,
147		SigningName:   "rekognition",
148		OperationName: "StartFaceDetection",
149	}
150}
151