Vendor aws-sdk-go (dep ensure) (#178)

This commit is contained in:
Onur Filiz
2018-04-27 18:18:36 -07:00
committed by Robbie Zhang
parent 228a1f7a5f
commit 8d67098d06
2785 changed files with 1973570 additions and 25 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,26 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package rekognition provides the client and types for making API
// requests to Amazon Rekognition.
//
// This is the Amazon Rekognition API reference.
//
// See rekognition package documentation for more information.
// https://docs.aws.amazon.com/sdk-for-go/api/service/rekognition/
//
// Using the Client
//
// To contact Amazon Rekognition with the SDK use the New function to create
// a new service client. With that client you can make API requests to the service.
// These clients are safe to use concurrently.
//
// See the SDK's documentation for more information on how to use the SDK.
// https://docs.aws.amazon.com/sdk-for-go/api/
//
// See aws.Config documentation for more information on configuring SDK clients.
// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config
//
// See the Amazon Rekognition client Rekognition for more
// information on creating client for this service.
// https://docs.aws.amazon.com/sdk-for-go/api/service/rekognition/#New
package rekognition

View File

@@ -0,0 +1,105 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package rekognition
const (
// ErrCodeAccessDeniedException for service response error code
// "AccessDeniedException".
//
// You are not authorized to perform the action.
ErrCodeAccessDeniedException = "AccessDeniedException"
// ErrCodeIdempotentParameterMismatchException for service response error code
// "IdempotentParameterMismatchException".
//
// A ClientRequestToken input parameter was reused with an operation, but at
// least one of the other input parameters is different from the previous call
// to the operation.
ErrCodeIdempotentParameterMismatchException = "IdempotentParameterMismatchException"
// ErrCodeImageTooLargeException for service response error code
// "ImageTooLargeException".
//
// The input image size exceeds the allowed limit. For more information, see
// limits.
ErrCodeImageTooLargeException = "ImageTooLargeException"
// ErrCodeInternalServerError for service response error code
// "InternalServerError".
//
// Amazon Rekognition experienced a service issue. Try your call again.
ErrCodeInternalServerError = "InternalServerError"
// ErrCodeInvalidImageFormatException for service response error code
// "InvalidImageFormatException".
//
// The provided image format is not supported.
ErrCodeInvalidImageFormatException = "InvalidImageFormatException"
// ErrCodeInvalidPaginationTokenException for service response error code
// "InvalidPaginationTokenException".
//
// Pagination token in the request is not valid.
ErrCodeInvalidPaginationTokenException = "InvalidPaginationTokenException"
// ErrCodeInvalidParameterException for service response error code
// "InvalidParameterException".
//
// Input parameter violated a constraint. Validate your parameter before calling
// the API operation again.
ErrCodeInvalidParameterException = "InvalidParameterException"
// ErrCodeInvalidS3ObjectException for service response error code
// "InvalidS3ObjectException".
//
// Amazon Rekognition is unable to access the S3 object specified in the request.
ErrCodeInvalidS3ObjectException = "InvalidS3ObjectException"
// ErrCodeLimitExceededException for service response error code
// "LimitExceededException".
//
// An Amazon Rekognition service limit was exceeded. For example, if you start
// too many Rekognition Video jobs concurrently, calls to start operations (StartLabelDetection,
// for example) will raise a LimitExceededException exception (HTTP status code:
// 400) until the number of concurrently running jobs is below the Amazon Rekognition
// service limit.
ErrCodeLimitExceededException = "LimitExceededException"
// ErrCodeProvisionedThroughputExceededException for service response error code
// "ProvisionedThroughputExceededException".
//
// The number of requests exceeded your throughput limit. If you want to increase
// this limit, contact Amazon Rekognition.
ErrCodeProvisionedThroughputExceededException = "ProvisionedThroughputExceededException"
// ErrCodeResourceAlreadyExistsException for service response error code
// "ResourceAlreadyExistsException".
//
// A collection with the specified ID already exists.
ErrCodeResourceAlreadyExistsException = "ResourceAlreadyExistsException"
// ErrCodeResourceInUseException for service response error code
// "ResourceInUseException".
ErrCodeResourceInUseException = "ResourceInUseException"
// ErrCodeResourceNotFoundException for service response error code
// "ResourceNotFoundException".
//
// The collection specified in the request cannot be found.
ErrCodeResourceNotFoundException = "ResourceNotFoundException"
// ErrCodeThrottlingException for service response error code
// "ThrottlingException".
//
// Amazon Rekognition is temporarily unable to process the request. Try your
// call again.
ErrCodeThrottlingException = "ThrottlingException"
// ErrCodeVideoTooLargeException for service response error code
// "VideoTooLargeException".
//
// The file size or duration of the supplied media is too large. The maximum
// file size is 8GB. The maximum duration is 2 hours.
ErrCodeVideoTooLargeException = "VideoTooLargeException"
)

View File

@@ -0,0 +1,531 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package rekognition_test
import (
"fmt"
"strings"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/awserr"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/rekognition"
)
var _ time.Duration
var _ strings.Reader
var _ aws.Config
func parseTime(layout, value string) *time.Time {
t, err := time.Parse(layout, value)
if err != nil {
panic(err)
}
return &t
}
// To compare two images
//
// This operation compares the largest face detected in the source image with each face
// detected in the target image.
func ExampleRekognition_CompareFaces_shared00() {
svc := rekognition.New(session.New())
input := &rekognition.CompareFacesInput{
SimilarityThreshold: aws.Float64(90.000000),
SourceImage: &rekognition.Image{
S3Object: &rekognition.S3Object{
Bucket: aws.String("mybucket"),
Name: aws.String("mysourceimage"),
},
},
TargetImage: &rekognition.Image{
S3Object: &rekognition.S3Object{
Bucket: aws.String("mybucket"),
Name: aws.String("mytargetimage"),
},
},
}
result, err := svc.CompareFaces(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case rekognition.ErrCodeInvalidParameterException:
fmt.Println(rekognition.ErrCodeInvalidParameterException, aerr.Error())
case rekognition.ErrCodeInvalidS3ObjectException:
fmt.Println(rekognition.ErrCodeInvalidS3ObjectException, aerr.Error())
case rekognition.ErrCodeImageTooLargeException:
fmt.Println(rekognition.ErrCodeImageTooLargeException, aerr.Error())
case rekognition.ErrCodeAccessDeniedException:
fmt.Println(rekognition.ErrCodeAccessDeniedException, aerr.Error())
case rekognition.ErrCodeInternalServerError:
fmt.Println(rekognition.ErrCodeInternalServerError, aerr.Error())
case rekognition.ErrCodeThrottlingException:
fmt.Println(rekognition.ErrCodeThrottlingException, aerr.Error())
case rekognition.ErrCodeProvisionedThroughputExceededException:
fmt.Println(rekognition.ErrCodeProvisionedThroughputExceededException, aerr.Error())
case rekognition.ErrCodeInvalidImageFormatException:
fmt.Println(rekognition.ErrCodeInvalidImageFormatException, aerr.Error())
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// To create a collection
//
// This operation creates a Rekognition collection for storing image data.
func ExampleRekognition_CreateCollection_shared00() {
svc := rekognition.New(session.New())
input := &rekognition.CreateCollectionInput{
CollectionId: aws.String("myphotos"),
}
result, err := svc.CreateCollection(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case rekognition.ErrCodeInvalidParameterException:
fmt.Println(rekognition.ErrCodeInvalidParameterException, aerr.Error())
case rekognition.ErrCodeAccessDeniedException:
fmt.Println(rekognition.ErrCodeAccessDeniedException, aerr.Error())
case rekognition.ErrCodeInternalServerError:
fmt.Println(rekognition.ErrCodeInternalServerError, aerr.Error())
case rekognition.ErrCodeThrottlingException:
fmt.Println(rekognition.ErrCodeThrottlingException, aerr.Error())
case rekognition.ErrCodeProvisionedThroughputExceededException:
fmt.Println(rekognition.ErrCodeProvisionedThroughputExceededException, aerr.Error())
case rekognition.ErrCodeResourceAlreadyExistsException:
fmt.Println(rekognition.ErrCodeResourceAlreadyExistsException, aerr.Error())
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// To delete a collection
//
// This operation deletes a Rekognition collection.
func ExampleRekognition_DeleteCollection_shared00() {
svc := rekognition.New(session.New())
input := &rekognition.DeleteCollectionInput{
CollectionId: aws.String("myphotos"),
}
result, err := svc.DeleteCollection(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case rekognition.ErrCodeInvalidParameterException:
fmt.Println(rekognition.ErrCodeInvalidParameterException, aerr.Error())
case rekognition.ErrCodeAccessDeniedException:
fmt.Println(rekognition.ErrCodeAccessDeniedException, aerr.Error())
case rekognition.ErrCodeInternalServerError:
fmt.Println(rekognition.ErrCodeInternalServerError, aerr.Error())
case rekognition.ErrCodeThrottlingException:
fmt.Println(rekognition.ErrCodeThrottlingException, aerr.Error())
case rekognition.ErrCodeProvisionedThroughputExceededException:
fmt.Println(rekognition.ErrCodeProvisionedThroughputExceededException, aerr.Error())
case rekognition.ErrCodeResourceNotFoundException:
fmt.Println(rekognition.ErrCodeResourceNotFoundException, aerr.Error())
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// To delete a face
//
// This operation deletes one or more faces from a Rekognition collection.
func ExampleRekognition_DeleteFaces_shared00() {
svc := rekognition.New(session.New())
input := &rekognition.DeleteFacesInput{
CollectionId: aws.String("myphotos"),
FaceIds: []*string{
aws.String("ff43d742-0c13-5d16-a3e8-03d3f58e980b"),
},
}
result, err := svc.DeleteFaces(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case rekognition.ErrCodeInvalidParameterException:
fmt.Println(rekognition.ErrCodeInvalidParameterException, aerr.Error())
case rekognition.ErrCodeAccessDeniedException:
fmt.Println(rekognition.ErrCodeAccessDeniedException, aerr.Error())
case rekognition.ErrCodeInternalServerError:
fmt.Println(rekognition.ErrCodeInternalServerError, aerr.Error())
case rekognition.ErrCodeThrottlingException:
fmt.Println(rekognition.ErrCodeThrottlingException, aerr.Error())
case rekognition.ErrCodeProvisionedThroughputExceededException:
fmt.Println(rekognition.ErrCodeProvisionedThroughputExceededException, aerr.Error())
case rekognition.ErrCodeResourceNotFoundException:
fmt.Println(rekognition.ErrCodeResourceNotFoundException, aerr.Error())
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// To detect faces in an image
//
// This operation detects faces in an image stored in an AWS S3 bucket.
func ExampleRekognition_DetectFaces_shared00() {
svc := rekognition.New(session.New())
input := &rekognition.DetectFacesInput{
Image: &rekognition.Image{
S3Object: &rekognition.S3Object{
Bucket: aws.String("mybucket"),
Name: aws.String("myphoto"),
},
},
}
result, err := svc.DetectFaces(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case rekognition.ErrCodeInvalidS3ObjectException:
fmt.Println(rekognition.ErrCodeInvalidS3ObjectException, aerr.Error())
case rekognition.ErrCodeInvalidParameterException:
fmt.Println(rekognition.ErrCodeInvalidParameterException, aerr.Error())
case rekognition.ErrCodeImageTooLargeException:
fmt.Println(rekognition.ErrCodeImageTooLargeException, aerr.Error())
case rekognition.ErrCodeAccessDeniedException:
fmt.Println(rekognition.ErrCodeAccessDeniedException, aerr.Error())
case rekognition.ErrCodeInternalServerError:
fmt.Println(rekognition.ErrCodeInternalServerError, aerr.Error())
case rekognition.ErrCodeThrottlingException:
fmt.Println(rekognition.ErrCodeThrottlingException, aerr.Error())
case rekognition.ErrCodeProvisionedThroughputExceededException:
fmt.Println(rekognition.ErrCodeProvisionedThroughputExceededException, aerr.Error())
case rekognition.ErrCodeInvalidImageFormatException:
fmt.Println(rekognition.ErrCodeInvalidImageFormatException, aerr.Error())
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// To detect labels
//
// This operation detects labels in the supplied image
func ExampleRekognition_DetectLabels_shared00() {
svc := rekognition.New(session.New())
input := &rekognition.DetectLabelsInput{
Image: &rekognition.Image{
S3Object: &rekognition.S3Object{
Bucket: aws.String("mybucket"),
Name: aws.String("myphoto"),
},
},
MaxLabels: aws.Int64(123),
MinConfidence: aws.Float64(70.000000),
}
result, err := svc.DetectLabels(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case rekognition.ErrCodeInvalidS3ObjectException:
fmt.Println(rekognition.ErrCodeInvalidS3ObjectException, aerr.Error())
case rekognition.ErrCodeInvalidParameterException:
fmt.Println(rekognition.ErrCodeInvalidParameterException, aerr.Error())
case rekognition.ErrCodeImageTooLargeException:
fmt.Println(rekognition.ErrCodeImageTooLargeException, aerr.Error())
case rekognition.ErrCodeAccessDeniedException:
fmt.Println(rekognition.ErrCodeAccessDeniedException, aerr.Error())
case rekognition.ErrCodeInternalServerError:
fmt.Println(rekognition.ErrCodeInternalServerError, aerr.Error())
case rekognition.ErrCodeThrottlingException:
fmt.Println(rekognition.ErrCodeThrottlingException, aerr.Error())
case rekognition.ErrCodeProvisionedThroughputExceededException:
fmt.Println(rekognition.ErrCodeProvisionedThroughputExceededException, aerr.Error())
case rekognition.ErrCodeInvalidImageFormatException:
fmt.Println(rekognition.ErrCodeInvalidImageFormatException, aerr.Error())
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// To add a face to a collection
//
// This operation detects faces in an image and adds them to the specified Rekognition
// collection.
func ExampleRekognition_IndexFaces_shared00() {
svc := rekognition.New(session.New())
input := &rekognition.IndexFacesInput{
CollectionId: aws.String("myphotos"),
ExternalImageId: aws.String("myphotoid"),
Image: &rekognition.Image{
S3Object: &rekognition.S3Object{
Bucket: aws.String("mybucket"),
Name: aws.String("myphoto"),
},
},
}
result, err := svc.IndexFaces(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case rekognition.ErrCodeInvalidS3ObjectException:
fmt.Println(rekognition.ErrCodeInvalidS3ObjectException, aerr.Error())
case rekognition.ErrCodeInvalidParameterException:
fmt.Println(rekognition.ErrCodeInvalidParameterException, aerr.Error())
case rekognition.ErrCodeImageTooLargeException:
fmt.Println(rekognition.ErrCodeImageTooLargeException, aerr.Error())
case rekognition.ErrCodeAccessDeniedException:
fmt.Println(rekognition.ErrCodeAccessDeniedException, aerr.Error())
case rekognition.ErrCodeInternalServerError:
fmt.Println(rekognition.ErrCodeInternalServerError, aerr.Error())
case rekognition.ErrCodeThrottlingException:
fmt.Println(rekognition.ErrCodeThrottlingException, aerr.Error())
case rekognition.ErrCodeProvisionedThroughputExceededException:
fmt.Println(rekognition.ErrCodeProvisionedThroughputExceededException, aerr.Error())
case rekognition.ErrCodeResourceNotFoundException:
fmt.Println(rekognition.ErrCodeResourceNotFoundException, aerr.Error())
case rekognition.ErrCodeInvalidImageFormatException:
fmt.Println(rekognition.ErrCodeInvalidImageFormatException, aerr.Error())
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// To list the collections
//
// This operation returns a list of Rekognition collections.
func ExampleRekognition_ListCollections_shared00() {
svc := rekognition.New(session.New())
input := &rekognition.ListCollectionsInput{}
result, err := svc.ListCollections(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case rekognition.ErrCodeInvalidParameterException:
fmt.Println(rekognition.ErrCodeInvalidParameterException, aerr.Error())
case rekognition.ErrCodeAccessDeniedException:
fmt.Println(rekognition.ErrCodeAccessDeniedException, aerr.Error())
case rekognition.ErrCodeInternalServerError:
fmt.Println(rekognition.ErrCodeInternalServerError, aerr.Error())
case rekognition.ErrCodeThrottlingException:
fmt.Println(rekognition.ErrCodeThrottlingException, aerr.Error())
case rekognition.ErrCodeProvisionedThroughputExceededException:
fmt.Println(rekognition.ErrCodeProvisionedThroughputExceededException, aerr.Error())
case rekognition.ErrCodeInvalidPaginationTokenException:
fmt.Println(rekognition.ErrCodeInvalidPaginationTokenException, aerr.Error())
case rekognition.ErrCodeResourceNotFoundException:
fmt.Println(rekognition.ErrCodeResourceNotFoundException, aerr.Error())
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// To list the faces in a collection
//
// This operation lists the faces in a Rekognition collection.
func ExampleRekognition_ListFaces_shared00() {
svc := rekognition.New(session.New())
input := &rekognition.ListFacesInput{
CollectionId: aws.String("myphotos"),
MaxResults: aws.Int64(20),
}
result, err := svc.ListFaces(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case rekognition.ErrCodeInvalidParameterException:
fmt.Println(rekognition.ErrCodeInvalidParameterException, aerr.Error())
case rekognition.ErrCodeAccessDeniedException:
fmt.Println(rekognition.ErrCodeAccessDeniedException, aerr.Error())
case rekognition.ErrCodeInternalServerError:
fmt.Println(rekognition.ErrCodeInternalServerError, aerr.Error())
case rekognition.ErrCodeThrottlingException:
fmt.Println(rekognition.ErrCodeThrottlingException, aerr.Error())
case rekognition.ErrCodeProvisionedThroughputExceededException:
fmt.Println(rekognition.ErrCodeProvisionedThroughputExceededException, aerr.Error())
case rekognition.ErrCodeInvalidPaginationTokenException:
fmt.Println(rekognition.ErrCodeInvalidPaginationTokenException, aerr.Error())
case rekognition.ErrCodeResourceNotFoundException:
fmt.Println(rekognition.ErrCodeResourceNotFoundException, aerr.Error())
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// To delete a face
//
// This operation searches for matching faces in the collection the supplied face belongs
// to.
func ExampleRekognition_SearchFaces_shared00() {
svc := rekognition.New(session.New())
input := &rekognition.SearchFacesInput{
CollectionId: aws.String("myphotos"),
FaceId: aws.String("70008e50-75e4-55d0-8e80-363fb73b3a14"),
FaceMatchThreshold: aws.Float64(90.000000),
MaxFaces: aws.Int64(10),
}
result, err := svc.SearchFaces(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case rekognition.ErrCodeInvalidParameterException:
fmt.Println(rekognition.ErrCodeInvalidParameterException, aerr.Error())
case rekognition.ErrCodeAccessDeniedException:
fmt.Println(rekognition.ErrCodeAccessDeniedException, aerr.Error())
case rekognition.ErrCodeInternalServerError:
fmt.Println(rekognition.ErrCodeInternalServerError, aerr.Error())
case rekognition.ErrCodeThrottlingException:
fmt.Println(rekognition.ErrCodeThrottlingException, aerr.Error())
case rekognition.ErrCodeProvisionedThroughputExceededException:
fmt.Println(rekognition.ErrCodeProvisionedThroughputExceededException, aerr.Error())
case rekognition.ErrCodeResourceNotFoundException:
fmt.Println(rekognition.ErrCodeResourceNotFoundException, aerr.Error())
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}
// To search for faces matching a supplied image
//
// This operation searches for faces in a Rekognition collection that match the largest
// face in an S3 bucket stored image.
func ExampleRekognition_SearchFacesByImage_shared00() {
svc := rekognition.New(session.New())
input := &rekognition.SearchFacesByImageInput{
CollectionId: aws.String("myphotos"),
FaceMatchThreshold: aws.Float64(95.000000),
Image: &rekognition.Image{
S3Object: &rekognition.S3Object{
Bucket: aws.String("mybucket"),
Name: aws.String("myphoto"),
},
},
MaxFaces: aws.Int64(5),
}
result, err := svc.SearchFacesByImage(input)
if err != nil {
if aerr, ok := err.(awserr.Error); ok {
switch aerr.Code() {
case rekognition.ErrCodeInvalidS3ObjectException:
fmt.Println(rekognition.ErrCodeInvalidS3ObjectException, aerr.Error())
case rekognition.ErrCodeInvalidParameterException:
fmt.Println(rekognition.ErrCodeInvalidParameterException, aerr.Error())
case rekognition.ErrCodeImageTooLargeException:
fmt.Println(rekognition.ErrCodeImageTooLargeException, aerr.Error())
case rekognition.ErrCodeAccessDeniedException:
fmt.Println(rekognition.ErrCodeAccessDeniedException, aerr.Error())
case rekognition.ErrCodeInternalServerError:
fmt.Println(rekognition.ErrCodeInternalServerError, aerr.Error())
case rekognition.ErrCodeThrottlingException:
fmt.Println(rekognition.ErrCodeThrottlingException, aerr.Error())
case rekognition.ErrCodeProvisionedThroughputExceededException:
fmt.Println(rekognition.ErrCodeProvisionedThroughputExceededException, aerr.Error())
case rekognition.ErrCodeResourceNotFoundException:
fmt.Println(rekognition.ErrCodeResourceNotFoundException, aerr.Error())
case rekognition.ErrCodeInvalidImageFormatException:
fmt.Println(rekognition.ErrCodeInvalidImageFormatException, aerr.Error())
default:
fmt.Println(aerr.Error())
}
} else {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
}
return
}
fmt.Println(result)
}

View File

@@ -0,0 +1,223 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
// Package rekognitioniface provides an interface to enable mocking the Amazon Rekognition service client
// for testing your code.
//
// It is important to note that this interface will have breaking changes
// when the service model is updated and adds new API operations, paginators,
// and waiters.
package rekognitioniface
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/rekognition"
)
// RekognitionAPI provides an interface to enable mocking the
// rekognition.Rekognition service client's API operation,
// paginators, and waiters. This make unit testing your code that calls out
// to the SDK's service client's calls easier.
//
// The best way to use this interface is so the SDK's service client's calls
// can be stubbed out for unit testing your code with the SDK without needing
// to inject custom request handlers into the SDK's request pipeline.
//
// // myFunc uses an SDK service client to make a request to
// // Amazon Rekognition.
// func myFunc(svc rekognitioniface.RekognitionAPI) bool {
// // Make svc.CompareFaces request
// }
//
// func main() {
// sess := session.New()
// svc := rekognition.New(sess)
//
// myFunc(svc)
// }
//
// In your _test.go file:
//
// // Define a mock struct to be used in your unit tests of myFunc.
// type mockRekognitionClient struct {
// rekognitioniface.RekognitionAPI
// }
// func (m *mockRekognitionClient) CompareFaces(input *rekognition.CompareFacesInput) (*rekognition.CompareFacesOutput, error) {
// // mock response/functionality
// }
//
// func TestMyFunc(t *testing.T) {
// // Setup Test
// mockSvc := &mockRekognitionClient{}
//
// myfunc(mockSvc)
//
// // Verify myFunc's functionality
// }
//
// It is important to note that this interface will have breaking changes
// when the service model is updated and adds new API operations, paginators,
// and waiters. Its suggested to use the pattern above for testing, or using
// tooling to generate mocks to satisfy the interfaces.
type RekognitionAPI interface {
CompareFaces(*rekognition.CompareFacesInput) (*rekognition.CompareFacesOutput, error)
CompareFacesWithContext(aws.Context, *rekognition.CompareFacesInput, ...request.Option) (*rekognition.CompareFacesOutput, error)
CompareFacesRequest(*rekognition.CompareFacesInput) (*request.Request, *rekognition.CompareFacesOutput)
CreateCollection(*rekognition.CreateCollectionInput) (*rekognition.CreateCollectionOutput, error)
CreateCollectionWithContext(aws.Context, *rekognition.CreateCollectionInput, ...request.Option) (*rekognition.CreateCollectionOutput, error)
CreateCollectionRequest(*rekognition.CreateCollectionInput) (*request.Request, *rekognition.CreateCollectionOutput)
CreateStreamProcessor(*rekognition.CreateStreamProcessorInput) (*rekognition.CreateStreamProcessorOutput, error)
CreateStreamProcessorWithContext(aws.Context, *rekognition.CreateStreamProcessorInput, ...request.Option) (*rekognition.CreateStreamProcessorOutput, error)
CreateStreamProcessorRequest(*rekognition.CreateStreamProcessorInput) (*request.Request, *rekognition.CreateStreamProcessorOutput)
DeleteCollection(*rekognition.DeleteCollectionInput) (*rekognition.DeleteCollectionOutput, error)
DeleteCollectionWithContext(aws.Context, *rekognition.DeleteCollectionInput, ...request.Option) (*rekognition.DeleteCollectionOutput, error)
DeleteCollectionRequest(*rekognition.DeleteCollectionInput) (*request.Request, *rekognition.DeleteCollectionOutput)
DeleteFaces(*rekognition.DeleteFacesInput) (*rekognition.DeleteFacesOutput, error)
DeleteFacesWithContext(aws.Context, *rekognition.DeleteFacesInput, ...request.Option) (*rekognition.DeleteFacesOutput, error)
DeleteFacesRequest(*rekognition.DeleteFacesInput) (*request.Request, *rekognition.DeleteFacesOutput)
DeleteStreamProcessor(*rekognition.DeleteStreamProcessorInput) (*rekognition.DeleteStreamProcessorOutput, error)
DeleteStreamProcessorWithContext(aws.Context, *rekognition.DeleteStreamProcessorInput, ...request.Option) (*rekognition.DeleteStreamProcessorOutput, error)
DeleteStreamProcessorRequest(*rekognition.DeleteStreamProcessorInput) (*request.Request, *rekognition.DeleteStreamProcessorOutput)
DescribeStreamProcessor(*rekognition.DescribeStreamProcessorInput) (*rekognition.DescribeStreamProcessorOutput, error)
DescribeStreamProcessorWithContext(aws.Context, *rekognition.DescribeStreamProcessorInput, ...request.Option) (*rekognition.DescribeStreamProcessorOutput, error)
DescribeStreamProcessorRequest(*rekognition.DescribeStreamProcessorInput) (*request.Request, *rekognition.DescribeStreamProcessorOutput)
DetectFaces(*rekognition.DetectFacesInput) (*rekognition.DetectFacesOutput, error)
DetectFacesWithContext(aws.Context, *rekognition.DetectFacesInput, ...request.Option) (*rekognition.DetectFacesOutput, error)
DetectFacesRequest(*rekognition.DetectFacesInput) (*request.Request, *rekognition.DetectFacesOutput)
DetectLabels(*rekognition.DetectLabelsInput) (*rekognition.DetectLabelsOutput, error)
DetectLabelsWithContext(aws.Context, *rekognition.DetectLabelsInput, ...request.Option) (*rekognition.DetectLabelsOutput, error)
DetectLabelsRequest(*rekognition.DetectLabelsInput) (*request.Request, *rekognition.DetectLabelsOutput)
DetectModerationLabels(*rekognition.DetectModerationLabelsInput) (*rekognition.DetectModerationLabelsOutput, error)
DetectModerationLabelsWithContext(aws.Context, *rekognition.DetectModerationLabelsInput, ...request.Option) (*rekognition.DetectModerationLabelsOutput, error)
DetectModerationLabelsRequest(*rekognition.DetectModerationLabelsInput) (*request.Request, *rekognition.DetectModerationLabelsOutput)
DetectText(*rekognition.DetectTextInput) (*rekognition.DetectTextOutput, error)
DetectTextWithContext(aws.Context, *rekognition.DetectTextInput, ...request.Option) (*rekognition.DetectTextOutput, error)
DetectTextRequest(*rekognition.DetectTextInput) (*request.Request, *rekognition.DetectTextOutput)
GetCelebrityInfo(*rekognition.GetCelebrityInfoInput) (*rekognition.GetCelebrityInfoOutput, error)
GetCelebrityInfoWithContext(aws.Context, *rekognition.GetCelebrityInfoInput, ...request.Option) (*rekognition.GetCelebrityInfoOutput, error)
GetCelebrityInfoRequest(*rekognition.GetCelebrityInfoInput) (*request.Request, *rekognition.GetCelebrityInfoOutput)
GetCelebrityRecognition(*rekognition.GetCelebrityRecognitionInput) (*rekognition.GetCelebrityRecognitionOutput, error)
GetCelebrityRecognitionWithContext(aws.Context, *rekognition.GetCelebrityRecognitionInput, ...request.Option) (*rekognition.GetCelebrityRecognitionOutput, error)
GetCelebrityRecognitionRequest(*rekognition.GetCelebrityRecognitionInput) (*request.Request, *rekognition.GetCelebrityRecognitionOutput)
GetCelebrityRecognitionPages(*rekognition.GetCelebrityRecognitionInput, func(*rekognition.GetCelebrityRecognitionOutput, bool) bool) error
GetCelebrityRecognitionPagesWithContext(aws.Context, *rekognition.GetCelebrityRecognitionInput, func(*rekognition.GetCelebrityRecognitionOutput, bool) bool, ...request.Option) error
GetContentModeration(*rekognition.GetContentModerationInput) (*rekognition.GetContentModerationOutput, error)
GetContentModerationWithContext(aws.Context, *rekognition.GetContentModerationInput, ...request.Option) (*rekognition.GetContentModerationOutput, error)
GetContentModerationRequest(*rekognition.GetContentModerationInput) (*request.Request, *rekognition.GetContentModerationOutput)
GetContentModerationPages(*rekognition.GetContentModerationInput, func(*rekognition.GetContentModerationOutput, bool) bool) error
GetContentModerationPagesWithContext(aws.Context, *rekognition.GetContentModerationInput, func(*rekognition.GetContentModerationOutput, bool) bool, ...request.Option) error
GetFaceDetection(*rekognition.GetFaceDetectionInput) (*rekognition.GetFaceDetectionOutput, error)
GetFaceDetectionWithContext(aws.Context, *rekognition.GetFaceDetectionInput, ...request.Option) (*rekognition.GetFaceDetectionOutput, error)
GetFaceDetectionRequest(*rekognition.GetFaceDetectionInput) (*request.Request, *rekognition.GetFaceDetectionOutput)
GetFaceDetectionPages(*rekognition.GetFaceDetectionInput, func(*rekognition.GetFaceDetectionOutput, bool) bool) error
GetFaceDetectionPagesWithContext(aws.Context, *rekognition.GetFaceDetectionInput, func(*rekognition.GetFaceDetectionOutput, bool) bool, ...request.Option) error
GetFaceSearch(*rekognition.GetFaceSearchInput) (*rekognition.GetFaceSearchOutput, error)
GetFaceSearchWithContext(aws.Context, *rekognition.GetFaceSearchInput, ...request.Option) (*rekognition.GetFaceSearchOutput, error)
GetFaceSearchRequest(*rekognition.GetFaceSearchInput) (*request.Request, *rekognition.GetFaceSearchOutput)
GetFaceSearchPages(*rekognition.GetFaceSearchInput, func(*rekognition.GetFaceSearchOutput, bool) bool) error
GetFaceSearchPagesWithContext(aws.Context, *rekognition.GetFaceSearchInput, func(*rekognition.GetFaceSearchOutput, bool) bool, ...request.Option) error
GetLabelDetection(*rekognition.GetLabelDetectionInput) (*rekognition.GetLabelDetectionOutput, error)
GetLabelDetectionWithContext(aws.Context, *rekognition.GetLabelDetectionInput, ...request.Option) (*rekognition.GetLabelDetectionOutput, error)
GetLabelDetectionRequest(*rekognition.GetLabelDetectionInput) (*request.Request, *rekognition.GetLabelDetectionOutput)
GetLabelDetectionPages(*rekognition.GetLabelDetectionInput, func(*rekognition.GetLabelDetectionOutput, bool) bool) error
GetLabelDetectionPagesWithContext(aws.Context, *rekognition.GetLabelDetectionInput, func(*rekognition.GetLabelDetectionOutput, bool) bool, ...request.Option) error
GetPersonTracking(*rekognition.GetPersonTrackingInput) (*rekognition.GetPersonTrackingOutput, error)
GetPersonTrackingWithContext(aws.Context, *rekognition.GetPersonTrackingInput, ...request.Option) (*rekognition.GetPersonTrackingOutput, error)
GetPersonTrackingRequest(*rekognition.GetPersonTrackingInput) (*request.Request, *rekognition.GetPersonTrackingOutput)
GetPersonTrackingPages(*rekognition.GetPersonTrackingInput, func(*rekognition.GetPersonTrackingOutput, bool) bool) error
GetPersonTrackingPagesWithContext(aws.Context, *rekognition.GetPersonTrackingInput, func(*rekognition.GetPersonTrackingOutput, bool) bool, ...request.Option) error
IndexFaces(*rekognition.IndexFacesInput) (*rekognition.IndexFacesOutput, error)
IndexFacesWithContext(aws.Context, *rekognition.IndexFacesInput, ...request.Option) (*rekognition.IndexFacesOutput, error)
IndexFacesRequest(*rekognition.IndexFacesInput) (*request.Request, *rekognition.IndexFacesOutput)
ListCollections(*rekognition.ListCollectionsInput) (*rekognition.ListCollectionsOutput, error)
ListCollectionsWithContext(aws.Context, *rekognition.ListCollectionsInput, ...request.Option) (*rekognition.ListCollectionsOutput, error)
ListCollectionsRequest(*rekognition.ListCollectionsInput) (*request.Request, *rekognition.ListCollectionsOutput)
ListCollectionsPages(*rekognition.ListCollectionsInput, func(*rekognition.ListCollectionsOutput, bool) bool) error
ListCollectionsPagesWithContext(aws.Context, *rekognition.ListCollectionsInput, func(*rekognition.ListCollectionsOutput, bool) bool, ...request.Option) error
ListFaces(*rekognition.ListFacesInput) (*rekognition.ListFacesOutput, error)
ListFacesWithContext(aws.Context, *rekognition.ListFacesInput, ...request.Option) (*rekognition.ListFacesOutput, error)
ListFacesRequest(*rekognition.ListFacesInput) (*request.Request, *rekognition.ListFacesOutput)
ListFacesPages(*rekognition.ListFacesInput, func(*rekognition.ListFacesOutput, bool) bool) error
ListFacesPagesWithContext(aws.Context, *rekognition.ListFacesInput, func(*rekognition.ListFacesOutput, bool) bool, ...request.Option) error
ListStreamProcessors(*rekognition.ListStreamProcessorsInput) (*rekognition.ListStreamProcessorsOutput, error)
ListStreamProcessorsWithContext(aws.Context, *rekognition.ListStreamProcessorsInput, ...request.Option) (*rekognition.ListStreamProcessorsOutput, error)
ListStreamProcessorsRequest(*rekognition.ListStreamProcessorsInput) (*request.Request, *rekognition.ListStreamProcessorsOutput)
ListStreamProcessorsPages(*rekognition.ListStreamProcessorsInput, func(*rekognition.ListStreamProcessorsOutput, bool) bool) error
ListStreamProcessorsPagesWithContext(aws.Context, *rekognition.ListStreamProcessorsInput, func(*rekognition.ListStreamProcessorsOutput, bool) bool, ...request.Option) error
RecognizeCelebrities(*rekognition.RecognizeCelebritiesInput) (*rekognition.RecognizeCelebritiesOutput, error)
RecognizeCelebritiesWithContext(aws.Context, *rekognition.RecognizeCelebritiesInput, ...request.Option) (*rekognition.RecognizeCelebritiesOutput, error)
RecognizeCelebritiesRequest(*rekognition.RecognizeCelebritiesInput) (*request.Request, *rekognition.RecognizeCelebritiesOutput)
SearchFaces(*rekognition.SearchFacesInput) (*rekognition.SearchFacesOutput, error)
SearchFacesWithContext(aws.Context, *rekognition.SearchFacesInput, ...request.Option) (*rekognition.SearchFacesOutput, error)
SearchFacesRequest(*rekognition.SearchFacesInput) (*request.Request, *rekognition.SearchFacesOutput)
SearchFacesByImage(*rekognition.SearchFacesByImageInput) (*rekognition.SearchFacesByImageOutput, error)
SearchFacesByImageWithContext(aws.Context, *rekognition.SearchFacesByImageInput, ...request.Option) (*rekognition.SearchFacesByImageOutput, error)
SearchFacesByImageRequest(*rekognition.SearchFacesByImageInput) (*request.Request, *rekognition.SearchFacesByImageOutput)
StartCelebrityRecognition(*rekognition.StartCelebrityRecognitionInput) (*rekognition.StartCelebrityRecognitionOutput, error)
StartCelebrityRecognitionWithContext(aws.Context, *rekognition.StartCelebrityRecognitionInput, ...request.Option) (*rekognition.StartCelebrityRecognitionOutput, error)
StartCelebrityRecognitionRequest(*rekognition.StartCelebrityRecognitionInput) (*request.Request, *rekognition.StartCelebrityRecognitionOutput)
StartContentModeration(*rekognition.StartContentModerationInput) (*rekognition.StartContentModerationOutput, error)
StartContentModerationWithContext(aws.Context, *rekognition.StartContentModerationInput, ...request.Option) (*rekognition.StartContentModerationOutput, error)
StartContentModerationRequest(*rekognition.StartContentModerationInput) (*request.Request, *rekognition.StartContentModerationOutput)
StartFaceDetection(*rekognition.StartFaceDetectionInput) (*rekognition.StartFaceDetectionOutput, error)
StartFaceDetectionWithContext(aws.Context, *rekognition.StartFaceDetectionInput, ...request.Option) (*rekognition.StartFaceDetectionOutput, error)
StartFaceDetectionRequest(*rekognition.StartFaceDetectionInput) (*request.Request, *rekognition.StartFaceDetectionOutput)
StartFaceSearch(*rekognition.StartFaceSearchInput) (*rekognition.StartFaceSearchOutput, error)
StartFaceSearchWithContext(aws.Context, *rekognition.StartFaceSearchInput, ...request.Option) (*rekognition.StartFaceSearchOutput, error)
StartFaceSearchRequest(*rekognition.StartFaceSearchInput) (*request.Request, *rekognition.StartFaceSearchOutput)
StartLabelDetection(*rekognition.StartLabelDetectionInput) (*rekognition.StartLabelDetectionOutput, error)
StartLabelDetectionWithContext(aws.Context, *rekognition.StartLabelDetectionInput, ...request.Option) (*rekognition.StartLabelDetectionOutput, error)
StartLabelDetectionRequest(*rekognition.StartLabelDetectionInput) (*request.Request, *rekognition.StartLabelDetectionOutput)
StartPersonTracking(*rekognition.StartPersonTrackingInput) (*rekognition.StartPersonTrackingOutput, error)
StartPersonTrackingWithContext(aws.Context, *rekognition.StartPersonTrackingInput, ...request.Option) (*rekognition.StartPersonTrackingOutput, error)
StartPersonTrackingRequest(*rekognition.StartPersonTrackingInput) (*request.Request, *rekognition.StartPersonTrackingOutput)
StartStreamProcessor(*rekognition.StartStreamProcessorInput) (*rekognition.StartStreamProcessorOutput, error)
StartStreamProcessorWithContext(aws.Context, *rekognition.StartStreamProcessorInput, ...request.Option) (*rekognition.StartStreamProcessorOutput, error)
StartStreamProcessorRequest(*rekognition.StartStreamProcessorInput) (*request.Request, *rekognition.StartStreamProcessorOutput)
StopStreamProcessor(*rekognition.StopStreamProcessorInput) (*rekognition.StopStreamProcessorOutput, error)
StopStreamProcessorWithContext(aws.Context, *rekognition.StopStreamProcessorInput, ...request.Option) (*rekognition.StopStreamProcessorOutput, error)
StopStreamProcessorRequest(*rekognition.StopStreamProcessorInput) (*request.Request, *rekognition.StopStreamProcessorOutput)
}
var _ RekognitionAPI = (*rekognition.Rekognition)(nil)

View File

@@ -0,0 +1,95 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package rekognition
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/client"
"github.com/aws/aws-sdk-go/aws/client/metadata"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/aws/signer/v4"
"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
)
// Rekognition provides the API operation methods for making requests to
// Amazon Rekognition. See this package's package overview docs
// for details on the service.
//
// Rekognition methods are safe to use concurrently. It is not safe to
// modify mutate any of the struct's properties though.
type Rekognition struct {
*client.Client
}
// Used for custom client initialization logic
var initClient func(*client.Client)
// Used for custom request initialization logic
var initRequest func(*request.Request)
// Service information constants
const (
ServiceName = "rekognition" // Service endpoint prefix API calls made to.
EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata.
)
// New creates a new instance of the Rekognition client with a session.
// If additional configuration is needed for the client instance use the optional
// aws.Config parameter to add your extra config.
//
// Example:
// // Create a Rekognition client from just a session.
// svc := rekognition.New(mySession)
//
// // Create a Rekognition client with additional configuration
// svc := rekognition.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *Rekognition {
c := p.ClientConfig(EndpointsID, cfgs...)
return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName)
}
// newClient creates, initializes and returns a new service client instance.
func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *Rekognition {
svc := &Rekognition{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningName: signingName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2016-06-27",
JSONVersion: "1.1",
TargetPrefix: "RekognitionService",
},
handlers,
),
}
// Handlers
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler)
svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler)
svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler)
svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler)
// Run custom client initialization if present
if initClient != nil {
initClient(svc.Client)
}
return svc
}
// newRequest creates a new request for a Rekognition operation and runs any
// custom request initialization.
func (c *Rekognition) newRequest(op *request.Operation, params, data interface{}) *request.Request {
req := c.NewRequest(op, params, data)
// Run custom request initialization if present
if initRequest != nil {
initRequest(req)
}
return req
}