func ExampleCognitoSync_DescribeDataset() { svc := cognitosync.New(nil) 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 { if awsErr, ok := err.(awserr.Error); ok { // Generic AWS error with Code, Message, and original error (if any) fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) if reqErr, ok := err.(awserr.RequestFailure); ok { // A service error occurred fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) } } else { // This case should never be hit, the SDK should always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(resp)) }
func ExampleCognitoSync_SetCognitoEvents() { svc := cognitosync.New(nil) 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 { if awsErr, ok := err.(awserr.Error); ok { // Generic AWS error with Code, Message, and original error (if any) fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) if reqErr, ok := err.(awserr.RequestFailure); ok { // A service error occurred fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) } } else { // This case should never be hit, the SDK should always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(resp)) }
func ExampleCognitoSync_ListIdentityPoolUsage() { svc := cognitosync.New(nil) params := &cognitosync.ListIdentityPoolUsageInput{ MaxResults: aws.Int64(1), NextToken: aws.String("String"), } resp, err := svc.ListIdentityPoolUsage(params) if err != nil { if awsErr, ok := err.(awserr.Error); ok { // Generic AWS error with Code, Message, and original error (if any) fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) if reqErr, ok := err.(awserr.RequestFailure); ok { // A service error occurred fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) } } else { // This case should never be hit, the SDK should always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(resp)) }
func ExampleCognitoSync_UpdateRecords() { svc := cognitosync.New(nil) 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 { if awsErr, ok := err.(awserr.Error); ok { // Generic AWS error with Code, Message, and original error (if any) fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) if reqErr, ok := err.(awserr.RequestFailure); ok { // A service error occurred fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) } } else { // This case should never be hit, the SDK should always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(resp)) }
func ExampleCognitoSync_SetIdentityPoolConfiguration() { svc := cognitosync.New(nil) 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 { if awsErr, ok := err.(awserr.Error); ok { // Generic AWS error with Code, Message, and original error (if any) fmt.Println(awsErr.Code(), awsErr.Message(), awsErr.OrigErr()) if reqErr, ok := err.(awserr.RequestFailure); ok { // A service error occurred fmt.Println(reqErr.Code(), reqErr.Message(), reqErr.StatusCode(), reqErr.RequestID()) } } else { // This case should never be hit, the SDK should always return an // error which satisfies the awserr.Error interface. fmt.Println(err.Error()) } } // Pretty-print the response data. fmt.Println(awsutil.Prettify(resp)) }
func init() { Before("@cognitosync", func() { World["client"] = cognitosync.New(nil) }) }
func TestInterface(t *testing.T) { assert.Implements(t, (*cognitosynciface.CognitoSyncAPI)(nil), cognitosync.New(nil)) }