func ExampleKMS_GenerateDataKeyWithoutPlaintext() { svc := kms.New(nil) params := &kms.GenerateDataKeyWithoutPlaintextInput{ KeyID: aws.String("KeyIdType"), // Required EncryptionContext: &map[string]*string{ "Key": aws.String("EncryptionContextValue"), // Required // More values... }, GrantTokens: []*string{ aws.String("GrantTokenType"), // Required // More values... }, KeySpec: aws.String("DataKeySpec"), NumberOfBytes: aws.Long(1), } resp, err := svc.GenerateDataKeyWithoutPlaintext(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleKMS_Decrypt() { svc := kms.New(nil) params := &kms.DecryptInput{ CiphertextBlob: []byte("PAYLOAD"), // Required EncryptionContext: &map[string]*string{ "Key": aws.String("EncryptionContextValue"), // Required // More values... }, GrantTokens: []*string{ aws.String("GrantTokenType"), // Required // More values... }, } resp, err := svc.Decrypt(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleKMS_RetireGrant() { svc := kms.New(nil) params := &kms.RetireGrantInput{ GrantToken: aws.String("GrantTokenType"), // Required } resp, err := svc.RetireGrant(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleKMS_GetKeyRotationStatus() { svc := kms.New(nil) params := &kms.GetKeyRotationStatusInput{ KeyID: aws.String("KeyIdType"), // Required } resp, err := svc.GetKeyRotationStatus(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleKMS_GenerateRandom() { svc := kms.New(nil) params := &kms.GenerateRandomInput{ NumberOfBytes: aws.Long(1), } resp, err := svc.GenerateRandom(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleKMS_DeleteAlias() { svc := kms.New(nil) params := &kms.DeleteAliasInput{ AliasName: aws.String("AliasNameType"), // Required } resp, err := svc.DeleteAlias(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleKMS_ListKeys() { svc := kms.New(nil) params := &kms.ListKeysInput{ Limit: aws.Long(1), Marker: aws.String("MarkerType"), } resp, err := svc.ListKeys(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleKMS_CreateKey() { svc := kms.New(nil) params := &kms.CreateKeyInput{ Description: aws.String("DescriptionType"), KeyUsage: aws.String("KeyUsageType"), Policy: aws.String("PolicyType"), } resp, err := svc.CreateKey(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }
func ExampleKMS_CreateGrant() { svc := kms.New(nil) params := &kms.CreateGrantInput{ GranteePrincipal: aws.String("PrincipalIdType"), // Required KeyID: aws.String("KeyIdType"), // Required Constraints: &kms.GrantConstraints{ EncryptionContextEquals: &map[string]*string{ "Key": aws.String("EncryptionContextValue"), // Required // More values... }, EncryptionContextSubset: &map[string]*string{ "Key": aws.String("EncryptionContextValue"), // Required // More values... }, }, GrantTokens: []*string{ aws.String("GrantTokenType"), // Required // More values... }, Operations: []*string{ aws.String("GrantOperation"), // Required // More values... }, RetiringPrincipal: aws.String("PrincipalIdType"), } resp, err := svc.CreateGrant(params) if awserr := aws.Error(err); awserr != nil { // A service error occurred. fmt.Println("Error:", awserr.Code, awserr.Message) } else if err != nil { // A non-service error occurred. panic(err) } // Pretty-print the response data. fmt.Println(awsutil.StringValue(resp)) }