123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496 |
- // 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, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- 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, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- 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, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- 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, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- 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, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- 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, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- 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, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- 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, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- 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, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- 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, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- 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, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- 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, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- 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, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- 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, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- 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, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- 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, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- 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, err := session.NewSession()
- if err != nil {
- fmt.Println("failed to create session,", err)
- return
- }
- 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)
- }
|