Switch to using the dep tool and update all the dependencies

This commit is contained in:
Nick Craig-Wood
2017-05-11 15:39:54 +01:00
parent 5135ff73cb
commit 98c2d2c41b
5321 changed files with 4483197 additions and 5918 deletions
File diff suppressed because it is too large Load Diff
+78
View File
@@ -0,0 +1,78 @@
// 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 use the client for Amazon Rekognition you will first need
// to create a new instance of it.
//
// When creating a client for an AWS service you'll first need to have a Session
// already created. The Session provides configuration that can be shared
// between multiple service clients. Additional configuration can be applied to
// the Session and service's client when they are constructed. The aws package's
// Config type contains several fields such as Region for the AWS Region the
// client should make API requests too. The optional Config value can be provided
// as the variadic argument for Sessions and client creation.
//
// Once the service's client is created you can use it to make API requests the
// AWS service. These clients are safe to use concurrently.
//
// // Create a session to share configuration, and load external configuration.
// sess := session.Must(session.NewSession())
//
// // Create the service's client with the session.
// svc := rekognition.New(sess)
//
// See the SDK's documentation for more information on how to use service clients.
// https://docs.aws.amazon.com/sdk-for-go/api/
//
// See aws package's Config type for more information on configuration options.
// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config
//
// See the Amazon Rekognition client Rekognition for more
// information on creating the service's client.
// https://docs.aws.amazon.com/sdk-for-go/api/service/rekognition/#New
//
// Once the client is created you can make an API request to the service.
// Each API method takes a input parameter, and returns the service response
// and an error.
//
// The API method will document which error codes the service can be returned
// by the operation if the service models the API operation's errors. These
// errors will also be available as const strings prefixed with "ErrCode".
//
// result, err := svc.CompareFaces(params)
// if err != nil {
// // Cast err to awserr.Error to handle specific error codes.
// aerr, ok := err.(awserr.Error)
// if ok && aerr.Code() == <error code to check for> {
// // Specific error code handling
// }
// return err
// }
//
// fmt.Println("CompareFaces result:")
// fmt.Println(result)
//
// Using the Client with Context
//
// The service's client also provides methods to make API requests with a Context
// value. This allows you to control the timeout, and cancellation of pending
// requests. These methods also take request Option as variadic parameter to apply
// additional configuration to the API request.
//
// ctx := context.Background()
//
// result, err := svc.CompareFacesWithContext(ctx, params)
//
// See the request package documentation for more information on using Context pattern
// with the SDK.
// https://docs.aws.amazon.com/sdk-for-go/api/aws/request/
package rekognition
+76
View File
@@ -0,0 +1,76 @@
// 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"
// 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"
// 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"
// ErrCodeResourceNotFoundException for service response error code
// "ResourceNotFoundException".
//
// Collection specified in the request is not 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"
)
+345
View File
@@ -0,0 +1,345 @@
// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT.
package rekognition_test
import (
"bytes"
"fmt"
"time"
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/session"
"github.com/aws/aws-sdk-go/service/rekognition"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleRekognition_CompareFaces() {
sess := session.Must(session.NewSession())
svc := rekognition.New(sess)
params := &rekognition.CompareFacesInput{
SourceImage: &rekognition.Image{ // Required
Bytes: []byte("PAYLOAD"),
S3Object: &rekognition.S3Object{
Bucket: aws.String("S3Bucket"),
Name: aws.String("S3ObjectName"),
Version: aws.String("S3ObjectVersion"),
},
},
TargetImage: &rekognition.Image{ // Required
Bytes: []byte("PAYLOAD"),
S3Object: &rekognition.S3Object{
Bucket: aws.String("S3Bucket"),
Name: aws.String("S3ObjectName"),
Version: aws.String("S3ObjectVersion"),
},
},
SimilarityThreshold: aws.Float64(1.0),
}
resp, err := svc.CompareFaces(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleRekognition_CreateCollection() {
sess := session.Must(session.NewSession())
svc := rekognition.New(sess)
params := &rekognition.CreateCollectionInput{
CollectionId: aws.String("CollectionId"), // Required
}
resp, err := svc.CreateCollection(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleRekognition_DeleteCollection() {
sess := session.Must(session.NewSession())
svc := rekognition.New(sess)
params := &rekognition.DeleteCollectionInput{
CollectionId: aws.String("CollectionId"), // Required
}
resp, err := svc.DeleteCollection(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleRekognition_DeleteFaces() {
sess := session.Must(session.NewSession())
svc := rekognition.New(sess)
params := &rekognition.DeleteFacesInput{
CollectionId: aws.String("CollectionId"), // Required
FaceIds: []*string{ // Required
aws.String("FaceId"), // Required
// More values...
},
}
resp, err := svc.DeleteFaces(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleRekognition_DetectFaces() {
sess := session.Must(session.NewSession())
svc := rekognition.New(sess)
params := &rekognition.DetectFacesInput{
Image: &rekognition.Image{ // Required
Bytes: []byte("PAYLOAD"),
S3Object: &rekognition.S3Object{
Bucket: aws.String("S3Bucket"),
Name: aws.String("S3ObjectName"),
Version: aws.String("S3ObjectVersion"),
},
},
Attributes: []*string{
aws.String("Attribute"), // Required
// More values...
},
}
resp, err := svc.DetectFaces(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleRekognition_DetectLabels() {
sess := session.Must(session.NewSession())
svc := rekognition.New(sess)
params := &rekognition.DetectLabelsInput{
Image: &rekognition.Image{ // Required
Bytes: []byte("PAYLOAD"),
S3Object: &rekognition.S3Object{
Bucket: aws.String("S3Bucket"),
Name: aws.String("S3ObjectName"),
Version: aws.String("S3ObjectVersion"),
},
},
MaxLabels: aws.Int64(1),
MinConfidence: aws.Float64(1.0),
}
resp, err := svc.DetectLabels(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleRekognition_DetectModerationLabels() {
sess := session.Must(session.NewSession())
svc := rekognition.New(sess)
params := &rekognition.DetectModerationLabelsInput{
Image: &rekognition.Image{ // Required
Bytes: []byte("PAYLOAD"),
S3Object: &rekognition.S3Object{
Bucket: aws.String("S3Bucket"),
Name: aws.String("S3ObjectName"),
Version: aws.String("S3ObjectVersion"),
},
},
MinConfidence: aws.Float64(1.0),
}
resp, err := svc.DetectModerationLabels(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleRekognition_IndexFaces() {
sess := session.Must(session.NewSession())
svc := rekognition.New(sess)
params := &rekognition.IndexFacesInput{
CollectionId: aws.String("CollectionId"), // Required
Image: &rekognition.Image{ // Required
Bytes: []byte("PAYLOAD"),
S3Object: &rekognition.S3Object{
Bucket: aws.String("S3Bucket"),
Name: aws.String("S3ObjectName"),
Version: aws.String("S3ObjectVersion"),
},
},
DetectionAttributes: []*string{
aws.String("Attribute"), // Required
// More values...
},
ExternalImageId: aws.String("ExternalImageId"),
}
resp, err := svc.IndexFaces(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleRekognition_ListCollections() {
sess := session.Must(session.NewSession())
svc := rekognition.New(sess)
params := &rekognition.ListCollectionsInput{
MaxResults: aws.Int64(1),
NextToken: aws.String("PaginationToken"),
}
resp, err := svc.ListCollections(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleRekognition_ListFaces() {
sess := session.Must(session.NewSession())
svc := rekognition.New(sess)
params := &rekognition.ListFacesInput{
CollectionId: aws.String("CollectionId"), // Required
MaxResults: aws.Int64(1),
NextToken: aws.String("PaginationToken"),
}
resp, err := svc.ListFaces(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleRekognition_SearchFaces() {
sess := session.Must(session.NewSession())
svc := rekognition.New(sess)
params := &rekognition.SearchFacesInput{
CollectionId: aws.String("CollectionId"), // Required
FaceId: aws.String("FaceId"), // Required
FaceMatchThreshold: aws.Float64(1.0),
MaxFaces: aws.Int64(1),
}
resp, err := svc.SearchFaces(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
func ExampleRekognition_SearchFacesByImage() {
sess := session.Must(session.NewSession())
svc := rekognition.New(sess)
params := &rekognition.SearchFacesByImageInput{
CollectionId: aws.String("CollectionId"), // Required
Image: &rekognition.Image{ // Required
Bytes: []byte("PAYLOAD"),
S3Object: &rekognition.S3Object{
Bucket: aws.String("S3Bucket"),
Name: aws.String("S3ObjectName"),
Version: aws.String("S3ObjectVersion"),
},
},
FaceMatchThreshold: aws.Float64(1.0),
MaxFaces: aws.Int64(1),
}
resp, err := svc.SearchFacesByImage(params)
if err != nil {
// Print the error, cast err to awserr.Error to get the Code and
// Message from an error.
fmt.Println(err.Error())
return
}
// Pretty-print the response data.
fmt.Println(resp)
}
@@ -0,0 +1,118 @@
// 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 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)
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)
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)
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
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)
}
var _ RekognitionAPI = (*rekognition.Rekognition)(nil)
+95
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
}