本文整理匯總了Golang中github.com/aws/aws-sdk-go/service/cognitosync.New函數的典型用法代碼示例。如果您正苦於以下問題:Golang New函數的具體用法?Golang New怎麽用?Golang New使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。
在下文中一共展示了New函數的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Golang代碼示例。
示例1: ExampleCognitoSync_ListIdentityPoolUsage
func ExampleCognitoSync_ListIdentityPoolUsage() {
svc := cognitosync.New(nil)
params := &cognitosync.ListIdentityPoolUsageInput{
MaxResults: aws.Long(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.StringValue(resp))
}
示例2: ExampleCognitoSync_SetCognitoEvents
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.StringValue(resp))
}
示例3: ExampleCognitoSync_SetIdentityPoolConfiguration
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 {
// 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)
}
示例4: ExampleCognitoSync_ListIdentityPoolUsage
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)
}
示例5: ExampleCognitoSync_ListRecords
func ExampleCognitoSync_ListRecords() {
svc := cognitosync.New(nil)
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 {
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))
}
示例6: ExampleCognitoSync_RegisterDevice
func ExampleCognitoSync_RegisterDevice() {
svc := cognitosync.New(nil)
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 {
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))
}
示例7: ExampleCognitoSync_DescribeDataset
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)
}
示例8: ExampleCognitoSync_UpdateRecords
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 {
// 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)
}
示例9: ExampleCognitoSync_SetCognitoEvents
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)
}
示例10: ExampleCognitoSync_RegisterDevice
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)
}
示例11: ExampleCognitoSync_ListRecords
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)
}
示例12: ExampleCognitoSync_DescribeDataset
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.StringValue(resp))
}
示例13: ExampleCognitoSync_DescribeIdentityPoolUsage
func ExampleCognitoSync_DescribeIdentityPoolUsage() {
svc := cognitosync.New(nil)
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)
}
示例14: ExampleCognitoSync_GetIdentityPoolConfiguration
func ExampleCognitoSync_GetIdentityPoolConfiguration() {
svc := cognitosync.New(session.New())
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)
}
示例15: ExampleCognitoSync_UpdateRecords
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.Long(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.StringValue(resp))
}