123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148 |
- // THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT.
- package sts_test
- import (
- "bytes"
- "fmt"
- "time"
- "github.com/aws/aws-sdk-go/aws"
- "github.com/aws/aws-sdk-go/service/sts"
- )
- var _ time.Duration
- var _ bytes.Buffer
- func ExampleSTS_AssumeRole() {
- svc := sts.New(nil)
- params := &sts.AssumeRoleInput{
- RoleArn: aws.String("arnType"), // Required
- RoleSessionName: aws.String("userNameType"), // Required
- DurationSeconds: aws.Int64(1),
- ExternalId: aws.String("externalIdType"),
- Policy: aws.String("sessionPolicyDocumentType"),
- SerialNumber: aws.String("serialNumberType"),
- TokenCode: aws.String("tokenCodeType"),
- }
- resp, err := svc.AssumeRole(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 ExampleSTS_AssumeRoleWithSAML() {
- svc := sts.New(nil)
- params := &sts.AssumeRoleWithSAMLInput{
- PrincipalArn: aws.String("arnType"), // Required
- RoleArn: aws.String("arnType"), // Required
- SAMLAssertion: aws.String("SAMLAssertionType"), // Required
- DurationSeconds: aws.Int64(1),
- Policy: aws.String("sessionPolicyDocumentType"),
- }
- resp, err := svc.AssumeRoleWithSAML(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 ExampleSTS_AssumeRoleWithWebIdentity() {
- svc := sts.New(nil)
- params := &sts.AssumeRoleWithWebIdentityInput{
- RoleArn: aws.String("arnType"), // Required
- RoleSessionName: aws.String("userNameType"), // Required
- WebIdentityToken: aws.String("clientTokenType"), // Required
- DurationSeconds: aws.Int64(1),
- Policy: aws.String("sessionPolicyDocumentType"),
- ProviderId: aws.String("urlType"),
- }
- resp, err := svc.AssumeRoleWithWebIdentity(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 ExampleSTS_DecodeAuthorizationMessage() {
- svc := sts.New(nil)
- params := &sts.DecodeAuthorizationMessageInput{
- EncodedMessage: aws.String("encodedMessageType"), // Required
- }
- resp, err := svc.DecodeAuthorizationMessage(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 ExampleSTS_GetFederationToken() {
- svc := sts.New(nil)
- params := &sts.GetFederationTokenInput{
- Name: aws.String("userNameType"), // Required
- DurationSeconds: aws.Int64(1),
- Policy: aws.String("sessionPolicyDocumentType"),
- }
- resp, err := svc.GetFederationToken(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 ExampleSTS_GetSessionToken() {
- svc := sts.New(nil)
- params := &sts.GetSessionTokenInput{
- DurationSeconds: aws.Int64(1),
- SerialNumber: aws.String("serialNumberType"),
- TokenCode: aws.String("tokenCodeType"),
- }
- resp, err := svc.GetSessionToken(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)
- }
|