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 unsafe content in a stored video. Amazon 15// Rekognition Video can moderate content in a video stored in an Amazon S3 bucket. 16// Use Video to specify the bucket name and the filename of the video. 17// StartContentModeration returns a job identifier (JobId) which you use to get the 18// results of the analysis. When unsafe content analysis is finished, Amazon 19// Rekognition Video publishes a completion status to the Amazon Simple 20// Notification Service topic that you specify in NotificationChannel. To get the 21// results of the unsafe content analysis, first check that the status value 22// published to the Amazon SNS topic is SUCCEEDED. If so, call GetContentModeration 23// and pass the job identifier (JobId) from the initial call to 24// StartContentModeration. For more information, see Detecting Unsafe Content in 25// the Amazon Rekognition Developer Guide. 26func (c *Client) StartContentModeration(ctx context.Context, params *StartContentModerationInput, optFns ...func(*Options)) (*StartContentModerationOutput, error) { 27 if params == nil { 28 params = &StartContentModerationInput{} 29 } 30 31 result, metadata, err := c.invokeOperation(ctx, "StartContentModeration", params, optFns, addOperationStartContentModerationMiddlewares) 32 if err != nil { 33 return nil, err 34 } 35 36 out := result.(*StartContentModerationOutput) 37 out.ResultMetadata = metadata 38 return out, nil 39} 40 41type StartContentModerationInput struct { 42 43 // The video in which you want to detect unsafe content. The video must be stored 44 // in an Amazon S3 bucket. 45 // 46 // This member is required. 47 Video *types.Video 48 49 // Idempotent token used to identify the start request. If you use the same token 50 // with multiple StartContentModeration requests, the same JobId is returned. Use 51 // ClientRequestToken to prevent the same job from being accidently started more 52 // than once. 53 ClientRequestToken *string 54 55 // An identifier you specify that's returned in the completion notification that's 56 // published to your Amazon Simple Notification Service topic. For example, you can 57 // use JobTag to group related jobs and identify them in the completion 58 // notification. 59 JobTag *string 60 61 // Specifies the minimum confidence that Amazon Rekognition must have in order to 62 // return a moderated content label. Confidence represents how certain Amazon 63 // Rekognition is that the moderated content is correctly identified. 0 is the 64 // lowest confidence. 100 is the highest confidence. Amazon Rekognition doesn't 65 // return any moderated content labels with a confidence level lower than this 66 // specified value. If you don't specify MinConfidence, GetContentModeration 67 // returns labels with confidence values greater than or equal to 50 percent. 68 MinConfidence *float32 69 70 // The Amazon SNS topic ARN that you want Amazon Rekognition Video to publish the 71 // completion status of the unsafe content analysis to. 72 NotificationChannel *types.NotificationChannel 73} 74 75type StartContentModerationOutput struct { 76 77 // The identifier for the unsafe content analysis job. Use JobId to identify the 78 // job in a subsequent call to GetContentModeration. 79 JobId *string 80 81 // Metadata pertaining to the operation's result. 82 ResultMetadata middleware.Metadata 83} 84 85func addOperationStartContentModerationMiddlewares(stack *middleware.Stack, options Options) (err error) { 86 err = stack.Serialize.Add(&awsAwsjson11_serializeOpStartContentModeration{}, middleware.After) 87 if err != nil { 88 return err 89 } 90 err = stack.Deserialize.Add(&awsAwsjson11_deserializeOpStartContentModeration{}, middleware.After) 91 if err != nil { 92 return err 93 } 94 if err = addSetLoggerMiddleware(stack, options); err != nil { 95 return err 96 } 97 if err = awsmiddleware.AddClientRequestIDMiddleware(stack); err != nil { 98 return err 99 } 100 if err = smithyhttp.AddComputeContentLengthMiddleware(stack); err != nil { 101 return err 102 } 103 if err = addResolveEndpointMiddleware(stack, options); err != nil { 104 return err 105 } 106 if err = v4.AddComputePayloadSHA256Middleware(stack); err != nil { 107 return err 108 } 109 if err = addRetryMiddlewares(stack, options); err != nil { 110 return err 111 } 112 if err = addHTTPSignerV4Middleware(stack, options); err != nil { 113 return err 114 } 115 if err = awsmiddleware.AddRawResponseToMetadata(stack); err != nil { 116 return err 117 } 118 if err = awsmiddleware.AddRecordResponseTiming(stack); err != nil { 119 return err 120 } 121 if err = addClientUserAgent(stack); err != nil { 122 return err 123 } 124 if err = smithyhttp.AddErrorCloseResponseBodyMiddleware(stack); err != nil { 125 return err 126 } 127 if err = smithyhttp.AddCloseResponseBodyMiddleware(stack); err != nil { 128 return err 129 } 130 if err = addOpStartContentModerationValidationMiddleware(stack); err != nil { 131 return err 132 } 133 if err = stack.Initialize.Add(newServiceMetadataMiddleware_opStartContentModeration(options.Region), middleware.Before); err != nil { 134 return err 135 } 136 if err = addRequestIDRetrieverMiddleware(stack); err != nil { 137 return err 138 } 139 if err = addResponseErrorMiddleware(stack); err != nil { 140 return err 141 } 142 if err = addRequestResponseLogging(stack, options); err != nil { 143 return err 144 } 145 return nil 146} 147 148func newServiceMetadataMiddleware_opStartContentModeration(region string) *awsmiddleware.RegisterServiceMetadata { 149 return &awsmiddleware.RegisterServiceMetadata{ 150 Region: region, 151 ServiceID: ServiceID, 152 SigningName: "rekognition", 153 OperationName: "StartContentModeration", 154 } 155} 156