mirror of
https://github.com/aptly-dev/aptly.git
synced 2026-06-01 04:40:38 +00:00
Conver to regular Go vendor + dep tool
This commit is contained in:
+1436
File diff suppressed because it is too large
Load Diff
Generated
Vendored
+76
@@ -0,0 +1,76 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
|
||||
// Package cloudsearchdomainiface provides an interface to enable mocking the Amazon CloudSearch Domain 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 cloudsearchdomainiface
|
||||
|
||||
import (
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/aws/request"
|
||||
"github.com/aws/aws-sdk-go/service/cloudsearchdomain"
|
||||
)
|
||||
|
||||
// CloudSearchDomainAPI provides an interface to enable mocking the
|
||||
// cloudsearchdomain.CloudSearchDomain 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 CloudSearch Domain.
|
||||
// func myFunc(svc cloudsearchdomainiface.CloudSearchDomainAPI) bool {
|
||||
// // Make svc.Search request
|
||||
// }
|
||||
//
|
||||
// func main() {
|
||||
// sess := session.New()
|
||||
// svc := cloudsearchdomain.New(sess)
|
||||
//
|
||||
// myFunc(svc)
|
||||
// }
|
||||
//
|
||||
// In your _test.go file:
|
||||
//
|
||||
// // Define a mock struct to be used in your unit tests of myFunc.
|
||||
// type mockCloudSearchDomainClient struct {
|
||||
// cloudsearchdomainiface.CloudSearchDomainAPI
|
||||
// }
|
||||
// func (m *mockCloudSearchDomainClient) Search(input *cloudsearchdomain.SearchInput) (*cloudsearchdomain.SearchOutput, error) {
|
||||
// // mock response/functionality
|
||||
// }
|
||||
//
|
||||
// func TestMyFunc(t *testing.T) {
|
||||
// // Setup Test
|
||||
// mockSvc := &mockCloudSearchDomainClient{}
|
||||
//
|
||||
// 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 CloudSearchDomainAPI interface {
|
||||
Search(*cloudsearchdomain.SearchInput) (*cloudsearchdomain.SearchOutput, error)
|
||||
SearchWithContext(aws.Context, *cloudsearchdomain.SearchInput, ...request.Option) (*cloudsearchdomain.SearchOutput, error)
|
||||
SearchRequest(*cloudsearchdomain.SearchInput) (*request.Request, *cloudsearchdomain.SearchOutput)
|
||||
|
||||
Suggest(*cloudsearchdomain.SuggestInput) (*cloudsearchdomain.SuggestOutput, error)
|
||||
SuggestWithContext(aws.Context, *cloudsearchdomain.SuggestInput, ...request.Option) (*cloudsearchdomain.SuggestOutput, error)
|
||||
SuggestRequest(*cloudsearchdomain.SuggestInput) (*request.Request, *cloudsearchdomain.SuggestOutput)
|
||||
|
||||
UploadDocuments(*cloudsearchdomain.UploadDocumentsInput) (*cloudsearchdomain.UploadDocumentsOutput, error)
|
||||
UploadDocumentsWithContext(aws.Context, *cloudsearchdomain.UploadDocumentsInput, ...request.Option) (*cloudsearchdomain.UploadDocumentsOutput, error)
|
||||
UploadDocumentsRequest(*cloudsearchdomain.UploadDocumentsInput) (*request.Request, *cloudsearchdomain.UploadDocumentsOutput)
|
||||
}
|
||||
|
||||
var _ CloudSearchDomainAPI = (*cloudsearchdomain.CloudSearchDomain)(nil)
|
||||
Generated
Vendored
+49
@@ -0,0 +1,49 @@
|
||||
package cloudsearchdomain_test
|
||||
|
||||
import (
|
||||
"testing"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
|
||||
"github.com/aws/aws-sdk-go/aws"
|
||||
"github.com/aws/aws-sdk-go/awstesting/unit"
|
||||
"github.com/aws/aws-sdk-go/service/cloudsearchdomain"
|
||||
)
|
||||
|
||||
func TestRequireEndpointIfRegionProvided(t *testing.T) {
|
||||
svc := cloudsearchdomain.New(unit.Session, &aws.Config{
|
||||
Region: aws.String("mock-region"),
|
||||
DisableParamValidation: aws.Bool(true),
|
||||
})
|
||||
req, _ := svc.SearchRequest(nil)
|
||||
err := req.Build()
|
||||
|
||||
assert.Equal(t, "", svc.Endpoint)
|
||||
assert.Error(t, err)
|
||||
assert.Equal(t, aws.ErrMissingEndpoint, err)
|
||||
}
|
||||
|
||||
func TestRequireEndpointIfNoRegionProvided(t *testing.T) {
|
||||
svc := cloudsearchdomain.New(unit.Session, &aws.Config{
|
||||
DisableParamValidation: aws.Bool(true),
|
||||
})
|
||||
req, _ := svc.SearchRequest(nil)
|
||||
err := req.Build()
|
||||
|
||||
assert.Equal(t, "", svc.Endpoint)
|
||||
assert.Error(t, err)
|
||||
assert.Equal(t, aws.ErrMissingEndpoint, err)
|
||||
}
|
||||
|
||||
func TestRequireEndpointUsed(t *testing.T) {
|
||||
svc := cloudsearchdomain.New(unit.Session, &aws.Config{
|
||||
Region: aws.String("mock-region"),
|
||||
DisableParamValidation: aws.Bool(true),
|
||||
Endpoint: aws.String("https://endpoint"),
|
||||
})
|
||||
req, _ := svc.SearchRequest(nil)
|
||||
err := req.Build()
|
||||
|
||||
assert.Equal(t, "https://endpoint", svc.Endpoint)
|
||||
assert.NoError(t, err)
|
||||
}
|
||||
+18
@@ -0,0 +1,18 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
|
||||
package cloudsearchdomain
|
||||
|
||||
const (
|
||||
|
||||
// ErrCodeDocumentServiceException for service response error code
|
||||
// "DocumentServiceException".
|
||||
//
|
||||
// Information about any problems encountered while processing an upload request.
|
||||
ErrCodeDocumentServiceException = "DocumentServiceException"
|
||||
|
||||
// ErrCodeSearchException for service response error code
|
||||
// "SearchException".
|
||||
//
|
||||
// Information about any problems encountered while processing a search request.
|
||||
ErrCodeSearchException = "SearchException"
|
||||
)
|
||||
+95
@@ -0,0 +1,95 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
|
||||
package cloudsearchdomain_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/cloudsearchdomain"
|
||||
)
|
||||
|
||||
var _ time.Duration
|
||||
var _ bytes.Buffer
|
||||
|
||||
func ExampleCloudSearchDomain_Search() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := cloudsearchdomain.New(sess)
|
||||
|
||||
params := &cloudsearchdomain.SearchInput{
|
||||
Query: aws.String("Query"), // Required
|
||||
Cursor: aws.String("Cursor"),
|
||||
Expr: aws.String("Expr"),
|
||||
Facet: aws.String("Facet"),
|
||||
FilterQuery: aws.String("FilterQuery"),
|
||||
Highlight: aws.String("Highlight"),
|
||||
Partial: aws.Bool(true),
|
||||
QueryOptions: aws.String("QueryOptions"),
|
||||
QueryParser: aws.String("QueryParser"),
|
||||
Return: aws.String("Return"),
|
||||
Size: aws.Int64(1),
|
||||
Sort: aws.String("Sort"),
|
||||
Start: aws.Int64(1),
|
||||
Stats: aws.String("Stat"),
|
||||
}
|
||||
resp, err := svc.Search(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 ExampleCloudSearchDomain_Suggest() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := cloudsearchdomain.New(sess)
|
||||
|
||||
params := &cloudsearchdomain.SuggestInput{
|
||||
Query: aws.String("Query"), // Required
|
||||
Suggester: aws.String("Suggester"), // Required
|
||||
Size: aws.Int64(1),
|
||||
}
|
||||
resp, err := svc.Suggest(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 ExampleCloudSearchDomain_UploadDocuments() {
|
||||
sess := session.Must(session.NewSession())
|
||||
|
||||
svc := cloudsearchdomain.New(sess)
|
||||
|
||||
params := &cloudsearchdomain.UploadDocumentsInput{
|
||||
ContentType: aws.String("ContentType"), // Required
|
||||
Documents: bytes.NewReader([]byte("PAYLOAD")), // Required
|
||||
}
|
||||
resp, err := svc.UploadDocuments(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)
|
||||
}
|
||||
+108
@@ -0,0 +1,108 @@
|
||||
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
|
||||
|
||||
package cloudsearchdomain
|
||||
|
||||
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/restjson"
|
||||
)
|
||||
|
||||
// You use the AmazonCloudSearch2013 API to upload documents to a search domain
|
||||
// and search those documents.
|
||||
//
|
||||
// The endpoints for submitting UploadDocuments, Search, and Suggest requests
|
||||
// are domain-specific. To get the endpoints for your domain, use the Amazon
|
||||
// CloudSearch configuration service DescribeDomains action. The domain endpoints
|
||||
// are also displayed on the domain dashboard in the Amazon CloudSearch console.
|
||||
// You submit suggest requests to the search endpoint.
|
||||
//
|
||||
// For more information, see the Amazon CloudSearch Developer Guide (http://docs.aws.amazon.com/cloudsearch/latest/developerguide).
|
||||
// The service client's operations are safe to be used concurrently.
|
||||
// It is not safe to mutate any of the client's properties though.
|
||||
type CloudSearchDomain 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 = "cloudsearchdomain" // Service endpoint prefix API calls made to.
|
||||
EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata.
|
||||
)
|
||||
|
||||
// New creates a new instance of the CloudSearchDomain 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 CloudSearchDomain client from just a session.
|
||||
// svc := cloudsearchdomain.New(mySession)
|
||||
//
|
||||
// // Create a CloudSearchDomain client with additional configuration
|
||||
// svc := cloudsearchdomain.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
|
||||
func New(p client.ConfigProvider, cfgs ...*aws.Config) *CloudSearchDomain {
|
||||
var c client.Config
|
||||
if v, ok := p.(client.ConfigNoResolveEndpointProvider); ok {
|
||||
c = v.ClientConfigNoResolveEndpoint(cfgs...)
|
||||
} else {
|
||||
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) *CloudSearchDomain {
|
||||
if len(signingName) == 0 {
|
||||
signingName = "cloudsearch"
|
||||
}
|
||||
svc := &CloudSearchDomain{
|
||||
Client: client.New(
|
||||
cfg,
|
||||
metadata.ClientInfo{
|
||||
ServiceName: ServiceName,
|
||||
SigningName: signingName,
|
||||
SigningRegion: signingRegion,
|
||||
Endpoint: endpoint,
|
||||
APIVersion: "2013-01-01",
|
||||
JSONVersion: "1.1",
|
||||
},
|
||||
handlers,
|
||||
),
|
||||
}
|
||||
|
||||
// Handlers
|
||||
svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler)
|
||||
svc.Handlers.Build.PushBackNamed(restjson.BuildHandler)
|
||||
svc.Handlers.Unmarshal.PushBackNamed(restjson.UnmarshalHandler)
|
||||
svc.Handlers.UnmarshalMeta.PushBackNamed(restjson.UnmarshalMetaHandler)
|
||||
svc.Handlers.UnmarshalError.PushBackNamed(restjson.UnmarshalErrorHandler)
|
||||
|
||||
// Run custom client initialization if present
|
||||
if initClient != nil {
|
||||
initClient(svc.Client)
|
||||
}
|
||||
|
||||
return svc
|
||||
}
|
||||
|
||||
// newRequest creates a new request for a CloudSearchDomain operation and runs any
|
||||
// custom request initialization.
|
||||
func (c *CloudSearchDomain) 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
|
||||
}
|
||||
Reference in New Issue
Block a user