Conver to regular Go vendor + dep tool

This commit is contained in:
Andrey Smirnov
2017-03-22 17:38:32 +03:00
parent 070347295e
commit c6c1012330
3260 changed files with 1742550 additions and 72 deletions
File diff suppressed because it is too large Load Diff
@@ -0,0 +1,132 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
// Package cognitosynciface provides an interface to enable mocking the Amazon Cognito Sync 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 cognitosynciface
import (
"github.com/aws/aws-sdk-go/aws"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/service/cognitosync"
)
// CognitoSyncAPI provides an interface to enable mocking the
// cognitosync.CognitoSync 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 Cognito Sync.
// func myFunc(svc cognitosynciface.CognitoSyncAPI) bool {
// // Make svc.BulkPublish request
// }
//
// func main() {
// sess := session.New()
// svc := cognitosync.New(sess)
//
// myFunc(svc)
// }
//
// In your _test.go file:
//
// // Define a mock struct to be used in your unit tests of myFunc.
// type mockCognitoSyncClient struct {
// cognitosynciface.CognitoSyncAPI
// }
// func (m *mockCognitoSyncClient) BulkPublish(input *cognitosync.BulkPublishInput) (*cognitosync.BulkPublishOutput, error) {
// // mock response/functionality
// }
//
// func TestMyFunc(t *testing.T) {
// // Setup Test
// mockSvc := &mockCognitoSyncClient{}
//
// 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 CognitoSyncAPI interface {
BulkPublish(*cognitosync.BulkPublishInput) (*cognitosync.BulkPublishOutput, error)
BulkPublishWithContext(aws.Context, *cognitosync.BulkPublishInput, ...request.Option) (*cognitosync.BulkPublishOutput, error)
BulkPublishRequest(*cognitosync.BulkPublishInput) (*request.Request, *cognitosync.BulkPublishOutput)
DeleteDataset(*cognitosync.DeleteDatasetInput) (*cognitosync.DeleteDatasetOutput, error)
DeleteDatasetWithContext(aws.Context, *cognitosync.DeleteDatasetInput, ...request.Option) (*cognitosync.DeleteDatasetOutput, error)
DeleteDatasetRequest(*cognitosync.DeleteDatasetInput) (*request.Request, *cognitosync.DeleteDatasetOutput)
DescribeDataset(*cognitosync.DescribeDatasetInput) (*cognitosync.DescribeDatasetOutput, error)
DescribeDatasetWithContext(aws.Context, *cognitosync.DescribeDatasetInput, ...request.Option) (*cognitosync.DescribeDatasetOutput, error)
DescribeDatasetRequest(*cognitosync.DescribeDatasetInput) (*request.Request, *cognitosync.DescribeDatasetOutput)
DescribeIdentityPoolUsage(*cognitosync.DescribeIdentityPoolUsageInput) (*cognitosync.DescribeIdentityPoolUsageOutput, error)
DescribeIdentityPoolUsageWithContext(aws.Context, *cognitosync.DescribeIdentityPoolUsageInput, ...request.Option) (*cognitosync.DescribeIdentityPoolUsageOutput, error)
DescribeIdentityPoolUsageRequest(*cognitosync.DescribeIdentityPoolUsageInput) (*request.Request, *cognitosync.DescribeIdentityPoolUsageOutput)
DescribeIdentityUsage(*cognitosync.DescribeIdentityUsageInput) (*cognitosync.DescribeIdentityUsageOutput, error)
DescribeIdentityUsageWithContext(aws.Context, *cognitosync.DescribeIdentityUsageInput, ...request.Option) (*cognitosync.DescribeIdentityUsageOutput, error)
DescribeIdentityUsageRequest(*cognitosync.DescribeIdentityUsageInput) (*request.Request, *cognitosync.DescribeIdentityUsageOutput)
GetBulkPublishDetails(*cognitosync.GetBulkPublishDetailsInput) (*cognitosync.GetBulkPublishDetailsOutput, error)
GetBulkPublishDetailsWithContext(aws.Context, *cognitosync.GetBulkPublishDetailsInput, ...request.Option) (*cognitosync.GetBulkPublishDetailsOutput, error)
GetBulkPublishDetailsRequest(*cognitosync.GetBulkPublishDetailsInput) (*request.Request, *cognitosync.GetBulkPublishDetailsOutput)
GetCognitoEvents(*cognitosync.GetCognitoEventsInput) (*cognitosync.GetCognitoEventsOutput, error)
GetCognitoEventsWithContext(aws.Context, *cognitosync.GetCognitoEventsInput, ...request.Option) (*cognitosync.GetCognitoEventsOutput, error)
GetCognitoEventsRequest(*cognitosync.GetCognitoEventsInput) (*request.Request, *cognitosync.GetCognitoEventsOutput)
GetIdentityPoolConfiguration(*cognitosync.GetIdentityPoolConfigurationInput) (*cognitosync.GetIdentityPoolConfigurationOutput, error)
GetIdentityPoolConfigurationWithContext(aws.Context, *cognitosync.GetIdentityPoolConfigurationInput, ...request.Option) (*cognitosync.GetIdentityPoolConfigurationOutput, error)
GetIdentityPoolConfigurationRequest(*cognitosync.GetIdentityPoolConfigurationInput) (*request.Request, *cognitosync.GetIdentityPoolConfigurationOutput)
ListDatasets(*cognitosync.ListDatasetsInput) (*cognitosync.ListDatasetsOutput, error)
ListDatasetsWithContext(aws.Context, *cognitosync.ListDatasetsInput, ...request.Option) (*cognitosync.ListDatasetsOutput, error)
ListDatasetsRequest(*cognitosync.ListDatasetsInput) (*request.Request, *cognitosync.ListDatasetsOutput)
ListIdentityPoolUsage(*cognitosync.ListIdentityPoolUsageInput) (*cognitosync.ListIdentityPoolUsageOutput, error)
ListIdentityPoolUsageWithContext(aws.Context, *cognitosync.ListIdentityPoolUsageInput, ...request.Option) (*cognitosync.ListIdentityPoolUsageOutput, error)
ListIdentityPoolUsageRequest(*cognitosync.ListIdentityPoolUsageInput) (*request.Request, *cognitosync.ListIdentityPoolUsageOutput)
ListRecords(*cognitosync.ListRecordsInput) (*cognitosync.ListRecordsOutput, error)
ListRecordsWithContext(aws.Context, *cognitosync.ListRecordsInput, ...request.Option) (*cognitosync.ListRecordsOutput, error)
ListRecordsRequest(*cognitosync.ListRecordsInput) (*request.Request, *cognitosync.ListRecordsOutput)
RegisterDevice(*cognitosync.RegisterDeviceInput) (*cognitosync.RegisterDeviceOutput, error)
RegisterDeviceWithContext(aws.Context, *cognitosync.RegisterDeviceInput, ...request.Option) (*cognitosync.RegisterDeviceOutput, error)
RegisterDeviceRequest(*cognitosync.RegisterDeviceInput) (*request.Request, *cognitosync.RegisterDeviceOutput)
SetCognitoEvents(*cognitosync.SetCognitoEventsInput) (*cognitosync.SetCognitoEventsOutput, error)
SetCognitoEventsWithContext(aws.Context, *cognitosync.SetCognitoEventsInput, ...request.Option) (*cognitosync.SetCognitoEventsOutput, error)
SetCognitoEventsRequest(*cognitosync.SetCognitoEventsInput) (*request.Request, *cognitosync.SetCognitoEventsOutput)
SetIdentityPoolConfiguration(*cognitosync.SetIdentityPoolConfigurationInput) (*cognitosync.SetIdentityPoolConfigurationOutput, error)
SetIdentityPoolConfigurationWithContext(aws.Context, *cognitosync.SetIdentityPoolConfigurationInput, ...request.Option) (*cognitosync.SetIdentityPoolConfigurationOutput, error)
SetIdentityPoolConfigurationRequest(*cognitosync.SetIdentityPoolConfigurationInput) (*request.Request, *cognitosync.SetIdentityPoolConfigurationOutput)
SubscribeToDataset(*cognitosync.SubscribeToDatasetInput) (*cognitosync.SubscribeToDatasetOutput, error)
SubscribeToDatasetWithContext(aws.Context, *cognitosync.SubscribeToDatasetInput, ...request.Option) (*cognitosync.SubscribeToDatasetOutput, error)
SubscribeToDatasetRequest(*cognitosync.SubscribeToDatasetInput) (*request.Request, *cognitosync.SubscribeToDatasetOutput)
UnsubscribeFromDataset(*cognitosync.UnsubscribeFromDatasetInput) (*cognitosync.UnsubscribeFromDatasetOutput, error)
UnsubscribeFromDatasetWithContext(aws.Context, *cognitosync.UnsubscribeFromDatasetInput, ...request.Option) (*cognitosync.UnsubscribeFromDatasetOutput, error)
UnsubscribeFromDatasetRequest(*cognitosync.UnsubscribeFromDatasetInput) (*request.Request, *cognitosync.UnsubscribeFromDatasetOutput)
UpdateRecords(*cognitosync.UpdateRecordsInput) (*cognitosync.UpdateRecordsOutput, error)
UpdateRecordsWithContext(aws.Context, *cognitosync.UpdateRecordsInput, ...request.Option) (*cognitosync.UpdateRecordsOutput, error)
UpdateRecordsRequest(*cognitosync.UpdateRecordsInput) (*request.Request, *cognitosync.UpdateRecordsOutput)
}
var _ CognitoSyncAPI = (*cognitosync.CognitoSync)(nil)
+85
View File
@@ -0,0 +1,85 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cognitosync
const (
// ErrCodeAlreadyStreamedException for service response error code
// "AlreadyStreamedException".
//
// An exception thrown when a bulk publish operation is requested less than
// 24 hours after a previous bulk publish operation completed successfully.
ErrCodeAlreadyStreamedException = "AlreadyStreamedException"
// ErrCodeConcurrentModificationException for service response error code
// "ConcurrentModificationException".
//
// Thrown if there are parallel requests to modify a resource.
ErrCodeConcurrentModificationException = "ConcurrentModificationException"
// ErrCodeDuplicateRequestException for service response error code
// "DuplicateRequestException".
//
// An exception thrown when there is an IN_PROGRESS bulk publish operation for
// the given identity pool.
ErrCodeDuplicateRequestException = "DuplicateRequestException"
// ErrCodeInternalErrorException for service response error code
// "InternalErrorException".
//
// Indicates an internal service error.
ErrCodeInternalErrorException = "InternalErrorException"
// ErrCodeInvalidConfigurationException for service response error code
// "InvalidConfigurationException".
ErrCodeInvalidConfigurationException = "InvalidConfigurationException"
// ErrCodeInvalidLambdaFunctionOutputException for service response error code
// "InvalidLambdaFunctionOutputException".
//
// The AWS Lambda function returned invalid output or an exception.
ErrCodeInvalidLambdaFunctionOutputException = "InvalidLambdaFunctionOutputException"
// ErrCodeInvalidParameterException for service response error code
// "InvalidParameterException".
//
// Thrown when a request parameter does not comply with the associated constraints.
ErrCodeInvalidParameterException = "InvalidParameterException"
// ErrCodeLambdaThrottledException for service response error code
// "LambdaThrottledException".
//
// AWS Lambda throttled your account, please contact AWS Support
ErrCodeLambdaThrottledException = "LambdaThrottledException"
// ErrCodeLimitExceededException for service response error code
// "LimitExceededException".
//
// Thrown when the limit on the number of objects or operations has been exceeded.
ErrCodeLimitExceededException = "LimitExceededException"
// ErrCodeNotAuthorizedException for service response error code
// "NotAuthorizedException".
//
// Thrown when a user is not authorized to access the requested resource.
ErrCodeNotAuthorizedException = "NotAuthorizedException"
// ErrCodeResourceConflictException for service response error code
// "ResourceConflictException".
//
// Thrown if an update can't be applied because the resource was changed by
// another call and this would result in a conflict.
ErrCodeResourceConflictException = "ResourceConflictException"
// ErrCodeResourceNotFoundException for service response error code
// "ResourceNotFoundException".
//
// Thrown if the resource doesn't exist.
ErrCodeResourceNotFoundException = "ResourceNotFoundException"
// ErrCodeTooManyRequestsException for service response error code
// "TooManyRequestsException".
//
// Thrown if the request is throttled.
ErrCodeTooManyRequestsException = "TooManyRequestsException"
)
+428
View File
@@ -0,0 +1,428 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cognitosync_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/cognitosync"
)
var _ time.Duration
var _ bytes.Buffer
func ExampleCognitoSync_BulkPublish() {
sess := session.Must(session.NewSession())
svc := cognitosync.New(sess)
params := &cognitosync.BulkPublishInput{
IdentityPoolId: aws.String("IdentityPoolId"), // Required
}
resp, err := svc.BulkPublish(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 ExampleCognitoSync_DeleteDataset() {
sess := session.Must(session.NewSession())
svc := cognitosync.New(sess)
params := &cognitosync.DeleteDatasetInput{
DatasetName: aws.String("DatasetName"), // Required
IdentityId: aws.String("IdentityId"), // Required
IdentityPoolId: aws.String("IdentityPoolId"), // Required
}
resp, err := svc.DeleteDataset(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 ExampleCognitoSync_DescribeDataset() {
sess := session.Must(session.NewSession())
svc := cognitosync.New(sess)
params := &cognitosync.DescribeDatasetInput{
DatasetName: aws.String("DatasetName"), // Required
IdentityId: aws.String("IdentityId"), // Required
IdentityPoolId: aws.String("IdentityPoolId"), // Required
}
resp, err := svc.DescribeDataset(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 ExampleCognitoSync_DescribeIdentityPoolUsage() {
sess := session.Must(session.NewSession())
svc := cognitosync.New(sess)
params := &cognitosync.DescribeIdentityPoolUsageInput{
IdentityPoolId: aws.String("IdentityPoolId"), // Required
}
resp, err := svc.DescribeIdentityPoolUsage(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 ExampleCognitoSync_DescribeIdentityUsage() {
sess := session.Must(session.NewSession())
svc := cognitosync.New(sess)
params := &cognitosync.DescribeIdentityUsageInput{
IdentityId: aws.String("IdentityId"), // Required
IdentityPoolId: aws.String("IdentityPoolId"), // Required
}
resp, err := svc.DescribeIdentityUsage(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 ExampleCognitoSync_GetBulkPublishDetails() {
sess := session.Must(session.NewSession())
svc := cognitosync.New(sess)
params := &cognitosync.GetBulkPublishDetailsInput{
IdentityPoolId: aws.String("IdentityPoolId"), // Required
}
resp, err := svc.GetBulkPublishDetails(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 ExampleCognitoSync_GetCognitoEvents() {
sess := session.Must(session.NewSession())
svc := cognitosync.New(sess)
params := &cognitosync.GetCognitoEventsInput{
IdentityPoolId: aws.String("IdentityPoolId"), // Required
}
resp, err := svc.GetCognitoEvents(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 ExampleCognitoSync_GetIdentityPoolConfiguration() {
sess := session.Must(session.NewSession())
svc := cognitosync.New(sess)
params := &cognitosync.GetIdentityPoolConfigurationInput{
IdentityPoolId: aws.String("IdentityPoolId"), // Required
}
resp, err := svc.GetIdentityPoolConfiguration(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 ExampleCognitoSync_ListDatasets() {
sess := session.Must(session.NewSession())
svc := cognitosync.New(sess)
params := &cognitosync.ListDatasetsInput{
IdentityId: aws.String("IdentityId"), // Required
IdentityPoolId: aws.String("IdentityPoolId"), // Required
MaxResults: aws.Int64(1),
NextToken: aws.String("String"),
}
resp, err := svc.ListDatasets(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 ExampleCognitoSync_ListIdentityPoolUsage() {
sess := session.Must(session.NewSession())
svc := cognitosync.New(sess)
params := &cognitosync.ListIdentityPoolUsageInput{
MaxResults: aws.Int64(1),
NextToken: aws.String("String"),
}
resp, err := svc.ListIdentityPoolUsage(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 ExampleCognitoSync_ListRecords() {
sess := session.Must(session.NewSession())
svc := cognitosync.New(sess)
params := &cognitosync.ListRecordsInput{
DatasetName: aws.String("DatasetName"), // Required
IdentityId: aws.String("IdentityId"), // Required
IdentityPoolId: aws.String("IdentityPoolId"), // Required
LastSyncCount: aws.Int64(1),
MaxResults: aws.Int64(1),
NextToken: aws.String("String"),
SyncSessionToken: aws.String("SyncSessionToken"),
}
resp, err := svc.ListRecords(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 ExampleCognitoSync_RegisterDevice() {
sess := session.Must(session.NewSession())
svc := cognitosync.New(sess)
params := &cognitosync.RegisterDeviceInput{
IdentityId: aws.String("IdentityId"), // Required
IdentityPoolId: aws.String("IdentityPoolId"), // Required
Platform: aws.String("Platform"), // Required
Token: aws.String("PushToken"), // Required
}
resp, err := svc.RegisterDevice(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 ExampleCognitoSync_SetCognitoEvents() {
sess := session.Must(session.NewSession())
svc := cognitosync.New(sess)
params := &cognitosync.SetCognitoEventsInput{
Events: map[string]*string{ // Required
"Key": aws.String("LambdaFunctionArn"), // Required
// More values...
},
IdentityPoolId: aws.String("IdentityPoolId"), // Required
}
resp, err := svc.SetCognitoEvents(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 ExampleCognitoSync_SetIdentityPoolConfiguration() {
sess := session.Must(session.NewSession())
svc := cognitosync.New(sess)
params := &cognitosync.SetIdentityPoolConfigurationInput{
IdentityPoolId: aws.String("IdentityPoolId"), // Required
CognitoStreams: &cognitosync.CognitoStreams{
RoleArn: aws.String("AssumeRoleArn"),
StreamName: aws.String("StreamName"),
StreamingStatus: aws.String("StreamingStatus"),
},
PushSync: &cognitosync.PushSync{
ApplicationArns: []*string{
aws.String("ApplicationArn"), // Required
// More values...
},
RoleArn: aws.String("AssumeRoleArn"),
},
}
resp, err := svc.SetIdentityPoolConfiguration(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 ExampleCognitoSync_SubscribeToDataset() {
sess := session.Must(session.NewSession())
svc := cognitosync.New(sess)
params := &cognitosync.SubscribeToDatasetInput{
DatasetName: aws.String("DatasetName"), // Required
DeviceId: aws.String("DeviceId"), // Required
IdentityId: aws.String("IdentityId"), // Required
IdentityPoolId: aws.String("IdentityPoolId"), // Required
}
resp, err := svc.SubscribeToDataset(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 ExampleCognitoSync_UnsubscribeFromDataset() {
sess := session.Must(session.NewSession())
svc := cognitosync.New(sess)
params := &cognitosync.UnsubscribeFromDatasetInput{
DatasetName: aws.String("DatasetName"), // Required
DeviceId: aws.String("DeviceId"), // Required
IdentityId: aws.String("IdentityId"), // Required
IdentityPoolId: aws.String("IdentityPoolId"), // Required
}
resp, err := svc.UnsubscribeFromDataset(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 ExampleCognitoSync_UpdateRecords() {
sess := session.Must(session.NewSession())
svc := cognitosync.New(sess)
params := &cognitosync.UpdateRecordsInput{
DatasetName: aws.String("DatasetName"), // Required
IdentityId: aws.String("IdentityId"), // Required
IdentityPoolId: aws.String("IdentityPoolId"), // Required
SyncSessionToken: aws.String("SyncSessionToken"), // Required
ClientContext: aws.String("ClientContext"),
DeviceId: aws.String("DeviceId"),
RecordPatches: []*cognitosync.RecordPatch{
{ // Required
Key: aws.String("RecordKey"), // Required
Op: aws.String("Operation"), // Required
SyncCount: aws.Int64(1), // Required
DeviceLastModifiedDate: aws.Time(time.Now()),
Value: aws.String("RecordValue"),
},
// More values...
},
}
resp, err := svc.UpdateRecords(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)
}
+109
View File
@@ -0,0 +1,109 @@
// THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
package cognitosync
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"
)
// Amazon Cognito Sync provides an AWS service and client library that enable
// cross-device syncing of application-related user data. High-level client
// libraries are available for both iOS and Android. You can use these libraries
// to persist data locally so that it's available even if the device is offline.
// Developer credentials don't need to be stored on the mobile device to access
// the service. You can use Amazon Cognito to obtain a normalized user ID and
// credentials. User data is persisted in a dataset that can store up to 1 MB
// of key-value pairs, and you can have up to 20 datasets per user identity.
//
// With Amazon Cognito Sync, the data stored for each identity is accessible
// only to credentials assigned to that identity. In order to use the Cognito
// Sync service, you need to make API calls using credentials retrieved with
// Amazon Cognito Identity service (http://docs.aws.amazon.com/cognitoidentity/latest/APIReference/Welcome.html).
//
// If you want to use Cognito Sync in an Android or iOS application, you will
// probably want to make API calls via the AWS Mobile SDK. To learn more, see
// the Developer Guide for Android (http://docs.aws.amazon.com/mobile/sdkforandroid/developerguide/cognito-sync.html)
// and the Developer Guide for iOS (http://docs.aws.amazon.com/mobile/sdkforios/developerguide/cognito-sync.html).
// The service client's operations are safe to be used concurrently.
// It is not safe to mutate any of the client's properties though.
// Please also see https://docs.aws.amazon.com/goto/WebAPI/cognito-sync-2014-06-30
type CognitoSync 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 = "cognito-sync" // Service endpoint prefix API calls made to.
EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata.
)
// New creates a new instance of the CognitoSync 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 CognitoSync client from just a session.
// svc := cognitosync.New(mySession)
//
// // Create a CognitoSync client with additional configuration
// svc := cognitosync.New(mySession, aws.NewConfig().WithRegion("us-west-2"))
func New(p client.ConfigProvider, cfgs ...*aws.Config) *CognitoSync {
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) *CognitoSync {
svc := &CognitoSync{
Client: client.New(
cfg,
metadata.ClientInfo{
ServiceName: ServiceName,
SigningName: signingName,
SigningRegion: signingRegion,
Endpoint: endpoint,
APIVersion: "2014-06-30",
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 CognitoSync operation and runs any
// custom request initialization.
func (c *CognitoSync) 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
}