diff --git a/aws/config.go b/aws/config.go index d3e889514d6..16647c808d6 100644 --- a/aws/config.go +++ b/aws/config.go @@ -130,11 +130,12 @@ type Config struct { // client to create a new http.Client. This options is only meaningful if you're not // already using a custom HTTP client with the SDK. Enabled by default. // - // Must be set and provided to the session.New() in order to disable the EC2Metadata - // overriding the timeout for default credentials chain. + // Must be set and provided to the session.NewSession() in order to disable + // the EC2Metadata overriding the timeout for default credentials chain. // // Example: - // sess := session.New(aws.NewConfig().WithEC2MetadataDiableTimeoutOverride(true)) + // sess, err := session.NewSession(aws.NewConfig().WithEC2MetadataDiableTimeoutOverride(true)) + // // svc := s3.New(sess) // EC2MetadataDisableTimeoutOverride *bool @@ -150,7 +151,7 @@ type Config struct { // NewConfig returns a new Config pointer that can be chained with builder methods to // set multiple configuration values inline without using pointers. // -// sess := session.New(aws.NewConfig().WithRegion("us-west-2").WithMaxRetries(10)) +// sess, err := session.NewSession(aws.NewConfig().WithRegion("us-west-2").WithMaxRetries(10)) // func NewConfig() *Config { return &Config{} diff --git a/aws/corehandlers/param_validator_test.go b/aws/corehandlers/param_validator_test.go index fb50a0bd871..66973ca01f7 100644 --- a/aws/corehandlers/param_validator_test.go +++ b/aws/corehandlers/param_validator_test.go @@ -12,7 +12,7 @@ import ( "github.com/aws/aws-sdk-go/aws/client/metadata" "github.com/aws/aws-sdk-go/aws/corehandlers" "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/awstesting/unit" "github.com/aws/aws-sdk-go/service/kinesis" "github.com/stretchr/testify/require" ) @@ -242,7 +242,7 @@ func BenchmarkValidateAny(b *testing.B) { input.Records = append(input.Records, record) } - req, _ := kinesis.New(session.New()).PutRecordsRequest(input) + req, _ := kinesis.New(unit.Session).PutRecordsRequest(input) b.ResetTimer() for i := 0; i < b.N; i++ { diff --git a/aws/credentials/ec2rolecreds/ec2_role_provider_test.go b/aws/credentials/ec2rolecreds/ec2_role_provider_test.go index da3d8ed3ec1..cccd4bffe42 100644 --- a/aws/credentials/ec2rolecreds/ec2_role_provider_test.go +++ b/aws/credentials/ec2rolecreds/ec2_role_provider_test.go @@ -13,7 +13,7 @@ import ( "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds" "github.com/aws/aws-sdk-go/aws/ec2metadata" - "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/awstesting/unit" ) const credsRespTmpl = `{ @@ -55,7 +55,7 @@ func TestEC2RoleProvider(t *testing.T) { defer server.Close() p := &ec2rolecreds.EC2RoleProvider{ - Client: ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), + Client: ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), } creds, err := p.Retrieve() @@ -71,7 +71,7 @@ func TestEC2RoleProviderFailAssume(t *testing.T) { defer server.Close() p := &ec2rolecreds.EC2RoleProvider{ - Client: ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), + Client: ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), } creds, err := p.Retrieve() @@ -92,7 +92,7 @@ func TestEC2RoleProviderIsExpired(t *testing.T) { defer server.Close() p := &ec2rolecreds.EC2RoleProvider{ - Client: ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), + Client: ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), } p.CurrentTime = func() time.Time { return time.Date(2014, 12, 15, 21, 26, 0, 0, time.UTC) @@ -117,7 +117,7 @@ func TestEC2RoleProviderExpiryWindowIsExpired(t *testing.T) { defer server.Close() p := &ec2rolecreds.EC2RoleProvider{ - Client: ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), + Client: ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), ExpiryWindow: time.Hour * 1, } p.CurrentTime = func() time.Time { @@ -143,7 +143,7 @@ func BenchmarkEC3RoleProvider(b *testing.B) { defer server.Close() p := &ec2rolecreds.EC2RoleProvider{ - Client: ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), + Client: ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}), } _, err := p.Retrieve() if err != nil { diff --git a/aws/ec2metadata/api_test.go b/aws/ec2metadata/api_test.go index 37b74fb0cc8..be813aae270 100644 --- a/aws/ec2metadata/api_test.go +++ b/aws/ec2metadata/api_test.go @@ -15,7 +15,7 @@ import ( "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/ec2metadata" "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/awstesting/unit" ) const instanceIdentityDocument = `{ @@ -61,7 +61,7 @@ func initTestServer(path string, resp string) *httptest.Server { } func TestEndpoint(t *testing.T) { - c := ec2metadata.New(session.New()) + c := ec2metadata.New(unit.Session) op := &request.Operation{ Name: "GetMetadata", HTTPMethod: "GET", @@ -79,7 +79,7 @@ func TestGetMetadata(t *testing.T) { "success", // real response includes suffix ) defer server.Close() - c := ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) + c := ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) resp, err := c.GetMetadata("some/path") @@ -93,7 +93,7 @@ func TestGetRegion(t *testing.T) { "us-west-2a", // real response includes suffix ) defer server.Close() - c := ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) + c := ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) region, err := c.Region() @@ -107,7 +107,7 @@ func TestMetadataAvailable(t *testing.T) { "instance-id", ) defer server.Close() - c := ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) + c := ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) available := c.Available() @@ -120,7 +120,7 @@ func TestMetadataIAMInfo_success(t *testing.T) { validIamInfo, ) defer server.Close() - c := ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) + c := ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) iamInfo, err := c.IAMInfo() assert.NoError(t, err) @@ -135,7 +135,7 @@ func TestMetadataIAMInfo_failure(t *testing.T) { unsuccessfulIamInfo, ) defer server.Close() - c := ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) + c := ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) iamInfo, err := c.IAMInfo() assert.NotNil(t, err) @@ -145,7 +145,7 @@ func TestMetadataIAMInfo_failure(t *testing.T) { } func TestMetadataNotAvailable(t *testing.T) { - c := ec2metadata.New(session.New()) + c := ec2metadata.New(unit.Session) c.Handlers.Send.Clear() c.Handlers.Send.PushBack(func(r *request.Request) { r.HTTPResponse = &http.Response{ @@ -163,7 +163,7 @@ func TestMetadataNotAvailable(t *testing.T) { } func TestMetadataErrorResponse(t *testing.T) { - c := ec2metadata.New(session.New()) + c := ec2metadata.New(unit.Session) c.Handlers.Send.Clear() c.Handlers.Send.PushBack(func(r *request.Request) { r.HTTPResponse = &http.Response{ @@ -185,7 +185,7 @@ func TestEC2RoleProviderInstanceIdentity(t *testing.T) { instanceIdentityDocument, ) defer server.Close() - c := ec2metadata.New(session.New(), &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) + c := ec2metadata.New(unit.Session, &aws.Config{Endpoint: aws.String(server.URL + "/latest")}) doc, err := c.GetInstanceIdentityDocument() assert.Nil(t, err, "Expect no error, %v", err) diff --git a/aws/ec2metadata/service_test.go b/aws/ec2metadata/service_test.go index d10ecb303b6..c2bc215879b 100644 --- a/aws/ec2metadata/service_test.go +++ b/aws/ec2metadata/service_test.go @@ -9,25 +9,24 @@ import ( "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/ec2metadata" - "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/awstesting/unit" "github.com/stretchr/testify/assert" ) func TestClientOverrideDefaultHTTPClientTimeout(t *testing.T) { - svc := ec2metadata.New(session.New()) + svc := ec2metadata.New(unit.Session) assert.NotEqual(t, http.DefaultClient, svc.Config.HTTPClient) assert.Equal(t, 5*time.Second, svc.Config.HTTPClient.Timeout) } func TestClientNotOverrideDefaultHTTPClientTimeout(t *testing.T) { - origClient := *http.DefaultClient http.DefaultClient.Transport = &http.Transport{} defer func() { - http.DefaultClient = &origClient + http.DefaultClient.Transport = nil }() - svc := ec2metadata.New(session.New()) + svc := ec2metadata.New(unit.Session) assert.Equal(t, http.DefaultClient, svc.Config.HTTPClient) @@ -38,7 +37,7 @@ func TestClientNotOverrideDefaultHTTPClientTimeout(t *testing.T) { } func TestClientDisableOverrideDefaultHTTPClientTimeout(t *testing.T) { - svc := ec2metadata.New(session.New(aws.NewConfig().WithEC2MetadataDisableTimeoutOverride(true))) + svc := ec2metadata.New(unit.Session, aws.NewConfig().WithEC2MetadataDisableTimeoutOverride(true)) assert.Equal(t, http.DefaultClient, svc.Config.HTTPClient) } @@ -69,7 +68,7 @@ func runEC2MetadataClients(t *testing.T, cfg *aws.Config, atOnce int) { wg.Add(atOnce) for i := 0; i < atOnce; i++ { go func() { - svc := ec2metadata.New(session.New(), cfg) + svc := ec2metadata.New(unit.Session, cfg) _, err := svc.Region() assert.NoError(t, err) wg.Done() diff --git a/awstesting/mock/mock.go b/awstesting/mock/mock.go index bca85fe46de..9f180074523 100644 --- a/awstesting/mock/mock.go +++ b/awstesting/mock/mock.go @@ -11,10 +11,10 @@ import ( ) // Session is a mock session which is used to hit the mock server -var Session = session.New(&aws.Config{ +var Session = session.Must(session.NewSession(&aws.Config{ DisableSSL: aws.Bool(true), Endpoint: aws.String(server.URL[7:]), -}) +})) // server is the mock server that simply writes a 200 status back to the client var server = httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { diff --git a/awstesting/performance/logging.go b/awstesting/performance/logging.go index 6b0815ed0e1..03c885fd9bf 100644 --- a/awstesting/performance/logging.go +++ b/awstesting/performance/logging.go @@ -10,7 +10,7 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/awstesting/unit" "github.com/aws/aws-sdk-go/service/dynamodb" "github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute" ) @@ -75,10 +75,10 @@ type outputer interface { type dynamodbOut struct { table string // table to write to in dynamodb region string - db *dynamodb.DynamoDB // the dynamodb session + db *dynamodb.DynamoDB // the dynamodb } -// init initializes dynamodbOut to have a new session +// init initializes dynamodbOut func newDynamodbOut(table, region string) *dynamodbOut { out := dynamodbOut{ table: table, @@ -86,7 +86,7 @@ func newDynamodbOut(table, region string) *dynamodbOut { } out.db = dynamodb.New( - session.New(), + unit.Session, &aws.Config{Region: &out.region}, ) return &out diff --git a/awstesting/unit/unit.go b/awstesting/unit/unit.go index e3ec33a82f8..1c6e6054684 100644 --- a/awstesting/unit/unit.go +++ b/awstesting/unit/unit.go @@ -8,6 +8,6 @@ import ( ) // Session is a shared session for unit tests to use. -var Session = session.New(aws.NewConfig(). +var Session = session.Must(session.NewSession(aws.NewConfig(). WithCredentials(credentials.NewStaticCredentials("AKID", "SECRET", "SESSION")). - WithRegion("mock-region")) + WithRegion("mock-region"))) diff --git a/example/service/ec2/filterInstances/filter_ec2_by_tag.go b/example/service/ec2/filterInstances/filter_ec2_by_tag.go index da5a47619e1..a5c3c7e9f22 100644 --- a/example/service/ec2/filterInstances/filter_ec2_by_tag.go +++ b/example/service/ec2/filterInstances/filter_ec2_by_tag.go @@ -2,12 +2,13 @@ package main import ( "fmt" - "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" - "github.com/aws/aws-sdk-go/service/ec2" "log" "os" "strings" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/service/ec2" ) // This example will list instances with a filter @@ -15,9 +16,14 @@ import ( // Usage: // go run filter_ec2_by_tag.go func main() { + sess, err := session.NewSession() + if err != nil { + log.Fatalf("failed to create session %v\n", err) + } + nameFilter := os.Args[1] awsRegion := "us-east-1" - svc := ec2.New(session.New(&aws.Config{Region: aws.String(awsRegion)})) + svc := ec2.New(sess, &aws.Config{Region: aws.String(awsRegion)}) fmt.Printf("listing instances with tag %v in: %v\n", nameFilter, awsRegion) params := &ec2.DescribeInstancesInput{ Filters: []*ec2.Filter{ diff --git a/example/service/s3/listObjects/listObjects.go b/example/service/s3/listObjects/listObjects.go index 4c114024f76..c5cf162f3be 100644 --- a/example/service/s3/listObjects/listObjects.go +++ b/example/service/s3/listObjects/listObjects.go @@ -13,12 +13,16 @@ import ( // Usage: // go run listObjects.go func main() { - sess := session.New() + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } svc := s3.New(sess) i := 0 - err := svc.ListObjectsPages(&s3.ListObjectsInput{ + err = svc.ListObjectsPages(&s3.ListObjectsInput{ Bucket: &os.Args[1], }, func(p *s3.ListObjectsOutput, last bool) (shouldContinue bool) { fmt.Println("Page,", i) diff --git a/example/service/s3/listObjectsConcurrently/listObjectsConcurrently.go b/example/service/s3/listObjectsConcurrently/listObjectsConcurrently.go index 33c855e06b0..2f0235886d3 100644 --- a/example/service/s3/listObjectsConcurrently/listObjectsConcurrently.go +++ b/example/service/s3/listObjectsConcurrently/listObjectsConcurrently.go @@ -8,7 +8,6 @@ import ( "time" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/credentials" "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/service/s3" ) @@ -32,11 +31,18 @@ func main() { for _, acc := range accounts { wg.Add(1) go func(acc string) { - sess := session.New(&aws.Config{Credentials: credentials.NewSharedCredentials("", acc)}) - if err := getAccountBuckets(sess, bucketCh, acc); err != nil { + defer wg.Done() + + sess, err := session.NewSessionWithOptions(session.Options{ + Profile: acc, + }) + if err != nil { + fmt.Fprintf(os.Stderr, "failed to create session for account, %d, %v\n", acc, err) + return + } + if err = getAccountBuckets(sess, bucketCh, acc); err != nil { fmt.Fprintf(os.Stderr, "failed to get account %s's bucket info, %v\n", acc, err) } - wg.Done() }(acc) } // Spin off a goroutine which will wait until all account buckets have been collected and diff --git a/models/protocol_tests/generate.go b/models/protocol_tests/generate.go index 50a56c3f121..56630309545 100644 --- a/models/protocol_tests/generate.go +++ b/models/protocol_tests/generate.go @@ -89,7 +89,7 @@ var extraImports = []string{ "net/url", "", "github.com/aws/aws-sdk-go/awstesting", - "github.com/aws/aws-sdk-go/aws/session", + "github.com/aws/aws-sdk-go/awstesting/unit", "github.com/aws/aws-sdk-go/private/protocol", "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil", "github.com/aws/aws-sdk-go/private/util", @@ -125,8 +125,7 @@ func (t *testSuite) TestSuite() string { var tplInputTestCase = template.Must(template.New("inputcase").Parse(` func Test{{ .OpName }}(t *testing.T) { - sess := session.New() - svc := New{{ .TestCase.TestSuite.API.StructName }}(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := New{{ .TestCase.TestSuite.API.StructName }}(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) {{ if ne .ParamsString "" }}input := {{ .ParamsString }} req, _ := svc.{{ .TestCase.Given.ExportedName }}Request(input){{ else }}req, _ := svc.{{ .TestCase.Given.ExportedName }}Request(nil){{ end }} r := req.HTTPRequest @@ -197,8 +196,7 @@ func (t tplInputTestCaseData) BodyAssertions() string { var tplOutputTestCase = template.Must(template.New("outputcase").Parse(` func Test{{ .OpName }}(t *testing.T) { - sess := session.New() - svc := New{{ .TestCase.TestSuite.API.StructName }}(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := New{{ .TestCase.TestSuite.API.StructName }}(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte({{ .Body }})) req, out := svc.{{ .TestCase.Given.ExportedName }}Request(nil) diff --git a/private/model/api/operation.go b/private/model/api/operation.go index 479e5d8a21e..47de9cb6ea3 100644 --- a/private/model/api/operation.go +++ b/private/model/api/operation.go @@ -168,7 +168,13 @@ func (o *Operation) InterfaceSignature() string { // tplExample defines the template for rendering an Operation example var tplExample = template.Must(template.New("operationExample").Parse(` func Example{{ .API.StructName }}_{{ .ExportedName }}() { - svc := {{ .API.PackageName }}.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := {{ .API.PackageName }}.New(sess) {{ .ExampleInput }} resp, err := svc.{{ .ExportedName }}(params) diff --git a/private/protocol/ec2query/build_test.go b/private/protocol/ec2query/build_test.go index 84ddb203288..7dd00a9307a 100644 --- a/private/protocol/ec2query/build_test.go +++ b/private/protocol/ec2query/build_test.go @@ -16,9 +16,9 @@ import ( "github.com/aws/aws-sdk-go/aws/client" "github.com/aws/aws-sdk-go/aws/client/metadata" "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/aws/signer/v4" "github.com/aws/aws-sdk-go/awstesting" + "github.com/aws/aws-sdk-go/awstesting/unit" "github.com/aws/aws-sdk-go/private/protocol" "github.com/aws/aws-sdk-go/private/protocol/ec2query" "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" @@ -1123,8 +1123,7 @@ type InputService9TestShapeInputShape struct { // func TestInputService1ProtocolTestScalarMembersCase1(t *testing.T) { - sess := session.New() - svc := NewInputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService1TestShapeInputService1TestCaseOperation1Input{ Bar: aws.String("val2"), Foo: aws.String("val1"), @@ -1149,8 +1148,7 @@ func TestInputService1ProtocolTestScalarMembersCase1(t *testing.T) { } func TestInputService2ProtocolTestStructureWithLocationNameAndQueryNameAppliedToMembersCase1(t *testing.T) { - sess := session.New() - svc := NewInputService2ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService2ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService2TestShapeInputService2TestCaseOperation1Input{ Bar: aws.String("val2"), Foo: aws.String("val1"), @@ -1176,8 +1174,7 @@ func TestInputService2ProtocolTestStructureWithLocationNameAndQueryNameAppliedTo } func TestInputService3ProtocolTestNestedStructureMembersCase1(t *testing.T) { - sess := session.New() - svc := NewInputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService3ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService3TestShapeInputService3TestCaseOperation1Input{ StructArg: &InputService3TestShapeStructType{ ScalarArg: aws.String("foo"), @@ -1203,8 +1200,7 @@ func TestInputService3ProtocolTestNestedStructureMembersCase1(t *testing.T) { } func TestInputService4ProtocolTestListTypesCase1(t *testing.T) { - sess := session.New() - svc := NewInputService4ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService4ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService4TestShapeInputService4TestCaseOperation1Input{ ListArg: []*string{ aws.String("foo"), @@ -1232,8 +1228,7 @@ func TestInputService4ProtocolTestListTypesCase1(t *testing.T) { } func TestInputService5ProtocolTestListWithLocationNameAppliedToMemberCase1(t *testing.T) { - sess := session.New() - svc := NewInputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService5TestShapeInputService5TestCaseOperation1Input{ ListArg: []*string{ aws.String("a"), @@ -1261,8 +1256,7 @@ func TestInputService5ProtocolTestListWithLocationNameAppliedToMemberCase1(t *te } func TestInputService6ProtocolTestListWithLocationNameAndQueryNameCase1(t *testing.T) { - sess := session.New() - svc := NewInputService6ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService6ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService6TestShapeInputService6TestCaseOperation1Input{ ListArg: []*string{ aws.String("a"), @@ -1290,8 +1284,7 @@ func TestInputService6ProtocolTestListWithLocationNameAndQueryNameCase1(t *testi } func TestInputService7ProtocolTestBase64EncodedBlobsCase1(t *testing.T) { - sess := session.New() - svc := NewInputService7ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService7ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService7TestShapeInputService7TestCaseOperation1Input{ BlobArg: []byte("foo"), } @@ -1315,8 +1308,7 @@ func TestInputService7ProtocolTestBase64EncodedBlobsCase1(t *testing.T) { } func TestInputService8ProtocolTestTimestampValuesCase1(t *testing.T) { - sess := session.New() - svc := NewInputService8ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService8ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService8TestShapeInputService8TestCaseOperation1Input{ TimeArg: aws.Time(time.Unix(1422172800, 0)), } @@ -1340,8 +1332,7 @@ func TestInputService8ProtocolTestTimestampValuesCase1(t *testing.T) { } func TestInputService9ProtocolTestIdempotencyTokenAutoFillCase1(t *testing.T) { - sess := session.New() - svc := NewInputService9ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService9ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService9TestShapeInputShape{ Token: aws.String("abc123"), } @@ -1365,8 +1356,7 @@ func TestInputService9ProtocolTestIdempotencyTokenAutoFillCase1(t *testing.T) { } func TestInputService9ProtocolTestIdempotencyTokenAutoFillCase2(t *testing.T) { - sess := session.New() - svc := NewInputService9ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService9ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService9TestShapeInputShape{} req, _ := svc.InputService9TestCaseOperation2Request(input) r := req.HTTPRequest diff --git a/private/protocol/ec2query/unmarshal_test.go b/private/protocol/ec2query/unmarshal_test.go index 890e2d68b43..2b57eddcfe8 100644 --- a/private/protocol/ec2query/unmarshal_test.go +++ b/private/protocol/ec2query/unmarshal_test.go @@ -16,9 +16,9 @@ import ( "github.com/aws/aws-sdk-go/aws/client" "github.com/aws/aws-sdk-go/aws/client/metadata" "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/aws/signer/v4" "github.com/aws/aws-sdk-go/awstesting" + "github.com/aws/aws-sdk-go/awstesting/unit" "github.com/aws/aws-sdk-go/private/protocol" "github.com/aws/aws-sdk-go/private/protocol/ec2query" "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" @@ -1059,8 +1059,7 @@ type OutputService9TestShapeOutputService9TestCaseOperation1Output struct { // func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("myname123falsetrue1.21.3200arequest-id")) req, out := svc.OutputService1TestCaseOperation1Request(nil) @@ -1087,8 +1086,7 @@ func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) { } func TestOutputService2ProtocolTestBlobCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService2ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService2ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("dmFsdWU=requestid")) req, out := svc.OutputService2TestCaseOperation1Request(nil) @@ -1108,8 +1106,7 @@ func TestOutputService2ProtocolTestBlobCase1(t *testing.T) { } func TestOutputService3ProtocolTestListsCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService3ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("abc123requestid")) req, out := svc.OutputService3TestCaseOperation1Request(nil) @@ -1130,8 +1127,7 @@ func TestOutputService3ProtocolTestListsCase1(t *testing.T) { } func TestOutputService4ProtocolTestListWithCustomMemberNameCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService4ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService4ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("abc123requestid")) req, out := svc.OutputService4TestCaseOperation1Request(nil) @@ -1152,8 +1148,7 @@ func TestOutputService4ProtocolTestListWithCustomMemberNameCase1(t *testing.T) { } func TestOutputService5ProtocolTestFlattenedListCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("abc123requestid")) req, out := svc.OutputService5TestCaseOperation1Request(nil) @@ -1174,8 +1169,7 @@ func TestOutputService5ProtocolTestFlattenedListCase1(t *testing.T) { } func TestOutputService6ProtocolTestNormalMapCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService6ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService6ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) req, out := svc.OutputService6TestCaseOperation1Request(nil) @@ -1196,8 +1190,7 @@ func TestOutputService6ProtocolTestNormalMapCase1(t *testing.T) { } func TestOutputService7ProtocolTestFlattenedMapCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService7ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService7ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) req, out := svc.OutputService7TestCaseOperation1Request(nil) @@ -1218,8 +1211,7 @@ func TestOutputService7ProtocolTestFlattenedMapCase1(t *testing.T) { } func TestOutputService8ProtocolTestNamedMapCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService8ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService8ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) req, out := svc.OutputService8TestCaseOperation1Request(nil) @@ -1240,8 +1232,7 @@ func TestOutputService8ProtocolTestNamedMapCase1(t *testing.T) { } func TestOutputService9ProtocolTestEmptyStringCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService9ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService9ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("requestid")) req, out := svc.OutputService9TestCaseOperation1Request(nil) diff --git a/private/protocol/jsonrpc/build_test.go b/private/protocol/jsonrpc/build_test.go index bd731586566..42d9ab0eabf 100644 --- a/private/protocol/jsonrpc/build_test.go +++ b/private/protocol/jsonrpc/build_test.go @@ -16,9 +16,9 @@ import ( "github.com/aws/aws-sdk-go/aws/client" "github.com/aws/aws-sdk-go/aws/client/metadata" "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/aws/signer/v4" "github.com/aws/aws-sdk-go/awstesting" + "github.com/aws/aws-sdk-go/awstesting/unit" "github.com/aws/aws-sdk-go/private/protocol" "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" @@ -1230,8 +1230,7 @@ type InputService7TestShapeInputShape struct { // func TestInputService1ProtocolTestScalarMembersCase1(t *testing.T) { - sess := session.New() - svc := NewInputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService1TestShapeInputService1TestCaseOperation1Input{ Name: aws.String("myname"), } @@ -1257,8 +1256,7 @@ func TestInputService1ProtocolTestScalarMembersCase1(t *testing.T) { } func TestInputService2ProtocolTestTimestampValuesCase1(t *testing.T) { - sess := session.New() - svc := NewInputService2ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService2ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService2TestShapeInputService2TestCaseOperation1Input{ TimeArg: aws.Time(time.Unix(1422172800, 0)), } @@ -1284,8 +1282,7 @@ func TestInputService2ProtocolTestTimestampValuesCase1(t *testing.T) { } func TestInputService3ProtocolTestBase64EncodedBlobsCase1(t *testing.T) { - sess := session.New() - svc := NewInputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService3ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService3TestShapeInputShape{ BlobArg: []byte("foo"), } @@ -1311,8 +1308,7 @@ func TestInputService3ProtocolTestBase64EncodedBlobsCase1(t *testing.T) { } func TestInputService3ProtocolTestBase64EncodedBlobsCase2(t *testing.T) { - sess := session.New() - svc := NewInputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService3ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService3TestShapeInputShape{ BlobMap: map[string][]byte{ "key1": []byte("foo"), @@ -1341,8 +1337,7 @@ func TestInputService3ProtocolTestBase64EncodedBlobsCase2(t *testing.T) { } func TestInputService4ProtocolTestNestedBlobsCase1(t *testing.T) { - sess := session.New() - svc := NewInputService4ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService4ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService4TestShapeInputService4TestCaseOperation1Input{ ListParam: [][]byte{ []byte("foo"), @@ -1371,8 +1366,7 @@ func TestInputService4ProtocolTestNestedBlobsCase1(t *testing.T) { } func TestInputService5ProtocolTestRecursiveShapesCase1(t *testing.T) { - sess := session.New() - svc := NewInputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService5TestShapeInputShape{ RecursiveStruct: &InputService5TestShapeRecursiveStructType{ NoRecurse: aws.String("foo"), @@ -1400,8 +1394,7 @@ func TestInputService5ProtocolTestRecursiveShapesCase1(t *testing.T) { } func TestInputService5ProtocolTestRecursiveShapesCase2(t *testing.T) { - sess := session.New() - svc := NewInputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService5TestShapeInputShape{ RecursiveStruct: &InputService5TestShapeRecursiveStructType{ RecursiveStruct: &InputService5TestShapeRecursiveStructType{ @@ -1431,8 +1424,7 @@ func TestInputService5ProtocolTestRecursiveShapesCase2(t *testing.T) { } func TestInputService5ProtocolTestRecursiveShapesCase3(t *testing.T) { - sess := session.New() - svc := NewInputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService5TestShapeInputShape{ RecursiveStruct: &InputService5TestShapeRecursiveStructType{ RecursiveStruct: &InputService5TestShapeRecursiveStructType{ @@ -1466,8 +1458,7 @@ func TestInputService5ProtocolTestRecursiveShapesCase3(t *testing.T) { } func TestInputService5ProtocolTestRecursiveShapesCase4(t *testing.T) { - sess := session.New() - svc := NewInputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService5TestShapeInputShape{ RecursiveStruct: &InputService5TestShapeRecursiveStructType{ RecursiveList: []*InputService5TestShapeRecursiveStructType{ @@ -1502,8 +1493,7 @@ func TestInputService5ProtocolTestRecursiveShapesCase4(t *testing.T) { } func TestInputService5ProtocolTestRecursiveShapesCase5(t *testing.T) { - sess := session.New() - svc := NewInputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService5TestShapeInputShape{ RecursiveStruct: &InputService5TestShapeRecursiveStructType{ RecursiveList: []*InputService5TestShapeRecursiveStructType{ @@ -1540,8 +1530,7 @@ func TestInputService5ProtocolTestRecursiveShapesCase5(t *testing.T) { } func TestInputService5ProtocolTestRecursiveShapesCase6(t *testing.T) { - sess := session.New() - svc := NewInputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService5TestShapeInputShape{ RecursiveStruct: &InputService5TestShapeRecursiveStructType{ RecursiveMap: map[string]*InputService5TestShapeRecursiveStructType{ @@ -1576,8 +1565,7 @@ func TestInputService5ProtocolTestRecursiveShapesCase6(t *testing.T) { } func TestInputService6ProtocolTestEmptyMapsCase1(t *testing.T) { - sess := session.New() - svc := NewInputService6ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService6ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService6TestShapeInputService6TestCaseOperation1Input{ Map: map[string]*string{}, } @@ -1603,8 +1591,7 @@ func TestInputService6ProtocolTestEmptyMapsCase1(t *testing.T) { } func TestInputService7ProtocolTestIdempotencyTokenAutoFillCase1(t *testing.T) { - sess := session.New() - svc := NewInputService7ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService7ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService7TestShapeInputShape{ Token: aws.String("abc123"), } @@ -1628,8 +1615,7 @@ func TestInputService7ProtocolTestIdempotencyTokenAutoFillCase1(t *testing.T) { } func TestInputService7ProtocolTestIdempotencyTokenAutoFillCase2(t *testing.T) { - sess := session.New() - svc := NewInputService7ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService7ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService7TestShapeInputShape{} req, _ := svc.InputService7TestCaseOperation2Request(input) r := req.HTTPRequest diff --git a/private/protocol/jsonrpc/unmarshal_test.go b/private/protocol/jsonrpc/unmarshal_test.go index 5f6c4c989a9..e1fcac8b38a 100644 --- a/private/protocol/jsonrpc/unmarshal_test.go +++ b/private/protocol/jsonrpc/unmarshal_test.go @@ -16,9 +16,9 @@ import ( "github.com/aws/aws-sdk-go/aws/client" "github.com/aws/aws-sdk-go/aws/client/metadata" "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/aws/signer/v4" "github.com/aws/aws-sdk-go/awstesting" + "github.com/aws/aws-sdk-go/awstesting/unit" "github.com/aws/aws-sdk-go/private/protocol" "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" @@ -810,8 +810,7 @@ type OutputService6TestShapeOutputService6TestCaseOperation1Output struct { // func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("{\"Str\": \"myname\", \"Num\": 123, \"FalseBool\": false, \"TrueBool\": true, \"Float\": 1.2, \"Double\": 1.3, \"Long\": 200, \"Char\": \"a\"}")) req, out := svc.OutputService1TestCaseOperation1Request(nil) @@ -838,8 +837,7 @@ func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) { } func TestOutputService2ProtocolTestBlobMembersCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService2ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService2ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("{\"BlobMember\": \"aGkh\", \"StructMember\": {\"foo\": \"dGhlcmUh\"}}")) req, out := svc.OutputService2TestCaseOperation1Request(nil) @@ -860,8 +858,7 @@ func TestOutputService2ProtocolTestBlobMembersCase1(t *testing.T) { } func TestOutputService3ProtocolTestTimestampMembersCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService3ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("{\"TimeMember\": 1398796238, \"StructMember\": {\"foo\": 1398796238}}")) req, out := svc.OutputService3TestCaseOperation1Request(nil) @@ -882,8 +879,7 @@ func TestOutputService3ProtocolTestTimestampMembersCase1(t *testing.T) { } func TestOutputService4ProtocolTestListsCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService4ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService4ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("{\"ListMember\": [\"a\", \"b\"]}")) req, out := svc.OutputService4TestCaseOperation1Request(nil) @@ -904,8 +900,7 @@ func TestOutputService4ProtocolTestListsCase1(t *testing.T) { } func TestOutputService4ProtocolTestListsCase2(t *testing.T) { - sess := session.New() - svc := NewOutputService4ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService4ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("{\"ListMember\": [\"a\", null], \"ListMemberMap\": [{}, null, null, {}], \"ListMemberStruct\": [{}, null, null, {}]}")) req, out := svc.OutputService4TestCaseOperation2Request(nil) @@ -930,8 +925,7 @@ func TestOutputService4ProtocolTestListsCase2(t *testing.T) { } func TestOutputService5ProtocolTestMapsCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("{\"MapMember\": {\"a\": [1, 2], \"b\": [3, 4]}}")) req, out := svc.OutputService5TestCaseOperation1Request(nil) @@ -954,8 +948,7 @@ func TestOutputService5ProtocolTestMapsCase1(t *testing.T) { } func TestOutputService6ProtocolTestIgnoresExtraDataCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService6ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService6ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("{\"foo\": \"bar\"}")) req, out := svc.OutputService6TestCaseOperation1Request(nil) diff --git a/private/protocol/query/build_test.go b/private/protocol/query/build_test.go index 6d05621ad41..1496e94da67 100644 --- a/private/protocol/query/build_test.go +++ b/private/protocol/query/build_test.go @@ -16,9 +16,9 @@ import ( "github.com/aws/aws-sdk-go/aws/client" "github.com/aws/aws-sdk-go/aws/client/metadata" "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/aws/signer/v4" "github.com/aws/aws-sdk-go/awstesting" + "github.com/aws/aws-sdk-go/awstesting/unit" "github.com/aws/aws-sdk-go/private/protocol" "github.com/aws/aws-sdk-go/private/protocol/query" "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" @@ -2055,8 +2055,7 @@ type InputService13TestShapeInputShape struct { // func TestInputService1ProtocolTestScalarMembersCase1(t *testing.T) { - sess := session.New() - svc := NewInputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService1TestShapeInputShape{ Bar: aws.String("val2"), Foo: aws.String("val1"), @@ -2081,8 +2080,7 @@ func TestInputService1ProtocolTestScalarMembersCase1(t *testing.T) { } func TestInputService1ProtocolTestScalarMembersCase2(t *testing.T) { - sess := session.New() - svc := NewInputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService1TestShapeInputShape{ Baz: aws.Bool(true), } @@ -2106,8 +2104,7 @@ func TestInputService1ProtocolTestScalarMembersCase2(t *testing.T) { } func TestInputService1ProtocolTestScalarMembersCase3(t *testing.T) { - sess := session.New() - svc := NewInputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService1TestShapeInputShape{ Baz: aws.Bool(false), } @@ -2131,8 +2128,7 @@ func TestInputService1ProtocolTestScalarMembersCase3(t *testing.T) { } func TestInputService2ProtocolTestNestedStructureMembersCase1(t *testing.T) { - sess := session.New() - svc := NewInputService2ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService2ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService2TestShapeInputService2TestCaseOperation1Input{ StructArg: &InputService2TestShapeStructType{ ScalarArg: aws.String("foo"), @@ -2158,8 +2154,7 @@ func TestInputService2ProtocolTestNestedStructureMembersCase1(t *testing.T) { } func TestInputService3ProtocolTestListTypesCase1(t *testing.T) { - sess := session.New() - svc := NewInputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService3ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService3TestShapeInputShape{ ListArg: []*string{ aws.String("foo"), @@ -2187,8 +2182,7 @@ func TestInputService3ProtocolTestListTypesCase1(t *testing.T) { } func TestInputService3ProtocolTestListTypesCase2(t *testing.T) { - sess := session.New() - svc := NewInputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService3ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService3TestShapeInputShape{ ListArg: []*string{}, } @@ -2212,8 +2206,7 @@ func TestInputService3ProtocolTestListTypesCase2(t *testing.T) { } func TestInputService4ProtocolTestFlattenedListCase1(t *testing.T) { - sess := session.New() - svc := NewInputService4ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService4ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService4TestShapeInputShape{ ListArg: []*string{ aws.String("a"), @@ -2242,8 +2235,7 @@ func TestInputService4ProtocolTestFlattenedListCase1(t *testing.T) { } func TestInputService4ProtocolTestFlattenedListCase2(t *testing.T) { - sess := session.New() - svc := NewInputService4ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService4ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService4TestShapeInputShape{ NamedListArg: []*string{ aws.String("a"), @@ -2269,8 +2261,7 @@ func TestInputService4ProtocolTestFlattenedListCase2(t *testing.T) { } func TestInputService5ProtocolTestSerializeFlattenedMapTypeCase1(t *testing.T) { - sess := session.New() - svc := NewInputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService5TestShapeInputService5TestCaseOperation1Input{ MapArg: map[string]*string{ "key1": aws.String("val1"), @@ -2297,8 +2288,7 @@ func TestInputService5ProtocolTestSerializeFlattenedMapTypeCase1(t *testing.T) { } func TestInputService6ProtocolTestNonFlattenedListWithLocationNameCase1(t *testing.T) { - sess := session.New() - svc := NewInputService6ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService6ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService6TestShapeInputService6TestCaseOperation1Input{ ListArg: []*string{ aws.String("a"), @@ -2326,8 +2316,7 @@ func TestInputService6ProtocolTestNonFlattenedListWithLocationNameCase1(t *testi } func TestInputService7ProtocolTestFlattenedListWithLocationNameCase1(t *testing.T) { - sess := session.New() - svc := NewInputService7ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService7ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService7TestShapeInputService7TestCaseOperation1Input{ ListArg: []*string{ aws.String("a"), @@ -2356,8 +2345,7 @@ func TestInputService7ProtocolTestFlattenedListWithLocationNameCase1(t *testing. } func TestInputService8ProtocolTestSerializeMapTypeCase1(t *testing.T) { - sess := session.New() - svc := NewInputService8ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService8ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService8TestShapeInputService8TestCaseOperation1Input{ MapArg: map[string]*string{ "key1": aws.String("val1"), @@ -2384,8 +2372,7 @@ func TestInputService8ProtocolTestSerializeMapTypeCase1(t *testing.T) { } func TestInputService9ProtocolTestSerializeMapTypeWithLocationNameCase1(t *testing.T) { - sess := session.New() - svc := NewInputService9ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService9ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService9TestShapeInputService9TestCaseOperation1Input{ MapArg: map[string]*string{ "key1": aws.String("val1"), @@ -2412,8 +2399,7 @@ func TestInputService9ProtocolTestSerializeMapTypeWithLocationNameCase1(t *testi } func TestInputService10ProtocolTestBase64EncodedBlobsCase1(t *testing.T) { - sess := session.New() - svc := NewInputService10ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService10ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService10TestShapeInputService10TestCaseOperation1Input{ BlobArg: []byte("foo"), } @@ -2437,8 +2423,7 @@ func TestInputService10ProtocolTestBase64EncodedBlobsCase1(t *testing.T) { } func TestInputService11ProtocolTestTimestampValuesCase1(t *testing.T) { - sess := session.New() - svc := NewInputService11ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService11ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService11TestShapeInputService11TestCaseOperation1Input{ TimeArg: aws.Time(time.Unix(1422172800, 0)), } @@ -2462,8 +2447,7 @@ func TestInputService11ProtocolTestTimestampValuesCase1(t *testing.T) { } func TestInputService12ProtocolTestRecursiveShapesCase1(t *testing.T) { - sess := session.New() - svc := NewInputService12ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService12ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService12TestShapeInputShape{ RecursiveStruct: &InputService12TestShapeRecursiveStructType{ NoRecurse: aws.String("foo"), @@ -2489,8 +2473,7 @@ func TestInputService12ProtocolTestRecursiveShapesCase1(t *testing.T) { } func TestInputService12ProtocolTestRecursiveShapesCase2(t *testing.T) { - sess := session.New() - svc := NewInputService12ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService12ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService12TestShapeInputShape{ RecursiveStruct: &InputService12TestShapeRecursiveStructType{ RecursiveStruct: &InputService12TestShapeRecursiveStructType{ @@ -2518,8 +2501,7 @@ func TestInputService12ProtocolTestRecursiveShapesCase2(t *testing.T) { } func TestInputService12ProtocolTestRecursiveShapesCase3(t *testing.T) { - sess := session.New() - svc := NewInputService12ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService12ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService12TestShapeInputShape{ RecursiveStruct: &InputService12TestShapeRecursiveStructType{ RecursiveStruct: &InputService12TestShapeRecursiveStructType{ @@ -2551,8 +2533,7 @@ func TestInputService12ProtocolTestRecursiveShapesCase3(t *testing.T) { } func TestInputService12ProtocolTestRecursiveShapesCase4(t *testing.T) { - sess := session.New() - svc := NewInputService12ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService12ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService12TestShapeInputShape{ RecursiveStruct: &InputService12TestShapeRecursiveStructType{ RecursiveList: []*InputService12TestShapeRecursiveStructType{ @@ -2585,8 +2566,7 @@ func TestInputService12ProtocolTestRecursiveShapesCase4(t *testing.T) { } func TestInputService12ProtocolTestRecursiveShapesCase5(t *testing.T) { - sess := session.New() - svc := NewInputService12ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService12ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService12TestShapeInputShape{ RecursiveStruct: &InputService12TestShapeRecursiveStructType{ RecursiveList: []*InputService12TestShapeRecursiveStructType{ @@ -2621,8 +2601,7 @@ func TestInputService12ProtocolTestRecursiveShapesCase5(t *testing.T) { } func TestInputService12ProtocolTestRecursiveShapesCase6(t *testing.T) { - sess := session.New() - svc := NewInputService12ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService12ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService12TestShapeInputShape{ RecursiveStruct: &InputService12TestShapeRecursiveStructType{ RecursiveMap: map[string]*InputService12TestShapeRecursiveStructType{ @@ -2655,8 +2634,7 @@ func TestInputService12ProtocolTestRecursiveShapesCase6(t *testing.T) { } func TestInputService13ProtocolTestIdempotencyTokenAutoFillCase1(t *testing.T) { - sess := session.New() - svc := NewInputService13ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService13ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService13TestShapeInputShape{ Token: aws.String("abc123"), } @@ -2680,8 +2658,7 @@ func TestInputService13ProtocolTestIdempotencyTokenAutoFillCase1(t *testing.T) { } func TestInputService13ProtocolTestIdempotencyTokenAutoFillCase2(t *testing.T) { - sess := session.New() - svc := NewInputService13ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService13ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService13TestShapeInputShape{} req, _ := svc.InputService13TestCaseOperation2Request(input) r := req.HTTPRequest diff --git a/private/protocol/query/unmarshal_test.go b/private/protocol/query/unmarshal_test.go index 98a82a73d01..dbe0d99ed1b 100644 --- a/private/protocol/query/unmarshal_test.go +++ b/private/protocol/query/unmarshal_test.go @@ -16,9 +16,9 @@ import ( "github.com/aws/aws-sdk-go/aws/client" "github.com/aws/aws-sdk-go/aws/client/metadata" "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/aws/signer/v4" "github.com/aws/aws-sdk-go/awstesting" + "github.com/aws/aws-sdk-go/awstesting/unit" "github.com/aws/aws-sdk-go/private/protocol" "github.com/aws/aws-sdk-go/private/protocol/query" "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" @@ -1743,8 +1743,7 @@ type OutputService15TestShapeOutputService15TestCaseOperation1Output struct { // func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("myname123falsetrue1.21.3200a2015-01-25T08:00:00Zrequest-id")) req, out := svc.OutputService1TestCaseOperation1Request(nil) @@ -1772,8 +1771,7 @@ func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) { } func TestOutputService2ProtocolTestNotAllMembersInResponseCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService2ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService2ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("mynamerequest-id")) req, out := svc.OutputService2TestCaseOperation1Request(nil) @@ -1793,8 +1791,7 @@ func TestOutputService2ProtocolTestNotAllMembersInResponseCase1(t *testing.T) { } func TestOutputService3ProtocolTestBlobCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService3ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("dmFsdWU=requestid")) req, out := svc.OutputService3TestCaseOperation1Request(nil) @@ -1814,8 +1811,7 @@ func TestOutputService3ProtocolTestBlobCase1(t *testing.T) { } func TestOutputService4ProtocolTestListsCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService4ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService4ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("abc123requestid")) req, out := svc.OutputService4TestCaseOperation1Request(nil) @@ -1836,8 +1832,7 @@ func TestOutputService4ProtocolTestListsCase1(t *testing.T) { } func TestOutputService5ProtocolTestListWithCustomMemberNameCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("abc123requestid")) req, out := svc.OutputService5TestCaseOperation1Request(nil) @@ -1858,8 +1853,7 @@ func TestOutputService5ProtocolTestListWithCustomMemberNameCase1(t *testing.T) { } func TestOutputService6ProtocolTestFlattenedListCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService6ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService6ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("abc123requestid")) req, out := svc.OutputService6TestCaseOperation1Request(nil) @@ -1880,8 +1874,7 @@ func TestOutputService6ProtocolTestFlattenedListCase1(t *testing.T) { } func TestOutputService7ProtocolTestFlattenedSingleElementListCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService7ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService7ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("abcrequestid")) req, out := svc.OutputService7TestCaseOperation1Request(nil) @@ -1901,8 +1894,7 @@ func TestOutputService7ProtocolTestFlattenedSingleElementListCase1(t *testing.T) } func TestOutputService8ProtocolTestListOfStructuresCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService8ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService8ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("firstfoofirstbarfirstbazsecondfoosecondbarsecondbazrequestid")) req, out := svc.OutputService8TestCaseOperation1Request(nil) @@ -1927,8 +1919,7 @@ func TestOutputService8ProtocolTestListOfStructuresCase1(t *testing.T) { } func TestOutputService9ProtocolTestFlattenedListOfStructuresCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService9ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService9ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("firstfoofirstbarfirstbazsecondfoosecondbarsecondbazrequestid")) req, out := svc.OutputService9TestCaseOperation1Request(nil) @@ -1953,8 +1944,7 @@ func TestOutputService9ProtocolTestFlattenedListOfStructuresCase1(t *testing.T) } func TestOutputService10ProtocolTestFlattenedListWithLocationNameCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService10ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService10ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("abrequestid")) req, out := svc.OutputService10TestCaseOperation1Request(nil) @@ -1975,8 +1965,7 @@ func TestOutputService10ProtocolTestFlattenedListWithLocationNameCase1(t *testin } func TestOutputService11ProtocolTestNormalMapCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService11ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService11ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) req, out := svc.OutputService11TestCaseOperation1Request(nil) @@ -1997,8 +1986,7 @@ func TestOutputService11ProtocolTestNormalMapCase1(t *testing.T) { } func TestOutputService12ProtocolTestFlattenedMapCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService12ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService12ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) req, out := svc.OutputService12TestCaseOperation1Request(nil) @@ -2019,8 +2007,7 @@ func TestOutputService12ProtocolTestFlattenedMapCase1(t *testing.T) { } func TestOutputService13ProtocolTestFlattenedMapInShapeDefinitionCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService13ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService13ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("quxbarrequestid")) req, out := svc.OutputService13TestCaseOperation1Request(nil) @@ -2040,8 +2027,7 @@ func TestOutputService13ProtocolTestFlattenedMapInShapeDefinitionCase1(t *testin } func TestOutputService14ProtocolTestNamedMapCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService14ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService14ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("quxbarbazbamrequestid")) req, out := svc.OutputService14TestCaseOperation1Request(nil) @@ -2062,8 +2048,7 @@ func TestOutputService14ProtocolTestNamedMapCase1(t *testing.T) { } func TestOutputService15ProtocolTestEmptyStringCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService15ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService15ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("requestid")) req, out := svc.OutputService15TestCaseOperation1Request(nil) diff --git a/private/protocol/restjson/build_test.go b/private/protocol/restjson/build_test.go index e9d3c86f87e..4d0269da10b 100644 --- a/private/protocol/restjson/build_test.go +++ b/private/protocol/restjson/build_test.go @@ -16,9 +16,9 @@ import ( "github.com/aws/aws-sdk-go/aws/client" "github.com/aws/aws-sdk-go/aws/client/metadata" "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/aws/signer/v4" "github.com/aws/aws-sdk-go/awstesting" + "github.com/aws/aws-sdk-go/awstesting/unit" "github.com/aws/aws-sdk-go/private/protocol" "github.com/aws/aws-sdk-go/private/protocol/restjson" "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" @@ -2814,8 +2814,7 @@ type InputService19TestShapeInputShape struct { // func TestInputService1ProtocolTestNoParametersCase1(t *testing.T) { - sess := session.New() - svc := NewInputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) req, _ := svc.InputService1TestCaseOperation1Request(nil) r := req.HTTPRequest @@ -2831,8 +2830,7 @@ func TestInputService1ProtocolTestNoParametersCase1(t *testing.T) { } func TestInputService2ProtocolTestURIParameterOnlyWithNoLocationNameCase1(t *testing.T) { - sess := session.New() - svc := NewInputService2ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService2ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService2TestShapeInputService2TestCaseOperation1Input{ PipelineId: aws.String("foo"), } @@ -2851,8 +2849,7 @@ func TestInputService2ProtocolTestURIParameterOnlyWithNoLocationNameCase1(t *tes } func TestInputService3ProtocolTestURIParameterOnlyWithLocationNameCase1(t *testing.T) { - sess := session.New() - svc := NewInputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService3ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService3TestShapeInputService3TestCaseOperation1Input{ Foo: aws.String("bar"), } @@ -2871,8 +2868,7 @@ func TestInputService3ProtocolTestURIParameterOnlyWithLocationNameCase1(t *testi } func TestInputService4ProtocolTestQuerystringListOfStringsCase1(t *testing.T) { - sess := session.New() - svc := NewInputService4ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService4ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService4TestShapeInputService4TestCaseOperation1Input{ Items: []*string{ aws.String("value1"), @@ -2894,8 +2890,7 @@ func TestInputService4ProtocolTestQuerystringListOfStringsCase1(t *testing.T) { } func TestInputService5ProtocolTestStringToStringMapsInQuerystringCase1(t *testing.T) { - sess := session.New() - svc := NewInputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService5TestShapeInputService5TestCaseOperation1Input{ PipelineId: aws.String("foo"), QueryDoc: map[string]*string{ @@ -2918,8 +2913,7 @@ func TestInputService5ProtocolTestStringToStringMapsInQuerystringCase1(t *testin } func TestInputService6ProtocolTestStringToStringListMapsInQuerystringCase1(t *testing.T) { - sess := session.New() - svc := NewInputService6ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService6ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService6TestShapeInputService6TestCaseOperation1Input{ PipelineId: aws.String("id"), QueryDoc: map[string][]*string{ @@ -2948,8 +2942,7 @@ func TestInputService6ProtocolTestStringToStringListMapsInQuerystringCase1(t *te } func TestInputService7ProtocolTestURIParameterAndQuerystringParamsCase1(t *testing.T) { - sess := session.New() - svc := NewInputService7ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService7ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService7TestShapeInputService7TestCaseOperation1Input{ Ascending: aws.String("true"), PageToken: aws.String("bar"), @@ -2970,8 +2963,7 @@ func TestInputService7ProtocolTestURIParameterAndQuerystringParamsCase1(t *testi } func TestInputService8ProtocolTestURIParameterQuerystringParamsAndJSONBodyCase1(t *testing.T) { - sess := session.New() - svc := NewInputService8ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService8ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService8TestShapeInputService8TestCaseOperation1Input{ Ascending: aws.String("true"), Config: &InputService8TestShapeStructType{ @@ -3001,8 +2993,7 @@ func TestInputService8ProtocolTestURIParameterQuerystringParamsAndJSONBodyCase1( } func TestInputService9ProtocolTestURIParameterQuerystringParamsHeadersAndJSONBodyCase1(t *testing.T) { - sess := session.New() - svc := NewInputService9ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService9ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService9TestShapeInputService9TestCaseOperation1Input{ Ascending: aws.String("true"), Checksum: aws.String("12345"), @@ -3034,8 +3025,7 @@ func TestInputService9ProtocolTestURIParameterQuerystringParamsHeadersAndJSONBod } func TestInputService10ProtocolTestStreamingPayloadCase1(t *testing.T) { - sess := session.New() - svc := NewInputService10ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService10ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService10TestShapeInputService10TestCaseOperation1Input{ Body: aws.ReadSeekCloser(bytes.NewBufferString("contents")), Checksum: aws.String("foo"), @@ -3062,8 +3052,7 @@ func TestInputService10ProtocolTestStreamingPayloadCase1(t *testing.T) { } func TestInputService11ProtocolTestSerializeBlobsInBodyCase1(t *testing.T) { - sess := session.New() - svc := NewInputService11ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService11ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService11TestShapeInputService11TestCaseOperation1Input{ Bar: []byte("Blob param"), Foo: aws.String("foo_name"), @@ -3088,8 +3077,7 @@ func TestInputService11ProtocolTestSerializeBlobsInBodyCase1(t *testing.T) { } func TestInputService12ProtocolTestBlobPayloadCase1(t *testing.T) { - sess := session.New() - svc := NewInputService12ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService12ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService12TestShapeInputShape{ Foo: []byte("bar"), } @@ -3113,8 +3101,7 @@ func TestInputService12ProtocolTestBlobPayloadCase1(t *testing.T) { } func TestInputService12ProtocolTestBlobPayloadCase2(t *testing.T) { - sess := session.New() - svc := NewInputService12ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService12ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService12TestShapeInputShape{} req, _ := svc.InputService12TestCaseOperation2Request(input) r := req.HTTPRequest @@ -3131,8 +3118,7 @@ func TestInputService12ProtocolTestBlobPayloadCase2(t *testing.T) { } func TestInputService13ProtocolTestStructurePayloadCase1(t *testing.T) { - sess := session.New() - svc := NewInputService13ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService13ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService13TestShapeInputShape{ Foo: &InputService13TestShapeFooShape{ Baz: aws.String("bar"), @@ -3158,8 +3144,7 @@ func TestInputService13ProtocolTestStructurePayloadCase1(t *testing.T) { } func TestInputService13ProtocolTestStructurePayloadCase2(t *testing.T) { - sess := session.New() - svc := NewInputService13ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService13ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService13TestShapeInputShape{} req, _ := svc.InputService13TestCaseOperation2Request(input) r := req.HTTPRequest @@ -3176,8 +3161,7 @@ func TestInputService13ProtocolTestStructurePayloadCase2(t *testing.T) { } func TestInputService14ProtocolTestOmitsNullQueryParamsButSerializesEmptyStringsCase1(t *testing.T) { - sess := session.New() - svc := NewInputService14ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService14ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService14TestShapeInputShape{} req, _ := svc.InputService14TestCaseOperation1Request(input) r := req.HTTPRequest @@ -3194,8 +3178,7 @@ func TestInputService14ProtocolTestOmitsNullQueryParamsButSerializesEmptyStrings } func TestInputService14ProtocolTestOmitsNullQueryParamsButSerializesEmptyStringsCase2(t *testing.T) { - sess := session.New() - svc := NewInputService14ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService14ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService14TestShapeInputShape{ Foo: aws.String(""), } @@ -3214,8 +3197,7 @@ func TestInputService14ProtocolTestOmitsNullQueryParamsButSerializesEmptyStrings } func TestInputService15ProtocolTestRecursiveShapesCase1(t *testing.T) { - sess := session.New() - svc := NewInputService15ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService15ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService15TestShapeInputShape{ RecursiveStruct: &InputService15TestShapeRecursiveStructType{ NoRecurse: aws.String("foo"), @@ -3241,8 +3223,7 @@ func TestInputService15ProtocolTestRecursiveShapesCase1(t *testing.T) { } func TestInputService15ProtocolTestRecursiveShapesCase2(t *testing.T) { - sess := session.New() - svc := NewInputService15ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService15ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService15TestShapeInputShape{ RecursiveStruct: &InputService15TestShapeRecursiveStructType{ RecursiveStruct: &InputService15TestShapeRecursiveStructType{ @@ -3270,8 +3251,7 @@ func TestInputService15ProtocolTestRecursiveShapesCase2(t *testing.T) { } func TestInputService15ProtocolTestRecursiveShapesCase3(t *testing.T) { - sess := session.New() - svc := NewInputService15ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService15ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService15TestShapeInputShape{ RecursiveStruct: &InputService15TestShapeRecursiveStructType{ RecursiveStruct: &InputService15TestShapeRecursiveStructType{ @@ -3303,8 +3283,7 @@ func TestInputService15ProtocolTestRecursiveShapesCase3(t *testing.T) { } func TestInputService15ProtocolTestRecursiveShapesCase4(t *testing.T) { - sess := session.New() - svc := NewInputService15ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService15ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService15TestShapeInputShape{ RecursiveStruct: &InputService15TestShapeRecursiveStructType{ RecursiveList: []*InputService15TestShapeRecursiveStructType{ @@ -3337,8 +3316,7 @@ func TestInputService15ProtocolTestRecursiveShapesCase4(t *testing.T) { } func TestInputService15ProtocolTestRecursiveShapesCase5(t *testing.T) { - sess := session.New() - svc := NewInputService15ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService15ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService15TestShapeInputShape{ RecursiveStruct: &InputService15TestShapeRecursiveStructType{ RecursiveList: []*InputService15TestShapeRecursiveStructType{ @@ -3373,8 +3351,7 @@ func TestInputService15ProtocolTestRecursiveShapesCase5(t *testing.T) { } func TestInputService15ProtocolTestRecursiveShapesCase6(t *testing.T) { - sess := session.New() - svc := NewInputService15ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService15ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService15TestShapeInputShape{ RecursiveStruct: &InputService15TestShapeRecursiveStructType{ RecursiveMap: map[string]*InputService15TestShapeRecursiveStructType{ @@ -3407,8 +3384,7 @@ func TestInputService15ProtocolTestRecursiveShapesCase6(t *testing.T) { } func TestInputService16ProtocolTestTimestampValuesCase1(t *testing.T) { - sess := session.New() - svc := NewInputService16ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService16ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService16TestShapeInputShape{ TimeArg: aws.Time(time.Unix(1422172800, 0)), } @@ -3432,8 +3408,7 @@ func TestInputService16ProtocolTestTimestampValuesCase1(t *testing.T) { } func TestInputService16ProtocolTestTimestampValuesCase2(t *testing.T) { - sess := session.New() - svc := NewInputService16ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService16ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService16TestShapeInputShape{ TimeArgInHeader: aws.Time(time.Unix(1422172800, 0)), } @@ -3453,8 +3428,7 @@ func TestInputService16ProtocolTestTimestampValuesCase2(t *testing.T) { } func TestInputService17ProtocolTestNamedLocationsInJSONBodyCase1(t *testing.T) { - sess := session.New() - svc := NewInputService17ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService17ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService17TestShapeInputService17TestCaseOperation1Input{ TimeArg: aws.Time(time.Unix(1422172800, 0)), } @@ -3478,8 +3452,7 @@ func TestInputService17ProtocolTestNamedLocationsInJSONBodyCase1(t *testing.T) { } func TestInputService18ProtocolTestStringPayloadCase1(t *testing.T) { - sess := session.New() - svc := NewInputService18ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService18ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService18TestShapeInputService18TestCaseOperation1Input{ Foo: aws.String("bar"), } @@ -3503,8 +3476,7 @@ func TestInputService18ProtocolTestStringPayloadCase1(t *testing.T) { } func TestInputService19ProtocolTestIdempotencyTokenAutoFillCase1(t *testing.T) { - sess := session.New() - svc := NewInputService19ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService19ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService19TestShapeInputShape{ Token: aws.String("abc123"), } @@ -3528,8 +3500,7 @@ func TestInputService19ProtocolTestIdempotencyTokenAutoFillCase1(t *testing.T) { } func TestInputService19ProtocolTestIdempotencyTokenAutoFillCase2(t *testing.T) { - sess := session.New() - svc := NewInputService19ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService19ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService19TestShapeInputShape{} req, _ := svc.InputService19TestCaseOperation2Request(input) r := req.HTTPRequest diff --git a/private/protocol/restjson/unmarshal_test.go b/private/protocol/restjson/unmarshal_test.go index 4011c003a2a..d6590c9b9c0 100644 --- a/private/protocol/restjson/unmarshal_test.go +++ b/private/protocol/restjson/unmarshal_test.go @@ -16,9 +16,9 @@ import ( "github.com/aws/aws-sdk-go/aws/client" "github.com/aws/aws-sdk-go/aws/client/metadata" "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/aws/signer/v4" "github.com/aws/aws-sdk-go/awstesting" + "github.com/aws/aws-sdk-go/awstesting/unit" "github.com/aws/aws-sdk-go/private/protocol" "github.com/aws/aws-sdk-go/private/protocol/restjson" "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" @@ -1312,8 +1312,7 @@ type OutputService11TestShapeOutputService11TestCaseOperation1Output struct { // func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("{\"Str\": \"myname\", \"Num\": 123, \"FalseBool\": false, \"TrueBool\": true, \"Float\": 1.2, \"Double\": 1.3, \"Long\": 200, \"Char\": \"a\"}")) req, out := svc.OutputService1TestCaseOperation1Request(nil) @@ -1345,8 +1344,7 @@ func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) { } func TestOutputService2ProtocolTestBlobMembersCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService2ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService2ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("{\"BlobMember\": \"aGkh\", \"StructMember\": {\"foo\": \"dGhlcmUh\"}}")) req, out := svc.OutputService2TestCaseOperation1Request(nil) @@ -1367,8 +1365,7 @@ func TestOutputService2ProtocolTestBlobMembersCase1(t *testing.T) { } func TestOutputService3ProtocolTestTimestampMembersCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService3ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("{\"TimeMember\": 1398796238, \"StructMember\": {\"foo\": 1398796238}}")) req, out := svc.OutputService3TestCaseOperation1Request(nil) @@ -1389,8 +1386,7 @@ func TestOutputService3ProtocolTestTimestampMembersCase1(t *testing.T) { } func TestOutputService4ProtocolTestListsCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService4ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService4ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("{\"ListMember\": [\"a\", \"b\"]}")) req, out := svc.OutputService4TestCaseOperation1Request(nil) @@ -1411,8 +1407,7 @@ func TestOutputService4ProtocolTestListsCase1(t *testing.T) { } func TestOutputService5ProtocolTestListsWithStructureMemberCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("{\"ListMember\": [{\"Foo\": \"a\"}, {\"Foo\": \"b\"}]}")) req, out := svc.OutputService5TestCaseOperation1Request(nil) @@ -1433,8 +1428,7 @@ func TestOutputService5ProtocolTestListsWithStructureMemberCase1(t *testing.T) { } func TestOutputService6ProtocolTestMapsCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService6ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService6ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("{\"MapMember\": {\"a\": [1, 2], \"b\": [3, 4]}}")) req, out := svc.OutputService6TestCaseOperation1Request(nil) @@ -1457,8 +1451,7 @@ func TestOutputService6ProtocolTestMapsCase1(t *testing.T) { } func TestOutputService7ProtocolTestComplexMapValuesCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService7ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService7ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("{\"MapMember\": {\"a\": 1398796238, \"b\": 1398796238}}")) req, out := svc.OutputService7TestCaseOperation1Request(nil) @@ -1479,8 +1472,7 @@ func TestOutputService7ProtocolTestComplexMapValuesCase1(t *testing.T) { } func TestOutputService8ProtocolTestIgnoresExtraDataCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService8ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService8ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("{\"foo\": \"bar\"}")) req, out := svc.OutputService8TestCaseOperation1Request(nil) @@ -1499,8 +1491,7 @@ func TestOutputService8ProtocolTestIgnoresExtraDataCase1(t *testing.T) { } func TestOutputService9ProtocolTestSupportsHeaderMapsCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService9ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService9ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("{}")) req, out := svc.OutputService9TestCaseOperation1Request(nil) @@ -1527,8 +1518,7 @@ func TestOutputService9ProtocolTestSupportsHeaderMapsCase1(t *testing.T) { } func TestOutputService10ProtocolTestJSONPayloadCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService10ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService10ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("{\"Foo\": \"abc\"}")) req, out := svc.OutputService10TestCaseOperation1Request(nil) @@ -1550,8 +1540,7 @@ func TestOutputService10ProtocolTestJSONPayloadCase1(t *testing.T) { } func TestOutputService11ProtocolTestStreamingPayloadCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService11ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService11ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("abc")) req, out := svc.OutputService11TestCaseOperation1Request(nil) diff --git a/private/protocol/restxml/build_test.go b/private/protocol/restxml/build_test.go index 947487de7ad..6263877e2bb 100644 --- a/private/protocol/restxml/build_test.go +++ b/private/protocol/restxml/build_test.go @@ -16,9 +16,9 @@ import ( "github.com/aws/aws-sdk-go/aws/client" "github.com/aws/aws-sdk-go/aws/client/metadata" "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/aws/signer/v4" "github.com/aws/aws-sdk-go/awstesting" + "github.com/aws/aws-sdk-go/awstesting/unit" "github.com/aws/aws-sdk-go/private/protocol" "github.com/aws/aws-sdk-go/private/protocol/restxml" "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" @@ -3474,8 +3474,7 @@ type InputService23TestShapeInputShape struct { // func TestInputService1ProtocolTestBasicXMLSerializationCase1(t *testing.T) { - sess := session.New() - svc := NewInputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService1TestShapeInputShape{ Description: aws.String("bar"), Name: aws.String("foo"), @@ -3500,8 +3499,7 @@ func TestInputService1ProtocolTestBasicXMLSerializationCase1(t *testing.T) { } func TestInputService1ProtocolTestBasicXMLSerializationCase2(t *testing.T) { - sess := session.New() - svc := NewInputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService1TestShapeInputShape{ Description: aws.String("bar"), Name: aws.String("foo"), @@ -3526,8 +3524,7 @@ func TestInputService1ProtocolTestBasicXMLSerializationCase2(t *testing.T) { } func TestInputService1ProtocolTestBasicXMLSerializationCase3(t *testing.T) { - sess := session.New() - svc := NewInputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService1TestShapeInputService1TestCaseOperation3Input{} req, _ := svc.InputService1TestCaseOperation3Request(input) r := req.HTTPRequest @@ -3544,8 +3541,7 @@ func TestInputService1ProtocolTestBasicXMLSerializationCase3(t *testing.T) { } func TestInputService2ProtocolTestSerializeOtherScalarTypesCase1(t *testing.T) { - sess := session.New() - svc := NewInputService2ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService2ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService2TestShapeInputService2TestCaseOperation1Input{ First: aws.Bool(true), Fourth: aws.Int64(3), @@ -3572,8 +3568,7 @@ func TestInputService2ProtocolTestSerializeOtherScalarTypesCase1(t *testing.T) { } func TestInputService3ProtocolTestNestedStructuresCase1(t *testing.T) { - sess := session.New() - svc := NewInputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService3ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService3TestShapeInputShape{ Description: aws.String("baz"), SubStructure: &InputService3TestShapeSubStructure{ @@ -3601,8 +3596,7 @@ func TestInputService3ProtocolTestNestedStructuresCase1(t *testing.T) { } func TestInputService3ProtocolTestNestedStructuresCase2(t *testing.T) { - sess := session.New() - svc := NewInputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService3ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService3TestShapeInputShape{ Description: aws.String("baz"), SubStructure: &InputService3TestShapeSubStructure{ @@ -3629,8 +3623,7 @@ func TestInputService3ProtocolTestNestedStructuresCase2(t *testing.T) { } func TestInputService4ProtocolTestNestedStructuresCase1(t *testing.T) { - sess := session.New() - svc := NewInputService4ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService4ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService4TestShapeInputService4TestCaseOperation1Input{ Description: aws.String("baz"), SubStructure: &InputService4TestShapeSubStructure{}, @@ -3655,8 +3648,7 @@ func TestInputService4ProtocolTestNestedStructuresCase1(t *testing.T) { } func TestInputService5ProtocolTestNonFlattenedListsCase1(t *testing.T) { - sess := session.New() - svc := NewInputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService5TestShapeInputService5TestCaseOperation1Input{ ListParam: []*string{ aws.String("one"), @@ -3684,8 +3676,7 @@ func TestInputService5ProtocolTestNonFlattenedListsCase1(t *testing.T) { } func TestInputService6ProtocolTestNonFlattenedListsWithLocationNameCase1(t *testing.T) { - sess := session.New() - svc := NewInputService6ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService6ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService6TestShapeInputService6TestCaseOperation1Input{ ListParam: []*string{ aws.String("one"), @@ -3713,8 +3704,7 @@ func TestInputService6ProtocolTestNonFlattenedListsWithLocationNameCase1(t *test } func TestInputService7ProtocolTestFlattenedListsCase1(t *testing.T) { - sess := session.New() - svc := NewInputService7ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService7ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService7TestShapeInputService7TestCaseOperation1Input{ ListParam: []*string{ aws.String("one"), @@ -3742,8 +3732,7 @@ func TestInputService7ProtocolTestFlattenedListsCase1(t *testing.T) { } func TestInputService8ProtocolTestFlattenedListsWithLocationNameCase1(t *testing.T) { - sess := session.New() - svc := NewInputService8ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService8ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService8TestShapeInputService8TestCaseOperation1Input{ ListParam: []*string{ aws.String("one"), @@ -3771,8 +3760,7 @@ func TestInputService8ProtocolTestFlattenedListsWithLocationNameCase1(t *testing } func TestInputService9ProtocolTestListOfStructuresCase1(t *testing.T) { - sess := session.New() - svc := NewInputService9ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService9ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService9TestShapeInputService9TestCaseOperation1Input{ ListParam: []*InputService9TestShapeSingleFieldStruct{ { @@ -3806,8 +3794,7 @@ func TestInputService9ProtocolTestListOfStructuresCase1(t *testing.T) { } func TestInputService10ProtocolTestBlobAndTimestampShapesCase1(t *testing.T) { - sess := session.New() - svc := NewInputService10ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService10ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService10TestShapeInputService10TestCaseOperation1Input{ StructureParam: &InputService10TestShapeStructureShape{ B: []byte("foo"), @@ -3834,8 +3821,7 @@ func TestInputService10ProtocolTestBlobAndTimestampShapesCase1(t *testing.T) { } func TestInputService11ProtocolTestHeaderMapsCase1(t *testing.T) { - sess := session.New() - svc := NewInputService11ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService11ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService11TestShapeInputService11TestCaseOperation1Input{ Foo: map[string]*string{ "a": aws.String("b"), @@ -3859,8 +3845,7 @@ func TestInputService11ProtocolTestHeaderMapsCase1(t *testing.T) { } func TestInputService12ProtocolTestQuerystringListOfStringsCase1(t *testing.T) { - sess := session.New() - svc := NewInputService12ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService12ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService12TestShapeInputService12TestCaseOperation1Input{ Items: []*string{ aws.String("value1"), @@ -3882,8 +3867,7 @@ func TestInputService12ProtocolTestQuerystringListOfStringsCase1(t *testing.T) { } func TestInputService13ProtocolTestStringToStringMapsInQuerystringCase1(t *testing.T) { - sess := session.New() - svc := NewInputService13ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService13ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService13TestShapeInputService13TestCaseOperation1Input{ PipelineId: aws.String("foo"), QueryDoc: map[string]*string{ @@ -3906,8 +3890,7 @@ func TestInputService13ProtocolTestStringToStringMapsInQuerystringCase1(t *testi } func TestInputService14ProtocolTestStringToStringListMapsInQuerystringCase1(t *testing.T) { - sess := session.New() - svc := NewInputService14ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService14ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService14TestShapeInputService14TestCaseOperation1Input{ PipelineId: aws.String("id"), QueryDoc: map[string][]*string{ @@ -3936,8 +3919,7 @@ func TestInputService14ProtocolTestStringToStringListMapsInQuerystringCase1(t *t } func TestInputService15ProtocolTestStringPayloadCase1(t *testing.T) { - sess := session.New() - svc := NewInputService15ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService15ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService15TestShapeInputService15TestCaseOperation1Input{ Foo: aws.String("bar"), } @@ -3961,8 +3943,7 @@ func TestInputService15ProtocolTestStringPayloadCase1(t *testing.T) { } func TestInputService16ProtocolTestBlobPayloadCase1(t *testing.T) { - sess := session.New() - svc := NewInputService16ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService16ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService16TestShapeInputShape{ Foo: []byte("bar"), } @@ -3986,8 +3967,7 @@ func TestInputService16ProtocolTestBlobPayloadCase1(t *testing.T) { } func TestInputService16ProtocolTestBlobPayloadCase2(t *testing.T) { - sess := session.New() - svc := NewInputService16ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService16ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService16TestShapeInputShape{} req, _ := svc.InputService16TestCaseOperation2Request(input) r := req.HTTPRequest @@ -4004,8 +3984,7 @@ func TestInputService16ProtocolTestBlobPayloadCase2(t *testing.T) { } func TestInputService17ProtocolTestStructurePayloadCase1(t *testing.T) { - sess := session.New() - svc := NewInputService17ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService17ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService17TestShapeInputShape{ Foo: &InputService17TestShapeFooShape{ Baz: aws.String("bar"), @@ -4031,8 +4010,7 @@ func TestInputService17ProtocolTestStructurePayloadCase1(t *testing.T) { } func TestInputService17ProtocolTestStructurePayloadCase2(t *testing.T) { - sess := session.New() - svc := NewInputService17ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService17ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService17TestShapeInputShape{} req, _ := svc.InputService17TestCaseOperation2Request(input) r := req.HTTPRequest @@ -4049,8 +4027,7 @@ func TestInputService17ProtocolTestStructurePayloadCase2(t *testing.T) { } func TestInputService17ProtocolTestStructurePayloadCase3(t *testing.T) { - sess := session.New() - svc := NewInputService17ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService17ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService17TestShapeInputShape{ Foo: &InputService17TestShapeFooShape{}, } @@ -4074,8 +4051,7 @@ func TestInputService17ProtocolTestStructurePayloadCase3(t *testing.T) { } func TestInputService17ProtocolTestStructurePayloadCase4(t *testing.T) { - sess := session.New() - svc := NewInputService17ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService17ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService17TestShapeInputShape{} req, _ := svc.InputService17TestCaseOperation4Request(input) r := req.HTTPRequest @@ -4092,8 +4068,7 @@ func TestInputService17ProtocolTestStructurePayloadCase4(t *testing.T) { } func TestInputService18ProtocolTestXMLAttributeCase1(t *testing.T) { - sess := session.New() - svc := NewInputService18ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService18ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService18TestShapeInputService18TestCaseOperation1Input{ Grant: &InputService18TestShapeGrant{ Grantee: &InputService18TestShapeGrantee{ @@ -4122,8 +4097,7 @@ func TestInputService18ProtocolTestXMLAttributeCase1(t *testing.T) { } func TestInputService19ProtocolTestGreedyKeysCase1(t *testing.T) { - sess := session.New() - svc := NewInputService19ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService19ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService19TestShapeInputService19TestCaseOperation1Input{ Bucket: aws.String("my/bucket"), Key: aws.String("testing /123"), @@ -4143,8 +4117,7 @@ func TestInputService19ProtocolTestGreedyKeysCase1(t *testing.T) { } func TestInputService20ProtocolTestOmitsNullQueryParamsButSerializesEmptyStringsCase1(t *testing.T) { - sess := session.New() - svc := NewInputService20ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService20ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService20TestShapeInputShape{} req, _ := svc.InputService20TestCaseOperation1Request(input) r := req.HTTPRequest @@ -4161,8 +4134,7 @@ func TestInputService20ProtocolTestOmitsNullQueryParamsButSerializesEmptyStrings } func TestInputService20ProtocolTestOmitsNullQueryParamsButSerializesEmptyStringsCase2(t *testing.T) { - sess := session.New() - svc := NewInputService20ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService20ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService20TestShapeInputShape{ Foo: aws.String(""), } @@ -4181,8 +4153,7 @@ func TestInputService20ProtocolTestOmitsNullQueryParamsButSerializesEmptyStrings } func TestInputService21ProtocolTestRecursiveShapesCase1(t *testing.T) { - sess := session.New() - svc := NewInputService21ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService21ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService21TestShapeInputShape{ RecursiveStruct: &InputService21TestShapeRecursiveStructType{ NoRecurse: aws.String("foo"), @@ -4208,8 +4179,7 @@ func TestInputService21ProtocolTestRecursiveShapesCase1(t *testing.T) { } func TestInputService21ProtocolTestRecursiveShapesCase2(t *testing.T) { - sess := session.New() - svc := NewInputService21ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService21ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService21TestShapeInputShape{ RecursiveStruct: &InputService21TestShapeRecursiveStructType{ RecursiveStruct: &InputService21TestShapeRecursiveStructType{ @@ -4237,8 +4207,7 @@ func TestInputService21ProtocolTestRecursiveShapesCase2(t *testing.T) { } func TestInputService21ProtocolTestRecursiveShapesCase3(t *testing.T) { - sess := session.New() - svc := NewInputService21ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService21ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService21TestShapeInputShape{ RecursiveStruct: &InputService21TestShapeRecursiveStructType{ RecursiveStruct: &InputService21TestShapeRecursiveStructType{ @@ -4270,8 +4239,7 @@ func TestInputService21ProtocolTestRecursiveShapesCase3(t *testing.T) { } func TestInputService21ProtocolTestRecursiveShapesCase4(t *testing.T) { - sess := session.New() - svc := NewInputService21ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService21ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService21TestShapeInputShape{ RecursiveStruct: &InputService21TestShapeRecursiveStructType{ RecursiveList: []*InputService21TestShapeRecursiveStructType{ @@ -4304,8 +4272,7 @@ func TestInputService21ProtocolTestRecursiveShapesCase4(t *testing.T) { } func TestInputService21ProtocolTestRecursiveShapesCase5(t *testing.T) { - sess := session.New() - svc := NewInputService21ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService21ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService21TestShapeInputShape{ RecursiveStruct: &InputService21TestShapeRecursiveStructType{ RecursiveList: []*InputService21TestShapeRecursiveStructType{ @@ -4340,8 +4307,7 @@ func TestInputService21ProtocolTestRecursiveShapesCase5(t *testing.T) { } func TestInputService21ProtocolTestRecursiveShapesCase6(t *testing.T) { - sess := session.New() - svc := NewInputService21ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService21ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService21TestShapeInputShape{ RecursiveStruct: &InputService21TestShapeRecursiveStructType{ RecursiveMap: map[string]*InputService21TestShapeRecursiveStructType{ @@ -4374,8 +4340,7 @@ func TestInputService21ProtocolTestRecursiveShapesCase6(t *testing.T) { } func TestInputService22ProtocolTestTimestampInHeaderCase1(t *testing.T) { - sess := session.New() - svc := NewInputService22ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService22ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService22TestShapeInputService22TestCaseOperation1Input{ TimeArgInHeader: aws.Time(time.Unix(1422172800, 0)), } @@ -4395,8 +4360,7 @@ func TestInputService22ProtocolTestTimestampInHeaderCase1(t *testing.T) { } func TestInputService23ProtocolTestIdempotencyTokenAutoFillCase1(t *testing.T) { - sess := session.New() - svc := NewInputService23ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService23ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService23TestShapeInputShape{ Token: aws.String("abc123"), } @@ -4420,8 +4384,7 @@ func TestInputService23ProtocolTestIdempotencyTokenAutoFillCase1(t *testing.T) { } func TestInputService23ProtocolTestIdempotencyTokenAutoFillCase2(t *testing.T) { - sess := session.New() - svc := NewInputService23ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewInputService23ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) input := &InputService23TestShapeInputShape{} req, _ := svc.InputService23TestCaseOperation2Request(input) r := req.HTTPRequest diff --git a/private/protocol/restxml/unmarshal_test.go b/private/protocol/restxml/unmarshal_test.go index 42d9887d5a8..700edb49ab8 100644 --- a/private/protocol/restxml/unmarshal_test.go +++ b/private/protocol/restxml/unmarshal_test.go @@ -16,9 +16,9 @@ import ( "github.com/aws/aws-sdk-go/aws/client" "github.com/aws/aws-sdk-go/aws/client/metadata" "github.com/aws/aws-sdk-go/aws/request" - "github.com/aws/aws-sdk-go/aws/session" "github.com/aws/aws-sdk-go/aws/signer/v4" "github.com/aws/aws-sdk-go/awstesting" + "github.com/aws/aws-sdk-go/awstesting/unit" "github.com/aws/aws-sdk-go/private/protocol" "github.com/aws/aws-sdk-go/private/protocol/restxml" "github.com/aws/aws-sdk-go/private/protocol/xml/xmlutil" @@ -1469,8 +1469,7 @@ type OutputService12TestShapeOutputService12TestCaseOperation1Output struct { // func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("myname123falsetrue1.21.3200a2015-01-25T08:00:00Z")) req, out := svc.OutputService1TestCaseOperation1Request(nil) @@ -1502,8 +1501,7 @@ func TestOutputService1ProtocolTestScalarMembersCase1(t *testing.T) { } func TestOutputService1ProtocolTestScalarMembersCase2(t *testing.T) { - sess := session.New() - svc := NewOutputService1ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService1ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("123falsetrue1.21.3200a2015-01-25T08:00:00Z")) req, out := svc.OutputService1TestCaseOperation2Request(nil) @@ -1535,8 +1533,7 @@ func TestOutputService1ProtocolTestScalarMembersCase2(t *testing.T) { } func TestOutputService2ProtocolTestBlobCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService2ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService2ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("dmFsdWU=")) req, out := svc.OutputService2TestCaseOperation1Request(nil) @@ -1556,8 +1553,7 @@ func TestOutputService2ProtocolTestBlobCase1(t *testing.T) { } func TestOutputService3ProtocolTestListsCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService3ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService3ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("abc123")) req, out := svc.OutputService3TestCaseOperation1Request(nil) @@ -1578,8 +1574,7 @@ func TestOutputService3ProtocolTestListsCase1(t *testing.T) { } func TestOutputService4ProtocolTestListWithCustomMemberNameCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService4ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService4ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("abc123")) req, out := svc.OutputService4TestCaseOperation1Request(nil) @@ -1600,8 +1595,7 @@ func TestOutputService4ProtocolTestListWithCustomMemberNameCase1(t *testing.T) { } func TestOutputService5ProtocolTestFlattenedListCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService5ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService5ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("abc123")) req, out := svc.OutputService5TestCaseOperation1Request(nil) @@ -1622,8 +1616,7 @@ func TestOutputService5ProtocolTestFlattenedListCase1(t *testing.T) { } func TestOutputService6ProtocolTestNormalMapCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService6ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService6ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("quxbarbazbam")) req, out := svc.OutputService6TestCaseOperation1Request(nil) @@ -1644,8 +1637,7 @@ func TestOutputService6ProtocolTestNormalMapCase1(t *testing.T) { } func TestOutputService7ProtocolTestFlattenedMapCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService7ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService7ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("quxbarbazbam")) req, out := svc.OutputService7TestCaseOperation1Request(nil) @@ -1666,8 +1658,7 @@ func TestOutputService7ProtocolTestFlattenedMapCase1(t *testing.T) { } func TestOutputService8ProtocolTestNamedMapCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService8ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService8ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("quxbarbazbam")) req, out := svc.OutputService8TestCaseOperation1Request(nil) @@ -1688,8 +1679,7 @@ func TestOutputService8ProtocolTestNamedMapCase1(t *testing.T) { } func TestOutputService9ProtocolTestXMLPayloadCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService9ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService9ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("abc")) req, out := svc.OutputService9TestCaseOperation1Request(nil) @@ -1711,8 +1701,7 @@ func TestOutputService9ProtocolTestXMLPayloadCase1(t *testing.T) { } func TestOutputService10ProtocolTestStreamingPayloadCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService10ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService10ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("abc")) req, out := svc.OutputService10TestCaseOperation1Request(nil) @@ -1732,8 +1721,7 @@ func TestOutputService10ProtocolTestStreamingPayloadCase1(t *testing.T) { } func TestOutputService11ProtocolTestScalarMembersInHeadersCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService11ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService11ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("")) req, out := svc.OutputService11TestCaseOperation1Request(nil) @@ -1770,8 +1758,7 @@ func TestOutputService11ProtocolTestScalarMembersInHeadersCase1(t *testing.T) { } func TestOutputService12ProtocolTestEmptyStringCase1(t *testing.T) { - sess := session.New() - svc := NewOutputService12ProtocolTest(sess, &aws.Config{Endpoint: aws.String("https://test")}) + svc := NewOutputService12ProtocolTest(unit.Session, &aws.Config{Endpoint: aws.String("https://test")}) buf := bytes.NewReader([]byte("requestid")) req, out := svc.OutputService12TestCaseOperation1Request(nil) diff --git a/service/acm/examples_test.go b/service/acm/examples_test.go index 438ee76b6f6..cc19ad1dd02 100644 --- a/service/acm/examples_test.go +++ b/service/acm/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleACM_AddTagsToCertificate() { - svc := acm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := acm.New(sess) params := &acm.AddTagsToCertificateInput{ CertificateArn: aws.String("Arn"), // Required @@ -42,7 +48,13 @@ func ExampleACM_AddTagsToCertificate() { } func ExampleACM_DeleteCertificate() { - svc := acm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := acm.New(sess) params := &acm.DeleteCertificateInput{ CertificateArn: aws.String("Arn"), // Required @@ -61,7 +73,13 @@ func ExampleACM_DeleteCertificate() { } func ExampleACM_DescribeCertificate() { - svc := acm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := acm.New(sess) params := &acm.DescribeCertificateInput{ CertificateArn: aws.String("Arn"), // Required @@ -80,7 +98,13 @@ func ExampleACM_DescribeCertificate() { } func ExampleACM_GetCertificate() { - svc := acm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := acm.New(sess) params := &acm.GetCertificateInput{ CertificateArn: aws.String("Arn"), // Required @@ -99,7 +123,13 @@ func ExampleACM_GetCertificate() { } func ExampleACM_ListCertificates() { - svc := acm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := acm.New(sess) params := &acm.ListCertificatesInput{ CertificateStatuses: []*string{ @@ -123,7 +153,13 @@ func ExampleACM_ListCertificates() { } func ExampleACM_ListTagsForCertificate() { - svc := acm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := acm.New(sess) params := &acm.ListTagsForCertificateInput{ CertificateArn: aws.String("Arn"), // Required @@ -142,7 +178,13 @@ func ExampleACM_ListTagsForCertificate() { } func ExampleACM_RemoveTagsFromCertificate() { - svc := acm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := acm.New(sess) params := &acm.RemoveTagsFromCertificateInput{ CertificateArn: aws.String("Arn"), // Required @@ -168,7 +210,13 @@ func ExampleACM_RemoveTagsFromCertificate() { } func ExampleACM_RequestCertificate() { - svc := acm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := acm.New(sess) params := &acm.RequestCertificateInput{ DomainName: aws.String("DomainNameString"), // Required @@ -199,7 +247,13 @@ func ExampleACM_RequestCertificate() { } func ExampleACM_ResendValidationEmail() { - svc := acm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := acm.New(sess) params := &acm.ResendValidationEmailInput{ CertificateArn: aws.String("Arn"), // Required diff --git a/service/apigateway/examples_test.go b/service/apigateway/examples_test.go index 6889a372caf..575b6bcc086 100644 --- a/service/apigateway/examples_test.go +++ b/service/apigateway/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleAPIGateway_CreateApiKey() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.CreateApiKeyInput{ Description: aws.String("String"), @@ -44,7 +50,13 @@ func ExampleAPIGateway_CreateApiKey() { } func ExampleAPIGateway_CreateAuthorizer() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.CreateAuthorizerInput{ IdentitySource: aws.String("String"), // Required @@ -75,7 +87,13 @@ func ExampleAPIGateway_CreateAuthorizer() { } func ExampleAPIGateway_CreateBasePathMapping() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.CreateBasePathMappingInput{ DomainName: aws.String("String"), // Required @@ -97,7 +115,13 @@ func ExampleAPIGateway_CreateBasePathMapping() { } func ExampleAPIGateway_CreateDeployment() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.CreateDeploymentInput{ RestApiId: aws.String("String"), // Required @@ -125,7 +149,13 @@ func ExampleAPIGateway_CreateDeployment() { } func ExampleAPIGateway_CreateDomainName() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.CreateDomainNameInput{ CertificateBody: aws.String("String"), // Required @@ -148,7 +178,13 @@ func ExampleAPIGateway_CreateDomainName() { } func ExampleAPIGateway_CreateModel() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.CreateModelInput{ ContentType: aws.String("String"), // Required @@ -171,7 +207,13 @@ func ExampleAPIGateway_CreateModel() { } func ExampleAPIGateway_CreateResource() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.CreateResourceInput{ ParentId: aws.String("String"), // Required @@ -192,7 +234,13 @@ func ExampleAPIGateway_CreateResource() { } func ExampleAPIGateway_CreateRestApi() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.CreateRestApiInput{ Name: aws.String("String"), // Required @@ -213,7 +261,13 @@ func ExampleAPIGateway_CreateRestApi() { } func ExampleAPIGateway_CreateStage() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.CreateStageInput{ DeploymentId: aws.String("String"), // Required @@ -241,7 +295,13 @@ func ExampleAPIGateway_CreateStage() { } func ExampleAPIGateway_DeleteApiKey() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.DeleteApiKeyInput{ ApiKey: aws.String("String"), // Required @@ -260,7 +320,13 @@ func ExampleAPIGateway_DeleteApiKey() { } func ExampleAPIGateway_DeleteAuthorizer() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.DeleteAuthorizerInput{ AuthorizerId: aws.String("String"), // Required @@ -280,7 +346,13 @@ func ExampleAPIGateway_DeleteAuthorizer() { } func ExampleAPIGateway_DeleteBasePathMapping() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.DeleteBasePathMappingInput{ BasePath: aws.String("String"), // Required @@ -300,7 +372,13 @@ func ExampleAPIGateway_DeleteBasePathMapping() { } func ExampleAPIGateway_DeleteClientCertificate() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.DeleteClientCertificateInput{ ClientCertificateId: aws.String("String"), // Required @@ -319,7 +397,13 @@ func ExampleAPIGateway_DeleteClientCertificate() { } func ExampleAPIGateway_DeleteDeployment() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.DeleteDeploymentInput{ DeploymentId: aws.String("String"), // Required @@ -339,7 +423,13 @@ func ExampleAPIGateway_DeleteDeployment() { } func ExampleAPIGateway_DeleteDomainName() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.DeleteDomainNameInput{ DomainName: aws.String("String"), // Required @@ -358,7 +448,13 @@ func ExampleAPIGateway_DeleteDomainName() { } func ExampleAPIGateway_DeleteIntegration() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.DeleteIntegrationInput{ HttpMethod: aws.String("String"), // Required @@ -379,7 +475,13 @@ func ExampleAPIGateway_DeleteIntegration() { } func ExampleAPIGateway_DeleteIntegrationResponse() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.DeleteIntegrationResponseInput{ HttpMethod: aws.String("String"), // Required @@ -401,7 +503,13 @@ func ExampleAPIGateway_DeleteIntegrationResponse() { } func ExampleAPIGateway_DeleteMethod() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.DeleteMethodInput{ HttpMethod: aws.String("String"), // Required @@ -422,7 +530,13 @@ func ExampleAPIGateway_DeleteMethod() { } func ExampleAPIGateway_DeleteMethodResponse() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.DeleteMethodResponseInput{ HttpMethod: aws.String("String"), // Required @@ -444,7 +558,13 @@ func ExampleAPIGateway_DeleteMethodResponse() { } func ExampleAPIGateway_DeleteModel() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.DeleteModelInput{ ModelName: aws.String("String"), // Required @@ -464,7 +584,13 @@ func ExampleAPIGateway_DeleteModel() { } func ExampleAPIGateway_DeleteResource() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.DeleteResourceInput{ ResourceId: aws.String("String"), // Required @@ -484,7 +610,13 @@ func ExampleAPIGateway_DeleteResource() { } func ExampleAPIGateway_DeleteRestApi() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.DeleteRestApiInput{ RestApiId: aws.String("String"), // Required @@ -503,7 +635,13 @@ func ExampleAPIGateway_DeleteRestApi() { } func ExampleAPIGateway_DeleteStage() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.DeleteStageInput{ RestApiId: aws.String("String"), // Required @@ -523,7 +661,13 @@ func ExampleAPIGateway_DeleteStage() { } func ExampleAPIGateway_FlushStageAuthorizersCache() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.FlushStageAuthorizersCacheInput{ RestApiId: aws.String("String"), // Required @@ -543,7 +687,13 @@ func ExampleAPIGateway_FlushStageAuthorizersCache() { } func ExampleAPIGateway_FlushStageCache() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.FlushStageCacheInput{ RestApiId: aws.String("String"), // Required @@ -563,7 +713,13 @@ func ExampleAPIGateway_FlushStageCache() { } func ExampleAPIGateway_GenerateClientCertificate() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.GenerateClientCertificateInput{ Description: aws.String("String"), @@ -582,7 +738,13 @@ func ExampleAPIGateway_GenerateClientCertificate() { } func ExampleAPIGateway_GetAccount() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) var params *apigateway.GetAccountInput resp, err := svc.GetAccount(params) @@ -599,7 +761,13 @@ func ExampleAPIGateway_GetAccount() { } func ExampleAPIGateway_GetApiKey() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.GetApiKeyInput{ ApiKey: aws.String("String"), // Required @@ -618,7 +786,13 @@ func ExampleAPIGateway_GetApiKey() { } func ExampleAPIGateway_GetApiKeys() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.GetApiKeysInput{ Limit: aws.Int64(1), @@ -638,7 +812,13 @@ func ExampleAPIGateway_GetApiKeys() { } func ExampleAPIGateway_GetAuthorizer() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.GetAuthorizerInput{ AuthorizerId: aws.String("String"), // Required @@ -658,7 +838,13 @@ func ExampleAPIGateway_GetAuthorizer() { } func ExampleAPIGateway_GetAuthorizers() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.GetAuthorizersInput{ RestApiId: aws.String("String"), // Required @@ -679,7 +865,13 @@ func ExampleAPIGateway_GetAuthorizers() { } func ExampleAPIGateway_GetBasePathMapping() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.GetBasePathMappingInput{ BasePath: aws.String("String"), // Required @@ -699,7 +891,13 @@ func ExampleAPIGateway_GetBasePathMapping() { } func ExampleAPIGateway_GetBasePathMappings() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.GetBasePathMappingsInput{ DomainName: aws.String("String"), // Required @@ -720,7 +918,13 @@ func ExampleAPIGateway_GetBasePathMappings() { } func ExampleAPIGateway_GetClientCertificate() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.GetClientCertificateInput{ ClientCertificateId: aws.String("String"), // Required @@ -739,7 +943,13 @@ func ExampleAPIGateway_GetClientCertificate() { } func ExampleAPIGateway_GetClientCertificates() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.GetClientCertificatesInput{ Limit: aws.Int64(1), @@ -759,7 +969,13 @@ func ExampleAPIGateway_GetClientCertificates() { } func ExampleAPIGateway_GetDeployment() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.GetDeploymentInput{ DeploymentId: aws.String("String"), // Required @@ -779,7 +995,13 @@ func ExampleAPIGateway_GetDeployment() { } func ExampleAPIGateway_GetDeployments() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.GetDeploymentsInput{ RestApiId: aws.String("String"), // Required @@ -800,7 +1022,13 @@ func ExampleAPIGateway_GetDeployments() { } func ExampleAPIGateway_GetDomainName() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.GetDomainNameInput{ DomainName: aws.String("String"), // Required @@ -819,7 +1047,13 @@ func ExampleAPIGateway_GetDomainName() { } func ExampleAPIGateway_GetDomainNames() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.GetDomainNamesInput{ Limit: aws.Int64(1), @@ -839,7 +1073,13 @@ func ExampleAPIGateway_GetDomainNames() { } func ExampleAPIGateway_GetExport() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.GetExportInput{ ExportType: aws.String("String"), // Required @@ -865,7 +1105,13 @@ func ExampleAPIGateway_GetExport() { } func ExampleAPIGateway_GetIntegration() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.GetIntegrationInput{ HttpMethod: aws.String("String"), // Required @@ -886,7 +1132,13 @@ func ExampleAPIGateway_GetIntegration() { } func ExampleAPIGateway_GetIntegrationResponse() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.GetIntegrationResponseInput{ HttpMethod: aws.String("String"), // Required @@ -908,7 +1160,13 @@ func ExampleAPIGateway_GetIntegrationResponse() { } func ExampleAPIGateway_GetMethod() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.GetMethodInput{ HttpMethod: aws.String("String"), // Required @@ -929,7 +1187,13 @@ func ExampleAPIGateway_GetMethod() { } func ExampleAPIGateway_GetMethodResponse() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.GetMethodResponseInput{ HttpMethod: aws.String("String"), // Required @@ -951,7 +1215,13 @@ func ExampleAPIGateway_GetMethodResponse() { } func ExampleAPIGateway_GetModel() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.GetModelInput{ ModelName: aws.String("String"), // Required @@ -972,7 +1242,13 @@ func ExampleAPIGateway_GetModel() { } func ExampleAPIGateway_GetModelTemplate() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.GetModelTemplateInput{ ModelName: aws.String("String"), // Required @@ -992,7 +1268,13 @@ func ExampleAPIGateway_GetModelTemplate() { } func ExampleAPIGateway_GetModels() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.GetModelsInput{ RestApiId: aws.String("String"), // Required @@ -1013,7 +1295,13 @@ func ExampleAPIGateway_GetModels() { } func ExampleAPIGateway_GetResource() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.GetResourceInput{ ResourceId: aws.String("String"), // Required @@ -1033,7 +1321,13 @@ func ExampleAPIGateway_GetResource() { } func ExampleAPIGateway_GetResources() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.GetResourcesInput{ RestApiId: aws.String("String"), // Required @@ -1054,7 +1348,13 @@ func ExampleAPIGateway_GetResources() { } func ExampleAPIGateway_GetRestApi() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.GetRestApiInput{ RestApiId: aws.String("String"), // Required @@ -1073,7 +1373,13 @@ func ExampleAPIGateway_GetRestApi() { } func ExampleAPIGateway_GetRestApis() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.GetRestApisInput{ Limit: aws.Int64(1), @@ -1093,7 +1399,13 @@ func ExampleAPIGateway_GetRestApis() { } func ExampleAPIGateway_GetSdk() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.GetSdkInput{ RestApiId: aws.String("String"), // Required @@ -1118,7 +1430,13 @@ func ExampleAPIGateway_GetSdk() { } func ExampleAPIGateway_GetStage() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.GetStageInput{ RestApiId: aws.String("String"), // Required @@ -1138,7 +1456,13 @@ func ExampleAPIGateway_GetStage() { } func ExampleAPIGateway_GetStages() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.GetStagesInput{ RestApiId: aws.String("String"), // Required @@ -1158,7 +1482,13 @@ func ExampleAPIGateway_GetStages() { } func ExampleAPIGateway_ImportRestApi() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.ImportRestApiInput{ Body: []byte("PAYLOAD"), // Required @@ -1182,7 +1512,13 @@ func ExampleAPIGateway_ImportRestApi() { } func ExampleAPIGateway_PutIntegration() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.PutIntegrationInput{ HttpMethod: aws.String("String"), // Required @@ -1221,7 +1557,13 @@ func ExampleAPIGateway_PutIntegration() { } func ExampleAPIGateway_PutIntegrationResponse() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.PutIntegrationResponseInput{ HttpMethod: aws.String("String"), // Required @@ -1252,7 +1594,13 @@ func ExampleAPIGateway_PutIntegrationResponse() { } func ExampleAPIGateway_PutMethod() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.PutMethodInput{ AuthorizationType: aws.String("String"), // Required @@ -1284,7 +1632,13 @@ func ExampleAPIGateway_PutMethod() { } func ExampleAPIGateway_PutMethodResponse() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.PutMethodResponseInput{ HttpMethod: aws.String("String"), // Required @@ -1314,7 +1668,13 @@ func ExampleAPIGateway_PutMethodResponse() { } func ExampleAPIGateway_PutRestApi() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.PutRestApiInput{ Body: []byte("PAYLOAD"), // Required @@ -1340,7 +1700,13 @@ func ExampleAPIGateway_PutRestApi() { } func ExampleAPIGateway_TestInvokeAuthorizer() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.TestInvokeAuthorizerInput{ AuthorizerId: aws.String("String"), // Required @@ -1374,7 +1740,13 @@ func ExampleAPIGateway_TestInvokeAuthorizer() { } func ExampleAPIGateway_TestInvokeMethod() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.TestInvokeMethodInput{ HttpMethod: aws.String("String"), // Required @@ -1406,7 +1778,13 @@ func ExampleAPIGateway_TestInvokeMethod() { } func ExampleAPIGateway_UpdateAccount() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.UpdateAccountInput{ PatchOperations: []*apigateway.PatchOperation{ @@ -1433,7 +1811,13 @@ func ExampleAPIGateway_UpdateAccount() { } func ExampleAPIGateway_UpdateApiKey() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.UpdateApiKeyInput{ ApiKey: aws.String("String"), // Required @@ -1461,7 +1845,13 @@ func ExampleAPIGateway_UpdateApiKey() { } func ExampleAPIGateway_UpdateAuthorizer() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.UpdateAuthorizerInput{ AuthorizerId: aws.String("String"), // Required @@ -1490,7 +1880,13 @@ func ExampleAPIGateway_UpdateAuthorizer() { } func ExampleAPIGateway_UpdateBasePathMapping() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.UpdateBasePathMappingInput{ BasePath: aws.String("String"), // Required @@ -1519,7 +1915,13 @@ func ExampleAPIGateway_UpdateBasePathMapping() { } func ExampleAPIGateway_UpdateClientCertificate() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.UpdateClientCertificateInput{ ClientCertificateId: aws.String("String"), // Required @@ -1547,7 +1949,13 @@ func ExampleAPIGateway_UpdateClientCertificate() { } func ExampleAPIGateway_UpdateDeployment() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.UpdateDeploymentInput{ DeploymentId: aws.String("String"), // Required @@ -1576,7 +1984,13 @@ func ExampleAPIGateway_UpdateDeployment() { } func ExampleAPIGateway_UpdateDomainName() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.UpdateDomainNameInput{ DomainName: aws.String("String"), // Required @@ -1604,7 +2018,13 @@ func ExampleAPIGateway_UpdateDomainName() { } func ExampleAPIGateway_UpdateIntegration() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.UpdateIntegrationInput{ HttpMethod: aws.String("String"), // Required @@ -1634,7 +2054,13 @@ func ExampleAPIGateway_UpdateIntegration() { } func ExampleAPIGateway_UpdateIntegrationResponse() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.UpdateIntegrationResponseInput{ HttpMethod: aws.String("String"), // Required @@ -1665,7 +2091,13 @@ func ExampleAPIGateway_UpdateIntegrationResponse() { } func ExampleAPIGateway_UpdateMethod() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.UpdateMethodInput{ HttpMethod: aws.String("String"), // Required @@ -1695,7 +2127,13 @@ func ExampleAPIGateway_UpdateMethod() { } func ExampleAPIGateway_UpdateMethodResponse() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.UpdateMethodResponseInput{ HttpMethod: aws.String("String"), // Required @@ -1726,7 +2164,13 @@ func ExampleAPIGateway_UpdateMethodResponse() { } func ExampleAPIGateway_UpdateModel() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.UpdateModelInput{ ModelName: aws.String("String"), // Required @@ -1755,7 +2199,13 @@ func ExampleAPIGateway_UpdateModel() { } func ExampleAPIGateway_UpdateResource() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.UpdateResourceInput{ ResourceId: aws.String("String"), // Required @@ -1784,7 +2234,13 @@ func ExampleAPIGateway_UpdateResource() { } func ExampleAPIGateway_UpdateRestApi() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.UpdateRestApiInput{ RestApiId: aws.String("String"), // Required @@ -1812,7 +2268,13 @@ func ExampleAPIGateway_UpdateRestApi() { } func ExampleAPIGateway_UpdateStage() { - svc := apigateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := apigateway.New(sess) params := &apigateway.UpdateStageInput{ RestApiId: aws.String("String"), // Required diff --git a/service/applicationautoscaling/examples_test.go b/service/applicationautoscaling/examples_test.go index d3249c9a3a1..952643a68ba 100644 --- a/service/applicationautoscaling/examples_test.go +++ b/service/applicationautoscaling/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleApplicationAutoScaling_DeleteScalingPolicy() { - svc := applicationautoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := applicationautoscaling.New(sess) params := &applicationautoscaling.DeleteScalingPolicyInput{ PolicyName: aws.String("ResourceIdMaxLen1600"), // Required @@ -38,7 +44,13 @@ func ExampleApplicationAutoScaling_DeleteScalingPolicy() { } func ExampleApplicationAutoScaling_DeregisterScalableTarget() { - svc := applicationautoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := applicationautoscaling.New(sess) params := &applicationautoscaling.DeregisterScalableTargetInput{ ResourceId: aws.String("ResourceIdMaxLen1600"), // Required @@ -59,7 +71,13 @@ func ExampleApplicationAutoScaling_DeregisterScalableTarget() { } func ExampleApplicationAutoScaling_DescribeScalableTargets() { - svc := applicationautoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := applicationautoscaling.New(sess) params := &applicationautoscaling.DescribeScalableTargetsInput{ ServiceNamespace: aws.String("ServiceNamespace"), // Required @@ -85,7 +103,13 @@ func ExampleApplicationAutoScaling_DescribeScalableTargets() { } func ExampleApplicationAutoScaling_DescribeScalingActivities() { - svc := applicationautoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := applicationautoscaling.New(sess) params := &applicationautoscaling.DescribeScalingActivitiesInput{ ServiceNamespace: aws.String("ServiceNamespace"), // Required @@ -108,7 +132,13 @@ func ExampleApplicationAutoScaling_DescribeScalingActivities() { } func ExampleApplicationAutoScaling_DescribeScalingPolicies() { - svc := applicationautoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := applicationautoscaling.New(sess) params := &applicationautoscaling.DescribeScalingPoliciesInput{ ServiceNamespace: aws.String("ServiceNamespace"), // Required @@ -135,7 +165,13 @@ func ExampleApplicationAutoScaling_DescribeScalingPolicies() { } func ExampleApplicationAutoScaling_PutScalingPolicy() { - svc := applicationautoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := applicationautoscaling.New(sess) params := &applicationautoscaling.PutScalingPolicyInput{ PolicyName: aws.String("PolicyName"), // Required @@ -172,7 +208,13 @@ func ExampleApplicationAutoScaling_PutScalingPolicy() { } func ExampleApplicationAutoScaling_RegisterScalableTarget() { - svc := applicationautoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := applicationautoscaling.New(sess) params := &applicationautoscaling.RegisterScalableTargetInput{ ResourceId: aws.String("ResourceIdMaxLen1600"), // Required diff --git a/service/applicationdiscoveryservice/examples_test.go b/service/applicationdiscoveryservice/examples_test.go index 0f09bcc6f73..e39f906bcee 100644 --- a/service/applicationdiscoveryservice/examples_test.go +++ b/service/applicationdiscoveryservice/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleApplicationDiscoveryService_CreateTags() { - svc := applicationdiscoveryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := applicationdiscoveryservice.New(sess) params := &applicationdiscoveryservice.CreateTagsInput{ ConfigurationIds: []*string{ // Required @@ -45,7 +51,13 @@ func ExampleApplicationDiscoveryService_CreateTags() { } func ExampleApplicationDiscoveryService_DeleteTags() { - svc := applicationdiscoveryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := applicationdiscoveryservice.New(sess) params := &applicationdiscoveryservice.DeleteTagsInput{ ConfigurationIds: []*string{ // Required @@ -74,7 +86,13 @@ func ExampleApplicationDiscoveryService_DeleteTags() { } func ExampleApplicationDiscoveryService_DescribeAgents() { - svc := applicationdiscoveryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := applicationdiscoveryservice.New(sess) params := &applicationdiscoveryservice.DescribeAgentsInput{ AgentIds: []*string{ @@ -98,7 +116,13 @@ func ExampleApplicationDiscoveryService_DescribeAgents() { } func ExampleApplicationDiscoveryService_DescribeConfigurations() { - svc := applicationdiscoveryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := applicationdiscoveryservice.New(sess) params := &applicationdiscoveryservice.DescribeConfigurationsInput{ ConfigurationIds: []*string{ // Required @@ -120,7 +144,13 @@ func ExampleApplicationDiscoveryService_DescribeConfigurations() { } func ExampleApplicationDiscoveryService_DescribeExportConfigurations() { - svc := applicationdiscoveryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := applicationdiscoveryservice.New(sess) params := &applicationdiscoveryservice.DescribeExportConfigurationsInput{ ExportIds: []*string{ @@ -144,7 +174,13 @@ func ExampleApplicationDiscoveryService_DescribeExportConfigurations() { } func ExampleApplicationDiscoveryService_DescribeTags() { - svc := applicationdiscoveryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := applicationdiscoveryservice.New(sess) params := &applicationdiscoveryservice.DescribeTagsInput{ Filters: []*applicationdiscoveryservice.TagFilter{ @@ -174,7 +210,13 @@ func ExampleApplicationDiscoveryService_DescribeTags() { } func ExampleApplicationDiscoveryService_ExportConfigurations() { - svc := applicationdiscoveryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := applicationdiscoveryservice.New(sess) var params *applicationdiscoveryservice.ExportConfigurationsInput resp, err := svc.ExportConfigurations(params) @@ -191,7 +233,13 @@ func ExampleApplicationDiscoveryService_ExportConfigurations() { } func ExampleApplicationDiscoveryService_ListConfigurations() { - svc := applicationdiscoveryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := applicationdiscoveryservice.New(sess) params := &applicationdiscoveryservice.ListConfigurationsInput{ ConfigurationType: aws.String("ConfigurationItemType"), // Required @@ -223,7 +271,13 @@ func ExampleApplicationDiscoveryService_ListConfigurations() { } func ExampleApplicationDiscoveryService_StartDataCollectionByAgentIds() { - svc := applicationdiscoveryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := applicationdiscoveryservice.New(sess) params := &applicationdiscoveryservice.StartDataCollectionByAgentIdsInput{ AgentIds: []*string{ // Required @@ -245,7 +299,13 @@ func ExampleApplicationDiscoveryService_StartDataCollectionByAgentIds() { } func ExampleApplicationDiscoveryService_StopDataCollectionByAgentIds() { - svc := applicationdiscoveryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := applicationdiscoveryservice.New(sess) params := &applicationdiscoveryservice.StopDataCollectionByAgentIdsInput{ AgentIds: []*string{ // Required diff --git a/service/autoscaling/examples_test.go b/service/autoscaling/examples_test.go index 24b9ee9a80b..2ff7d8a9d51 100644 --- a/service/autoscaling/examples_test.go +++ b/service/autoscaling/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleAutoScaling_AttachInstances() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.AttachInstancesInput{ AutoScalingGroupName: aws.String("ResourceName"), // Required @@ -39,7 +45,13 @@ func ExampleAutoScaling_AttachInstances() { } func ExampleAutoScaling_AttachLoadBalancers() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.AttachLoadBalancersInput{ AutoScalingGroupName: aws.String("ResourceName"), @@ -62,7 +74,13 @@ func ExampleAutoScaling_AttachLoadBalancers() { } func ExampleAutoScaling_CompleteLifecycleAction() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.CompleteLifecycleActionInput{ AutoScalingGroupName: aws.String("ResourceName"), // Required @@ -85,7 +103,13 @@ func ExampleAutoScaling_CompleteLifecycleAction() { } func ExampleAutoScaling_CreateAutoScalingGroup() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.CreateAutoScalingGroupInput{ AutoScalingGroupName: aws.String("XmlStringMaxLen255"), // Required @@ -137,7 +161,13 @@ func ExampleAutoScaling_CreateAutoScalingGroup() { } func ExampleAutoScaling_CreateLaunchConfiguration() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.CreateLaunchConfigurationInput{ LaunchConfigurationName: aws.String("XmlStringMaxLen255"), // Required @@ -196,7 +226,13 @@ func ExampleAutoScaling_CreateLaunchConfiguration() { } func ExampleAutoScaling_CreateOrUpdateTags() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.CreateOrUpdateTagsInput{ Tags: []*autoscaling.Tag{ // Required @@ -224,7 +260,13 @@ func ExampleAutoScaling_CreateOrUpdateTags() { } func ExampleAutoScaling_DeleteAutoScalingGroup() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.DeleteAutoScalingGroupInput{ AutoScalingGroupName: aws.String("ResourceName"), // Required @@ -244,7 +286,13 @@ func ExampleAutoScaling_DeleteAutoScalingGroup() { } func ExampleAutoScaling_DeleteLaunchConfiguration() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.DeleteLaunchConfigurationInput{ LaunchConfigurationName: aws.String("ResourceName"), // Required @@ -263,7 +311,13 @@ func ExampleAutoScaling_DeleteLaunchConfiguration() { } func ExampleAutoScaling_DeleteLifecycleHook() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.DeleteLifecycleHookInput{ AutoScalingGroupName: aws.String("ResourceName"), // Required @@ -283,7 +337,13 @@ func ExampleAutoScaling_DeleteLifecycleHook() { } func ExampleAutoScaling_DeleteNotificationConfiguration() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.DeleteNotificationConfigurationInput{ AutoScalingGroupName: aws.String("ResourceName"), // Required @@ -303,7 +363,13 @@ func ExampleAutoScaling_DeleteNotificationConfiguration() { } func ExampleAutoScaling_DeletePolicy() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.DeletePolicyInput{ PolicyName: aws.String("ResourceName"), // Required @@ -323,7 +389,13 @@ func ExampleAutoScaling_DeletePolicy() { } func ExampleAutoScaling_DeleteScheduledAction() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.DeleteScheduledActionInput{ ScheduledActionName: aws.String("ResourceName"), // Required @@ -343,7 +415,13 @@ func ExampleAutoScaling_DeleteScheduledAction() { } func ExampleAutoScaling_DeleteTags() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.DeleteTagsInput{ Tags: []*autoscaling.Tag{ // Required @@ -371,7 +449,13 @@ func ExampleAutoScaling_DeleteTags() { } func ExampleAutoScaling_DescribeAccountLimits() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) var params *autoscaling.DescribeAccountLimitsInput resp, err := svc.DescribeAccountLimits(params) @@ -388,7 +472,13 @@ func ExampleAutoScaling_DescribeAccountLimits() { } func ExampleAutoScaling_DescribeAdjustmentTypes() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) var params *autoscaling.DescribeAdjustmentTypesInput resp, err := svc.DescribeAdjustmentTypes(params) @@ -405,7 +495,13 @@ func ExampleAutoScaling_DescribeAdjustmentTypes() { } func ExampleAutoScaling_DescribeAutoScalingGroups() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.DescribeAutoScalingGroupsInput{ AutoScalingGroupNames: []*string{ @@ -429,7 +525,13 @@ func ExampleAutoScaling_DescribeAutoScalingGroups() { } func ExampleAutoScaling_DescribeAutoScalingInstances() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.DescribeAutoScalingInstancesInput{ InstanceIds: []*string{ @@ -453,7 +555,13 @@ func ExampleAutoScaling_DescribeAutoScalingInstances() { } func ExampleAutoScaling_DescribeAutoScalingNotificationTypes() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) var params *autoscaling.DescribeAutoScalingNotificationTypesInput resp, err := svc.DescribeAutoScalingNotificationTypes(params) @@ -470,7 +578,13 @@ func ExampleAutoScaling_DescribeAutoScalingNotificationTypes() { } func ExampleAutoScaling_DescribeLaunchConfigurations() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.DescribeLaunchConfigurationsInput{ LaunchConfigurationNames: []*string{ @@ -494,7 +608,13 @@ func ExampleAutoScaling_DescribeLaunchConfigurations() { } func ExampleAutoScaling_DescribeLifecycleHookTypes() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) var params *autoscaling.DescribeLifecycleHookTypesInput resp, err := svc.DescribeLifecycleHookTypes(params) @@ -511,7 +631,13 @@ func ExampleAutoScaling_DescribeLifecycleHookTypes() { } func ExampleAutoScaling_DescribeLifecycleHooks() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.DescribeLifecycleHooksInput{ AutoScalingGroupName: aws.String("ResourceName"), // Required @@ -534,7 +660,13 @@ func ExampleAutoScaling_DescribeLifecycleHooks() { } func ExampleAutoScaling_DescribeLoadBalancers() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.DescribeLoadBalancersInput{ AutoScalingGroupName: aws.String("ResourceName"), // Required @@ -555,7 +687,13 @@ func ExampleAutoScaling_DescribeLoadBalancers() { } func ExampleAutoScaling_DescribeMetricCollectionTypes() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) var params *autoscaling.DescribeMetricCollectionTypesInput resp, err := svc.DescribeMetricCollectionTypes(params) @@ -572,7 +710,13 @@ func ExampleAutoScaling_DescribeMetricCollectionTypes() { } func ExampleAutoScaling_DescribeNotificationConfigurations() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.DescribeNotificationConfigurationsInput{ AutoScalingGroupNames: []*string{ @@ -596,7 +740,13 @@ func ExampleAutoScaling_DescribeNotificationConfigurations() { } func ExampleAutoScaling_DescribePolicies() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.DescribePoliciesInput{ AutoScalingGroupName: aws.String("ResourceName"), @@ -625,7 +775,13 @@ func ExampleAutoScaling_DescribePolicies() { } func ExampleAutoScaling_DescribeScalingActivities() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.DescribeScalingActivitiesInput{ ActivityIds: []*string{ @@ -650,7 +806,13 @@ func ExampleAutoScaling_DescribeScalingActivities() { } func ExampleAutoScaling_DescribeScalingProcessTypes() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) var params *autoscaling.DescribeScalingProcessTypesInput resp, err := svc.DescribeScalingProcessTypes(params) @@ -667,7 +829,13 @@ func ExampleAutoScaling_DescribeScalingProcessTypes() { } func ExampleAutoScaling_DescribeScheduledActions() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.DescribeScheduledActionsInput{ AutoScalingGroupName: aws.String("ResourceName"), @@ -694,7 +862,13 @@ func ExampleAutoScaling_DescribeScheduledActions() { } func ExampleAutoScaling_DescribeTags() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.DescribeTagsInput{ Filters: []*autoscaling.Filter{ @@ -724,7 +898,13 @@ func ExampleAutoScaling_DescribeTags() { } func ExampleAutoScaling_DescribeTerminationPolicyTypes() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) var params *autoscaling.DescribeTerminationPolicyTypesInput resp, err := svc.DescribeTerminationPolicyTypes(params) @@ -741,7 +921,13 @@ func ExampleAutoScaling_DescribeTerminationPolicyTypes() { } func ExampleAutoScaling_DetachInstances() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.DetachInstancesInput{ AutoScalingGroupName: aws.String("ResourceName"), // Required @@ -765,7 +951,13 @@ func ExampleAutoScaling_DetachInstances() { } func ExampleAutoScaling_DetachLoadBalancers() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.DetachLoadBalancersInput{ AutoScalingGroupName: aws.String("ResourceName"), @@ -788,7 +980,13 @@ func ExampleAutoScaling_DetachLoadBalancers() { } func ExampleAutoScaling_DisableMetricsCollection() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.DisableMetricsCollectionInput{ AutoScalingGroupName: aws.String("ResourceName"), // Required @@ -811,7 +1009,13 @@ func ExampleAutoScaling_DisableMetricsCollection() { } func ExampleAutoScaling_EnableMetricsCollection() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.EnableMetricsCollectionInput{ AutoScalingGroupName: aws.String("ResourceName"), // Required @@ -835,7 +1039,13 @@ func ExampleAutoScaling_EnableMetricsCollection() { } func ExampleAutoScaling_EnterStandby() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.EnterStandbyInput{ AutoScalingGroupName: aws.String("ResourceName"), // Required @@ -859,7 +1069,13 @@ func ExampleAutoScaling_EnterStandby() { } func ExampleAutoScaling_ExecutePolicy() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.ExecutePolicyInput{ PolicyName: aws.String("ResourceName"), // Required @@ -882,7 +1098,13 @@ func ExampleAutoScaling_ExecutePolicy() { } func ExampleAutoScaling_ExitStandby() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.ExitStandbyInput{ AutoScalingGroupName: aws.String("ResourceName"), // Required @@ -905,7 +1127,13 @@ func ExampleAutoScaling_ExitStandby() { } func ExampleAutoScaling_PutLifecycleHook() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.PutLifecycleHookInput{ AutoScalingGroupName: aws.String("ResourceName"), // Required @@ -931,7 +1159,13 @@ func ExampleAutoScaling_PutLifecycleHook() { } func ExampleAutoScaling_PutNotificationConfiguration() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.PutNotificationConfigurationInput{ AutoScalingGroupName: aws.String("ResourceName"), // Required @@ -955,7 +1189,13 @@ func ExampleAutoScaling_PutNotificationConfiguration() { } func ExampleAutoScaling_PutScalingPolicy() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.PutScalingPolicyInput{ AdjustmentType: aws.String("XmlStringMaxLen255"), // Required @@ -991,7 +1231,13 @@ func ExampleAutoScaling_PutScalingPolicy() { } func ExampleAutoScaling_PutScheduledUpdateGroupAction() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.PutScheduledUpdateGroupActionInput{ AutoScalingGroupName: aws.String("ResourceName"), // Required @@ -1018,7 +1264,13 @@ func ExampleAutoScaling_PutScheduledUpdateGroupAction() { } func ExampleAutoScaling_RecordLifecycleActionHeartbeat() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.RecordLifecycleActionHeartbeatInput{ AutoScalingGroupName: aws.String("ResourceName"), // Required @@ -1040,7 +1292,13 @@ func ExampleAutoScaling_RecordLifecycleActionHeartbeat() { } func ExampleAutoScaling_ResumeProcesses() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.ScalingProcessQuery{ AutoScalingGroupName: aws.String("ResourceName"), // Required @@ -1063,7 +1321,13 @@ func ExampleAutoScaling_ResumeProcesses() { } func ExampleAutoScaling_SetDesiredCapacity() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.SetDesiredCapacityInput{ AutoScalingGroupName: aws.String("ResourceName"), // Required @@ -1084,7 +1348,13 @@ func ExampleAutoScaling_SetDesiredCapacity() { } func ExampleAutoScaling_SetInstanceHealth() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.SetInstanceHealthInput{ HealthStatus: aws.String("XmlStringMaxLen32"), // Required @@ -1105,7 +1375,13 @@ func ExampleAutoScaling_SetInstanceHealth() { } func ExampleAutoScaling_SetInstanceProtection() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.SetInstanceProtectionInput{ AutoScalingGroupName: aws.String("ResourceName"), // Required @@ -1129,7 +1405,13 @@ func ExampleAutoScaling_SetInstanceProtection() { } func ExampleAutoScaling_SuspendProcesses() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.ScalingProcessQuery{ AutoScalingGroupName: aws.String("ResourceName"), // Required @@ -1152,7 +1434,13 @@ func ExampleAutoScaling_SuspendProcesses() { } func ExampleAutoScaling_TerminateInstanceInAutoScalingGroup() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.TerminateInstanceInAutoScalingGroupInput{ InstanceId: aws.String("XmlStringMaxLen19"), // Required @@ -1172,7 +1460,13 @@ func ExampleAutoScaling_TerminateInstanceInAutoScalingGroup() { } func ExampleAutoScaling_UpdateAutoScalingGroup() { - svc := autoscaling.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := autoscaling.New(sess) params := &autoscaling.UpdateAutoScalingGroupInput{ AutoScalingGroupName: aws.String("ResourceName"), // Required diff --git a/service/cloudformation/examples_test.go b/service/cloudformation/examples_test.go index 695686a05fc..e5bf53dbe41 100644 --- a/service/cloudformation/examples_test.go +++ b/service/cloudformation/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleCloudFormation_CancelUpdateStack() { - svc := cloudformation.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudformation.New(sess) params := &cloudformation.CancelUpdateStackInput{ StackName: aws.String("StackName"), // Required @@ -35,7 +41,13 @@ func ExampleCloudFormation_CancelUpdateStack() { } func ExampleCloudFormation_ContinueUpdateRollback() { - svc := cloudformation.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudformation.New(sess) params := &cloudformation.ContinueUpdateRollbackInput{ StackName: aws.String("StackNameOrId"), // Required @@ -54,7 +66,13 @@ func ExampleCloudFormation_ContinueUpdateRollback() { } func ExampleCloudFormation_CreateChangeSet() { - svc := cloudformation.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudformation.New(sess) params := &cloudformation.CreateChangeSetInput{ ChangeSetName: aws.String("ChangeSetName"), // Required @@ -106,7 +124,13 @@ func ExampleCloudFormation_CreateChangeSet() { } func ExampleCloudFormation_CreateStack() { - svc := cloudformation.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudformation.New(sess) params := &cloudformation.CreateStackInput{ StackName: aws.String("StackName"), // Required @@ -159,7 +183,13 @@ func ExampleCloudFormation_CreateStack() { } func ExampleCloudFormation_DeleteChangeSet() { - svc := cloudformation.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudformation.New(sess) params := &cloudformation.DeleteChangeSetInput{ ChangeSetName: aws.String("ChangeSetNameOrId"), // Required @@ -179,7 +209,13 @@ func ExampleCloudFormation_DeleteChangeSet() { } func ExampleCloudFormation_DeleteStack() { - svc := cloudformation.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudformation.New(sess) params := &cloudformation.DeleteStackInput{ StackName: aws.String("StackName"), // Required @@ -202,7 +238,13 @@ func ExampleCloudFormation_DeleteStack() { } func ExampleCloudFormation_DescribeAccountLimits() { - svc := cloudformation.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudformation.New(sess) params := &cloudformation.DescribeAccountLimitsInput{ NextToken: aws.String("NextToken"), @@ -221,7 +263,13 @@ func ExampleCloudFormation_DescribeAccountLimits() { } func ExampleCloudFormation_DescribeChangeSet() { - svc := cloudformation.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudformation.New(sess) params := &cloudformation.DescribeChangeSetInput{ ChangeSetName: aws.String("ChangeSetNameOrId"), // Required @@ -242,7 +290,13 @@ func ExampleCloudFormation_DescribeChangeSet() { } func ExampleCloudFormation_DescribeStackEvents() { - svc := cloudformation.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudformation.New(sess) params := &cloudformation.DescribeStackEventsInput{ NextToken: aws.String("NextToken"), @@ -262,7 +316,13 @@ func ExampleCloudFormation_DescribeStackEvents() { } func ExampleCloudFormation_DescribeStackResource() { - svc := cloudformation.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudformation.New(sess) params := &cloudformation.DescribeStackResourceInput{ LogicalResourceId: aws.String("LogicalResourceId"), // Required @@ -282,7 +342,13 @@ func ExampleCloudFormation_DescribeStackResource() { } func ExampleCloudFormation_DescribeStackResources() { - svc := cloudformation.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudformation.New(sess) params := &cloudformation.DescribeStackResourcesInput{ LogicalResourceId: aws.String("LogicalResourceId"), @@ -303,7 +369,13 @@ func ExampleCloudFormation_DescribeStackResources() { } func ExampleCloudFormation_DescribeStacks() { - svc := cloudformation.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudformation.New(sess) params := &cloudformation.DescribeStacksInput{ NextToken: aws.String("NextToken"), @@ -323,7 +395,13 @@ func ExampleCloudFormation_DescribeStacks() { } func ExampleCloudFormation_EstimateTemplateCost() { - svc := cloudformation.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudformation.New(sess) params := &cloudformation.EstimateTemplateCostInput{ Parameters: []*cloudformation.Parameter{ @@ -351,7 +429,13 @@ func ExampleCloudFormation_EstimateTemplateCost() { } func ExampleCloudFormation_ExecuteChangeSet() { - svc := cloudformation.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudformation.New(sess) params := &cloudformation.ExecuteChangeSetInput{ ChangeSetName: aws.String("ChangeSetNameOrId"), // Required @@ -371,7 +455,13 @@ func ExampleCloudFormation_ExecuteChangeSet() { } func ExampleCloudFormation_GetStackPolicy() { - svc := cloudformation.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudformation.New(sess) params := &cloudformation.GetStackPolicyInput{ StackName: aws.String("StackName"), // Required @@ -390,7 +480,13 @@ func ExampleCloudFormation_GetStackPolicy() { } func ExampleCloudFormation_GetTemplate() { - svc := cloudformation.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudformation.New(sess) params := &cloudformation.GetTemplateInput{ StackName: aws.String("StackName"), // Required @@ -409,7 +505,13 @@ func ExampleCloudFormation_GetTemplate() { } func ExampleCloudFormation_GetTemplateSummary() { - svc := cloudformation.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudformation.New(sess) params := &cloudformation.GetTemplateSummaryInput{ StackName: aws.String("StackNameOrId"), @@ -430,7 +532,13 @@ func ExampleCloudFormation_GetTemplateSummary() { } func ExampleCloudFormation_ListChangeSets() { - svc := cloudformation.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudformation.New(sess) params := &cloudformation.ListChangeSetsInput{ StackName: aws.String("StackNameOrId"), // Required @@ -450,7 +558,13 @@ func ExampleCloudFormation_ListChangeSets() { } func ExampleCloudFormation_ListStackResources() { - svc := cloudformation.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudformation.New(sess) params := &cloudformation.ListStackResourcesInput{ StackName: aws.String("StackName"), // Required @@ -470,7 +584,13 @@ func ExampleCloudFormation_ListStackResources() { } func ExampleCloudFormation_ListStacks() { - svc := cloudformation.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudformation.New(sess) params := &cloudformation.ListStacksInput{ NextToken: aws.String("NextToken"), @@ -493,7 +613,13 @@ func ExampleCloudFormation_ListStacks() { } func ExampleCloudFormation_SetStackPolicy() { - svc := cloudformation.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudformation.New(sess) params := &cloudformation.SetStackPolicyInput{ StackName: aws.String("StackName"), // Required @@ -514,7 +640,13 @@ func ExampleCloudFormation_SetStackPolicy() { } func ExampleCloudFormation_SignalResource() { - svc := cloudformation.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudformation.New(sess) params := &cloudformation.SignalResourceInput{ LogicalResourceId: aws.String("LogicalResourceId"), // Required @@ -536,7 +668,13 @@ func ExampleCloudFormation_SignalResource() { } func ExampleCloudFormation_UpdateStack() { - svc := cloudformation.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudformation.New(sess) params := &cloudformation.UpdateStackInput{ StackName: aws.String("StackName"), // Required @@ -589,7 +727,13 @@ func ExampleCloudFormation_UpdateStack() { } func ExampleCloudFormation_ValidateTemplate() { - svc := cloudformation.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudformation.New(sess) params := &cloudformation.ValidateTemplateInput{ TemplateBody: aws.String("TemplateBody"), diff --git a/service/cloudfront/examples_test.go b/service/cloudfront/examples_test.go index a10507eb5c7..7739ce13842 100644 --- a/service/cloudfront/examples_test.go +++ b/service/cloudfront/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleCloudFront_CreateCloudFrontOriginAccessIdentity() { - svc := cloudfront.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudfront.New(sess) params := &cloudfront.CreateCloudFrontOriginAccessIdentityInput{ CloudFrontOriginAccessIdentityConfig: &cloudfront.OriginAccessIdentityConfig{ // Required @@ -38,7 +44,13 @@ func ExampleCloudFront_CreateCloudFrontOriginAccessIdentity() { } func ExampleCloudFront_CreateDistribution() { - svc := cloudfront.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudfront.New(sess) params := &cloudfront.CreateDistributionInput{ DistributionConfig: &cloudfront.DistributionConfig{ // Required @@ -253,7 +265,13 @@ func ExampleCloudFront_CreateDistribution() { } func ExampleCloudFront_CreateInvalidation() { - svc := cloudfront.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudfront.New(sess) params := &cloudfront.CreateInvalidationInput{ DistributionId: aws.String("string"), // Required @@ -282,7 +300,13 @@ func ExampleCloudFront_CreateInvalidation() { } func ExampleCloudFront_CreateStreamingDistribution() { - svc := cloudfront.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudfront.New(sess) params := &cloudfront.CreateStreamingDistributionInput{ StreamingDistributionConfig: &cloudfront.StreamingDistributionConfig{ // Required @@ -330,7 +354,13 @@ func ExampleCloudFront_CreateStreamingDistribution() { } func ExampleCloudFront_DeleteCloudFrontOriginAccessIdentity() { - svc := cloudfront.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudfront.New(sess) params := &cloudfront.DeleteCloudFrontOriginAccessIdentityInput{ Id: aws.String("string"), // Required @@ -350,7 +380,13 @@ func ExampleCloudFront_DeleteCloudFrontOriginAccessIdentity() { } func ExampleCloudFront_DeleteDistribution() { - svc := cloudfront.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudfront.New(sess) params := &cloudfront.DeleteDistributionInput{ Id: aws.String("string"), // Required @@ -370,7 +406,13 @@ func ExampleCloudFront_DeleteDistribution() { } func ExampleCloudFront_DeleteStreamingDistribution() { - svc := cloudfront.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudfront.New(sess) params := &cloudfront.DeleteStreamingDistributionInput{ Id: aws.String("string"), // Required @@ -390,7 +432,13 @@ func ExampleCloudFront_DeleteStreamingDistribution() { } func ExampleCloudFront_GetCloudFrontOriginAccessIdentity() { - svc := cloudfront.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudfront.New(sess) params := &cloudfront.GetCloudFrontOriginAccessIdentityInput{ Id: aws.String("string"), // Required @@ -409,7 +457,13 @@ func ExampleCloudFront_GetCloudFrontOriginAccessIdentity() { } func ExampleCloudFront_GetCloudFrontOriginAccessIdentityConfig() { - svc := cloudfront.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudfront.New(sess) params := &cloudfront.GetCloudFrontOriginAccessIdentityConfigInput{ Id: aws.String("string"), // Required @@ -428,7 +482,13 @@ func ExampleCloudFront_GetCloudFrontOriginAccessIdentityConfig() { } func ExampleCloudFront_GetDistribution() { - svc := cloudfront.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudfront.New(sess) params := &cloudfront.GetDistributionInput{ Id: aws.String("string"), // Required @@ -447,7 +507,13 @@ func ExampleCloudFront_GetDistribution() { } func ExampleCloudFront_GetDistributionConfig() { - svc := cloudfront.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudfront.New(sess) params := &cloudfront.GetDistributionConfigInput{ Id: aws.String("string"), // Required @@ -466,7 +532,13 @@ func ExampleCloudFront_GetDistributionConfig() { } func ExampleCloudFront_GetInvalidation() { - svc := cloudfront.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudfront.New(sess) params := &cloudfront.GetInvalidationInput{ DistributionId: aws.String("string"), // Required @@ -486,7 +558,13 @@ func ExampleCloudFront_GetInvalidation() { } func ExampleCloudFront_GetStreamingDistribution() { - svc := cloudfront.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudfront.New(sess) params := &cloudfront.GetStreamingDistributionInput{ Id: aws.String("string"), // Required @@ -505,7 +583,13 @@ func ExampleCloudFront_GetStreamingDistribution() { } func ExampleCloudFront_GetStreamingDistributionConfig() { - svc := cloudfront.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudfront.New(sess) params := &cloudfront.GetStreamingDistributionConfigInput{ Id: aws.String("string"), // Required @@ -524,7 +608,13 @@ func ExampleCloudFront_GetStreamingDistributionConfig() { } func ExampleCloudFront_ListCloudFrontOriginAccessIdentities() { - svc := cloudfront.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudfront.New(sess) params := &cloudfront.ListCloudFrontOriginAccessIdentitiesInput{ Marker: aws.String("string"), @@ -544,7 +634,13 @@ func ExampleCloudFront_ListCloudFrontOriginAccessIdentities() { } func ExampleCloudFront_ListDistributions() { - svc := cloudfront.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudfront.New(sess) params := &cloudfront.ListDistributionsInput{ Marker: aws.String("string"), @@ -564,7 +660,13 @@ func ExampleCloudFront_ListDistributions() { } func ExampleCloudFront_ListDistributionsByWebACLId() { - svc := cloudfront.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudfront.New(sess) params := &cloudfront.ListDistributionsByWebACLIdInput{ WebACLId: aws.String("string"), // Required @@ -585,7 +687,13 @@ func ExampleCloudFront_ListDistributionsByWebACLId() { } func ExampleCloudFront_ListInvalidations() { - svc := cloudfront.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudfront.New(sess) params := &cloudfront.ListInvalidationsInput{ DistributionId: aws.String("string"), // Required @@ -606,7 +714,13 @@ func ExampleCloudFront_ListInvalidations() { } func ExampleCloudFront_ListStreamingDistributions() { - svc := cloudfront.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudfront.New(sess) params := &cloudfront.ListStreamingDistributionsInput{ Marker: aws.String("string"), @@ -626,7 +740,13 @@ func ExampleCloudFront_ListStreamingDistributions() { } func ExampleCloudFront_UpdateCloudFrontOriginAccessIdentity() { - svc := cloudfront.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudfront.New(sess) params := &cloudfront.UpdateCloudFrontOriginAccessIdentityInput{ CloudFrontOriginAccessIdentityConfig: &cloudfront.OriginAccessIdentityConfig{ // Required @@ -650,7 +770,13 @@ func ExampleCloudFront_UpdateCloudFrontOriginAccessIdentity() { } func ExampleCloudFront_UpdateDistribution() { - svc := cloudfront.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudfront.New(sess) params := &cloudfront.UpdateDistributionInput{ DistributionConfig: &cloudfront.DistributionConfig{ // Required @@ -867,7 +993,13 @@ func ExampleCloudFront_UpdateDistribution() { } func ExampleCloudFront_UpdateStreamingDistribution() { - svc := cloudfront.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudfront.New(sess) params := &cloudfront.UpdateStreamingDistributionInput{ Id: aws.String("string"), // Required diff --git a/service/cloudhsm/examples_test.go b/service/cloudhsm/examples_test.go index 18637892350..bdc7099ee1f 100644 --- a/service/cloudhsm/examples_test.go +++ b/service/cloudhsm/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleCloudHSM_AddTagsToResource() { - svc := cloudhsm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudhsm.New(sess) params := &cloudhsm.AddTagsToResourceInput{ ResourceArn: aws.String("String"), // Required @@ -42,7 +48,13 @@ func ExampleCloudHSM_AddTagsToResource() { } func ExampleCloudHSM_CreateHapg() { - svc := cloudhsm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudhsm.New(sess) params := &cloudhsm.CreateHapgInput{ Label: aws.String("Label"), // Required @@ -61,7 +73,13 @@ func ExampleCloudHSM_CreateHapg() { } func ExampleCloudHSM_CreateHsm() { - svc := cloudhsm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudhsm.New(sess) params := &cloudhsm.CreateHsmInput{ IamRoleArn: aws.String("IamRoleArn"), // Required @@ -87,7 +105,13 @@ func ExampleCloudHSM_CreateHsm() { } func ExampleCloudHSM_CreateLunaClient() { - svc := cloudhsm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudhsm.New(sess) params := &cloudhsm.CreateLunaClientInput{ Certificate: aws.String("Certificate"), // Required @@ -107,7 +131,13 @@ func ExampleCloudHSM_CreateLunaClient() { } func ExampleCloudHSM_DeleteHapg() { - svc := cloudhsm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudhsm.New(sess) params := &cloudhsm.DeleteHapgInput{ HapgArn: aws.String("HapgArn"), // Required @@ -126,7 +156,13 @@ func ExampleCloudHSM_DeleteHapg() { } func ExampleCloudHSM_DeleteHsm() { - svc := cloudhsm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudhsm.New(sess) params := &cloudhsm.DeleteHsmInput{ HsmArn: aws.String("HsmArn"), // Required @@ -145,7 +181,13 @@ func ExampleCloudHSM_DeleteHsm() { } func ExampleCloudHSM_DeleteLunaClient() { - svc := cloudhsm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudhsm.New(sess) params := &cloudhsm.DeleteLunaClientInput{ ClientArn: aws.String("ClientArn"), // Required @@ -164,7 +206,13 @@ func ExampleCloudHSM_DeleteLunaClient() { } func ExampleCloudHSM_DescribeHapg() { - svc := cloudhsm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudhsm.New(sess) params := &cloudhsm.DescribeHapgInput{ HapgArn: aws.String("HapgArn"), // Required @@ -183,7 +231,13 @@ func ExampleCloudHSM_DescribeHapg() { } func ExampleCloudHSM_DescribeHsm() { - svc := cloudhsm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudhsm.New(sess) params := &cloudhsm.DescribeHsmInput{ HsmArn: aws.String("HsmArn"), @@ -203,7 +257,13 @@ func ExampleCloudHSM_DescribeHsm() { } func ExampleCloudHSM_DescribeLunaClient() { - svc := cloudhsm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudhsm.New(sess) params := &cloudhsm.DescribeLunaClientInput{ CertificateFingerprint: aws.String("CertificateFingerprint"), @@ -223,7 +283,13 @@ func ExampleCloudHSM_DescribeLunaClient() { } func ExampleCloudHSM_GetConfig() { - svc := cloudhsm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudhsm.New(sess) params := &cloudhsm.GetConfigInput{ ClientArn: aws.String("ClientArn"), // Required @@ -247,7 +313,13 @@ func ExampleCloudHSM_GetConfig() { } func ExampleCloudHSM_ListAvailableZones() { - svc := cloudhsm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudhsm.New(sess) var params *cloudhsm.ListAvailableZonesInput resp, err := svc.ListAvailableZones(params) @@ -264,7 +336,13 @@ func ExampleCloudHSM_ListAvailableZones() { } func ExampleCloudHSM_ListHapgs() { - svc := cloudhsm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudhsm.New(sess) params := &cloudhsm.ListHapgsInput{ NextToken: aws.String("PaginationToken"), @@ -283,7 +361,13 @@ func ExampleCloudHSM_ListHapgs() { } func ExampleCloudHSM_ListHsms() { - svc := cloudhsm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudhsm.New(sess) params := &cloudhsm.ListHsmsInput{ NextToken: aws.String("PaginationToken"), @@ -302,7 +386,13 @@ func ExampleCloudHSM_ListHsms() { } func ExampleCloudHSM_ListLunaClients() { - svc := cloudhsm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudhsm.New(sess) params := &cloudhsm.ListLunaClientsInput{ NextToken: aws.String("PaginationToken"), @@ -321,7 +411,13 @@ func ExampleCloudHSM_ListLunaClients() { } func ExampleCloudHSM_ListTagsForResource() { - svc := cloudhsm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudhsm.New(sess) params := &cloudhsm.ListTagsForResourceInput{ ResourceArn: aws.String("String"), // Required @@ -340,7 +436,13 @@ func ExampleCloudHSM_ListTagsForResource() { } func ExampleCloudHSM_ModifyHapg() { - svc := cloudhsm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudhsm.New(sess) params := &cloudhsm.ModifyHapgInput{ HapgArn: aws.String("HapgArn"), // Required @@ -364,7 +466,13 @@ func ExampleCloudHSM_ModifyHapg() { } func ExampleCloudHSM_ModifyHsm() { - svc := cloudhsm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudhsm.New(sess) params := &cloudhsm.ModifyHsmInput{ HsmArn: aws.String("HsmArn"), // Required @@ -388,7 +496,13 @@ func ExampleCloudHSM_ModifyHsm() { } func ExampleCloudHSM_ModifyLunaClient() { - svc := cloudhsm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudhsm.New(sess) params := &cloudhsm.ModifyLunaClientInput{ Certificate: aws.String("Certificate"), // Required @@ -408,7 +522,13 @@ func ExampleCloudHSM_ModifyLunaClient() { } func ExampleCloudHSM_RemoveTagsFromResource() { - svc := cloudhsm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudhsm.New(sess) params := &cloudhsm.RemoveTagsFromResourceInput{ ResourceArn: aws.String("String"), // Required diff --git a/service/cloudsearch/examples_test.go b/service/cloudsearch/examples_test.go index d91e62d1c12..0e9eed485cb 100644 --- a/service/cloudsearch/examples_test.go +++ b/service/cloudsearch/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleCloudSearch_BuildSuggesters() { - svc := cloudsearch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudsearch.New(sess) params := &cloudsearch.BuildSuggestersInput{ DomainName: aws.String("DomainName"), // Required @@ -35,7 +41,13 @@ func ExampleCloudSearch_BuildSuggesters() { } func ExampleCloudSearch_CreateDomain() { - svc := cloudsearch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudsearch.New(sess) params := &cloudsearch.CreateDomainInput{ DomainName: aws.String("DomainName"), // Required @@ -54,7 +66,13 @@ func ExampleCloudSearch_CreateDomain() { } func ExampleCloudSearch_DefineAnalysisScheme() { - svc := cloudsearch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudsearch.New(sess) params := &cloudsearch.DefineAnalysisSchemeInput{ AnalysisScheme: &cloudsearch.AnalysisScheme{ // Required @@ -84,7 +102,13 @@ func ExampleCloudSearch_DefineAnalysisScheme() { } func ExampleCloudSearch_DefineExpression() { - svc := cloudsearch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudsearch.New(sess) params := &cloudsearch.DefineExpressionInput{ DomainName: aws.String("DomainName"), // Required @@ -107,7 +131,13 @@ func ExampleCloudSearch_DefineExpression() { } func ExampleCloudSearch_DefineIndexField() { - svc := cloudsearch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudsearch.New(sess) params := &cloudsearch.DefineIndexFieldInput{ DomainName: aws.String("DomainName"), // Required @@ -213,7 +243,13 @@ func ExampleCloudSearch_DefineIndexField() { } func ExampleCloudSearch_DefineSuggester() { - svc := cloudsearch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudsearch.New(sess) params := &cloudsearch.DefineSuggesterInput{ DomainName: aws.String("DomainName"), // Required @@ -240,7 +276,13 @@ func ExampleCloudSearch_DefineSuggester() { } func ExampleCloudSearch_DeleteAnalysisScheme() { - svc := cloudsearch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudsearch.New(sess) params := &cloudsearch.DeleteAnalysisSchemeInput{ AnalysisSchemeName: aws.String("StandardName"), // Required @@ -260,7 +302,13 @@ func ExampleCloudSearch_DeleteAnalysisScheme() { } func ExampleCloudSearch_DeleteDomain() { - svc := cloudsearch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudsearch.New(sess) params := &cloudsearch.DeleteDomainInput{ DomainName: aws.String("DomainName"), // Required @@ -279,7 +327,13 @@ func ExampleCloudSearch_DeleteDomain() { } func ExampleCloudSearch_DeleteExpression() { - svc := cloudsearch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudsearch.New(sess) params := &cloudsearch.DeleteExpressionInput{ DomainName: aws.String("DomainName"), // Required @@ -299,7 +353,13 @@ func ExampleCloudSearch_DeleteExpression() { } func ExampleCloudSearch_DeleteIndexField() { - svc := cloudsearch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudsearch.New(sess) params := &cloudsearch.DeleteIndexFieldInput{ DomainName: aws.String("DomainName"), // Required @@ -319,7 +379,13 @@ func ExampleCloudSearch_DeleteIndexField() { } func ExampleCloudSearch_DeleteSuggester() { - svc := cloudsearch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudsearch.New(sess) params := &cloudsearch.DeleteSuggesterInput{ DomainName: aws.String("DomainName"), // Required @@ -339,7 +405,13 @@ func ExampleCloudSearch_DeleteSuggester() { } func ExampleCloudSearch_DescribeAnalysisSchemes() { - svc := cloudsearch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudsearch.New(sess) params := &cloudsearch.DescribeAnalysisSchemesInput{ DomainName: aws.String("DomainName"), // Required @@ -363,7 +435,13 @@ func ExampleCloudSearch_DescribeAnalysisSchemes() { } func ExampleCloudSearch_DescribeAvailabilityOptions() { - svc := cloudsearch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudsearch.New(sess) params := &cloudsearch.DescribeAvailabilityOptionsInput{ DomainName: aws.String("DomainName"), // Required @@ -383,7 +461,13 @@ func ExampleCloudSearch_DescribeAvailabilityOptions() { } func ExampleCloudSearch_DescribeDomains() { - svc := cloudsearch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudsearch.New(sess) params := &cloudsearch.DescribeDomainsInput{ DomainNames: []*string{ @@ -405,7 +489,13 @@ func ExampleCloudSearch_DescribeDomains() { } func ExampleCloudSearch_DescribeExpressions() { - svc := cloudsearch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudsearch.New(sess) params := &cloudsearch.DescribeExpressionsInput{ DomainName: aws.String("DomainName"), // Required @@ -429,7 +519,13 @@ func ExampleCloudSearch_DescribeExpressions() { } func ExampleCloudSearch_DescribeIndexFields() { - svc := cloudsearch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudsearch.New(sess) params := &cloudsearch.DescribeIndexFieldsInput{ DomainName: aws.String("DomainName"), // Required @@ -453,7 +549,13 @@ func ExampleCloudSearch_DescribeIndexFields() { } func ExampleCloudSearch_DescribeScalingParameters() { - svc := cloudsearch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudsearch.New(sess) params := &cloudsearch.DescribeScalingParametersInput{ DomainName: aws.String("DomainName"), // Required @@ -472,7 +574,13 @@ func ExampleCloudSearch_DescribeScalingParameters() { } func ExampleCloudSearch_DescribeServiceAccessPolicies() { - svc := cloudsearch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudsearch.New(sess) params := &cloudsearch.DescribeServiceAccessPoliciesInput{ DomainName: aws.String("DomainName"), // Required @@ -492,7 +600,13 @@ func ExampleCloudSearch_DescribeServiceAccessPolicies() { } func ExampleCloudSearch_DescribeSuggesters() { - svc := cloudsearch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudsearch.New(sess) params := &cloudsearch.DescribeSuggestersInput{ DomainName: aws.String("DomainName"), // Required @@ -516,7 +630,13 @@ func ExampleCloudSearch_DescribeSuggesters() { } func ExampleCloudSearch_IndexDocuments() { - svc := cloudsearch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudsearch.New(sess) params := &cloudsearch.IndexDocumentsInput{ DomainName: aws.String("DomainName"), // Required @@ -535,7 +655,13 @@ func ExampleCloudSearch_IndexDocuments() { } func ExampleCloudSearch_ListDomainNames() { - svc := cloudsearch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudsearch.New(sess) var params *cloudsearch.ListDomainNamesInput resp, err := svc.ListDomainNames(params) @@ -552,7 +678,13 @@ func ExampleCloudSearch_ListDomainNames() { } func ExampleCloudSearch_UpdateAvailabilityOptions() { - svc := cloudsearch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudsearch.New(sess) params := &cloudsearch.UpdateAvailabilityOptionsInput{ DomainName: aws.String("DomainName"), // Required @@ -572,7 +704,13 @@ func ExampleCloudSearch_UpdateAvailabilityOptions() { } func ExampleCloudSearch_UpdateScalingParameters() { - svc := cloudsearch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudsearch.New(sess) params := &cloudsearch.UpdateScalingParametersInput{ DomainName: aws.String("DomainName"), // Required @@ -596,7 +734,13 @@ func ExampleCloudSearch_UpdateScalingParameters() { } func ExampleCloudSearch_UpdateServiceAccessPolicies() { - svc := cloudsearch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudsearch.New(sess) params := &cloudsearch.UpdateServiceAccessPoliciesInput{ AccessPolicies: aws.String("PolicyDocument"), // Required diff --git a/service/cloudsearchdomain/examples_test.go b/service/cloudsearchdomain/examples_test.go index 84c94c9a554..6588fa3e309 100644 --- a/service/cloudsearchdomain/examples_test.go +++ b/service/cloudsearchdomain/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleCloudSearchDomain_Search() { - svc := cloudsearchdomain.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudsearchdomain.New(sess) params := &cloudsearchdomain.SearchInput{ Query: aws.String("Query"), // Required @@ -48,7 +54,13 @@ func ExampleCloudSearchDomain_Search() { } func ExampleCloudSearchDomain_Suggest() { - svc := cloudsearchdomain.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudsearchdomain.New(sess) params := &cloudsearchdomain.SuggestInput{ Query: aws.String("Query"), // Required @@ -69,7 +81,13 @@ func ExampleCloudSearchDomain_Suggest() { } func ExampleCloudSearchDomain_UploadDocuments() { - svc := cloudsearchdomain.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudsearchdomain.New(sess) params := &cloudsearchdomain.UploadDocumentsInput{ ContentType: aws.String("ContentType"), // Required diff --git a/service/cloudtrail/examples_test.go b/service/cloudtrail/examples_test.go index 2a78c44e707..bb05fe7f34e 100644 --- a/service/cloudtrail/examples_test.go +++ b/service/cloudtrail/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleCloudTrail_AddTags() { - svc := cloudtrail.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudtrail.New(sess) params := &cloudtrail.AddTagsInput{ ResourceId: aws.String("String"), // Required @@ -42,7 +48,13 @@ func ExampleCloudTrail_AddTags() { } func ExampleCloudTrail_CreateTrail() { - svc := cloudtrail.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudtrail.New(sess) params := &cloudtrail.CreateTrailInput{ Name: aws.String("String"), // Required @@ -70,7 +82,13 @@ func ExampleCloudTrail_CreateTrail() { } func ExampleCloudTrail_DeleteTrail() { - svc := cloudtrail.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudtrail.New(sess) params := &cloudtrail.DeleteTrailInput{ Name: aws.String("String"), // Required @@ -89,7 +107,13 @@ func ExampleCloudTrail_DeleteTrail() { } func ExampleCloudTrail_DescribeTrails() { - svc := cloudtrail.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudtrail.New(sess) params := &cloudtrail.DescribeTrailsInput{ IncludeShadowTrails: aws.Bool(true), @@ -112,7 +136,13 @@ func ExampleCloudTrail_DescribeTrails() { } func ExampleCloudTrail_GetTrailStatus() { - svc := cloudtrail.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudtrail.New(sess) params := &cloudtrail.GetTrailStatusInput{ Name: aws.String("String"), // Required @@ -131,7 +161,13 @@ func ExampleCloudTrail_GetTrailStatus() { } func ExampleCloudTrail_ListPublicKeys() { - svc := cloudtrail.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudtrail.New(sess) params := &cloudtrail.ListPublicKeysInput{ EndTime: aws.Time(time.Now()), @@ -152,7 +188,13 @@ func ExampleCloudTrail_ListPublicKeys() { } func ExampleCloudTrail_ListTags() { - svc := cloudtrail.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudtrail.New(sess) params := &cloudtrail.ListTagsInput{ ResourceIdList: []*string{ // Required @@ -175,7 +217,13 @@ func ExampleCloudTrail_ListTags() { } func ExampleCloudTrail_LookupEvents() { - svc := cloudtrail.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudtrail.New(sess) params := &cloudtrail.LookupEventsInput{ EndTime: aws.Time(time.Now()), @@ -204,7 +252,13 @@ func ExampleCloudTrail_LookupEvents() { } func ExampleCloudTrail_RemoveTags() { - svc := cloudtrail.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudtrail.New(sess) params := &cloudtrail.RemoveTagsInput{ ResourceId: aws.String("String"), // Required @@ -230,7 +284,13 @@ func ExampleCloudTrail_RemoveTags() { } func ExampleCloudTrail_StartLogging() { - svc := cloudtrail.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudtrail.New(sess) params := &cloudtrail.StartLoggingInput{ Name: aws.String("String"), // Required @@ -249,7 +309,13 @@ func ExampleCloudTrail_StartLogging() { } func ExampleCloudTrail_StopLogging() { - svc := cloudtrail.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudtrail.New(sess) params := &cloudtrail.StopLoggingInput{ Name: aws.String("String"), // Required @@ -268,7 +334,13 @@ func ExampleCloudTrail_StopLogging() { } func ExampleCloudTrail_UpdateTrail() { - svc := cloudtrail.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudtrail.New(sess) params := &cloudtrail.UpdateTrailInput{ Name: aws.String("String"), // Required diff --git a/service/cloudwatch/examples_test.go b/service/cloudwatch/examples_test.go index 07b010852b9..1074b363cec 100644 --- a/service/cloudwatch/examples_test.go +++ b/service/cloudwatch/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleCloudWatch_DeleteAlarms() { - svc := cloudwatch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatch.New(sess) params := &cloudwatch.DeleteAlarmsInput{ AlarmNames: []*string{ // Required @@ -38,7 +44,13 @@ func ExampleCloudWatch_DeleteAlarms() { } func ExampleCloudWatch_DescribeAlarmHistory() { - svc := cloudwatch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatch.New(sess) params := &cloudwatch.DescribeAlarmHistoryInput{ AlarmName: aws.String("AlarmName"), @@ -62,7 +74,13 @@ func ExampleCloudWatch_DescribeAlarmHistory() { } func ExampleCloudWatch_DescribeAlarms() { - svc := cloudwatch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatch.New(sess) params := &cloudwatch.DescribeAlarmsInput{ ActionPrefix: aws.String("ActionPrefix"), @@ -89,7 +107,13 @@ func ExampleCloudWatch_DescribeAlarms() { } func ExampleCloudWatch_DescribeAlarmsForMetric() { - svc := cloudwatch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatch.New(sess) params := &cloudwatch.DescribeAlarmsForMetricInput{ MetricName: aws.String("MetricName"), // Required @@ -119,7 +143,13 @@ func ExampleCloudWatch_DescribeAlarmsForMetric() { } func ExampleCloudWatch_DisableAlarmActions() { - svc := cloudwatch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatch.New(sess) params := &cloudwatch.DisableAlarmActionsInput{ AlarmNames: []*string{ // Required @@ -141,7 +171,13 @@ func ExampleCloudWatch_DisableAlarmActions() { } func ExampleCloudWatch_EnableAlarmActions() { - svc := cloudwatch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatch.New(sess) params := &cloudwatch.EnableAlarmActionsInput{ AlarmNames: []*string{ // Required @@ -163,7 +199,13 @@ func ExampleCloudWatch_EnableAlarmActions() { } func ExampleCloudWatch_GetMetricStatistics() { - svc := cloudwatch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatch.New(sess) params := &cloudwatch.GetMetricStatisticsInput{ EndTime: aws.Time(time.Now()), // Required @@ -198,7 +240,13 @@ func ExampleCloudWatch_GetMetricStatistics() { } func ExampleCloudWatch_ListMetrics() { - svc := cloudwatch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatch.New(sess) params := &cloudwatch.ListMetricsInput{ Dimensions: []*cloudwatch.DimensionFilter{ @@ -226,7 +274,13 @@ func ExampleCloudWatch_ListMetrics() { } func ExampleCloudWatch_PutMetricAlarm() { - svc := cloudwatch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatch.New(sess) params := &cloudwatch.PutMetricAlarmInput{ AlarmName: aws.String("AlarmName"), // Required @@ -274,7 +328,13 @@ func ExampleCloudWatch_PutMetricAlarm() { } func ExampleCloudWatch_PutMetricData() { - svc := cloudwatch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatch.New(sess) params := &cloudwatch.PutMetricDataInput{ MetricData: []*cloudwatch.MetricDatum{ // Required @@ -315,7 +375,13 @@ func ExampleCloudWatch_PutMetricData() { } func ExampleCloudWatch_SetAlarmState() { - svc := cloudwatch.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatch.New(sess) params := &cloudwatch.SetAlarmStateInput{ AlarmName: aws.String("AlarmName"), // Required diff --git a/service/cloudwatchevents/examples_test.go b/service/cloudwatchevents/examples_test.go index e0f725d80ef..f4f3587e9c8 100644 --- a/service/cloudwatchevents/examples_test.go +++ b/service/cloudwatchevents/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleCloudWatchEvents_DeleteRule() { - svc := cloudwatchevents.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchevents.New(sess) params := &cloudwatchevents.DeleteRuleInput{ Name: aws.String("RuleName"), // Required @@ -35,7 +41,13 @@ func ExampleCloudWatchEvents_DeleteRule() { } func ExampleCloudWatchEvents_DescribeRule() { - svc := cloudwatchevents.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchevents.New(sess) params := &cloudwatchevents.DescribeRuleInput{ Name: aws.String("RuleName"), // Required @@ -54,7 +66,13 @@ func ExampleCloudWatchEvents_DescribeRule() { } func ExampleCloudWatchEvents_DisableRule() { - svc := cloudwatchevents.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchevents.New(sess) params := &cloudwatchevents.DisableRuleInput{ Name: aws.String("RuleName"), // Required @@ -73,7 +91,13 @@ func ExampleCloudWatchEvents_DisableRule() { } func ExampleCloudWatchEvents_EnableRule() { - svc := cloudwatchevents.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchevents.New(sess) params := &cloudwatchevents.EnableRuleInput{ Name: aws.String("RuleName"), // Required @@ -92,7 +116,13 @@ func ExampleCloudWatchEvents_EnableRule() { } func ExampleCloudWatchEvents_ListRuleNamesByTarget() { - svc := cloudwatchevents.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchevents.New(sess) params := &cloudwatchevents.ListRuleNamesByTargetInput{ TargetArn: aws.String("TargetArn"), // Required @@ -113,7 +143,13 @@ func ExampleCloudWatchEvents_ListRuleNamesByTarget() { } func ExampleCloudWatchEvents_ListRules() { - svc := cloudwatchevents.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchevents.New(sess) params := &cloudwatchevents.ListRulesInput{ Limit: aws.Int64(1), @@ -134,7 +170,13 @@ func ExampleCloudWatchEvents_ListRules() { } func ExampleCloudWatchEvents_ListTargetsByRule() { - svc := cloudwatchevents.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchevents.New(sess) params := &cloudwatchevents.ListTargetsByRuleInput{ Rule: aws.String("RuleName"), // Required @@ -155,7 +197,13 @@ func ExampleCloudWatchEvents_ListTargetsByRule() { } func ExampleCloudWatchEvents_PutEvents() { - svc := cloudwatchevents.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchevents.New(sess) params := &cloudwatchevents.PutEventsInput{ Entries: []*cloudwatchevents.PutEventsRequestEntry{ // Required @@ -186,7 +234,13 @@ func ExampleCloudWatchEvents_PutEvents() { } func ExampleCloudWatchEvents_PutRule() { - svc := cloudwatchevents.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchevents.New(sess) params := &cloudwatchevents.PutRuleInput{ Name: aws.String("RuleName"), // Required @@ -210,7 +264,13 @@ func ExampleCloudWatchEvents_PutRule() { } func ExampleCloudWatchEvents_PutTargets() { - svc := cloudwatchevents.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchevents.New(sess) params := &cloudwatchevents.PutTargetsInput{ Rule: aws.String("RuleName"), // Required @@ -238,7 +298,13 @@ func ExampleCloudWatchEvents_PutTargets() { } func ExampleCloudWatchEvents_RemoveTargets() { - svc := cloudwatchevents.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchevents.New(sess) params := &cloudwatchevents.RemoveTargetsInput{ Ids: []*string{ // Required @@ -261,7 +327,13 @@ func ExampleCloudWatchEvents_RemoveTargets() { } func ExampleCloudWatchEvents_TestEventPattern() { - svc := cloudwatchevents.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchevents.New(sess) params := &cloudwatchevents.TestEventPatternInput{ Event: aws.String("String"), // Required diff --git a/service/cloudwatchlogs/examples_test.go b/service/cloudwatchlogs/examples_test.go index 13c56fc8884..4542ab8c97e 100644 --- a/service/cloudwatchlogs/examples_test.go +++ b/service/cloudwatchlogs/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleCloudWatchLogs_CancelExportTask() { - svc := cloudwatchlogs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchlogs.New(sess) params := &cloudwatchlogs.CancelExportTaskInput{ TaskId: aws.String("ExportTaskId"), // Required @@ -35,7 +41,13 @@ func ExampleCloudWatchLogs_CancelExportTask() { } func ExampleCloudWatchLogs_CreateExportTask() { - svc := cloudwatchlogs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchlogs.New(sess) params := &cloudwatchlogs.CreateExportTaskInput{ Destination: aws.String("ExportDestinationBucket"), // Required @@ -60,7 +72,13 @@ func ExampleCloudWatchLogs_CreateExportTask() { } func ExampleCloudWatchLogs_CreateLogGroup() { - svc := cloudwatchlogs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchlogs.New(sess) params := &cloudwatchlogs.CreateLogGroupInput{ LogGroupName: aws.String("LogGroupName"), // Required @@ -79,7 +97,13 @@ func ExampleCloudWatchLogs_CreateLogGroup() { } func ExampleCloudWatchLogs_CreateLogStream() { - svc := cloudwatchlogs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchlogs.New(sess) params := &cloudwatchlogs.CreateLogStreamInput{ LogGroupName: aws.String("LogGroupName"), // Required @@ -99,7 +123,13 @@ func ExampleCloudWatchLogs_CreateLogStream() { } func ExampleCloudWatchLogs_DeleteDestination() { - svc := cloudwatchlogs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchlogs.New(sess) params := &cloudwatchlogs.DeleteDestinationInput{ DestinationName: aws.String("DestinationName"), // Required @@ -118,7 +148,13 @@ func ExampleCloudWatchLogs_DeleteDestination() { } func ExampleCloudWatchLogs_DeleteLogGroup() { - svc := cloudwatchlogs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchlogs.New(sess) params := &cloudwatchlogs.DeleteLogGroupInput{ LogGroupName: aws.String("LogGroupName"), // Required @@ -137,7 +173,13 @@ func ExampleCloudWatchLogs_DeleteLogGroup() { } func ExampleCloudWatchLogs_DeleteLogStream() { - svc := cloudwatchlogs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchlogs.New(sess) params := &cloudwatchlogs.DeleteLogStreamInput{ LogGroupName: aws.String("LogGroupName"), // Required @@ -157,7 +199,13 @@ func ExampleCloudWatchLogs_DeleteLogStream() { } func ExampleCloudWatchLogs_DeleteMetricFilter() { - svc := cloudwatchlogs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchlogs.New(sess) params := &cloudwatchlogs.DeleteMetricFilterInput{ FilterName: aws.String("FilterName"), // Required @@ -177,7 +225,13 @@ func ExampleCloudWatchLogs_DeleteMetricFilter() { } func ExampleCloudWatchLogs_DeleteRetentionPolicy() { - svc := cloudwatchlogs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchlogs.New(sess) params := &cloudwatchlogs.DeleteRetentionPolicyInput{ LogGroupName: aws.String("LogGroupName"), // Required @@ -196,7 +250,13 @@ func ExampleCloudWatchLogs_DeleteRetentionPolicy() { } func ExampleCloudWatchLogs_DeleteSubscriptionFilter() { - svc := cloudwatchlogs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchlogs.New(sess) params := &cloudwatchlogs.DeleteSubscriptionFilterInput{ FilterName: aws.String("FilterName"), // Required @@ -216,7 +276,13 @@ func ExampleCloudWatchLogs_DeleteSubscriptionFilter() { } func ExampleCloudWatchLogs_DescribeDestinations() { - svc := cloudwatchlogs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchlogs.New(sess) params := &cloudwatchlogs.DescribeDestinationsInput{ DestinationNamePrefix: aws.String("DestinationName"), @@ -237,7 +303,13 @@ func ExampleCloudWatchLogs_DescribeDestinations() { } func ExampleCloudWatchLogs_DescribeExportTasks() { - svc := cloudwatchlogs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchlogs.New(sess) params := &cloudwatchlogs.DescribeExportTasksInput{ Limit: aws.Int64(1), @@ -259,7 +331,13 @@ func ExampleCloudWatchLogs_DescribeExportTasks() { } func ExampleCloudWatchLogs_DescribeLogGroups() { - svc := cloudwatchlogs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchlogs.New(sess) params := &cloudwatchlogs.DescribeLogGroupsInput{ Limit: aws.Int64(1), @@ -280,7 +358,13 @@ func ExampleCloudWatchLogs_DescribeLogGroups() { } func ExampleCloudWatchLogs_DescribeLogStreams() { - svc := cloudwatchlogs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchlogs.New(sess) params := &cloudwatchlogs.DescribeLogStreamsInput{ LogGroupName: aws.String("LogGroupName"), // Required @@ -304,7 +388,13 @@ func ExampleCloudWatchLogs_DescribeLogStreams() { } func ExampleCloudWatchLogs_DescribeMetricFilters() { - svc := cloudwatchlogs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchlogs.New(sess) params := &cloudwatchlogs.DescribeMetricFiltersInput{ LogGroupName: aws.String("LogGroupName"), // Required @@ -326,7 +416,13 @@ func ExampleCloudWatchLogs_DescribeMetricFilters() { } func ExampleCloudWatchLogs_DescribeSubscriptionFilters() { - svc := cloudwatchlogs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchlogs.New(sess) params := &cloudwatchlogs.DescribeSubscriptionFiltersInput{ LogGroupName: aws.String("LogGroupName"), // Required @@ -348,7 +444,13 @@ func ExampleCloudWatchLogs_DescribeSubscriptionFilters() { } func ExampleCloudWatchLogs_FilterLogEvents() { - svc := cloudwatchlogs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchlogs.New(sess) params := &cloudwatchlogs.FilterLogEventsInput{ LogGroupName: aws.String("LogGroupName"), // Required @@ -377,7 +479,13 @@ func ExampleCloudWatchLogs_FilterLogEvents() { } func ExampleCloudWatchLogs_GetLogEvents() { - svc := cloudwatchlogs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchlogs.New(sess) params := &cloudwatchlogs.GetLogEventsInput{ LogGroupName: aws.String("LogGroupName"), // Required @@ -402,7 +510,13 @@ func ExampleCloudWatchLogs_GetLogEvents() { } func ExampleCloudWatchLogs_PutDestination() { - svc := cloudwatchlogs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchlogs.New(sess) params := &cloudwatchlogs.PutDestinationInput{ DestinationName: aws.String("DestinationName"), // Required @@ -423,7 +537,13 @@ func ExampleCloudWatchLogs_PutDestination() { } func ExampleCloudWatchLogs_PutDestinationPolicy() { - svc := cloudwatchlogs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchlogs.New(sess) params := &cloudwatchlogs.PutDestinationPolicyInput{ AccessPolicy: aws.String("AccessPolicy"), // Required @@ -443,7 +563,13 @@ func ExampleCloudWatchLogs_PutDestinationPolicy() { } func ExampleCloudWatchLogs_PutLogEvents() { - svc := cloudwatchlogs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchlogs.New(sess) params := &cloudwatchlogs.PutLogEventsInput{ LogEvents: []*cloudwatchlogs.InputLogEvent{ // Required @@ -471,7 +597,13 @@ func ExampleCloudWatchLogs_PutLogEvents() { } func ExampleCloudWatchLogs_PutMetricFilter() { - svc := cloudwatchlogs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchlogs.New(sess) params := &cloudwatchlogs.PutMetricFilterInput{ FilterName: aws.String("FilterName"), // Required @@ -500,7 +632,13 @@ func ExampleCloudWatchLogs_PutMetricFilter() { } func ExampleCloudWatchLogs_PutRetentionPolicy() { - svc := cloudwatchlogs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchlogs.New(sess) params := &cloudwatchlogs.PutRetentionPolicyInput{ LogGroupName: aws.String("LogGroupName"), // Required @@ -520,7 +658,13 @@ func ExampleCloudWatchLogs_PutRetentionPolicy() { } func ExampleCloudWatchLogs_PutSubscriptionFilter() { - svc := cloudwatchlogs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchlogs.New(sess) params := &cloudwatchlogs.PutSubscriptionFilterInput{ DestinationArn: aws.String("DestinationArn"), // Required @@ -543,7 +687,13 @@ func ExampleCloudWatchLogs_PutSubscriptionFilter() { } func ExampleCloudWatchLogs_TestMetricFilter() { - svc := cloudwatchlogs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cloudwatchlogs.New(sess) params := &cloudwatchlogs.TestMetricFilterInput{ FilterPattern: aws.String("FilterPattern"), // Required diff --git a/service/codecommit/examples_test.go b/service/codecommit/examples_test.go index 8aa9228ac1c..5e5973276a5 100644 --- a/service/codecommit/examples_test.go +++ b/service/codecommit/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleCodeCommit_BatchGetRepositories() { - svc := codecommit.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codecommit.New(sess) params := &codecommit.BatchGetRepositoriesInput{ RepositoryNames: []*string{ // Required @@ -38,7 +44,13 @@ func ExampleCodeCommit_BatchGetRepositories() { } func ExampleCodeCommit_CreateBranch() { - svc := codecommit.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codecommit.New(sess) params := &codecommit.CreateBranchInput{ BranchName: aws.String("BranchName"), // Required @@ -59,7 +71,13 @@ func ExampleCodeCommit_CreateBranch() { } func ExampleCodeCommit_CreateRepository() { - svc := codecommit.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codecommit.New(sess) params := &codecommit.CreateRepositoryInput{ RepositoryName: aws.String("RepositoryName"), // Required @@ -79,7 +97,13 @@ func ExampleCodeCommit_CreateRepository() { } func ExampleCodeCommit_DeleteRepository() { - svc := codecommit.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codecommit.New(sess) params := &codecommit.DeleteRepositoryInput{ RepositoryName: aws.String("RepositoryName"), // Required @@ -98,7 +122,13 @@ func ExampleCodeCommit_DeleteRepository() { } func ExampleCodeCommit_GetBranch() { - svc := codecommit.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codecommit.New(sess) params := &codecommit.GetBranchInput{ BranchName: aws.String("BranchName"), @@ -118,7 +148,13 @@ func ExampleCodeCommit_GetBranch() { } func ExampleCodeCommit_GetCommit() { - svc := codecommit.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codecommit.New(sess) params := &codecommit.GetCommitInput{ CommitId: aws.String("ObjectId"), // Required @@ -138,7 +174,13 @@ func ExampleCodeCommit_GetCommit() { } func ExampleCodeCommit_GetRepository() { - svc := codecommit.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codecommit.New(sess) params := &codecommit.GetRepositoryInput{ RepositoryName: aws.String("RepositoryName"), // Required @@ -157,7 +199,13 @@ func ExampleCodeCommit_GetRepository() { } func ExampleCodeCommit_GetRepositoryTriggers() { - svc := codecommit.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codecommit.New(sess) params := &codecommit.GetRepositoryTriggersInput{ RepositoryName: aws.String("RepositoryName"), @@ -176,7 +224,13 @@ func ExampleCodeCommit_GetRepositoryTriggers() { } func ExampleCodeCommit_ListBranches() { - svc := codecommit.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codecommit.New(sess) params := &codecommit.ListBranchesInput{ RepositoryName: aws.String("RepositoryName"), // Required @@ -196,7 +250,13 @@ func ExampleCodeCommit_ListBranches() { } func ExampleCodeCommit_ListRepositories() { - svc := codecommit.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codecommit.New(sess) params := &codecommit.ListRepositoriesInput{ NextToken: aws.String("NextToken"), @@ -217,7 +277,13 @@ func ExampleCodeCommit_ListRepositories() { } func ExampleCodeCommit_PutRepositoryTriggers() { - svc := codecommit.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codecommit.New(sess) params := &codecommit.PutRepositoryTriggersInput{ RepositoryName: aws.String("RepositoryName"), @@ -252,7 +318,13 @@ func ExampleCodeCommit_PutRepositoryTriggers() { } func ExampleCodeCommit_TestRepositoryTriggers() { - svc := codecommit.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codecommit.New(sess) params := &codecommit.TestRepositoryTriggersInput{ RepositoryName: aws.String("RepositoryName"), @@ -287,7 +359,13 @@ func ExampleCodeCommit_TestRepositoryTriggers() { } func ExampleCodeCommit_UpdateDefaultBranch() { - svc := codecommit.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codecommit.New(sess) params := &codecommit.UpdateDefaultBranchInput{ DefaultBranchName: aws.String("BranchName"), // Required @@ -307,7 +385,13 @@ func ExampleCodeCommit_UpdateDefaultBranch() { } func ExampleCodeCommit_UpdateRepositoryDescription() { - svc := codecommit.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codecommit.New(sess) params := &codecommit.UpdateRepositoryDescriptionInput{ RepositoryName: aws.String("RepositoryName"), // Required @@ -327,7 +411,13 @@ func ExampleCodeCommit_UpdateRepositoryDescription() { } func ExampleCodeCommit_UpdateRepositoryName() { - svc := codecommit.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codecommit.New(sess) params := &codecommit.UpdateRepositoryNameInput{ NewName: aws.String("RepositoryName"), // Required diff --git a/service/codedeploy/examples_test.go b/service/codedeploy/examples_test.go index e037f90906a..b7aed6f8b72 100644 --- a/service/codedeploy/examples_test.go +++ b/service/codedeploy/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleCodeDeploy_AddTagsToOnPremisesInstances() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.AddTagsToOnPremisesInstancesInput{ InstanceNames: []*string{ // Required @@ -45,7 +51,13 @@ func ExampleCodeDeploy_AddTagsToOnPremisesInstances() { } func ExampleCodeDeploy_BatchGetApplicationRevisions() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.BatchGetApplicationRevisionsInput{ ApplicationName: aws.String("ApplicationName"), // Required @@ -81,7 +93,13 @@ func ExampleCodeDeploy_BatchGetApplicationRevisions() { } func ExampleCodeDeploy_BatchGetApplications() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.BatchGetApplicationsInput{ ApplicationNames: []*string{ @@ -103,7 +121,13 @@ func ExampleCodeDeploy_BatchGetApplications() { } func ExampleCodeDeploy_BatchGetDeploymentGroups() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.BatchGetDeploymentGroupsInput{ ApplicationName: aws.String("ApplicationName"), // Required @@ -126,7 +150,13 @@ func ExampleCodeDeploy_BatchGetDeploymentGroups() { } func ExampleCodeDeploy_BatchGetDeploymentInstances() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.BatchGetDeploymentInstancesInput{ DeploymentId: aws.String("DeploymentId"), // Required @@ -149,7 +179,13 @@ func ExampleCodeDeploy_BatchGetDeploymentInstances() { } func ExampleCodeDeploy_BatchGetDeployments() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.BatchGetDeploymentsInput{ DeploymentIds: []*string{ @@ -171,7 +207,13 @@ func ExampleCodeDeploy_BatchGetDeployments() { } func ExampleCodeDeploy_BatchGetOnPremisesInstances() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.BatchGetOnPremisesInstancesInput{ InstanceNames: []*string{ @@ -193,7 +235,13 @@ func ExampleCodeDeploy_BatchGetOnPremisesInstances() { } func ExampleCodeDeploy_CreateApplication() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.CreateApplicationInput{ ApplicationName: aws.String("ApplicationName"), // Required @@ -212,7 +260,13 @@ func ExampleCodeDeploy_CreateApplication() { } func ExampleCodeDeploy_CreateDeployment() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.CreateDeploymentInput{ ApplicationName: aws.String("ApplicationName"), // Required @@ -249,7 +303,13 @@ func ExampleCodeDeploy_CreateDeployment() { } func ExampleCodeDeploy_CreateDeploymentConfig() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.CreateDeploymentConfigInput{ DeploymentConfigName: aws.String("DeploymentConfigName"), // Required @@ -272,7 +332,13 @@ func ExampleCodeDeploy_CreateDeploymentConfig() { } func ExampleCodeDeploy_CreateDeploymentGroup() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.CreateDeploymentGroupInput{ ApplicationName: aws.String("ApplicationName"), // Required @@ -325,7 +391,13 @@ func ExampleCodeDeploy_CreateDeploymentGroup() { } func ExampleCodeDeploy_DeleteApplication() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.DeleteApplicationInput{ ApplicationName: aws.String("ApplicationName"), // Required @@ -344,7 +416,13 @@ func ExampleCodeDeploy_DeleteApplication() { } func ExampleCodeDeploy_DeleteDeploymentConfig() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.DeleteDeploymentConfigInput{ DeploymentConfigName: aws.String("DeploymentConfigName"), // Required @@ -363,7 +441,13 @@ func ExampleCodeDeploy_DeleteDeploymentConfig() { } func ExampleCodeDeploy_DeleteDeploymentGroup() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.DeleteDeploymentGroupInput{ ApplicationName: aws.String("ApplicationName"), // Required @@ -383,7 +467,13 @@ func ExampleCodeDeploy_DeleteDeploymentGroup() { } func ExampleCodeDeploy_DeregisterOnPremisesInstance() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.DeregisterOnPremisesInstanceInput{ InstanceName: aws.String("InstanceName"), // Required @@ -402,7 +492,13 @@ func ExampleCodeDeploy_DeregisterOnPremisesInstance() { } func ExampleCodeDeploy_GetApplication() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.GetApplicationInput{ ApplicationName: aws.String("ApplicationName"), // Required @@ -421,7 +517,13 @@ func ExampleCodeDeploy_GetApplication() { } func ExampleCodeDeploy_GetApplicationRevision() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.GetApplicationRevisionInput{ ApplicationName: aws.String("ApplicationName"), // Required @@ -454,7 +556,13 @@ func ExampleCodeDeploy_GetApplicationRevision() { } func ExampleCodeDeploy_GetDeployment() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.GetDeploymentInput{ DeploymentId: aws.String("DeploymentId"), // Required @@ -473,7 +581,13 @@ func ExampleCodeDeploy_GetDeployment() { } func ExampleCodeDeploy_GetDeploymentConfig() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.GetDeploymentConfigInput{ DeploymentConfigName: aws.String("DeploymentConfigName"), // Required @@ -492,7 +606,13 @@ func ExampleCodeDeploy_GetDeploymentConfig() { } func ExampleCodeDeploy_GetDeploymentGroup() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.GetDeploymentGroupInput{ ApplicationName: aws.String("ApplicationName"), // Required @@ -512,7 +632,13 @@ func ExampleCodeDeploy_GetDeploymentGroup() { } func ExampleCodeDeploy_GetDeploymentInstance() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.GetDeploymentInstanceInput{ DeploymentId: aws.String("DeploymentId"), // Required @@ -532,7 +658,13 @@ func ExampleCodeDeploy_GetDeploymentInstance() { } func ExampleCodeDeploy_GetOnPremisesInstance() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.GetOnPremisesInstanceInput{ InstanceName: aws.String("InstanceName"), // Required @@ -551,7 +683,13 @@ func ExampleCodeDeploy_GetOnPremisesInstance() { } func ExampleCodeDeploy_ListApplicationRevisions() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.ListApplicationRevisionsInput{ ApplicationName: aws.String("ApplicationName"), // Required @@ -576,7 +714,13 @@ func ExampleCodeDeploy_ListApplicationRevisions() { } func ExampleCodeDeploy_ListApplications() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.ListApplicationsInput{ NextToken: aws.String("NextToken"), @@ -595,7 +739,13 @@ func ExampleCodeDeploy_ListApplications() { } func ExampleCodeDeploy_ListDeploymentConfigs() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.ListDeploymentConfigsInput{ NextToken: aws.String("NextToken"), @@ -614,7 +764,13 @@ func ExampleCodeDeploy_ListDeploymentConfigs() { } func ExampleCodeDeploy_ListDeploymentGroups() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.ListDeploymentGroupsInput{ ApplicationName: aws.String("ApplicationName"), // Required @@ -634,7 +790,13 @@ func ExampleCodeDeploy_ListDeploymentGroups() { } func ExampleCodeDeploy_ListDeploymentInstances() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.ListDeploymentInstancesInput{ DeploymentId: aws.String("DeploymentId"), // Required @@ -658,7 +820,13 @@ func ExampleCodeDeploy_ListDeploymentInstances() { } func ExampleCodeDeploy_ListDeployments() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.ListDeploymentsInput{ ApplicationName: aws.String("ApplicationName"), @@ -687,7 +855,13 @@ func ExampleCodeDeploy_ListDeployments() { } func ExampleCodeDeploy_ListOnPremisesInstances() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.ListOnPremisesInstancesInput{ NextToken: aws.String("NextToken"), @@ -715,7 +889,13 @@ func ExampleCodeDeploy_ListOnPremisesInstances() { } func ExampleCodeDeploy_RegisterApplicationRevision() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.RegisterApplicationRevisionInput{ ApplicationName: aws.String("ApplicationName"), // Required @@ -749,7 +929,13 @@ func ExampleCodeDeploy_RegisterApplicationRevision() { } func ExampleCodeDeploy_RegisterOnPremisesInstance() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.RegisterOnPremisesInstanceInput{ IamUserArn: aws.String("IamUserArn"), // Required @@ -769,7 +955,13 @@ func ExampleCodeDeploy_RegisterOnPremisesInstance() { } func ExampleCodeDeploy_RemoveTagsFromOnPremisesInstances() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.RemoveTagsFromOnPremisesInstancesInput{ InstanceNames: []*string{ // Required @@ -798,7 +990,13 @@ func ExampleCodeDeploy_RemoveTagsFromOnPremisesInstances() { } func ExampleCodeDeploy_StopDeployment() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.StopDeploymentInput{ DeploymentId: aws.String("DeploymentId"), // Required @@ -817,7 +1015,13 @@ func ExampleCodeDeploy_StopDeployment() { } func ExampleCodeDeploy_UpdateApplication() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.UpdateApplicationInput{ ApplicationName: aws.String("ApplicationName"), @@ -837,7 +1041,13 @@ func ExampleCodeDeploy_UpdateApplication() { } func ExampleCodeDeploy_UpdateDeploymentGroup() { - svc := codedeploy.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codedeploy.New(sess) params := &codedeploy.UpdateDeploymentGroupInput{ ApplicationName: aws.String("ApplicationName"), // Required diff --git a/service/codepipeline/examples_test.go b/service/codepipeline/examples_test.go index 1cba0713df1..ca94b228c8b 100644 --- a/service/codepipeline/examples_test.go +++ b/service/codepipeline/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleCodePipeline_AcknowledgeJob() { - svc := codepipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codepipeline.New(sess) params := &codepipeline.AcknowledgeJobInput{ JobId: aws.String("JobId"), // Required @@ -36,7 +42,13 @@ func ExampleCodePipeline_AcknowledgeJob() { } func ExampleCodePipeline_AcknowledgeThirdPartyJob() { - svc := codepipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codepipeline.New(sess) params := &codepipeline.AcknowledgeThirdPartyJobInput{ ClientToken: aws.String("ClientToken"), // Required @@ -57,7 +69,13 @@ func ExampleCodePipeline_AcknowledgeThirdPartyJob() { } func ExampleCodePipeline_CreateCustomActionType() { - svc := codepipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codepipeline.New(sess) params := &codepipeline.CreateCustomActionTypeInput{ Category: aws.String("ActionCategory"), // Required @@ -104,7 +122,13 @@ func ExampleCodePipeline_CreateCustomActionType() { } func ExampleCodePipeline_CreatePipeline() { - svc := codepipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codepipeline.New(sess) params := &codepipeline.CreatePipelineInput{ Pipeline: &codepipeline.PipelineDeclaration{ // Required @@ -178,7 +202,13 @@ func ExampleCodePipeline_CreatePipeline() { } func ExampleCodePipeline_DeleteCustomActionType() { - svc := codepipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codepipeline.New(sess) params := &codepipeline.DeleteCustomActionTypeInput{ Category: aws.String("ActionCategory"), // Required @@ -199,7 +229,13 @@ func ExampleCodePipeline_DeleteCustomActionType() { } func ExampleCodePipeline_DeletePipeline() { - svc := codepipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codepipeline.New(sess) params := &codepipeline.DeletePipelineInput{ Name: aws.String("PipelineName"), // Required @@ -218,7 +254,13 @@ func ExampleCodePipeline_DeletePipeline() { } func ExampleCodePipeline_DisableStageTransition() { - svc := codepipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codepipeline.New(sess) params := &codepipeline.DisableStageTransitionInput{ PipelineName: aws.String("PipelineName"), // Required @@ -240,7 +282,13 @@ func ExampleCodePipeline_DisableStageTransition() { } func ExampleCodePipeline_EnableStageTransition() { - svc := codepipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codepipeline.New(sess) params := &codepipeline.EnableStageTransitionInput{ PipelineName: aws.String("PipelineName"), // Required @@ -261,7 +309,13 @@ func ExampleCodePipeline_EnableStageTransition() { } func ExampleCodePipeline_GetJobDetails() { - svc := codepipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codepipeline.New(sess) params := &codepipeline.GetJobDetailsInput{ JobId: aws.String("JobId"), // Required @@ -280,7 +334,13 @@ func ExampleCodePipeline_GetJobDetails() { } func ExampleCodePipeline_GetPipeline() { - svc := codepipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codepipeline.New(sess) params := &codepipeline.GetPipelineInput{ Name: aws.String("PipelineName"), // Required @@ -300,7 +360,13 @@ func ExampleCodePipeline_GetPipeline() { } func ExampleCodePipeline_GetPipelineState() { - svc := codepipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codepipeline.New(sess) params := &codepipeline.GetPipelineStateInput{ Name: aws.String("PipelineName"), // Required @@ -319,7 +385,13 @@ func ExampleCodePipeline_GetPipelineState() { } func ExampleCodePipeline_GetThirdPartyJobDetails() { - svc := codepipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codepipeline.New(sess) params := &codepipeline.GetThirdPartyJobDetailsInput{ ClientToken: aws.String("ClientToken"), // Required @@ -339,7 +411,13 @@ func ExampleCodePipeline_GetThirdPartyJobDetails() { } func ExampleCodePipeline_ListActionTypes() { - svc := codepipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codepipeline.New(sess) params := &codepipeline.ListActionTypesInput{ ActionOwnerFilter: aws.String("ActionOwner"), @@ -359,7 +437,13 @@ func ExampleCodePipeline_ListActionTypes() { } func ExampleCodePipeline_ListPipelines() { - svc := codepipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codepipeline.New(sess) params := &codepipeline.ListPipelinesInput{ NextToken: aws.String("NextToken"), @@ -378,7 +462,13 @@ func ExampleCodePipeline_ListPipelines() { } func ExampleCodePipeline_PollForJobs() { - svc := codepipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codepipeline.New(sess) params := &codepipeline.PollForJobsInput{ ActionTypeId: &codepipeline.ActionTypeId{ // Required @@ -407,7 +497,13 @@ func ExampleCodePipeline_PollForJobs() { } func ExampleCodePipeline_PollForThirdPartyJobs() { - svc := codepipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codepipeline.New(sess) params := &codepipeline.PollForThirdPartyJobsInput{ ActionTypeId: &codepipeline.ActionTypeId{ // Required @@ -432,7 +528,13 @@ func ExampleCodePipeline_PollForThirdPartyJobs() { } func ExampleCodePipeline_PutActionRevision() { - svc := codepipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codepipeline.New(sess) params := &codepipeline.PutActionRevisionInput{ ActionName: aws.String("ActionName"), // Required @@ -458,7 +560,13 @@ func ExampleCodePipeline_PutActionRevision() { } func ExampleCodePipeline_PutApprovalResult() { - svc := codepipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codepipeline.New(sess) params := &codepipeline.PutApprovalResultInput{ ActionName: aws.String("ActionName"), // Required @@ -484,7 +592,13 @@ func ExampleCodePipeline_PutApprovalResult() { } func ExampleCodePipeline_PutJobFailureResult() { - svc := codepipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codepipeline.New(sess) params := &codepipeline.PutJobFailureResultInput{ FailureDetails: &codepipeline.FailureDetails{ // Required @@ -508,7 +622,13 @@ func ExampleCodePipeline_PutJobFailureResult() { } func ExampleCodePipeline_PutJobSuccessResult() { - svc := codepipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codepipeline.New(sess) params := &codepipeline.PutJobSuccessResultInput{ JobId: aws.String("JobId"), // Required @@ -537,7 +657,13 @@ func ExampleCodePipeline_PutJobSuccessResult() { } func ExampleCodePipeline_PutThirdPartyJobFailureResult() { - svc := codepipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codepipeline.New(sess) params := &codepipeline.PutThirdPartyJobFailureResultInput{ ClientToken: aws.String("ClientToken"), // Required @@ -562,7 +688,13 @@ func ExampleCodePipeline_PutThirdPartyJobFailureResult() { } func ExampleCodePipeline_PutThirdPartyJobSuccessResult() { - svc := codepipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codepipeline.New(sess) params := &codepipeline.PutThirdPartyJobSuccessResultInput{ ClientToken: aws.String("ClientToken"), // Required @@ -592,7 +724,13 @@ func ExampleCodePipeline_PutThirdPartyJobSuccessResult() { } func ExampleCodePipeline_RetryStageExecution() { - svc := codepipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codepipeline.New(sess) params := &codepipeline.RetryStageExecutionInput{ PipelineExecutionId: aws.String("PipelineExecutionId"), // Required @@ -614,7 +752,13 @@ func ExampleCodePipeline_RetryStageExecution() { } func ExampleCodePipeline_StartPipelineExecution() { - svc := codepipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codepipeline.New(sess) params := &codepipeline.StartPipelineExecutionInput{ Name: aws.String("PipelineName"), // Required @@ -633,7 +777,13 @@ func ExampleCodePipeline_StartPipelineExecution() { } func ExampleCodePipeline_UpdatePipeline() { - svc := codepipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := codepipeline.New(sess) params := &codepipeline.UpdatePipelineInput{ Pipeline: &codepipeline.PipelineDeclaration{ // Required diff --git a/service/cognitoidentity/examples_test.go b/service/cognitoidentity/examples_test.go index 9389663b357..e5fbcd40a51 100644 --- a/service/cognitoidentity/examples_test.go +++ b/service/cognitoidentity/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleCognitoIdentity_CreateIdentityPool() { - svc := cognitoidentity.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentity.New(sess) params := &cognitoidentity.CreateIdentityPoolInput{ AllowUnauthenticatedIdentities: aws.Bool(true), // Required @@ -56,7 +62,13 @@ func ExampleCognitoIdentity_CreateIdentityPool() { } func ExampleCognitoIdentity_DeleteIdentities() { - svc := cognitoidentity.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentity.New(sess) params := &cognitoidentity.DeleteIdentitiesInput{ IdentityIdsToDelete: []*string{ // Required @@ -78,7 +90,13 @@ func ExampleCognitoIdentity_DeleteIdentities() { } func ExampleCognitoIdentity_DeleteIdentityPool() { - svc := cognitoidentity.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentity.New(sess) params := &cognitoidentity.DeleteIdentityPoolInput{ IdentityPoolId: aws.String("IdentityPoolId"), // Required @@ -97,7 +115,13 @@ func ExampleCognitoIdentity_DeleteIdentityPool() { } func ExampleCognitoIdentity_DescribeIdentity() { - svc := cognitoidentity.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentity.New(sess) params := &cognitoidentity.DescribeIdentityInput{ IdentityId: aws.String("IdentityId"), // Required @@ -116,7 +140,13 @@ func ExampleCognitoIdentity_DescribeIdentity() { } func ExampleCognitoIdentity_DescribeIdentityPool() { - svc := cognitoidentity.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentity.New(sess) params := &cognitoidentity.DescribeIdentityPoolInput{ IdentityPoolId: aws.String("IdentityPoolId"), // Required @@ -135,7 +165,13 @@ func ExampleCognitoIdentity_DescribeIdentityPool() { } func ExampleCognitoIdentity_GetCredentialsForIdentity() { - svc := cognitoidentity.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentity.New(sess) params := &cognitoidentity.GetCredentialsForIdentityInput{ IdentityId: aws.String("IdentityId"), // Required @@ -159,7 +195,13 @@ func ExampleCognitoIdentity_GetCredentialsForIdentity() { } func ExampleCognitoIdentity_GetId() { - svc := cognitoidentity.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentity.New(sess) params := &cognitoidentity.GetIdInput{ IdentityPoolId: aws.String("IdentityPoolId"), // Required @@ -183,7 +225,13 @@ func ExampleCognitoIdentity_GetId() { } func ExampleCognitoIdentity_GetIdentityPoolRoles() { - svc := cognitoidentity.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentity.New(sess) params := &cognitoidentity.GetIdentityPoolRolesInput{ IdentityPoolId: aws.String("IdentityPoolId"), // Required @@ -202,7 +250,13 @@ func ExampleCognitoIdentity_GetIdentityPoolRoles() { } func ExampleCognitoIdentity_GetOpenIdToken() { - svc := cognitoidentity.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentity.New(sess) params := &cognitoidentity.GetOpenIdTokenInput{ IdentityId: aws.String("IdentityId"), // Required @@ -225,7 +279,13 @@ func ExampleCognitoIdentity_GetOpenIdToken() { } func ExampleCognitoIdentity_GetOpenIdTokenForDeveloperIdentity() { - svc := cognitoidentity.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentity.New(sess) params := &cognitoidentity.GetOpenIdTokenForDeveloperIdentityInput{ IdentityPoolId: aws.String("IdentityPoolId"), // Required @@ -250,7 +310,13 @@ func ExampleCognitoIdentity_GetOpenIdTokenForDeveloperIdentity() { } func ExampleCognitoIdentity_ListIdentities() { - svc := cognitoidentity.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentity.New(sess) params := &cognitoidentity.ListIdentitiesInput{ IdentityPoolId: aws.String("IdentityPoolId"), // Required @@ -272,7 +338,13 @@ func ExampleCognitoIdentity_ListIdentities() { } func ExampleCognitoIdentity_ListIdentityPools() { - svc := cognitoidentity.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentity.New(sess) params := &cognitoidentity.ListIdentityPoolsInput{ MaxResults: aws.Int64(1), // Required @@ -292,7 +364,13 @@ func ExampleCognitoIdentity_ListIdentityPools() { } func ExampleCognitoIdentity_LookupDeveloperIdentity() { - svc := cognitoidentity.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentity.New(sess) params := &cognitoidentity.LookupDeveloperIdentityInput{ IdentityPoolId: aws.String("IdentityPoolId"), // Required @@ -315,7 +393,13 @@ func ExampleCognitoIdentity_LookupDeveloperIdentity() { } func ExampleCognitoIdentity_MergeDeveloperIdentities() { - svc := cognitoidentity.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentity.New(sess) params := &cognitoidentity.MergeDeveloperIdentitiesInput{ DestinationUserIdentifier: aws.String("DeveloperUserIdentifier"), // Required @@ -337,7 +421,13 @@ func ExampleCognitoIdentity_MergeDeveloperIdentities() { } func ExampleCognitoIdentity_SetIdentityPoolRoles() { - svc := cognitoidentity.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentity.New(sess) params := &cognitoidentity.SetIdentityPoolRolesInput{ IdentityPoolId: aws.String("IdentityPoolId"), // Required @@ -360,7 +450,13 @@ func ExampleCognitoIdentity_SetIdentityPoolRoles() { } func ExampleCognitoIdentity_UnlinkDeveloperIdentity() { - svc := cognitoidentity.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentity.New(sess) params := &cognitoidentity.UnlinkDeveloperIdentityInput{ DeveloperProviderName: aws.String("DeveloperProviderName"), // Required @@ -382,7 +478,13 @@ func ExampleCognitoIdentity_UnlinkDeveloperIdentity() { } func ExampleCognitoIdentity_UnlinkIdentity() { - svc := cognitoidentity.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentity.New(sess) params := &cognitoidentity.UnlinkIdentityInput{ IdentityId: aws.String("IdentityId"), // Required @@ -409,7 +511,13 @@ func ExampleCognitoIdentity_UnlinkIdentity() { } func ExampleCognitoIdentity_UpdateIdentityPool() { - svc := cognitoidentity.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentity.New(sess) params := &cognitoidentity.IdentityPool{ AllowUnauthenticatedIdentities: aws.Bool(true), // Required diff --git a/service/cognitoidentityprovider/examples_test.go b/service/cognitoidentityprovider/examples_test.go index 9c88c1f19b9..e33b6f7d6fa 100644 --- a/service/cognitoidentityprovider/examples_test.go +++ b/service/cognitoidentityprovider/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleCognitoIdentityProvider_AddCustomAttributes() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.AddCustomAttributesInput{ CustomAttributes: []*cognitoidentityprovider.SchemaAttributeType{ // Required @@ -53,7 +59,13 @@ func ExampleCognitoIdentityProvider_AddCustomAttributes() { } func ExampleCognitoIdentityProvider_AdminConfirmSignUp() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.AdminConfirmSignUpInput{ UserPoolId: aws.String("UserPoolIdType"), // Required @@ -73,7 +85,13 @@ func ExampleCognitoIdentityProvider_AdminConfirmSignUp() { } func ExampleCognitoIdentityProvider_AdminDeleteUser() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.AdminDeleteUserInput{ UserPoolId: aws.String("UserPoolIdType"), // Required @@ -93,7 +111,13 @@ func ExampleCognitoIdentityProvider_AdminDeleteUser() { } func ExampleCognitoIdentityProvider_AdminDeleteUserAttributes() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.AdminDeleteUserAttributesInput{ UserAttributeNames: []*string{ // Required @@ -117,7 +141,13 @@ func ExampleCognitoIdentityProvider_AdminDeleteUserAttributes() { } func ExampleCognitoIdentityProvider_AdminDisableUser() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.AdminDisableUserInput{ UserPoolId: aws.String("UserPoolIdType"), // Required @@ -137,7 +167,13 @@ func ExampleCognitoIdentityProvider_AdminDisableUser() { } func ExampleCognitoIdentityProvider_AdminEnableUser() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.AdminEnableUserInput{ UserPoolId: aws.String("UserPoolIdType"), // Required @@ -157,7 +193,13 @@ func ExampleCognitoIdentityProvider_AdminEnableUser() { } func ExampleCognitoIdentityProvider_AdminForgetDevice() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.AdminForgetDeviceInput{ DeviceKey: aws.String("DeviceKeyType"), // Required @@ -178,7 +220,13 @@ func ExampleCognitoIdentityProvider_AdminForgetDevice() { } func ExampleCognitoIdentityProvider_AdminGetDevice() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.AdminGetDeviceInput{ DeviceKey: aws.String("DeviceKeyType"), // Required @@ -199,7 +247,13 @@ func ExampleCognitoIdentityProvider_AdminGetDevice() { } func ExampleCognitoIdentityProvider_AdminGetUser() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.AdminGetUserInput{ UserPoolId: aws.String("UserPoolIdType"), // Required @@ -219,7 +273,13 @@ func ExampleCognitoIdentityProvider_AdminGetUser() { } func ExampleCognitoIdentityProvider_AdminInitiateAuth() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.AdminInitiateAuthInput{ AuthFlow: aws.String("AuthFlowType"), // Required @@ -248,7 +308,13 @@ func ExampleCognitoIdentityProvider_AdminInitiateAuth() { } func ExampleCognitoIdentityProvider_AdminListDevices() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.AdminListDevicesInput{ UserPoolId: aws.String("UserPoolIdType"), // Required @@ -270,7 +336,13 @@ func ExampleCognitoIdentityProvider_AdminListDevices() { } func ExampleCognitoIdentityProvider_AdminResetUserPassword() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.AdminResetUserPasswordInput{ UserPoolId: aws.String("UserPoolIdType"), // Required @@ -290,7 +362,13 @@ func ExampleCognitoIdentityProvider_AdminResetUserPassword() { } func ExampleCognitoIdentityProvider_AdminRespondToAuthChallenge() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.AdminRespondToAuthChallengeInput{ ChallengeName: aws.String("ChallengeNameType"), // Required @@ -316,7 +394,13 @@ func ExampleCognitoIdentityProvider_AdminRespondToAuthChallenge() { } func ExampleCognitoIdentityProvider_AdminSetUserSettings() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.AdminSetUserSettingsInput{ MFAOptions: []*cognitoidentityprovider.MFAOptionType{ // Required @@ -343,7 +427,13 @@ func ExampleCognitoIdentityProvider_AdminSetUserSettings() { } func ExampleCognitoIdentityProvider_AdminUpdateDeviceStatus() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.AdminUpdateDeviceStatusInput{ DeviceKey: aws.String("DeviceKeyType"), // Required @@ -365,7 +455,13 @@ func ExampleCognitoIdentityProvider_AdminUpdateDeviceStatus() { } func ExampleCognitoIdentityProvider_AdminUpdateUserAttributes() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.AdminUpdateUserAttributesInput{ UserAttributes: []*cognitoidentityprovider.AttributeType{ // Required @@ -392,7 +488,13 @@ func ExampleCognitoIdentityProvider_AdminUpdateUserAttributes() { } func ExampleCognitoIdentityProvider_AdminUserGlobalSignOut() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.AdminUserGlobalSignOutInput{ UserPoolId: aws.String("UserPoolIdType"), // Required @@ -412,7 +514,13 @@ func ExampleCognitoIdentityProvider_AdminUserGlobalSignOut() { } func ExampleCognitoIdentityProvider_ChangePassword() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.ChangePasswordInput{ PreviousPassword: aws.String("PasswordType"), // Required @@ -433,7 +541,13 @@ func ExampleCognitoIdentityProvider_ChangePassword() { } func ExampleCognitoIdentityProvider_ConfirmDevice() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.ConfirmDeviceInput{ AccessToken: aws.String("TokenModelType"), // Required @@ -458,7 +572,13 @@ func ExampleCognitoIdentityProvider_ConfirmDevice() { } func ExampleCognitoIdentityProvider_ConfirmForgotPassword() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.ConfirmForgotPasswordInput{ ClientId: aws.String("ClientIdType"), // Required @@ -481,7 +601,13 @@ func ExampleCognitoIdentityProvider_ConfirmForgotPassword() { } func ExampleCognitoIdentityProvider_ConfirmSignUp() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.ConfirmSignUpInput{ ClientId: aws.String("ClientIdType"), // Required @@ -504,7 +630,13 @@ func ExampleCognitoIdentityProvider_ConfirmSignUp() { } func ExampleCognitoIdentityProvider_CreateUserPool() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.CreateUserPoolInput{ PoolName: aws.String("UserPoolNameType"), // Required @@ -567,7 +699,13 @@ func ExampleCognitoIdentityProvider_CreateUserPool() { } func ExampleCognitoIdentityProvider_CreateUserPoolClient() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.CreateUserPoolClientInput{ ClientName: aws.String("ClientNameType"), // Required @@ -601,7 +739,13 @@ func ExampleCognitoIdentityProvider_CreateUserPoolClient() { } func ExampleCognitoIdentityProvider_DeleteUser() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.DeleteUserInput{ AccessToken: aws.String("TokenModelType"), @@ -620,7 +764,13 @@ func ExampleCognitoIdentityProvider_DeleteUser() { } func ExampleCognitoIdentityProvider_DeleteUserAttributes() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.DeleteUserAttributesInput{ UserAttributeNames: []*string{ // Required @@ -643,7 +793,13 @@ func ExampleCognitoIdentityProvider_DeleteUserAttributes() { } func ExampleCognitoIdentityProvider_DeleteUserPool() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.DeleteUserPoolInput{ UserPoolId: aws.String("UserPoolIdType"), // Required @@ -662,7 +818,13 @@ func ExampleCognitoIdentityProvider_DeleteUserPool() { } func ExampleCognitoIdentityProvider_DeleteUserPoolClient() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.DeleteUserPoolClientInput{ ClientId: aws.String("ClientIdType"), // Required @@ -682,7 +844,13 @@ func ExampleCognitoIdentityProvider_DeleteUserPoolClient() { } func ExampleCognitoIdentityProvider_DescribeUserPool() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.DescribeUserPoolInput{ UserPoolId: aws.String("UserPoolIdType"), // Required @@ -701,7 +869,13 @@ func ExampleCognitoIdentityProvider_DescribeUserPool() { } func ExampleCognitoIdentityProvider_DescribeUserPoolClient() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.DescribeUserPoolClientInput{ ClientId: aws.String("ClientIdType"), // Required @@ -721,7 +895,13 @@ func ExampleCognitoIdentityProvider_DescribeUserPoolClient() { } func ExampleCognitoIdentityProvider_ForgetDevice() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.ForgetDeviceInput{ DeviceKey: aws.String("DeviceKeyType"), // Required @@ -741,7 +921,13 @@ func ExampleCognitoIdentityProvider_ForgetDevice() { } func ExampleCognitoIdentityProvider_ForgotPassword() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.ForgotPasswordInput{ ClientId: aws.String("ClientIdType"), // Required @@ -762,7 +948,13 @@ func ExampleCognitoIdentityProvider_ForgotPassword() { } func ExampleCognitoIdentityProvider_GetDevice() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.GetDeviceInput{ DeviceKey: aws.String("DeviceKeyType"), // Required @@ -782,7 +974,13 @@ func ExampleCognitoIdentityProvider_GetDevice() { } func ExampleCognitoIdentityProvider_GetUser() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.GetUserInput{ AccessToken: aws.String("TokenModelType"), @@ -801,7 +999,13 @@ func ExampleCognitoIdentityProvider_GetUser() { } func ExampleCognitoIdentityProvider_GetUserAttributeVerificationCode() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.GetUserAttributeVerificationCodeInput{ AttributeName: aws.String("AttributeNameType"), // Required @@ -821,7 +1025,13 @@ func ExampleCognitoIdentityProvider_GetUserAttributeVerificationCode() { } func ExampleCognitoIdentityProvider_GlobalSignOut() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.GlobalSignOutInput{ AccessToken: aws.String("TokenModelType"), @@ -840,7 +1050,13 @@ func ExampleCognitoIdentityProvider_GlobalSignOut() { } func ExampleCognitoIdentityProvider_InitiateAuth() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.InitiateAuthInput{ AuthFlow: aws.String("AuthFlowType"), // Required @@ -868,7 +1084,13 @@ func ExampleCognitoIdentityProvider_InitiateAuth() { } func ExampleCognitoIdentityProvider_ListDevices() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.ListDevicesInput{ AccessToken: aws.String("TokenModelType"), // Required @@ -889,7 +1111,13 @@ func ExampleCognitoIdentityProvider_ListDevices() { } func ExampleCognitoIdentityProvider_ListUserPoolClients() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.ListUserPoolClientsInput{ UserPoolId: aws.String("UserPoolIdType"), // Required @@ -910,7 +1138,13 @@ func ExampleCognitoIdentityProvider_ListUserPoolClients() { } func ExampleCognitoIdentityProvider_ListUserPools() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.ListUserPoolsInput{ MaxResults: aws.Int64(1), // Required @@ -930,7 +1164,13 @@ func ExampleCognitoIdentityProvider_ListUserPools() { } func ExampleCognitoIdentityProvider_ListUsers() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.ListUsersInput{ UserPoolId: aws.String("UserPoolIdType"), // Required @@ -956,7 +1196,13 @@ func ExampleCognitoIdentityProvider_ListUsers() { } func ExampleCognitoIdentityProvider_ResendConfirmationCode() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.ResendConfirmationCodeInput{ ClientId: aws.String("ClientIdType"), // Required @@ -977,7 +1223,13 @@ func ExampleCognitoIdentityProvider_ResendConfirmationCode() { } func ExampleCognitoIdentityProvider_RespondToAuthChallenge() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.RespondToAuthChallengeInput{ ChallengeName: aws.String("ChallengeNameType"), // Required @@ -1002,7 +1254,13 @@ func ExampleCognitoIdentityProvider_RespondToAuthChallenge() { } func ExampleCognitoIdentityProvider_SetUserSettings() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.SetUserSettingsInput{ AccessToken: aws.String("TokenModelType"), // Required @@ -1028,7 +1286,13 @@ func ExampleCognitoIdentityProvider_SetUserSettings() { } func ExampleCognitoIdentityProvider_SignUp() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.SignUpInput{ ClientId: aws.String("ClientIdType"), // Required @@ -1064,7 +1328,13 @@ func ExampleCognitoIdentityProvider_SignUp() { } func ExampleCognitoIdentityProvider_UpdateDeviceStatus() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.UpdateDeviceStatusInput{ AccessToken: aws.String("TokenModelType"), // Required @@ -1085,7 +1355,13 @@ func ExampleCognitoIdentityProvider_UpdateDeviceStatus() { } func ExampleCognitoIdentityProvider_UpdateUserAttributes() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.UpdateUserAttributesInput{ UserAttributes: []*cognitoidentityprovider.AttributeType{ // Required @@ -1111,7 +1387,13 @@ func ExampleCognitoIdentityProvider_UpdateUserAttributes() { } func ExampleCognitoIdentityProvider_UpdateUserPool() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.UpdateUserPoolInput{ UserPoolId: aws.String("UserPoolIdType"), // Required @@ -1170,7 +1452,13 @@ func ExampleCognitoIdentityProvider_UpdateUserPool() { } func ExampleCognitoIdentityProvider_UpdateUserPoolClient() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.UpdateUserPoolClientInput{ ClientId: aws.String("ClientIdType"), // Required @@ -1204,7 +1492,13 @@ func ExampleCognitoIdentityProvider_UpdateUserPoolClient() { } func ExampleCognitoIdentityProvider_VerifyUserAttribute() { - svc := cognitoidentityprovider.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := cognitoidentityprovider.New(sess) params := &cognitoidentityprovider.VerifyUserAttributeInput{ AttributeName: aws.String("AttributeNameType"), // Required diff --git a/service/cognitosync/examples_test.go b/service/cognitosync/examples_test.go index 0e38d401e8f..2aa1735ae69 100644 --- a/service/cognitosync/examples_test.go +++ b/service/cognitosync/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleCognitoSync_BulkPublish() { - svc := cognitosync.New(session.New()) + 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 @@ -35,7 +41,13 @@ func ExampleCognitoSync_BulkPublish() { } func ExampleCognitoSync_DeleteDataset() { - svc := cognitosync.New(session.New()) + 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 @@ -56,7 +68,13 @@ func ExampleCognitoSync_DeleteDataset() { } func ExampleCognitoSync_DescribeDataset() { - svc := cognitosync.New(session.New()) + 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 @@ -77,7 +95,13 @@ func ExampleCognitoSync_DescribeDataset() { } func ExampleCognitoSync_DescribeIdentityPoolUsage() { - svc := cognitosync.New(session.New()) + 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 @@ -96,7 +120,13 @@ func ExampleCognitoSync_DescribeIdentityPoolUsage() { } func ExampleCognitoSync_DescribeIdentityUsage() { - svc := cognitosync.New(session.New()) + 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 @@ -116,7 +146,13 @@ func ExampleCognitoSync_DescribeIdentityUsage() { } func ExampleCognitoSync_GetBulkPublishDetails() { - svc := cognitosync.New(session.New()) + 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 @@ -135,7 +171,13 @@ func ExampleCognitoSync_GetBulkPublishDetails() { } func ExampleCognitoSync_GetCognitoEvents() { - svc := cognitosync.New(session.New()) + 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 @@ -154,7 +196,13 @@ func ExampleCognitoSync_GetCognitoEvents() { } func ExampleCognitoSync_GetIdentityPoolConfiguration() { - svc := cognitosync.New(session.New()) + 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 @@ -173,7 +221,13 @@ func ExampleCognitoSync_GetIdentityPoolConfiguration() { } func ExampleCognitoSync_ListDatasets() { - svc := cognitosync.New(session.New()) + 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 @@ -195,7 +249,13 @@ func ExampleCognitoSync_ListDatasets() { } func ExampleCognitoSync_ListIdentityPoolUsage() { - svc := cognitosync.New(session.New()) + 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), @@ -215,7 +275,13 @@ func ExampleCognitoSync_ListIdentityPoolUsage() { } func ExampleCognitoSync_ListRecords() { - svc := cognitosync.New(session.New()) + 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 @@ -240,7 +306,13 @@ func ExampleCognitoSync_ListRecords() { } func ExampleCognitoSync_RegisterDevice() { - svc := cognitosync.New(session.New()) + 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 @@ -262,7 +334,13 @@ func ExampleCognitoSync_RegisterDevice() { } func ExampleCognitoSync_SetCognitoEvents() { - svc := cognitosync.New(session.New()) + 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 @@ -285,7 +363,13 @@ func ExampleCognitoSync_SetCognitoEvents() { } func ExampleCognitoSync_SetIdentityPoolConfiguration() { - svc := cognitosync.New(session.New()) + 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 @@ -316,7 +400,13 @@ func ExampleCognitoSync_SetIdentityPoolConfiguration() { } func ExampleCognitoSync_SubscribeToDataset() { - svc := cognitosync.New(session.New()) + 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 @@ -338,7 +428,13 @@ func ExampleCognitoSync_SubscribeToDataset() { } func ExampleCognitoSync_UnsubscribeFromDataset() { - svc := cognitosync.New(session.New()) + 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 @@ -360,7 +456,13 @@ func ExampleCognitoSync_UnsubscribeFromDataset() { } func ExampleCognitoSync_UpdateRecords() { - svc := cognitosync.New(session.New()) + 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 diff --git a/service/configservice/examples_test.go b/service/configservice/examples_test.go index fbe99df2f2f..eceb822ee43 100644 --- a/service/configservice/examples_test.go +++ b/service/configservice/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleConfigService_DeleteConfigRule() { - svc := configservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := configservice.New(sess) params := &configservice.DeleteConfigRuleInput{ ConfigRuleName: aws.String("StringWithCharLimit64"), // Required @@ -35,7 +41,13 @@ func ExampleConfigService_DeleteConfigRule() { } func ExampleConfigService_DeleteConfigurationRecorder() { - svc := configservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := configservice.New(sess) params := &configservice.DeleteConfigurationRecorderInput{ ConfigurationRecorderName: aws.String("RecorderName"), // Required @@ -54,7 +66,13 @@ func ExampleConfigService_DeleteConfigurationRecorder() { } func ExampleConfigService_DeleteDeliveryChannel() { - svc := configservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := configservice.New(sess) params := &configservice.DeleteDeliveryChannelInput{ DeliveryChannelName: aws.String("ChannelName"), // Required @@ -73,7 +91,13 @@ func ExampleConfigService_DeleteDeliveryChannel() { } func ExampleConfigService_DeleteEvaluationResults() { - svc := configservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := configservice.New(sess) params := &configservice.DeleteEvaluationResultsInput{ ConfigRuleName: aws.String("StringWithCharLimit64"), // Required @@ -92,7 +116,13 @@ func ExampleConfigService_DeleteEvaluationResults() { } func ExampleConfigService_DeliverConfigSnapshot() { - svc := configservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := configservice.New(sess) params := &configservice.DeliverConfigSnapshotInput{ DeliveryChannelName: aws.String("ChannelName"), // Required @@ -111,7 +141,13 @@ func ExampleConfigService_DeliverConfigSnapshot() { } func ExampleConfigService_DescribeComplianceByConfigRule() { - svc := configservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := configservice.New(sess) params := &configservice.DescribeComplianceByConfigRuleInput{ ComplianceTypes: []*string{ @@ -138,7 +174,13 @@ func ExampleConfigService_DescribeComplianceByConfigRule() { } func ExampleConfigService_DescribeComplianceByResource() { - svc := configservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := configservice.New(sess) params := &configservice.DescribeComplianceByResourceInput{ ComplianceTypes: []*string{ @@ -164,7 +206,13 @@ func ExampleConfigService_DescribeComplianceByResource() { } func ExampleConfigService_DescribeConfigRuleEvaluationStatus() { - svc := configservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := configservice.New(sess) params := &configservice.DescribeConfigRuleEvaluationStatusInput{ ConfigRuleNames: []*string{ @@ -186,7 +234,13 @@ func ExampleConfigService_DescribeConfigRuleEvaluationStatus() { } func ExampleConfigService_DescribeConfigRules() { - svc := configservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := configservice.New(sess) params := &configservice.DescribeConfigRulesInput{ ConfigRuleNames: []*string{ @@ -209,7 +263,13 @@ func ExampleConfigService_DescribeConfigRules() { } func ExampleConfigService_DescribeConfigurationRecorderStatus() { - svc := configservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := configservice.New(sess) params := &configservice.DescribeConfigurationRecorderStatusInput{ ConfigurationRecorderNames: []*string{ @@ -231,7 +291,13 @@ func ExampleConfigService_DescribeConfigurationRecorderStatus() { } func ExampleConfigService_DescribeConfigurationRecorders() { - svc := configservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := configservice.New(sess) params := &configservice.DescribeConfigurationRecordersInput{ ConfigurationRecorderNames: []*string{ @@ -253,7 +319,13 @@ func ExampleConfigService_DescribeConfigurationRecorders() { } func ExampleConfigService_DescribeDeliveryChannelStatus() { - svc := configservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := configservice.New(sess) params := &configservice.DescribeDeliveryChannelStatusInput{ DeliveryChannelNames: []*string{ @@ -275,7 +347,13 @@ func ExampleConfigService_DescribeDeliveryChannelStatus() { } func ExampleConfigService_DescribeDeliveryChannels() { - svc := configservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := configservice.New(sess) params := &configservice.DescribeDeliveryChannelsInput{ DeliveryChannelNames: []*string{ @@ -297,7 +375,13 @@ func ExampleConfigService_DescribeDeliveryChannels() { } func ExampleConfigService_GetComplianceDetailsByConfigRule() { - svc := configservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := configservice.New(sess) params := &configservice.GetComplianceDetailsByConfigRuleInput{ ConfigRuleName: aws.String("StringWithCharLimit64"), // Required @@ -322,7 +406,13 @@ func ExampleConfigService_GetComplianceDetailsByConfigRule() { } func ExampleConfigService_GetComplianceDetailsByResource() { - svc := configservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := configservice.New(sess) params := &configservice.GetComplianceDetailsByResourceInput{ ResourceId: aws.String("StringWithCharLimit256"), // Required @@ -347,7 +437,13 @@ func ExampleConfigService_GetComplianceDetailsByResource() { } func ExampleConfigService_GetComplianceSummaryByConfigRule() { - svc := configservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := configservice.New(sess) var params *configservice.GetComplianceSummaryByConfigRuleInput resp, err := svc.GetComplianceSummaryByConfigRule(params) @@ -364,7 +460,13 @@ func ExampleConfigService_GetComplianceSummaryByConfigRule() { } func ExampleConfigService_GetComplianceSummaryByResourceType() { - svc := configservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := configservice.New(sess) params := &configservice.GetComplianceSummaryByResourceTypeInput{ ResourceTypes: []*string{ @@ -386,7 +488,13 @@ func ExampleConfigService_GetComplianceSummaryByResourceType() { } func ExampleConfigService_GetResourceConfigHistory() { - svc := configservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := configservice.New(sess) params := &configservice.GetResourceConfigHistoryInput{ ResourceId: aws.String("ResourceId"), // Required @@ -411,7 +519,13 @@ func ExampleConfigService_GetResourceConfigHistory() { } func ExampleConfigService_ListDiscoveredResources() { - svc := configservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := configservice.New(sess) params := &configservice.ListDiscoveredResourcesInput{ ResourceType: aws.String("ResourceType"), // Required @@ -438,7 +552,13 @@ func ExampleConfigService_ListDiscoveredResources() { } func ExampleConfigService_PutConfigRule() { - svc := configservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := configservice.New(sess) params := &configservice.PutConfigRuleInput{ ConfigRule: &configservice.ConfigRule{ // Required @@ -486,7 +606,13 @@ func ExampleConfigService_PutConfigRule() { } func ExampleConfigService_PutConfigurationRecorder() { - svc := configservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := configservice.New(sess) params := &configservice.PutConfigurationRecorderInput{ ConfigurationRecorder: &configservice.ConfigurationRecorder{ // Required @@ -516,7 +642,13 @@ func ExampleConfigService_PutConfigurationRecorder() { } func ExampleConfigService_PutDeliveryChannel() { - svc := configservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := configservice.New(sess) params := &configservice.PutDeliveryChannelInput{ DeliveryChannel: &configservice.DeliveryChannel{ // Required @@ -543,7 +675,13 @@ func ExampleConfigService_PutDeliveryChannel() { } func ExampleConfigService_PutEvaluations() { - svc := configservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := configservice.New(sess) params := &configservice.PutEvaluationsInput{ ResultToken: aws.String("String"), // Required @@ -572,7 +710,13 @@ func ExampleConfigService_PutEvaluations() { } func ExampleConfigService_StartConfigRulesEvaluation() { - svc := configservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := configservice.New(sess) params := &configservice.StartConfigRulesEvaluationInput{ ConfigRuleNames: []*string{ @@ -594,7 +738,13 @@ func ExampleConfigService_StartConfigRulesEvaluation() { } func ExampleConfigService_StartConfigurationRecorder() { - svc := configservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := configservice.New(sess) params := &configservice.StartConfigurationRecorderInput{ ConfigurationRecorderName: aws.String("RecorderName"), // Required @@ -613,7 +763,13 @@ func ExampleConfigService_StartConfigurationRecorder() { } func ExampleConfigService_StopConfigurationRecorder() { - svc := configservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := configservice.New(sess) params := &configservice.StopConfigurationRecorderInput{ ConfigurationRecorderName: aws.String("RecorderName"), // Required diff --git a/service/databasemigrationservice/examples_test.go b/service/databasemigrationservice/examples_test.go index 47f8c9d7eec..fc1867ce1f8 100644 --- a/service/databasemigrationservice/examples_test.go +++ b/service/databasemigrationservice/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleDatabaseMigrationService_AddTagsToResource() { - svc := databasemigrationservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := databasemigrationservice.New(sess) params := &databasemigrationservice.AddTagsToResourceInput{ ResourceArn: aws.String("String"), // Required @@ -42,7 +48,13 @@ func ExampleDatabaseMigrationService_AddTagsToResource() { } func ExampleDatabaseMigrationService_CreateEndpoint() { - svc := databasemigrationservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := databasemigrationservice.New(sess) params := &databasemigrationservice.CreateEndpointInput{ EndpointIdentifier: aws.String("String"), // Required @@ -79,7 +91,13 @@ func ExampleDatabaseMigrationService_CreateEndpoint() { } func ExampleDatabaseMigrationService_CreateReplicationInstance() { - svc := databasemigrationservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := databasemigrationservice.New(sess) params := &databasemigrationservice.CreateReplicationInstanceInput{ ReplicationInstanceClass: aws.String("String"), // Required @@ -119,7 +137,13 @@ func ExampleDatabaseMigrationService_CreateReplicationInstance() { } func ExampleDatabaseMigrationService_CreateReplicationSubnetGroup() { - svc := databasemigrationservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := databasemigrationservice.New(sess) params := &databasemigrationservice.CreateReplicationSubnetGroupInput{ ReplicationSubnetGroupDescription: aws.String("String"), // Required @@ -150,7 +174,13 @@ func ExampleDatabaseMigrationService_CreateReplicationSubnetGroup() { } func ExampleDatabaseMigrationService_CreateReplicationTask() { - svc := databasemigrationservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := databasemigrationservice.New(sess) params := &databasemigrationservice.CreateReplicationTaskInput{ MigrationType: aws.String("MigrationTypeValue"), // Required @@ -183,7 +213,13 @@ func ExampleDatabaseMigrationService_CreateReplicationTask() { } func ExampleDatabaseMigrationService_DeleteCertificate() { - svc := databasemigrationservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := databasemigrationservice.New(sess) params := &databasemigrationservice.DeleteCertificateInput{ CertificateArn: aws.String("String"), // Required @@ -202,7 +238,13 @@ func ExampleDatabaseMigrationService_DeleteCertificate() { } func ExampleDatabaseMigrationService_DeleteEndpoint() { - svc := databasemigrationservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := databasemigrationservice.New(sess) params := &databasemigrationservice.DeleteEndpointInput{ EndpointArn: aws.String("String"), // Required @@ -221,7 +263,13 @@ func ExampleDatabaseMigrationService_DeleteEndpoint() { } func ExampleDatabaseMigrationService_DeleteReplicationInstance() { - svc := databasemigrationservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := databasemigrationservice.New(sess) params := &databasemigrationservice.DeleteReplicationInstanceInput{ ReplicationInstanceArn: aws.String("String"), // Required @@ -240,7 +288,13 @@ func ExampleDatabaseMigrationService_DeleteReplicationInstance() { } func ExampleDatabaseMigrationService_DeleteReplicationSubnetGroup() { - svc := databasemigrationservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := databasemigrationservice.New(sess) params := &databasemigrationservice.DeleteReplicationSubnetGroupInput{ ReplicationSubnetGroupIdentifier: aws.String("String"), // Required @@ -259,7 +313,13 @@ func ExampleDatabaseMigrationService_DeleteReplicationSubnetGroup() { } func ExampleDatabaseMigrationService_DeleteReplicationTask() { - svc := databasemigrationservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := databasemigrationservice.New(sess) params := &databasemigrationservice.DeleteReplicationTaskInput{ ReplicationTaskArn: aws.String("String"), // Required @@ -278,7 +338,13 @@ func ExampleDatabaseMigrationService_DeleteReplicationTask() { } func ExampleDatabaseMigrationService_DescribeAccountAttributes() { - svc := databasemigrationservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := databasemigrationservice.New(sess) var params *databasemigrationservice.DescribeAccountAttributesInput resp, err := svc.DescribeAccountAttributes(params) @@ -295,7 +361,13 @@ func ExampleDatabaseMigrationService_DescribeAccountAttributes() { } func ExampleDatabaseMigrationService_DescribeCertificates() { - svc := databasemigrationservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := databasemigrationservice.New(sess) params := &databasemigrationservice.DescribeCertificatesInput{ Filters: []*databasemigrationservice.Filter{ @@ -325,7 +397,13 @@ func ExampleDatabaseMigrationService_DescribeCertificates() { } func ExampleDatabaseMigrationService_DescribeConnections() { - svc := databasemigrationservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := databasemigrationservice.New(sess) params := &databasemigrationservice.DescribeConnectionsInput{ Filters: []*databasemigrationservice.Filter{ @@ -355,7 +433,13 @@ func ExampleDatabaseMigrationService_DescribeConnections() { } func ExampleDatabaseMigrationService_DescribeEndpointTypes() { - svc := databasemigrationservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := databasemigrationservice.New(sess) params := &databasemigrationservice.DescribeEndpointTypesInput{ Filters: []*databasemigrationservice.Filter{ @@ -385,7 +469,13 @@ func ExampleDatabaseMigrationService_DescribeEndpointTypes() { } func ExampleDatabaseMigrationService_DescribeEndpoints() { - svc := databasemigrationservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := databasemigrationservice.New(sess) params := &databasemigrationservice.DescribeEndpointsInput{ Filters: []*databasemigrationservice.Filter{ @@ -415,7 +505,13 @@ func ExampleDatabaseMigrationService_DescribeEndpoints() { } func ExampleDatabaseMigrationService_DescribeOrderableReplicationInstances() { - svc := databasemigrationservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := databasemigrationservice.New(sess) params := &databasemigrationservice.DescribeOrderableReplicationInstancesInput{ Marker: aws.String("String"), @@ -435,7 +531,13 @@ func ExampleDatabaseMigrationService_DescribeOrderableReplicationInstances() { } func ExampleDatabaseMigrationService_DescribeRefreshSchemasStatus() { - svc := databasemigrationservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := databasemigrationservice.New(sess) params := &databasemigrationservice.DescribeRefreshSchemasStatusInput{ EndpointArn: aws.String("String"), // Required @@ -454,7 +556,13 @@ func ExampleDatabaseMigrationService_DescribeRefreshSchemasStatus() { } func ExampleDatabaseMigrationService_DescribeReplicationInstances() { - svc := databasemigrationservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := databasemigrationservice.New(sess) params := &databasemigrationservice.DescribeReplicationInstancesInput{ Filters: []*databasemigrationservice.Filter{ @@ -484,7 +592,13 @@ func ExampleDatabaseMigrationService_DescribeReplicationInstances() { } func ExampleDatabaseMigrationService_DescribeReplicationSubnetGroups() { - svc := databasemigrationservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := databasemigrationservice.New(sess) params := &databasemigrationservice.DescribeReplicationSubnetGroupsInput{ Filters: []*databasemigrationservice.Filter{ @@ -514,7 +628,13 @@ func ExampleDatabaseMigrationService_DescribeReplicationSubnetGroups() { } func ExampleDatabaseMigrationService_DescribeReplicationTasks() { - svc := databasemigrationservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := databasemigrationservice.New(sess) params := &databasemigrationservice.DescribeReplicationTasksInput{ Filters: []*databasemigrationservice.Filter{ @@ -544,7 +664,13 @@ func ExampleDatabaseMigrationService_DescribeReplicationTasks() { } func ExampleDatabaseMigrationService_DescribeSchemas() { - svc := databasemigrationservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := databasemigrationservice.New(sess) params := &databasemigrationservice.DescribeSchemasInput{ EndpointArn: aws.String("String"), // Required @@ -565,7 +691,13 @@ func ExampleDatabaseMigrationService_DescribeSchemas() { } func ExampleDatabaseMigrationService_DescribeTableStatistics() { - svc := databasemigrationservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := databasemigrationservice.New(sess) params := &databasemigrationservice.DescribeTableStatisticsInput{ ReplicationTaskArn: aws.String("String"), // Required @@ -586,7 +718,13 @@ func ExampleDatabaseMigrationService_DescribeTableStatistics() { } func ExampleDatabaseMigrationService_ImportCertificate() { - svc := databasemigrationservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := databasemigrationservice.New(sess) params := &databasemigrationservice.ImportCertificateInput{ CertificateIdentifier: aws.String("String"), // Required @@ -606,7 +744,13 @@ func ExampleDatabaseMigrationService_ImportCertificate() { } func ExampleDatabaseMigrationService_ListTagsForResource() { - svc := databasemigrationservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := databasemigrationservice.New(sess) params := &databasemigrationservice.ListTagsForResourceInput{ ResourceArn: aws.String("String"), // Required @@ -625,7 +769,13 @@ func ExampleDatabaseMigrationService_ListTagsForResource() { } func ExampleDatabaseMigrationService_ModifyEndpoint() { - svc := databasemigrationservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := databasemigrationservice.New(sess) params := &databasemigrationservice.ModifyEndpointInput{ EndpointArn: aws.String("String"), // Required @@ -655,7 +805,13 @@ func ExampleDatabaseMigrationService_ModifyEndpoint() { } func ExampleDatabaseMigrationService_ModifyReplicationInstance() { - svc := databasemigrationservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := databasemigrationservice.New(sess) params := &databasemigrationservice.ModifyReplicationInstanceInput{ ReplicationInstanceArn: aws.String("String"), // Required @@ -687,7 +843,13 @@ func ExampleDatabaseMigrationService_ModifyReplicationInstance() { } func ExampleDatabaseMigrationService_ModifyReplicationSubnetGroup() { - svc := databasemigrationservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := databasemigrationservice.New(sess) params := &databasemigrationservice.ModifyReplicationSubnetGroupInput{ ReplicationSubnetGroupIdentifier: aws.String("String"), // Required @@ -711,7 +873,13 @@ func ExampleDatabaseMigrationService_ModifyReplicationSubnetGroup() { } func ExampleDatabaseMigrationService_RefreshSchemas() { - svc := databasemigrationservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := databasemigrationservice.New(sess) params := &databasemigrationservice.RefreshSchemasInput{ EndpointArn: aws.String("String"), // Required @@ -731,7 +899,13 @@ func ExampleDatabaseMigrationService_RefreshSchemas() { } func ExampleDatabaseMigrationService_RemoveTagsFromResource() { - svc := databasemigrationservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := databasemigrationservice.New(sess) params := &databasemigrationservice.RemoveTagsFromResourceInput{ ResourceArn: aws.String("String"), // Required @@ -754,7 +928,13 @@ func ExampleDatabaseMigrationService_RemoveTagsFromResource() { } func ExampleDatabaseMigrationService_StartReplicationTask() { - svc := databasemigrationservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := databasemigrationservice.New(sess) params := &databasemigrationservice.StartReplicationTaskInput{ ReplicationTaskArn: aws.String("String"), // Required @@ -775,7 +955,13 @@ func ExampleDatabaseMigrationService_StartReplicationTask() { } func ExampleDatabaseMigrationService_StopReplicationTask() { - svc := databasemigrationservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := databasemigrationservice.New(sess) params := &databasemigrationservice.StopReplicationTaskInput{ ReplicationTaskArn: aws.String("String"), // Required @@ -794,7 +980,13 @@ func ExampleDatabaseMigrationService_StopReplicationTask() { } func ExampleDatabaseMigrationService_TestConnection() { - svc := databasemigrationservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := databasemigrationservice.New(sess) params := &databasemigrationservice.TestConnectionInput{ EndpointArn: aws.String("String"), // Required diff --git a/service/datapipeline/examples_test.go b/service/datapipeline/examples_test.go index 1c2efcd89b3..d68f720bc81 100644 --- a/service/datapipeline/examples_test.go +++ b/service/datapipeline/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleDataPipeline_ActivatePipeline() { - svc := datapipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := datapipeline.New(sess) params := &datapipeline.ActivatePipelineInput{ PipelineId: aws.String("id"), // Required @@ -43,7 +49,13 @@ func ExampleDataPipeline_ActivatePipeline() { } func ExampleDataPipeline_AddTags() { - svc := datapipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := datapipeline.New(sess) params := &datapipeline.AddTagsInput{ PipelineId: aws.String("id"), // Required @@ -69,7 +81,13 @@ func ExampleDataPipeline_AddTags() { } func ExampleDataPipeline_CreatePipeline() { - svc := datapipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := datapipeline.New(sess) params := &datapipeline.CreatePipelineInput{ Name: aws.String("id"), // Required @@ -97,7 +115,13 @@ func ExampleDataPipeline_CreatePipeline() { } func ExampleDataPipeline_DeactivatePipeline() { - svc := datapipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := datapipeline.New(sess) params := &datapipeline.DeactivatePipelineInput{ PipelineId: aws.String("id"), // Required @@ -117,7 +141,13 @@ func ExampleDataPipeline_DeactivatePipeline() { } func ExampleDataPipeline_DeletePipeline() { - svc := datapipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := datapipeline.New(sess) params := &datapipeline.DeletePipelineInput{ PipelineId: aws.String("id"), // Required @@ -136,7 +166,13 @@ func ExampleDataPipeline_DeletePipeline() { } func ExampleDataPipeline_DescribeObjects() { - svc := datapipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := datapipeline.New(sess) params := &datapipeline.DescribeObjectsInput{ ObjectIds: []*string{ // Required @@ -161,7 +197,13 @@ func ExampleDataPipeline_DescribeObjects() { } func ExampleDataPipeline_DescribePipelines() { - svc := datapipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := datapipeline.New(sess) params := &datapipeline.DescribePipelinesInput{ PipelineIds: []*string{ // Required @@ -183,7 +225,13 @@ func ExampleDataPipeline_DescribePipelines() { } func ExampleDataPipeline_EvaluateExpression() { - svc := datapipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := datapipeline.New(sess) params := &datapipeline.EvaluateExpressionInput{ Expression: aws.String("longString"), // Required @@ -204,7 +252,13 @@ func ExampleDataPipeline_EvaluateExpression() { } func ExampleDataPipeline_GetPipelineDefinition() { - svc := datapipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := datapipeline.New(sess) params := &datapipeline.GetPipelineDefinitionInput{ PipelineId: aws.String("id"), // Required @@ -224,7 +278,13 @@ func ExampleDataPipeline_GetPipelineDefinition() { } func ExampleDataPipeline_ListPipelines() { - svc := datapipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := datapipeline.New(sess) params := &datapipeline.ListPipelinesInput{ Marker: aws.String("string"), @@ -243,7 +303,13 @@ func ExampleDataPipeline_ListPipelines() { } func ExampleDataPipeline_PollForTask() { - svc := datapipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := datapipeline.New(sess) params := &datapipeline.PollForTaskInput{ WorkerGroup: aws.String("string"), // Required @@ -267,7 +333,13 @@ func ExampleDataPipeline_PollForTask() { } func ExampleDataPipeline_PutPipelineDefinition() { - svc := datapipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := datapipeline.New(sess) params := &datapipeline.PutPipelineDefinitionInput{ PipelineId: aws.String("id"), // Required @@ -321,7 +393,13 @@ func ExampleDataPipeline_PutPipelineDefinition() { } func ExampleDataPipeline_QueryObjects() { - svc := datapipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := datapipeline.New(sess) params := &datapipeline.QueryObjectsInput{ PipelineId: aws.String("id"), // Required @@ -358,7 +436,13 @@ func ExampleDataPipeline_QueryObjects() { } func ExampleDataPipeline_RemoveTags() { - svc := datapipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := datapipeline.New(sess) params := &datapipeline.RemoveTagsInput{ PipelineId: aws.String("id"), // Required @@ -381,7 +465,13 @@ func ExampleDataPipeline_RemoveTags() { } func ExampleDataPipeline_ReportTaskProgress() { - svc := datapipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := datapipeline.New(sess) params := &datapipeline.ReportTaskProgressInput{ TaskId: aws.String("taskId"), // Required @@ -408,7 +498,13 @@ func ExampleDataPipeline_ReportTaskProgress() { } func ExampleDataPipeline_ReportTaskRunnerHeartbeat() { - svc := datapipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := datapipeline.New(sess) params := &datapipeline.ReportTaskRunnerHeartbeatInput{ TaskrunnerId: aws.String("id"), // Required @@ -429,7 +525,13 @@ func ExampleDataPipeline_ReportTaskRunnerHeartbeat() { } func ExampleDataPipeline_SetStatus() { - svc := datapipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := datapipeline.New(sess) params := &datapipeline.SetStatusInput{ ObjectIds: []*string{ // Required @@ -453,7 +555,13 @@ func ExampleDataPipeline_SetStatus() { } func ExampleDataPipeline_SetTaskStatus() { - svc := datapipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := datapipeline.New(sess) params := &datapipeline.SetTaskStatusInput{ TaskId: aws.String("taskId"), // Required @@ -476,7 +584,13 @@ func ExampleDataPipeline_SetTaskStatus() { } func ExampleDataPipeline_ValidatePipelineDefinition() { - svc := datapipeline.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := datapipeline.New(sess) params := &datapipeline.ValidatePipelineDefinitionInput{ PipelineId: aws.String("id"), // Required diff --git a/service/devicefarm/examples_test.go b/service/devicefarm/examples_test.go index a177fcf6158..3843e7c56e6 100644 --- a/service/devicefarm/examples_test.go +++ b/service/devicefarm/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleDeviceFarm_CreateDevicePool() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.CreateDevicePoolInput{ Name: aws.String("Name"), // Required @@ -45,7 +51,13 @@ func ExampleDeviceFarm_CreateDevicePool() { } func ExampleDeviceFarm_CreateProject() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.CreateProjectInput{ Name: aws.String("Name"), // Required @@ -64,7 +76,13 @@ func ExampleDeviceFarm_CreateProject() { } func ExampleDeviceFarm_CreateRemoteAccessSession() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.CreateRemoteAccessSessionInput{ DeviceArn: aws.String("AmazonResourceName"), // Required @@ -88,7 +106,13 @@ func ExampleDeviceFarm_CreateRemoteAccessSession() { } func ExampleDeviceFarm_CreateUpload() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.CreateUploadInput{ Name: aws.String("Name"), // Required @@ -110,7 +134,13 @@ func ExampleDeviceFarm_CreateUpload() { } func ExampleDeviceFarm_DeleteDevicePool() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.DeleteDevicePoolInput{ Arn: aws.String("AmazonResourceName"), // Required @@ -129,7 +159,13 @@ func ExampleDeviceFarm_DeleteDevicePool() { } func ExampleDeviceFarm_DeleteProject() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.DeleteProjectInput{ Arn: aws.String("AmazonResourceName"), // Required @@ -148,7 +184,13 @@ func ExampleDeviceFarm_DeleteProject() { } func ExampleDeviceFarm_DeleteRemoteAccessSession() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.DeleteRemoteAccessSessionInput{ Arn: aws.String("AmazonResourceName"), // Required @@ -167,7 +209,13 @@ func ExampleDeviceFarm_DeleteRemoteAccessSession() { } func ExampleDeviceFarm_DeleteRun() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.DeleteRunInput{ Arn: aws.String("AmazonResourceName"), // Required @@ -186,7 +234,13 @@ func ExampleDeviceFarm_DeleteRun() { } func ExampleDeviceFarm_DeleteUpload() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.DeleteUploadInput{ Arn: aws.String("AmazonResourceName"), // Required @@ -205,7 +259,13 @@ func ExampleDeviceFarm_DeleteUpload() { } func ExampleDeviceFarm_GetAccountSettings() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) var params *devicefarm.GetAccountSettingsInput resp, err := svc.GetAccountSettings(params) @@ -222,7 +282,13 @@ func ExampleDeviceFarm_GetAccountSettings() { } func ExampleDeviceFarm_GetDevice() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.GetDeviceInput{ Arn: aws.String("AmazonResourceName"), // Required @@ -241,7 +307,13 @@ func ExampleDeviceFarm_GetDevice() { } func ExampleDeviceFarm_GetDevicePool() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.GetDevicePoolInput{ Arn: aws.String("AmazonResourceName"), // Required @@ -260,7 +332,13 @@ func ExampleDeviceFarm_GetDevicePool() { } func ExampleDeviceFarm_GetDevicePoolCompatibility() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.GetDevicePoolCompatibilityInput{ DevicePoolArn: aws.String("AmazonResourceName"), // Required @@ -281,7 +359,13 @@ func ExampleDeviceFarm_GetDevicePoolCompatibility() { } func ExampleDeviceFarm_GetJob() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.GetJobInput{ Arn: aws.String("AmazonResourceName"), // Required @@ -300,7 +384,13 @@ func ExampleDeviceFarm_GetJob() { } func ExampleDeviceFarm_GetOfferingStatus() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.GetOfferingStatusInput{ NextToken: aws.String("PaginationToken"), @@ -319,7 +409,13 @@ func ExampleDeviceFarm_GetOfferingStatus() { } func ExampleDeviceFarm_GetProject() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.GetProjectInput{ Arn: aws.String("AmazonResourceName"), // Required @@ -338,7 +434,13 @@ func ExampleDeviceFarm_GetProject() { } func ExampleDeviceFarm_GetRemoteAccessSession() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.GetRemoteAccessSessionInput{ Arn: aws.String("AmazonResourceName"), // Required @@ -357,7 +459,13 @@ func ExampleDeviceFarm_GetRemoteAccessSession() { } func ExampleDeviceFarm_GetRun() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.GetRunInput{ Arn: aws.String("AmazonResourceName"), // Required @@ -376,7 +484,13 @@ func ExampleDeviceFarm_GetRun() { } func ExampleDeviceFarm_GetSuite() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.GetSuiteInput{ Arn: aws.String("AmazonResourceName"), // Required @@ -395,7 +509,13 @@ func ExampleDeviceFarm_GetSuite() { } func ExampleDeviceFarm_GetTest() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.GetTestInput{ Arn: aws.String("AmazonResourceName"), // Required @@ -414,7 +534,13 @@ func ExampleDeviceFarm_GetTest() { } func ExampleDeviceFarm_GetUpload() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.GetUploadInput{ Arn: aws.String("AmazonResourceName"), // Required @@ -433,7 +559,13 @@ func ExampleDeviceFarm_GetUpload() { } func ExampleDeviceFarm_InstallToRemoteAccessSession() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.InstallToRemoteAccessSessionInput{ AppArn: aws.String("AmazonResourceName"), // Required @@ -453,7 +585,13 @@ func ExampleDeviceFarm_InstallToRemoteAccessSession() { } func ExampleDeviceFarm_ListArtifacts() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.ListArtifactsInput{ Arn: aws.String("AmazonResourceName"), // Required @@ -474,7 +612,13 @@ func ExampleDeviceFarm_ListArtifacts() { } func ExampleDeviceFarm_ListDevicePools() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.ListDevicePoolsInput{ Arn: aws.String("AmazonResourceName"), // Required @@ -495,7 +639,13 @@ func ExampleDeviceFarm_ListDevicePools() { } func ExampleDeviceFarm_ListDevices() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.ListDevicesInput{ Arn: aws.String("AmazonResourceName"), @@ -515,7 +665,13 @@ func ExampleDeviceFarm_ListDevices() { } func ExampleDeviceFarm_ListJobs() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.ListJobsInput{ Arn: aws.String("AmazonResourceName"), // Required @@ -535,7 +691,13 @@ func ExampleDeviceFarm_ListJobs() { } func ExampleDeviceFarm_ListOfferingTransactions() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.ListOfferingTransactionsInput{ NextToken: aws.String("PaginationToken"), @@ -554,7 +716,13 @@ func ExampleDeviceFarm_ListOfferingTransactions() { } func ExampleDeviceFarm_ListOfferings() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.ListOfferingsInput{ NextToken: aws.String("PaginationToken"), @@ -573,7 +741,13 @@ func ExampleDeviceFarm_ListOfferings() { } func ExampleDeviceFarm_ListProjects() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.ListProjectsInput{ Arn: aws.String("AmazonResourceName"), @@ -593,7 +767,13 @@ func ExampleDeviceFarm_ListProjects() { } func ExampleDeviceFarm_ListRemoteAccessSessions() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.ListRemoteAccessSessionsInput{ Arn: aws.String("AmazonResourceName"), // Required @@ -613,7 +793,13 @@ func ExampleDeviceFarm_ListRemoteAccessSessions() { } func ExampleDeviceFarm_ListRuns() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.ListRunsInput{ Arn: aws.String("AmazonResourceName"), // Required @@ -633,7 +819,13 @@ func ExampleDeviceFarm_ListRuns() { } func ExampleDeviceFarm_ListSamples() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.ListSamplesInput{ Arn: aws.String("AmazonResourceName"), // Required @@ -653,7 +845,13 @@ func ExampleDeviceFarm_ListSamples() { } func ExampleDeviceFarm_ListSuites() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.ListSuitesInput{ Arn: aws.String("AmazonResourceName"), // Required @@ -673,7 +871,13 @@ func ExampleDeviceFarm_ListSuites() { } func ExampleDeviceFarm_ListTests() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.ListTestsInput{ Arn: aws.String("AmazonResourceName"), // Required @@ -693,7 +897,13 @@ func ExampleDeviceFarm_ListTests() { } func ExampleDeviceFarm_ListUniqueProblems() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.ListUniqueProblemsInput{ Arn: aws.String("AmazonResourceName"), // Required @@ -713,7 +923,13 @@ func ExampleDeviceFarm_ListUniqueProblems() { } func ExampleDeviceFarm_ListUploads() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.ListUploadsInput{ Arn: aws.String("AmazonResourceName"), // Required @@ -733,7 +949,13 @@ func ExampleDeviceFarm_ListUploads() { } func ExampleDeviceFarm_PurchaseOffering() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.PurchaseOfferingInput{ OfferingId: aws.String("OfferingIdentifier"), @@ -753,7 +975,13 @@ func ExampleDeviceFarm_PurchaseOffering() { } func ExampleDeviceFarm_RenewOffering() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.RenewOfferingInput{ OfferingId: aws.String("OfferingIdentifier"), @@ -773,7 +1001,13 @@ func ExampleDeviceFarm_RenewOffering() { } func ExampleDeviceFarm_ScheduleRun() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.ScheduleRunInput{ DevicePoolArn: aws.String("AmazonResourceName"), // Required @@ -824,7 +1058,13 @@ func ExampleDeviceFarm_ScheduleRun() { } func ExampleDeviceFarm_StopRemoteAccessSession() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.StopRemoteAccessSessionInput{ Arn: aws.String("AmazonResourceName"), // Required @@ -843,7 +1083,13 @@ func ExampleDeviceFarm_StopRemoteAccessSession() { } func ExampleDeviceFarm_StopRun() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.StopRunInput{ Arn: aws.String("AmazonResourceName"), // Required @@ -862,7 +1108,13 @@ func ExampleDeviceFarm_StopRun() { } func ExampleDeviceFarm_UpdateDevicePool() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.UpdateDevicePoolInput{ Arn: aws.String("AmazonResourceName"), // Required @@ -891,7 +1143,13 @@ func ExampleDeviceFarm_UpdateDevicePool() { } func ExampleDeviceFarm_UpdateProject() { - svc := devicefarm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := devicefarm.New(sess) params := &devicefarm.UpdateProjectInput{ Arn: aws.String("AmazonResourceName"), // Required diff --git a/service/directconnect/examples_test.go b/service/directconnect/examples_test.go index 22ef663306b..e08d7c6c904 100644 --- a/service/directconnect/examples_test.go +++ b/service/directconnect/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleDirectConnect_AllocateConnectionOnInterconnect() { - svc := directconnect.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directconnect.New(sess) params := &directconnect.AllocateConnectionOnInterconnectInput{ Bandwidth: aws.String("Bandwidth"), // Required @@ -39,7 +45,13 @@ func ExampleDirectConnect_AllocateConnectionOnInterconnect() { } func ExampleDirectConnect_AllocatePrivateVirtualInterface() { - svc := directconnect.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directconnect.New(sess) params := &directconnect.AllocatePrivateVirtualInterfaceInput{ ConnectionId: aws.String("ConnectionId"), // Required @@ -67,7 +79,13 @@ func ExampleDirectConnect_AllocatePrivateVirtualInterface() { } func ExampleDirectConnect_AllocatePublicVirtualInterface() { - svc := directconnect.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directconnect.New(sess) params := &directconnect.AllocatePublicVirtualInterfaceInput{ ConnectionId: aws.String("ConnectionId"), // Required @@ -101,7 +119,13 @@ func ExampleDirectConnect_AllocatePublicVirtualInterface() { } func ExampleDirectConnect_ConfirmConnection() { - svc := directconnect.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directconnect.New(sess) params := &directconnect.ConfirmConnectionInput{ ConnectionId: aws.String("ConnectionId"), // Required @@ -120,7 +144,13 @@ func ExampleDirectConnect_ConfirmConnection() { } func ExampleDirectConnect_ConfirmPrivateVirtualInterface() { - svc := directconnect.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directconnect.New(sess) params := &directconnect.ConfirmPrivateVirtualInterfaceInput{ VirtualGatewayId: aws.String("VirtualGatewayId"), // Required @@ -140,7 +170,13 @@ func ExampleDirectConnect_ConfirmPrivateVirtualInterface() { } func ExampleDirectConnect_ConfirmPublicVirtualInterface() { - svc := directconnect.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directconnect.New(sess) params := &directconnect.ConfirmPublicVirtualInterfaceInput{ VirtualInterfaceId: aws.String("VirtualInterfaceId"), // Required @@ -159,7 +195,13 @@ func ExampleDirectConnect_ConfirmPublicVirtualInterface() { } func ExampleDirectConnect_CreateConnection() { - svc := directconnect.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directconnect.New(sess) params := &directconnect.CreateConnectionInput{ Bandwidth: aws.String("Bandwidth"), // Required @@ -180,7 +222,13 @@ func ExampleDirectConnect_CreateConnection() { } func ExampleDirectConnect_CreateInterconnect() { - svc := directconnect.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directconnect.New(sess) params := &directconnect.CreateInterconnectInput{ Bandwidth: aws.String("Bandwidth"), // Required @@ -201,7 +249,13 @@ func ExampleDirectConnect_CreateInterconnect() { } func ExampleDirectConnect_CreatePrivateVirtualInterface() { - svc := directconnect.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directconnect.New(sess) params := &directconnect.CreatePrivateVirtualInterfaceInput{ ConnectionId: aws.String("ConnectionId"), // Required @@ -229,7 +283,13 @@ func ExampleDirectConnect_CreatePrivateVirtualInterface() { } func ExampleDirectConnect_CreatePublicVirtualInterface() { - svc := directconnect.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directconnect.New(sess) params := &directconnect.CreatePublicVirtualInterfaceInput{ ConnectionId: aws.String("ConnectionId"), // Required @@ -262,7 +322,13 @@ func ExampleDirectConnect_CreatePublicVirtualInterface() { } func ExampleDirectConnect_DeleteConnection() { - svc := directconnect.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directconnect.New(sess) params := &directconnect.DeleteConnectionInput{ ConnectionId: aws.String("ConnectionId"), // Required @@ -281,7 +347,13 @@ func ExampleDirectConnect_DeleteConnection() { } func ExampleDirectConnect_DeleteInterconnect() { - svc := directconnect.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directconnect.New(sess) params := &directconnect.DeleteInterconnectInput{ InterconnectId: aws.String("InterconnectId"), // Required @@ -300,7 +372,13 @@ func ExampleDirectConnect_DeleteInterconnect() { } func ExampleDirectConnect_DeleteVirtualInterface() { - svc := directconnect.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directconnect.New(sess) params := &directconnect.DeleteVirtualInterfaceInput{ VirtualInterfaceId: aws.String("VirtualInterfaceId"), // Required @@ -319,7 +397,13 @@ func ExampleDirectConnect_DeleteVirtualInterface() { } func ExampleDirectConnect_DescribeConnectionLoa() { - svc := directconnect.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directconnect.New(sess) params := &directconnect.DescribeConnectionLoaInput{ ConnectionId: aws.String("ConnectionId"), // Required @@ -340,7 +424,13 @@ func ExampleDirectConnect_DescribeConnectionLoa() { } func ExampleDirectConnect_DescribeConnections() { - svc := directconnect.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directconnect.New(sess) params := &directconnect.DescribeConnectionsInput{ ConnectionId: aws.String("ConnectionId"), @@ -359,7 +449,13 @@ func ExampleDirectConnect_DescribeConnections() { } func ExampleDirectConnect_DescribeConnectionsOnInterconnect() { - svc := directconnect.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directconnect.New(sess) params := &directconnect.DescribeConnectionsOnInterconnectInput{ InterconnectId: aws.String("InterconnectId"), // Required @@ -378,7 +474,13 @@ func ExampleDirectConnect_DescribeConnectionsOnInterconnect() { } func ExampleDirectConnect_DescribeInterconnectLoa() { - svc := directconnect.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directconnect.New(sess) params := &directconnect.DescribeInterconnectLoaInput{ InterconnectId: aws.String("InterconnectId"), // Required @@ -399,7 +501,13 @@ func ExampleDirectConnect_DescribeInterconnectLoa() { } func ExampleDirectConnect_DescribeInterconnects() { - svc := directconnect.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directconnect.New(sess) params := &directconnect.DescribeInterconnectsInput{ InterconnectId: aws.String("InterconnectId"), @@ -418,7 +526,13 @@ func ExampleDirectConnect_DescribeInterconnects() { } func ExampleDirectConnect_DescribeLocations() { - svc := directconnect.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directconnect.New(sess) var params *directconnect.DescribeLocationsInput resp, err := svc.DescribeLocations(params) @@ -435,7 +549,13 @@ func ExampleDirectConnect_DescribeLocations() { } func ExampleDirectConnect_DescribeVirtualGateways() { - svc := directconnect.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directconnect.New(sess) var params *directconnect.DescribeVirtualGatewaysInput resp, err := svc.DescribeVirtualGateways(params) @@ -452,7 +572,13 @@ func ExampleDirectConnect_DescribeVirtualGateways() { } func ExampleDirectConnect_DescribeVirtualInterfaces() { - svc := directconnect.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directconnect.New(sess) params := &directconnect.DescribeVirtualInterfacesInput{ ConnectionId: aws.String("ConnectionId"), diff --git a/service/directoryservice/examples_test.go b/service/directoryservice/examples_test.go index 6f90fcf5410..cbc17399ef1 100644 --- a/service/directoryservice/examples_test.go +++ b/service/directoryservice/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleDirectoryService_AddIpRoutes() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.AddIpRoutesInput{ DirectoryId: aws.String("DirectoryId"), // Required @@ -43,7 +49,13 @@ func ExampleDirectoryService_AddIpRoutes() { } func ExampleDirectoryService_AddTagsToResource() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.AddTagsToResourceInput{ ResourceId: aws.String("ResourceId"), // Required @@ -69,7 +81,13 @@ func ExampleDirectoryService_AddTagsToResource() { } func ExampleDirectoryService_ConnectDirectory() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.ConnectDirectoryInput{ ConnectSettings: &directoryservice.DirectoryConnectSettings{ // Required @@ -104,7 +122,13 @@ func ExampleDirectoryService_ConnectDirectory() { } func ExampleDirectoryService_CreateAlias() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.CreateAliasInput{ Alias: aws.String("AliasName"), // Required @@ -124,7 +148,13 @@ func ExampleDirectoryService_CreateAlias() { } func ExampleDirectoryService_CreateComputer() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.CreateComputerInput{ ComputerName: aws.String("ComputerName"), // Required @@ -153,7 +183,13 @@ func ExampleDirectoryService_CreateComputer() { } func ExampleDirectoryService_CreateConditionalForwarder() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.CreateConditionalForwarderInput{ DirectoryId: aws.String("DirectoryId"), // Required @@ -177,7 +213,13 @@ func ExampleDirectoryService_CreateConditionalForwarder() { } func ExampleDirectoryService_CreateDirectory() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.CreateDirectoryInput{ Name: aws.String("DirectoryName"), // Required @@ -207,7 +249,13 @@ func ExampleDirectoryService_CreateDirectory() { } func ExampleDirectoryService_CreateMicrosoftAD() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.CreateMicrosoftADInput{ Name: aws.String("DirectoryName"), // Required @@ -236,7 +284,13 @@ func ExampleDirectoryService_CreateMicrosoftAD() { } func ExampleDirectoryService_CreateSnapshot() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.CreateSnapshotInput{ DirectoryId: aws.String("DirectoryId"), // Required @@ -256,7 +310,13 @@ func ExampleDirectoryService_CreateSnapshot() { } func ExampleDirectoryService_CreateTrust() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.CreateTrustInput{ DirectoryId: aws.String("DirectoryId"), // Required @@ -283,7 +343,13 @@ func ExampleDirectoryService_CreateTrust() { } func ExampleDirectoryService_DeleteConditionalForwarder() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.DeleteConditionalForwarderInput{ DirectoryId: aws.String("DirectoryId"), // Required @@ -303,7 +369,13 @@ func ExampleDirectoryService_DeleteConditionalForwarder() { } func ExampleDirectoryService_DeleteDirectory() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.DeleteDirectoryInput{ DirectoryId: aws.String("DirectoryId"), // Required @@ -322,7 +394,13 @@ func ExampleDirectoryService_DeleteDirectory() { } func ExampleDirectoryService_DeleteSnapshot() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.DeleteSnapshotInput{ SnapshotId: aws.String("SnapshotId"), // Required @@ -341,7 +419,13 @@ func ExampleDirectoryService_DeleteSnapshot() { } func ExampleDirectoryService_DeleteTrust() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.DeleteTrustInput{ TrustId: aws.String("TrustId"), // Required @@ -361,7 +445,13 @@ func ExampleDirectoryService_DeleteTrust() { } func ExampleDirectoryService_DeregisterEventTopic() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.DeregisterEventTopicInput{ DirectoryId: aws.String("DirectoryId"), // Required @@ -381,7 +471,13 @@ func ExampleDirectoryService_DeregisterEventTopic() { } func ExampleDirectoryService_DescribeConditionalForwarders() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.DescribeConditionalForwardersInput{ DirectoryId: aws.String("DirectoryId"), // Required @@ -404,7 +500,13 @@ func ExampleDirectoryService_DescribeConditionalForwarders() { } func ExampleDirectoryService_DescribeDirectories() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.DescribeDirectoriesInput{ DirectoryIds: []*string{ @@ -428,7 +530,13 @@ func ExampleDirectoryService_DescribeDirectories() { } func ExampleDirectoryService_DescribeEventTopics() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.DescribeEventTopicsInput{ DirectoryId: aws.String("DirectoryId"), @@ -451,7 +559,13 @@ func ExampleDirectoryService_DescribeEventTopics() { } func ExampleDirectoryService_DescribeSnapshots() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.DescribeSnapshotsInput{ DirectoryId: aws.String("DirectoryId"), @@ -476,7 +590,13 @@ func ExampleDirectoryService_DescribeSnapshots() { } func ExampleDirectoryService_DescribeTrusts() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.DescribeTrustsInput{ DirectoryId: aws.String("DirectoryId"), @@ -501,7 +621,13 @@ func ExampleDirectoryService_DescribeTrusts() { } func ExampleDirectoryService_DisableRadius() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.DisableRadiusInput{ DirectoryId: aws.String("DirectoryId"), // Required @@ -520,7 +646,13 @@ func ExampleDirectoryService_DisableRadius() { } func ExampleDirectoryService_DisableSso() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.DisableSsoInput{ DirectoryId: aws.String("DirectoryId"), // Required @@ -541,7 +673,13 @@ func ExampleDirectoryService_DisableSso() { } func ExampleDirectoryService_EnableRadius() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.EnableRadiusInput{ DirectoryId: aws.String("DirectoryId"), // Required @@ -573,7 +711,13 @@ func ExampleDirectoryService_EnableRadius() { } func ExampleDirectoryService_EnableSso() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.EnableSsoInput{ DirectoryId: aws.String("DirectoryId"), // Required @@ -594,7 +738,13 @@ func ExampleDirectoryService_EnableSso() { } func ExampleDirectoryService_GetDirectoryLimits() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) var params *directoryservice.GetDirectoryLimitsInput resp, err := svc.GetDirectoryLimits(params) @@ -611,7 +761,13 @@ func ExampleDirectoryService_GetDirectoryLimits() { } func ExampleDirectoryService_GetSnapshotLimits() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.GetSnapshotLimitsInput{ DirectoryId: aws.String("DirectoryId"), // Required @@ -630,7 +786,13 @@ func ExampleDirectoryService_GetSnapshotLimits() { } func ExampleDirectoryService_ListIpRoutes() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.ListIpRoutesInput{ DirectoryId: aws.String("DirectoryId"), // Required @@ -651,7 +813,13 @@ func ExampleDirectoryService_ListIpRoutes() { } func ExampleDirectoryService_ListTagsForResource() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.ListTagsForResourceInput{ ResourceId: aws.String("ResourceId"), // Required @@ -672,7 +840,13 @@ func ExampleDirectoryService_ListTagsForResource() { } func ExampleDirectoryService_RegisterEventTopic() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.RegisterEventTopicInput{ DirectoryId: aws.String("DirectoryId"), // Required @@ -692,7 +866,13 @@ func ExampleDirectoryService_RegisterEventTopic() { } func ExampleDirectoryService_RemoveIpRoutes() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.RemoveIpRoutesInput{ CidrIps: []*string{ // Required @@ -715,7 +895,13 @@ func ExampleDirectoryService_RemoveIpRoutes() { } func ExampleDirectoryService_RemoveTagsFromResource() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.RemoveTagsFromResourceInput{ ResourceId: aws.String("ResourceId"), // Required @@ -738,7 +924,13 @@ func ExampleDirectoryService_RemoveTagsFromResource() { } func ExampleDirectoryService_RestoreFromSnapshot() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.RestoreFromSnapshotInput{ SnapshotId: aws.String("SnapshotId"), // Required @@ -757,7 +949,13 @@ func ExampleDirectoryService_RestoreFromSnapshot() { } func ExampleDirectoryService_UpdateConditionalForwarder() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.UpdateConditionalForwarderInput{ DirectoryId: aws.String("DirectoryId"), // Required @@ -781,7 +979,13 @@ func ExampleDirectoryService_UpdateConditionalForwarder() { } func ExampleDirectoryService_UpdateRadius() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.UpdateRadiusInput{ DirectoryId: aws.String("DirectoryId"), // Required @@ -813,7 +1017,13 @@ func ExampleDirectoryService_UpdateRadius() { } func ExampleDirectoryService_VerifyTrust() { - svc := directoryservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := directoryservice.New(sess) params := &directoryservice.VerifyTrustInput{ TrustId: aws.String("TrustId"), // Required diff --git a/service/dynamodb/dynamodbattribute/doc.go b/service/dynamodb/dynamodbattribute/doc.go index 34476569e7c..b603b584010 100644 --- a/service/dynamodb/dynamodbattribute/doc.go +++ b/service/dynamodb/dynamodbattribute/doc.go @@ -31,7 +31,12 @@ // // Marshal Go value type for DynamoDB.PutItem: // -// sess := session.New() +// sess, err := session.NewSession() +// if err != nil { +// fmt.Println("Failed create session", err) +// return +// } +// // svc := dynamodb.New(sess) // item, err := dynamodbattribute.MarshalMap(r) // if err != nil { diff --git a/service/dynamodb/examples_test.go b/service/dynamodb/examples_test.go index 060d1abdb6f..0a96cd8d2aa 100644 --- a/service/dynamodb/examples_test.go +++ b/service/dynamodb/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleDynamoDB_BatchGetItem() { - svc := dynamodb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := dynamodb.New(sess) params := &dynamodb.BatchGetItemInput{ RequestItems: map[string]*dynamodb.KeysAndAttributes{ // Required @@ -87,7 +93,13 @@ func ExampleDynamoDB_BatchGetItem() { } func ExampleDynamoDB_BatchWriteItem() { - svc := dynamodb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := dynamodb.New(sess) params := &dynamodb.BatchWriteItemInput{ RequestItems: map[string][]*dynamodb.WriteRequest{ // Required @@ -187,7 +199,13 @@ func ExampleDynamoDB_BatchWriteItem() { } func ExampleDynamoDB_CreateTable() { - svc := dynamodb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := dynamodb.New(sess) params := &dynamodb.CreateTableInput{ AttributeDefinitions: []*dynamodb.AttributeDefinition{ // Required @@ -272,7 +290,13 @@ func ExampleDynamoDB_CreateTable() { } func ExampleDynamoDB_DeleteItem() { - svc := dynamodb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := dynamodb.New(sess) params := &dynamodb.DeleteItemInput{ Key: map[string]*dynamodb.AttributeValue{ // Required @@ -440,7 +464,13 @@ func ExampleDynamoDB_DeleteItem() { } func ExampleDynamoDB_DeleteTable() { - svc := dynamodb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := dynamodb.New(sess) params := &dynamodb.DeleteTableInput{ TableName: aws.String("TableName"), // Required @@ -459,7 +489,13 @@ func ExampleDynamoDB_DeleteTable() { } func ExampleDynamoDB_DescribeLimits() { - svc := dynamodb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := dynamodb.New(sess) var params *dynamodb.DescribeLimitsInput resp, err := svc.DescribeLimits(params) @@ -476,7 +512,13 @@ func ExampleDynamoDB_DescribeLimits() { } func ExampleDynamoDB_DescribeTable() { - svc := dynamodb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := dynamodb.New(sess) params := &dynamodb.DescribeTableInput{ TableName: aws.String("TableName"), // Required @@ -495,7 +537,13 @@ func ExampleDynamoDB_DescribeTable() { } func ExampleDynamoDB_GetItem() { - svc := dynamodb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := dynamodb.New(sess) params := &dynamodb.GetItemInput{ Key: map[string]*dynamodb.AttributeValue{ // Required @@ -559,7 +607,13 @@ func ExampleDynamoDB_GetItem() { } func ExampleDynamoDB_ListTables() { - svc := dynamodb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := dynamodb.New(sess) params := &dynamodb.ListTablesInput{ ExclusiveStartTableName: aws.String("TableName"), @@ -579,7 +633,13 @@ func ExampleDynamoDB_ListTables() { } func ExampleDynamoDB_PutItem() { - svc := dynamodb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := dynamodb.New(sess) params := &dynamodb.PutItemInput{ Item: map[string]*dynamodb.AttributeValue{ // Required @@ -747,7 +807,13 @@ func ExampleDynamoDB_PutItem() { } func ExampleDynamoDB_Query() { - svc := dynamodb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := dynamodb.New(sess) params := &dynamodb.QueryInput{ TableName: aws.String("TableName"), // Required @@ -932,7 +998,13 @@ func ExampleDynamoDB_Query() { } func ExampleDynamoDB_Scan() { - svc := dynamodb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := dynamodb.New(sess) params := &dynamodb.ScanInput{ TableName: aws.String("TableName"), // Required @@ -1077,7 +1149,13 @@ func ExampleDynamoDB_Scan() { } func ExampleDynamoDB_UpdateItem() { - svc := dynamodb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := dynamodb.New(sess) params := &dynamodb.UpdateItemInput{ Key: map[string]*dynamodb.AttributeValue{ // Required @@ -1283,7 +1361,13 @@ func ExampleDynamoDB_UpdateItem() { } func ExampleDynamoDB_UpdateTable() { - svc := dynamodb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := dynamodb.New(sess) params := &dynamodb.UpdateTableInput{ TableName: aws.String("TableName"), // Required diff --git a/service/dynamodbstreams/examples_test.go b/service/dynamodbstreams/examples_test.go index 73c4ef2e2fa..40e37d94c86 100644 --- a/service/dynamodbstreams/examples_test.go +++ b/service/dynamodbstreams/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleDynamoDBStreams_DescribeStream() { - svc := dynamodbstreams.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := dynamodbstreams.New(sess) params := &dynamodbstreams.DescribeStreamInput{ StreamArn: aws.String("StreamArn"), // Required @@ -37,7 +43,13 @@ func ExampleDynamoDBStreams_DescribeStream() { } func ExampleDynamoDBStreams_GetRecords() { - svc := dynamodbstreams.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := dynamodbstreams.New(sess) params := &dynamodbstreams.GetRecordsInput{ ShardIterator: aws.String("ShardIterator"), // Required @@ -57,7 +69,13 @@ func ExampleDynamoDBStreams_GetRecords() { } func ExampleDynamoDBStreams_GetShardIterator() { - svc := dynamodbstreams.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := dynamodbstreams.New(sess) params := &dynamodbstreams.GetShardIteratorInput{ ShardId: aws.String("ShardId"), // Required @@ -79,7 +97,13 @@ func ExampleDynamoDBStreams_GetShardIterator() { } func ExampleDynamoDBStreams_ListStreams() { - svc := dynamodbstreams.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := dynamodbstreams.New(sess) params := &dynamodbstreams.ListStreamsInput{ ExclusiveStartStreamArn: aws.String("StreamArn"), diff --git a/service/ec2/examples_test.go b/service/ec2/examples_test.go index 60b82024b95..39892068efb 100644 --- a/service/ec2/examples_test.go +++ b/service/ec2/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleEC2_AcceptVpcPeeringConnection() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.AcceptVpcPeeringConnectionInput{ DryRun: aws.Bool(true), @@ -36,7 +42,13 @@ func ExampleEC2_AcceptVpcPeeringConnection() { } func ExampleEC2_AllocateAddress() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.AllocateAddressInput{ Domain: aws.String("DomainType"), @@ -56,7 +68,13 @@ func ExampleEC2_AllocateAddress() { } func ExampleEC2_AllocateHosts() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.AllocateHostsInput{ AvailabilityZone: aws.String("String"), // Required @@ -79,7 +97,13 @@ func ExampleEC2_AllocateHosts() { } func ExampleEC2_AssignPrivateIpAddresses() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.AssignPrivateIpAddressesInput{ NetworkInterfaceId: aws.String("String"), // Required @@ -104,7 +128,13 @@ func ExampleEC2_AssignPrivateIpAddresses() { } func ExampleEC2_AssociateAddress() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.AssociateAddressInput{ AllocationId: aws.String("String"), @@ -129,7 +159,13 @@ func ExampleEC2_AssociateAddress() { } func ExampleEC2_AssociateDhcpOptions() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.AssociateDhcpOptionsInput{ DhcpOptionsId: aws.String("String"), // Required @@ -150,7 +186,13 @@ func ExampleEC2_AssociateDhcpOptions() { } func ExampleEC2_AssociateRouteTable() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.AssociateRouteTableInput{ RouteTableId: aws.String("String"), // Required @@ -171,7 +213,13 @@ func ExampleEC2_AssociateRouteTable() { } func ExampleEC2_AttachClassicLinkVpc() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.AttachClassicLinkVpcInput{ Groups: []*string{ // Required @@ -196,7 +244,13 @@ func ExampleEC2_AttachClassicLinkVpc() { } func ExampleEC2_AttachInternetGateway() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.AttachInternetGatewayInput{ InternetGatewayId: aws.String("String"), // Required @@ -217,7 +271,13 @@ func ExampleEC2_AttachInternetGateway() { } func ExampleEC2_AttachNetworkInterface() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.AttachNetworkInterfaceInput{ DeviceIndex: aws.Int64(1), // Required @@ -239,7 +299,13 @@ func ExampleEC2_AttachNetworkInterface() { } func ExampleEC2_AttachVolume() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.AttachVolumeInput{ Device: aws.String("String"), // Required @@ -261,7 +327,13 @@ func ExampleEC2_AttachVolume() { } func ExampleEC2_AttachVpnGateway() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.AttachVpnGatewayInput{ VpcId: aws.String("String"), // Required @@ -282,7 +354,13 @@ func ExampleEC2_AttachVpnGateway() { } func ExampleEC2_AuthorizeSecurityGroupEgress() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.AuthorizeSecurityGroupEgressInput{ GroupId: aws.String("String"), // Required @@ -339,7 +417,13 @@ func ExampleEC2_AuthorizeSecurityGroupEgress() { } func ExampleEC2_AuthorizeSecurityGroupIngress() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.AuthorizeSecurityGroupIngressInput{ CidrIp: aws.String("String"), @@ -397,7 +481,13 @@ func ExampleEC2_AuthorizeSecurityGroupIngress() { } func ExampleEC2_BundleInstance() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.BundleInstanceInput{ InstanceId: aws.String("String"), // Required @@ -426,7 +516,13 @@ func ExampleEC2_BundleInstance() { } func ExampleEC2_CancelBundleTask() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CancelBundleTaskInput{ BundleId: aws.String("String"), // Required @@ -446,7 +542,13 @@ func ExampleEC2_CancelBundleTask() { } func ExampleEC2_CancelConversionTask() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CancelConversionTaskInput{ ConversionTaskId: aws.String("String"), // Required @@ -467,7 +569,13 @@ func ExampleEC2_CancelConversionTask() { } func ExampleEC2_CancelExportTask() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CancelExportTaskInput{ ExportTaskId: aws.String("String"), // Required @@ -486,7 +594,13 @@ func ExampleEC2_CancelExportTask() { } func ExampleEC2_CancelImportTask() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CancelImportTaskInput{ CancelReason: aws.String("String"), @@ -507,7 +621,13 @@ func ExampleEC2_CancelImportTask() { } func ExampleEC2_CancelReservedInstancesListing() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CancelReservedInstancesListingInput{ ReservedInstancesListingId: aws.String("String"), // Required @@ -526,7 +646,13 @@ func ExampleEC2_CancelReservedInstancesListing() { } func ExampleEC2_CancelSpotFleetRequests() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CancelSpotFleetRequestsInput{ SpotFleetRequestIds: []*string{ // Required @@ -550,7 +676,13 @@ func ExampleEC2_CancelSpotFleetRequests() { } func ExampleEC2_CancelSpotInstanceRequests() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CancelSpotInstanceRequestsInput{ SpotInstanceRequestIds: []*string{ // Required @@ -573,7 +705,13 @@ func ExampleEC2_CancelSpotInstanceRequests() { } func ExampleEC2_ConfirmProductInstance() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.ConfirmProductInstanceInput{ InstanceId: aws.String("String"), // Required @@ -594,7 +732,13 @@ func ExampleEC2_ConfirmProductInstance() { } func ExampleEC2_CopyImage() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CopyImageInput{ Name: aws.String("String"), // Required @@ -620,7 +764,13 @@ func ExampleEC2_CopyImage() { } func ExampleEC2_CopySnapshot() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CopySnapshotInput{ SourceRegion: aws.String("String"), // Required @@ -646,7 +796,13 @@ func ExampleEC2_CopySnapshot() { } func ExampleEC2_CreateCustomerGateway() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CreateCustomerGatewayInput{ BgpAsn: aws.Int64(1), // Required @@ -668,7 +824,13 @@ func ExampleEC2_CreateCustomerGateway() { } func ExampleEC2_CreateDhcpOptions() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CreateDhcpOptionsInput{ DhcpConfigurations: []*ec2.NewDhcpConfiguration{ // Required @@ -697,7 +859,13 @@ func ExampleEC2_CreateDhcpOptions() { } func ExampleEC2_CreateFlowLogs() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CreateFlowLogsInput{ DeliverLogsPermissionArn: aws.String("String"), // Required @@ -724,7 +892,13 @@ func ExampleEC2_CreateFlowLogs() { } func ExampleEC2_CreateImage() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CreateImageInput{ InstanceId: aws.String("String"), // Required @@ -763,7 +937,13 @@ func ExampleEC2_CreateImage() { } func ExampleEC2_CreateInstanceExportTask() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CreateInstanceExportTaskInput{ InstanceId: aws.String("String"), // Required @@ -790,7 +970,13 @@ func ExampleEC2_CreateInstanceExportTask() { } func ExampleEC2_CreateInternetGateway() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CreateInternetGatewayInput{ DryRun: aws.Bool(true), @@ -809,7 +995,13 @@ func ExampleEC2_CreateInternetGateway() { } func ExampleEC2_CreateKeyPair() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CreateKeyPairInput{ KeyName: aws.String("String"), // Required @@ -829,7 +1021,13 @@ func ExampleEC2_CreateKeyPair() { } func ExampleEC2_CreateNatGateway() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CreateNatGatewayInput{ AllocationId: aws.String("String"), // Required @@ -850,7 +1048,13 @@ func ExampleEC2_CreateNatGateway() { } func ExampleEC2_CreateNetworkAcl() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CreateNetworkAclInput{ VpcId: aws.String("String"), // Required @@ -870,7 +1074,13 @@ func ExampleEC2_CreateNetworkAcl() { } func ExampleEC2_CreateNetworkAclEntry() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CreateNetworkAclEntryInput{ CidrBlock: aws.String("String"), // Required @@ -903,7 +1113,13 @@ func ExampleEC2_CreateNetworkAclEntry() { } func ExampleEC2_CreateNetworkInterface() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CreateNetworkInterfaceInput{ SubnetId: aws.String("String"), // Required @@ -937,7 +1153,13 @@ func ExampleEC2_CreateNetworkInterface() { } func ExampleEC2_CreatePlacementGroup() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CreatePlacementGroupInput{ GroupName: aws.String("String"), // Required @@ -958,7 +1180,13 @@ func ExampleEC2_CreatePlacementGroup() { } func ExampleEC2_CreateReservedInstancesListing() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CreateReservedInstancesListingInput{ ClientToken: aws.String("String"), // Required @@ -987,7 +1215,13 @@ func ExampleEC2_CreateReservedInstancesListing() { } func ExampleEC2_CreateRoute() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CreateRouteInput{ DestinationCidrBlock: aws.String("String"), // Required @@ -1013,7 +1247,13 @@ func ExampleEC2_CreateRoute() { } func ExampleEC2_CreateRouteTable() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CreateRouteTableInput{ VpcId: aws.String("String"), // Required @@ -1033,7 +1273,13 @@ func ExampleEC2_CreateRouteTable() { } func ExampleEC2_CreateSecurityGroup() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CreateSecurityGroupInput{ Description: aws.String("String"), // Required @@ -1055,7 +1301,13 @@ func ExampleEC2_CreateSecurityGroup() { } func ExampleEC2_CreateSnapshot() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CreateSnapshotInput{ VolumeId: aws.String("String"), // Required @@ -1076,7 +1328,13 @@ func ExampleEC2_CreateSnapshot() { } func ExampleEC2_CreateSpotDatafeedSubscription() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CreateSpotDatafeedSubscriptionInput{ Bucket: aws.String("String"), // Required @@ -1097,7 +1355,13 @@ func ExampleEC2_CreateSpotDatafeedSubscription() { } func ExampleEC2_CreateSubnet() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CreateSubnetInput{ CidrBlock: aws.String("String"), // Required @@ -1119,7 +1383,13 @@ func ExampleEC2_CreateSubnet() { } func ExampleEC2_CreateTags() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CreateTagsInput{ Resources: []*string{ // Required @@ -1149,7 +1419,13 @@ func ExampleEC2_CreateTags() { } func ExampleEC2_CreateVolume() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CreateVolumeInput{ AvailabilityZone: aws.String("String"), // Required @@ -1175,7 +1451,13 @@ func ExampleEC2_CreateVolume() { } func ExampleEC2_CreateVpc() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CreateVpcInput{ CidrBlock: aws.String("String"), // Required @@ -1196,7 +1478,13 @@ func ExampleEC2_CreateVpc() { } func ExampleEC2_CreateVpcEndpoint() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CreateVpcEndpointInput{ ServiceName: aws.String("String"), // Required @@ -1223,7 +1511,13 @@ func ExampleEC2_CreateVpcEndpoint() { } func ExampleEC2_CreateVpcPeeringConnection() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CreateVpcPeeringConnectionInput{ DryRun: aws.Bool(true), @@ -1245,7 +1539,13 @@ func ExampleEC2_CreateVpcPeeringConnection() { } func ExampleEC2_CreateVpnConnection() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CreateVpnConnectionInput{ CustomerGatewayId: aws.String("String"), // Required @@ -1270,7 +1570,13 @@ func ExampleEC2_CreateVpnConnection() { } func ExampleEC2_CreateVpnConnectionRoute() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CreateVpnConnectionRouteInput{ DestinationCidrBlock: aws.String("String"), // Required @@ -1290,7 +1596,13 @@ func ExampleEC2_CreateVpnConnectionRoute() { } func ExampleEC2_CreateVpnGateway() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.CreateVpnGatewayInput{ Type: aws.String("GatewayType"), // Required @@ -1311,7 +1623,13 @@ func ExampleEC2_CreateVpnGateway() { } func ExampleEC2_DeleteCustomerGateway() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DeleteCustomerGatewayInput{ CustomerGatewayId: aws.String("String"), // Required @@ -1331,7 +1649,13 @@ func ExampleEC2_DeleteCustomerGateway() { } func ExampleEC2_DeleteDhcpOptions() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DeleteDhcpOptionsInput{ DhcpOptionsId: aws.String("String"), // Required @@ -1351,7 +1675,13 @@ func ExampleEC2_DeleteDhcpOptions() { } func ExampleEC2_DeleteFlowLogs() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DeleteFlowLogsInput{ FlowLogIds: []*string{ // Required @@ -1373,7 +1703,13 @@ func ExampleEC2_DeleteFlowLogs() { } func ExampleEC2_DeleteInternetGateway() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DeleteInternetGatewayInput{ InternetGatewayId: aws.String("String"), // Required @@ -1393,7 +1729,13 @@ func ExampleEC2_DeleteInternetGateway() { } func ExampleEC2_DeleteKeyPair() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DeleteKeyPairInput{ KeyName: aws.String("String"), // Required @@ -1413,7 +1755,13 @@ func ExampleEC2_DeleteKeyPair() { } func ExampleEC2_DeleteNatGateway() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DeleteNatGatewayInput{ NatGatewayId: aws.String("String"), // Required @@ -1432,7 +1780,13 @@ func ExampleEC2_DeleteNatGateway() { } func ExampleEC2_DeleteNetworkAcl() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DeleteNetworkAclInput{ NetworkAclId: aws.String("String"), // Required @@ -1452,7 +1806,13 @@ func ExampleEC2_DeleteNetworkAcl() { } func ExampleEC2_DeleteNetworkAclEntry() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DeleteNetworkAclEntryInput{ Egress: aws.Bool(true), // Required @@ -1474,7 +1834,13 @@ func ExampleEC2_DeleteNetworkAclEntry() { } func ExampleEC2_DeleteNetworkInterface() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DeleteNetworkInterfaceInput{ NetworkInterfaceId: aws.String("String"), // Required @@ -1494,7 +1860,13 @@ func ExampleEC2_DeleteNetworkInterface() { } func ExampleEC2_DeletePlacementGroup() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DeletePlacementGroupInput{ GroupName: aws.String("String"), // Required @@ -1514,7 +1886,13 @@ func ExampleEC2_DeletePlacementGroup() { } func ExampleEC2_DeleteRoute() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DeleteRouteInput{ DestinationCidrBlock: aws.String("String"), // Required @@ -1535,7 +1913,13 @@ func ExampleEC2_DeleteRoute() { } func ExampleEC2_DeleteRouteTable() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DeleteRouteTableInput{ RouteTableId: aws.String("String"), // Required @@ -1555,7 +1939,13 @@ func ExampleEC2_DeleteRouteTable() { } func ExampleEC2_DeleteSecurityGroup() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DeleteSecurityGroupInput{ DryRun: aws.Bool(true), @@ -1576,7 +1966,13 @@ func ExampleEC2_DeleteSecurityGroup() { } func ExampleEC2_DeleteSnapshot() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DeleteSnapshotInput{ SnapshotId: aws.String("String"), // Required @@ -1596,7 +1992,13 @@ func ExampleEC2_DeleteSnapshot() { } func ExampleEC2_DeleteSpotDatafeedSubscription() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DeleteSpotDatafeedSubscriptionInput{ DryRun: aws.Bool(true), @@ -1615,7 +2017,13 @@ func ExampleEC2_DeleteSpotDatafeedSubscription() { } func ExampleEC2_DeleteSubnet() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DeleteSubnetInput{ SubnetId: aws.String("String"), // Required @@ -1635,7 +2043,13 @@ func ExampleEC2_DeleteSubnet() { } func ExampleEC2_DeleteTags() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DeleteTagsInput{ Resources: []*string{ // Required @@ -1665,7 +2079,13 @@ func ExampleEC2_DeleteTags() { } func ExampleEC2_DeleteVolume() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DeleteVolumeInput{ VolumeId: aws.String("String"), // Required @@ -1685,7 +2105,13 @@ func ExampleEC2_DeleteVolume() { } func ExampleEC2_DeleteVpc() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DeleteVpcInput{ VpcId: aws.String("String"), // Required @@ -1705,7 +2131,13 @@ func ExampleEC2_DeleteVpc() { } func ExampleEC2_DeleteVpcEndpoints() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DeleteVpcEndpointsInput{ VpcEndpointIds: []*string{ // Required @@ -1728,7 +2160,13 @@ func ExampleEC2_DeleteVpcEndpoints() { } func ExampleEC2_DeleteVpcPeeringConnection() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DeleteVpcPeeringConnectionInput{ VpcPeeringConnectionId: aws.String("String"), // Required @@ -1748,7 +2186,13 @@ func ExampleEC2_DeleteVpcPeeringConnection() { } func ExampleEC2_DeleteVpnConnection() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DeleteVpnConnectionInput{ VpnConnectionId: aws.String("String"), // Required @@ -1768,7 +2212,13 @@ func ExampleEC2_DeleteVpnConnection() { } func ExampleEC2_DeleteVpnConnectionRoute() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DeleteVpnConnectionRouteInput{ DestinationCidrBlock: aws.String("String"), // Required @@ -1788,7 +2238,13 @@ func ExampleEC2_DeleteVpnConnectionRoute() { } func ExampleEC2_DeleteVpnGateway() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DeleteVpnGatewayInput{ VpnGatewayId: aws.String("String"), // Required @@ -1808,7 +2264,13 @@ func ExampleEC2_DeleteVpnGateway() { } func ExampleEC2_DeregisterImage() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DeregisterImageInput{ ImageId: aws.String("String"), // Required @@ -1828,7 +2290,13 @@ func ExampleEC2_DeregisterImage() { } func ExampleEC2_DescribeAccountAttributes() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeAccountAttributesInput{ AttributeNames: []*string{ @@ -1851,7 +2319,13 @@ func ExampleEC2_DescribeAccountAttributes() { } func ExampleEC2_DescribeAddresses() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeAddressesInput{ AllocationIds: []*string{ @@ -1888,7 +2362,13 @@ func ExampleEC2_DescribeAddresses() { } func ExampleEC2_DescribeAvailabilityZones() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeAvailabilityZonesInput{ DryRun: aws.Bool(true), @@ -1921,7 +2401,13 @@ func ExampleEC2_DescribeAvailabilityZones() { } func ExampleEC2_DescribeBundleTasks() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeBundleTasksInput{ BundleIds: []*string{ @@ -1954,7 +2440,13 @@ func ExampleEC2_DescribeBundleTasks() { } func ExampleEC2_DescribeClassicLinkInstances() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeClassicLinkInstancesInput{ DryRun: aws.Bool(true), @@ -1989,7 +2481,13 @@ func ExampleEC2_DescribeClassicLinkInstances() { } func ExampleEC2_DescribeConversionTasks() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeConversionTasksInput{ ConversionTaskIds: []*string{ @@ -2022,7 +2520,13 @@ func ExampleEC2_DescribeConversionTasks() { } func ExampleEC2_DescribeCustomerGateways() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeCustomerGatewaysInput{ CustomerGatewayIds: []*string{ @@ -2055,7 +2559,13 @@ func ExampleEC2_DescribeCustomerGateways() { } func ExampleEC2_DescribeDhcpOptions() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeDhcpOptionsInput{ DhcpOptionsIds: []*string{ @@ -2088,7 +2598,13 @@ func ExampleEC2_DescribeDhcpOptions() { } func ExampleEC2_DescribeExportTasks() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeExportTasksInput{ ExportTaskIds: []*string{ @@ -2110,7 +2626,13 @@ func ExampleEC2_DescribeExportTasks() { } func ExampleEC2_DescribeFlowLogs() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeFlowLogsInput{ Filter: []*ec2.Filter{ @@ -2144,7 +2666,13 @@ func ExampleEC2_DescribeFlowLogs() { } func ExampleEC2_DescribeHosts() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeHostsInput{ Filter: []*ec2.Filter{ @@ -2178,7 +2706,13 @@ func ExampleEC2_DescribeHosts() { } func ExampleEC2_DescribeIdFormat() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeIdFormatInput{ Resource: aws.String("String"), @@ -2197,7 +2731,13 @@ func ExampleEC2_DescribeIdFormat() { } func ExampleEC2_DescribeIdentityIdFormat() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeIdentityIdFormatInput{ PrincipalArn: aws.String("String"), // Required @@ -2217,7 +2757,13 @@ func ExampleEC2_DescribeIdentityIdFormat() { } func ExampleEC2_DescribeImageAttribute() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeImageAttributeInput{ Attribute: aws.String("ImageAttributeName"), // Required @@ -2238,7 +2784,13 @@ func ExampleEC2_DescribeImageAttribute() { } func ExampleEC2_DescribeImages() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeImagesInput{ DryRun: aws.Bool(true), @@ -2279,7 +2831,13 @@ func ExampleEC2_DescribeImages() { } func ExampleEC2_DescribeImportImageTasks() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeImportImageTasksInput{ DryRun: aws.Bool(true), @@ -2314,7 +2872,13 @@ func ExampleEC2_DescribeImportImageTasks() { } func ExampleEC2_DescribeImportSnapshotTasks() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeImportSnapshotTasksInput{ DryRun: aws.Bool(true), @@ -2349,7 +2913,13 @@ func ExampleEC2_DescribeImportSnapshotTasks() { } func ExampleEC2_DescribeInstanceAttribute() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeInstanceAttributeInput{ Attribute: aws.String("InstanceAttributeName"), // Required @@ -2370,7 +2940,13 @@ func ExampleEC2_DescribeInstanceAttribute() { } func ExampleEC2_DescribeInstanceStatus() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeInstanceStatusInput{ DryRun: aws.Bool(true), @@ -2406,7 +2982,13 @@ func ExampleEC2_DescribeInstanceStatus() { } func ExampleEC2_DescribeInstances() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeInstancesInput{ DryRun: aws.Bool(true), @@ -2441,7 +3023,13 @@ func ExampleEC2_DescribeInstances() { } func ExampleEC2_DescribeInternetGateways() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeInternetGatewaysInput{ DryRun: aws.Bool(true), @@ -2474,7 +3062,13 @@ func ExampleEC2_DescribeInternetGateways() { } func ExampleEC2_DescribeKeyPairs() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeKeyPairsInput{ DryRun: aws.Bool(true), @@ -2507,7 +3101,13 @@ func ExampleEC2_DescribeKeyPairs() { } func ExampleEC2_DescribeMovingAddresses() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeMovingAddressesInput{ DryRun: aws.Bool(true), @@ -2542,7 +3142,13 @@ func ExampleEC2_DescribeMovingAddresses() { } func ExampleEC2_DescribeNatGateways() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeNatGatewaysInput{ Filter: []*ec2.Filter{ @@ -2576,7 +3182,13 @@ func ExampleEC2_DescribeNatGateways() { } func ExampleEC2_DescribeNetworkAcls() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeNetworkAclsInput{ DryRun: aws.Bool(true), @@ -2609,7 +3221,13 @@ func ExampleEC2_DescribeNetworkAcls() { } func ExampleEC2_DescribeNetworkInterfaceAttribute() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeNetworkInterfaceAttributeInput{ NetworkInterfaceId: aws.String("String"), // Required @@ -2630,7 +3248,13 @@ func ExampleEC2_DescribeNetworkInterfaceAttribute() { } func ExampleEC2_DescribeNetworkInterfaces() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeNetworkInterfacesInput{ DryRun: aws.Bool(true), @@ -2663,7 +3287,13 @@ func ExampleEC2_DescribeNetworkInterfaces() { } func ExampleEC2_DescribePlacementGroups() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribePlacementGroupsInput{ DryRun: aws.Bool(true), @@ -2696,7 +3326,13 @@ func ExampleEC2_DescribePlacementGroups() { } func ExampleEC2_DescribePrefixLists() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribePrefixListsInput{ DryRun: aws.Bool(true), @@ -2731,7 +3367,13 @@ func ExampleEC2_DescribePrefixLists() { } func ExampleEC2_DescribeRegions() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeRegionsInput{ DryRun: aws.Bool(true), @@ -2764,7 +3406,13 @@ func ExampleEC2_DescribeRegions() { } func ExampleEC2_DescribeReservedInstances() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeReservedInstancesInput{ DryRun: aws.Bool(true), @@ -2798,7 +3446,13 @@ func ExampleEC2_DescribeReservedInstances() { } func ExampleEC2_DescribeReservedInstancesListings() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeReservedInstancesListingsInput{ Filters: []*ec2.Filter{ @@ -2828,7 +3482,13 @@ func ExampleEC2_DescribeReservedInstancesListings() { } func ExampleEC2_DescribeReservedInstancesModifications() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeReservedInstancesModificationsInput{ Filters: []*ec2.Filter{ @@ -2861,7 +3521,13 @@ func ExampleEC2_DescribeReservedInstancesModifications() { } func ExampleEC2_DescribeReservedInstancesOfferings() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeReservedInstancesOfferingsInput{ AvailabilityZone: aws.String("String"), @@ -2905,7 +3571,13 @@ func ExampleEC2_DescribeReservedInstancesOfferings() { } func ExampleEC2_DescribeRouteTables() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeRouteTablesInput{ DryRun: aws.Bool(true), @@ -2938,7 +3610,13 @@ func ExampleEC2_DescribeRouteTables() { } func ExampleEC2_DescribeScheduledInstanceAvailability() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeScheduledInstanceAvailabilityInput{ FirstSlotStartTimeRange: &ec2.SlotDateTimeRangeRequest{ // Required @@ -2985,7 +3663,13 @@ func ExampleEC2_DescribeScheduledInstanceAvailability() { } func ExampleEC2_DescribeScheduledInstances() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeScheduledInstancesInput{ DryRun: aws.Bool(true), @@ -3024,7 +3708,13 @@ func ExampleEC2_DescribeScheduledInstances() { } func ExampleEC2_DescribeSecurityGroupReferences() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeSecurityGroupReferencesInput{ GroupId: []*string{ // Required @@ -3047,7 +3737,13 @@ func ExampleEC2_DescribeSecurityGroupReferences() { } func ExampleEC2_DescribeSecurityGroups() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeSecurityGroupsInput{ DryRun: aws.Bool(true), @@ -3084,7 +3780,13 @@ func ExampleEC2_DescribeSecurityGroups() { } func ExampleEC2_DescribeSnapshotAttribute() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeSnapshotAttributeInput{ Attribute: aws.String("SnapshotAttributeName"), // Required @@ -3105,7 +3807,13 @@ func ExampleEC2_DescribeSnapshotAttribute() { } func ExampleEC2_DescribeSnapshots() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeSnapshotsInput{ DryRun: aws.Bool(true), @@ -3148,7 +3856,13 @@ func ExampleEC2_DescribeSnapshots() { } func ExampleEC2_DescribeSpotDatafeedSubscription() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeSpotDatafeedSubscriptionInput{ DryRun: aws.Bool(true), @@ -3167,7 +3881,13 @@ func ExampleEC2_DescribeSpotDatafeedSubscription() { } func ExampleEC2_DescribeSpotFleetInstances() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeSpotFleetInstancesInput{ SpotFleetRequestId: aws.String("String"), // Required @@ -3189,7 +3909,13 @@ func ExampleEC2_DescribeSpotFleetInstances() { } func ExampleEC2_DescribeSpotFleetRequestHistory() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeSpotFleetRequestHistoryInput{ SpotFleetRequestId: aws.String("String"), // Required @@ -3213,7 +3939,13 @@ func ExampleEC2_DescribeSpotFleetRequestHistory() { } func ExampleEC2_DescribeSpotFleetRequests() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeSpotFleetRequestsInput{ DryRun: aws.Bool(true), @@ -3238,7 +3970,13 @@ func ExampleEC2_DescribeSpotFleetRequests() { } func ExampleEC2_DescribeSpotInstanceRequests() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeSpotInstanceRequestsInput{ DryRun: aws.Bool(true), @@ -3271,7 +4009,13 @@ func ExampleEC2_DescribeSpotInstanceRequests() { } func ExampleEC2_DescribeSpotPriceHistory() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeSpotPriceHistoryInput{ AvailabilityZone: aws.String("String"), @@ -3313,7 +4057,13 @@ func ExampleEC2_DescribeSpotPriceHistory() { } func ExampleEC2_DescribeStaleSecurityGroups() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeStaleSecurityGroupsInput{ VpcId: aws.String("String"), // Required @@ -3335,7 +4085,13 @@ func ExampleEC2_DescribeStaleSecurityGroups() { } func ExampleEC2_DescribeSubnets() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeSubnetsInput{ DryRun: aws.Bool(true), @@ -3368,7 +4124,13 @@ func ExampleEC2_DescribeSubnets() { } func ExampleEC2_DescribeTags() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeTagsInput{ DryRun: aws.Bool(true), @@ -3399,7 +4161,13 @@ func ExampleEC2_DescribeTags() { } func ExampleEC2_DescribeVolumeAttribute() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeVolumeAttributeInput{ VolumeId: aws.String("String"), // Required @@ -3420,7 +4188,13 @@ func ExampleEC2_DescribeVolumeAttribute() { } func ExampleEC2_DescribeVolumeStatus() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeVolumeStatusInput{ DryRun: aws.Bool(true), @@ -3455,7 +4229,13 @@ func ExampleEC2_DescribeVolumeStatus() { } func ExampleEC2_DescribeVolumes() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeVolumesInput{ DryRun: aws.Bool(true), @@ -3490,7 +4270,13 @@ func ExampleEC2_DescribeVolumes() { } func ExampleEC2_DescribeVpcAttribute() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeVpcAttributeInput{ Attribute: aws.String("VpcAttributeName"), // Required @@ -3511,7 +4297,13 @@ func ExampleEC2_DescribeVpcAttribute() { } func ExampleEC2_DescribeVpcClassicLink() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeVpcClassicLinkInput{ DryRun: aws.Bool(true), @@ -3544,7 +4336,13 @@ func ExampleEC2_DescribeVpcClassicLink() { } func ExampleEC2_DescribeVpcClassicLinkDnsSupport() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeVpcClassicLinkDnsSupportInput{ MaxResults: aws.Int64(1), @@ -3568,7 +4366,13 @@ func ExampleEC2_DescribeVpcClassicLinkDnsSupport() { } func ExampleEC2_DescribeVpcEndpointServices() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeVpcEndpointServicesInput{ DryRun: aws.Bool(true), @@ -3589,7 +4393,13 @@ func ExampleEC2_DescribeVpcEndpointServices() { } func ExampleEC2_DescribeVpcEndpoints() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeVpcEndpointsInput{ DryRun: aws.Bool(true), @@ -3624,7 +4434,13 @@ func ExampleEC2_DescribeVpcEndpoints() { } func ExampleEC2_DescribeVpcPeeringConnections() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeVpcPeeringConnectionsInput{ DryRun: aws.Bool(true), @@ -3657,7 +4473,13 @@ func ExampleEC2_DescribeVpcPeeringConnections() { } func ExampleEC2_DescribeVpcs() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeVpcsInput{ DryRun: aws.Bool(true), @@ -3690,7 +4512,13 @@ func ExampleEC2_DescribeVpcs() { } func ExampleEC2_DescribeVpnConnections() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeVpnConnectionsInput{ DryRun: aws.Bool(true), @@ -3723,7 +4551,13 @@ func ExampleEC2_DescribeVpnConnections() { } func ExampleEC2_DescribeVpnGateways() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DescribeVpnGatewaysInput{ DryRun: aws.Bool(true), @@ -3756,7 +4590,13 @@ func ExampleEC2_DescribeVpnGateways() { } func ExampleEC2_DetachClassicLinkVpc() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DetachClassicLinkVpcInput{ InstanceId: aws.String("String"), // Required @@ -3777,7 +4617,13 @@ func ExampleEC2_DetachClassicLinkVpc() { } func ExampleEC2_DetachInternetGateway() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DetachInternetGatewayInput{ InternetGatewayId: aws.String("String"), // Required @@ -3798,7 +4644,13 @@ func ExampleEC2_DetachInternetGateway() { } func ExampleEC2_DetachNetworkInterface() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DetachNetworkInterfaceInput{ AttachmentId: aws.String("String"), // Required @@ -3819,7 +4671,13 @@ func ExampleEC2_DetachNetworkInterface() { } func ExampleEC2_DetachVolume() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DetachVolumeInput{ VolumeId: aws.String("String"), // Required @@ -3842,7 +4700,13 @@ func ExampleEC2_DetachVolume() { } func ExampleEC2_DetachVpnGateway() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DetachVpnGatewayInput{ VpcId: aws.String("String"), // Required @@ -3863,7 +4727,13 @@ func ExampleEC2_DetachVpnGateway() { } func ExampleEC2_DisableVgwRoutePropagation() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DisableVgwRoutePropagationInput{ GatewayId: aws.String("String"), // Required @@ -3883,7 +4753,13 @@ func ExampleEC2_DisableVgwRoutePropagation() { } func ExampleEC2_DisableVpcClassicLink() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DisableVpcClassicLinkInput{ VpcId: aws.String("String"), // Required @@ -3903,7 +4779,13 @@ func ExampleEC2_DisableVpcClassicLink() { } func ExampleEC2_DisableVpcClassicLinkDnsSupport() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DisableVpcClassicLinkDnsSupportInput{ VpcId: aws.String("String"), @@ -3922,7 +4804,13 @@ func ExampleEC2_DisableVpcClassicLinkDnsSupport() { } func ExampleEC2_DisassociateAddress() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DisassociateAddressInput{ AssociationId: aws.String("String"), @@ -3943,7 +4831,13 @@ func ExampleEC2_DisassociateAddress() { } func ExampleEC2_DisassociateRouteTable() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.DisassociateRouteTableInput{ AssociationId: aws.String("String"), // Required @@ -3963,7 +4857,13 @@ func ExampleEC2_DisassociateRouteTable() { } func ExampleEC2_EnableVgwRoutePropagation() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.EnableVgwRoutePropagationInput{ GatewayId: aws.String("String"), // Required @@ -3983,7 +4883,13 @@ func ExampleEC2_EnableVgwRoutePropagation() { } func ExampleEC2_EnableVolumeIO() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.EnableVolumeIOInput{ VolumeId: aws.String("String"), // Required @@ -4003,7 +4909,13 @@ func ExampleEC2_EnableVolumeIO() { } func ExampleEC2_EnableVpcClassicLink() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.EnableVpcClassicLinkInput{ VpcId: aws.String("String"), // Required @@ -4023,7 +4935,13 @@ func ExampleEC2_EnableVpcClassicLink() { } func ExampleEC2_EnableVpcClassicLinkDnsSupport() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.EnableVpcClassicLinkDnsSupportInput{ VpcId: aws.String("String"), @@ -4042,7 +4960,13 @@ func ExampleEC2_EnableVpcClassicLinkDnsSupport() { } func ExampleEC2_GetConsoleOutput() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.GetConsoleOutputInput{ InstanceId: aws.String("String"), // Required @@ -4062,7 +4986,13 @@ func ExampleEC2_GetConsoleOutput() { } func ExampleEC2_GetConsoleScreenshot() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.GetConsoleScreenshotInput{ InstanceId: aws.String("String"), // Required @@ -4083,7 +5013,13 @@ func ExampleEC2_GetConsoleScreenshot() { } func ExampleEC2_GetPasswordData() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.GetPasswordDataInput{ InstanceId: aws.String("String"), // Required @@ -4103,7 +5039,13 @@ func ExampleEC2_GetPasswordData() { } func ExampleEC2_ImportImage() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.ImportImageInput{ Architecture: aws.String("String"), @@ -4149,7 +5091,13 @@ func ExampleEC2_ImportImage() { } func ExampleEC2_ImportInstance() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.ImportInstanceInput{ Platform: aws.String("PlatformValues"), // Required @@ -4211,7 +5159,13 @@ func ExampleEC2_ImportInstance() { } func ExampleEC2_ImportKeyPair() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.ImportKeyPairInput{ KeyName: aws.String("String"), // Required @@ -4232,7 +5186,13 @@ func ExampleEC2_ImportKeyPair() { } func ExampleEC2_ImportSnapshot() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.ImportSnapshotInput{ ClientData: &ec2.ClientData{ @@ -4269,7 +5229,13 @@ func ExampleEC2_ImportSnapshot() { } func ExampleEC2_ImportVolume() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.ImportVolumeInput{ AvailabilityZone: aws.String("String"), // Required @@ -4298,7 +5264,13 @@ func ExampleEC2_ImportVolume() { } func ExampleEC2_ModifyHosts() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.ModifyHostsInput{ AutoPlacement: aws.String("AutoPlacement"), // Required @@ -4321,7 +5293,13 @@ func ExampleEC2_ModifyHosts() { } func ExampleEC2_ModifyIdFormat() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.ModifyIdFormatInput{ Resource: aws.String("String"), // Required @@ -4341,7 +5319,13 @@ func ExampleEC2_ModifyIdFormat() { } func ExampleEC2_ModifyIdentityIdFormat() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.ModifyIdentityIdFormatInput{ PrincipalArn: aws.String("String"), // Required @@ -4362,7 +5346,13 @@ func ExampleEC2_ModifyIdentityIdFormat() { } func ExampleEC2_ModifyImageAttribute() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.ModifyImageAttributeInput{ ImageId: aws.String("String"), // Required @@ -4416,7 +5406,13 @@ func ExampleEC2_ModifyImageAttribute() { } func ExampleEC2_ModifyInstanceAttribute() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.ModifyInstanceAttributeInput{ InstanceId: aws.String("String"), // Required @@ -4484,7 +5480,13 @@ func ExampleEC2_ModifyInstanceAttribute() { } func ExampleEC2_ModifyInstancePlacement() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.ModifyInstancePlacementInput{ InstanceId: aws.String("String"), // Required @@ -4506,7 +5508,13 @@ func ExampleEC2_ModifyInstancePlacement() { } func ExampleEC2_ModifyNetworkInterfaceAttribute() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.ModifyNetworkInterfaceAttributeInput{ NetworkInterfaceId: aws.String("String"), // Required @@ -4540,7 +5548,13 @@ func ExampleEC2_ModifyNetworkInterfaceAttribute() { } func ExampleEC2_ModifyReservedInstances() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.ModifyReservedInstancesInput{ ReservedInstancesIds: []*string{ // Required @@ -4572,7 +5586,13 @@ func ExampleEC2_ModifyReservedInstances() { } func ExampleEC2_ModifySnapshotAttribute() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.ModifySnapshotAttributeInput{ SnapshotId: aws.String("String"), // Required @@ -4618,7 +5638,13 @@ func ExampleEC2_ModifySnapshotAttribute() { } func ExampleEC2_ModifySpotFleetRequest() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.ModifySpotFleetRequestInput{ SpotFleetRequestId: aws.String("String"), // Required @@ -4639,7 +5665,13 @@ func ExampleEC2_ModifySpotFleetRequest() { } func ExampleEC2_ModifySubnetAttribute() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.ModifySubnetAttributeInput{ SubnetId: aws.String("String"), // Required @@ -4661,7 +5693,13 @@ func ExampleEC2_ModifySubnetAttribute() { } func ExampleEC2_ModifyVolumeAttribute() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.ModifyVolumeAttributeInput{ VolumeId: aws.String("String"), // Required @@ -4684,7 +5722,13 @@ func ExampleEC2_ModifyVolumeAttribute() { } func ExampleEC2_ModifyVpcAttribute() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.ModifyVpcAttributeInput{ VpcId: aws.String("String"), // Required @@ -4709,7 +5753,13 @@ func ExampleEC2_ModifyVpcAttribute() { } func ExampleEC2_ModifyVpcEndpoint() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.ModifyVpcEndpointInput{ VpcEndpointId: aws.String("String"), // Required @@ -4739,7 +5789,13 @@ func ExampleEC2_ModifyVpcEndpoint() { } func ExampleEC2_ModifyVpcPeeringConnectionOptions() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.ModifyVpcPeeringConnectionOptionsInput{ VpcPeeringConnectionId: aws.String("String"), // Required @@ -4769,7 +5825,13 @@ func ExampleEC2_ModifyVpcPeeringConnectionOptions() { } func ExampleEC2_MonitorInstances() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.MonitorInstancesInput{ InstanceIds: []*string{ // Required @@ -4792,7 +5854,13 @@ func ExampleEC2_MonitorInstances() { } func ExampleEC2_MoveAddressToVpc() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.MoveAddressToVpcInput{ PublicIp: aws.String("String"), // Required @@ -4812,7 +5880,13 @@ func ExampleEC2_MoveAddressToVpc() { } func ExampleEC2_PurchaseReservedInstancesOffering() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.PurchaseReservedInstancesOfferingInput{ InstanceCount: aws.Int64(1), // Required @@ -4837,7 +5911,13 @@ func ExampleEC2_PurchaseReservedInstancesOffering() { } func ExampleEC2_PurchaseScheduledInstances() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.PurchaseScheduledInstancesInput{ PurchaseRequests: []*ec2.PurchaseRequest{ // Required @@ -4864,7 +5944,13 @@ func ExampleEC2_PurchaseScheduledInstances() { } func ExampleEC2_RebootInstances() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.RebootInstancesInput{ InstanceIds: []*string{ // Required @@ -4887,7 +5973,13 @@ func ExampleEC2_RebootInstances() { } func ExampleEC2_RegisterImage() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.RegisterImageInput{ Name: aws.String("String"), // Required @@ -4932,7 +6024,13 @@ func ExampleEC2_RegisterImage() { } func ExampleEC2_RejectVpcPeeringConnection() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.RejectVpcPeeringConnectionInput{ VpcPeeringConnectionId: aws.String("String"), // Required @@ -4952,7 +6050,13 @@ func ExampleEC2_RejectVpcPeeringConnection() { } func ExampleEC2_ReleaseAddress() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.ReleaseAddressInput{ AllocationId: aws.String("String"), @@ -4973,7 +6077,13 @@ func ExampleEC2_ReleaseAddress() { } func ExampleEC2_ReleaseHosts() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.ReleaseHostsInput{ HostIds: []*string{ // Required @@ -4995,7 +6105,13 @@ func ExampleEC2_ReleaseHosts() { } func ExampleEC2_ReplaceNetworkAclAssociation() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.ReplaceNetworkAclAssociationInput{ AssociationId: aws.String("String"), // Required @@ -5016,7 +6132,13 @@ func ExampleEC2_ReplaceNetworkAclAssociation() { } func ExampleEC2_ReplaceNetworkAclEntry() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.ReplaceNetworkAclEntryInput{ CidrBlock: aws.String("String"), // Required @@ -5049,7 +6171,13 @@ func ExampleEC2_ReplaceNetworkAclEntry() { } func ExampleEC2_ReplaceRoute() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.ReplaceRouteInput{ DestinationCidrBlock: aws.String("String"), // Required @@ -5075,7 +6203,13 @@ func ExampleEC2_ReplaceRoute() { } func ExampleEC2_ReplaceRouteTableAssociation() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.ReplaceRouteTableAssociationInput{ AssociationId: aws.String("String"), // Required @@ -5096,7 +6230,13 @@ func ExampleEC2_ReplaceRouteTableAssociation() { } func ExampleEC2_ReportInstanceStatus() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.ReportInstanceStatusInput{ Instances: []*string{ // Required @@ -5127,7 +6267,13 @@ func ExampleEC2_ReportInstanceStatus() { } func ExampleEC2_RequestSpotFleet() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.RequestSpotFleetInput{ SpotFleetRequestConfig: &ec2.SpotFleetRequestConfigData{ // Required @@ -5233,7 +6379,13 @@ func ExampleEC2_RequestSpotFleet() { } func ExampleEC2_RequestSpotInstances() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.RequestSpotInstancesInput{ SpotPrice: aws.String("String"), // Required @@ -5331,7 +6483,13 @@ func ExampleEC2_RequestSpotInstances() { } func ExampleEC2_ResetImageAttribute() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.ResetImageAttributeInput{ Attribute: aws.String("ResetImageAttributeName"), // Required @@ -5352,7 +6510,13 @@ func ExampleEC2_ResetImageAttribute() { } func ExampleEC2_ResetInstanceAttribute() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.ResetInstanceAttributeInput{ Attribute: aws.String("InstanceAttributeName"), // Required @@ -5373,7 +6537,13 @@ func ExampleEC2_ResetInstanceAttribute() { } func ExampleEC2_ResetNetworkInterfaceAttribute() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.ResetNetworkInterfaceAttributeInput{ NetworkInterfaceId: aws.String("String"), // Required @@ -5394,7 +6564,13 @@ func ExampleEC2_ResetNetworkInterfaceAttribute() { } func ExampleEC2_ResetSnapshotAttribute() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.ResetSnapshotAttributeInput{ Attribute: aws.String("SnapshotAttributeName"), // Required @@ -5415,7 +6591,13 @@ func ExampleEC2_ResetSnapshotAttribute() { } func ExampleEC2_RestoreAddressToClassic() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.RestoreAddressToClassicInput{ PublicIp: aws.String("String"), // Required @@ -5435,7 +6617,13 @@ func ExampleEC2_RestoreAddressToClassic() { } func ExampleEC2_RevokeSecurityGroupEgress() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.RevokeSecurityGroupEgressInput{ GroupId: aws.String("String"), // Required @@ -5492,7 +6680,13 @@ func ExampleEC2_RevokeSecurityGroupEgress() { } func ExampleEC2_RevokeSecurityGroupIngress() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.RevokeSecurityGroupIngressInput{ CidrIp: aws.String("String"), @@ -5550,7 +6744,13 @@ func ExampleEC2_RevokeSecurityGroupIngress() { } func ExampleEC2_RunInstances() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.RunInstancesInput{ ImageId: aws.String("String"), // Required @@ -5646,7 +6846,13 @@ func ExampleEC2_RunInstances() { } func ExampleEC2_RunScheduledInstances() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.RunScheduledInstancesInput{ LaunchSpecification: &ec2.ScheduledInstancesLaunchSpecification{ // Required @@ -5733,7 +6939,13 @@ func ExampleEC2_RunScheduledInstances() { } func ExampleEC2_StartInstances() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.StartInstancesInput{ InstanceIds: []*string{ // Required @@ -5757,7 +6969,13 @@ func ExampleEC2_StartInstances() { } func ExampleEC2_StopInstances() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.StopInstancesInput{ InstanceIds: []*string{ // Required @@ -5781,7 +6999,13 @@ func ExampleEC2_StopInstances() { } func ExampleEC2_TerminateInstances() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.TerminateInstancesInput{ InstanceIds: []*string{ // Required @@ -5804,7 +7028,13 @@ func ExampleEC2_TerminateInstances() { } func ExampleEC2_UnassignPrivateIpAddresses() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.UnassignPrivateIpAddressesInput{ NetworkInterfaceId: aws.String("String"), // Required @@ -5827,7 +7057,13 @@ func ExampleEC2_UnassignPrivateIpAddresses() { } func ExampleEC2_UnmonitorInstances() { - svc := ec2.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ec2.New(sess) params := &ec2.UnmonitorInstancesInput{ InstanceIds: []*string{ // Required diff --git a/service/ecr/examples_test.go b/service/ecr/examples_test.go index 95e088baee8..3f11685ee7c 100644 --- a/service/ecr/examples_test.go +++ b/service/ecr/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleECR_BatchCheckLayerAvailability() { - svc := ecr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecr.New(sess) params := &ecr.BatchCheckLayerAvailabilityInput{ LayerDigests: []*string{ // Required @@ -40,7 +46,13 @@ func ExampleECR_BatchCheckLayerAvailability() { } func ExampleECR_BatchDeleteImage() { - svc := ecr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecr.New(sess) params := &ecr.BatchDeleteImageInput{ ImageIds: []*ecr.ImageIdentifier{ // Required @@ -67,7 +79,13 @@ func ExampleECR_BatchDeleteImage() { } func ExampleECR_BatchGetImage() { - svc := ecr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecr.New(sess) params := &ecr.BatchGetImageInput{ ImageIds: []*ecr.ImageIdentifier{ // Required @@ -94,7 +112,13 @@ func ExampleECR_BatchGetImage() { } func ExampleECR_CompleteLayerUpload() { - svc := ecr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecr.New(sess) params := &ecr.CompleteLayerUploadInput{ LayerDigests: []*string{ // Required @@ -119,7 +143,13 @@ func ExampleECR_CompleteLayerUpload() { } func ExampleECR_CreateRepository() { - svc := ecr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecr.New(sess) params := &ecr.CreateRepositoryInput{ RepositoryName: aws.String("RepositoryName"), // Required @@ -138,7 +168,13 @@ func ExampleECR_CreateRepository() { } func ExampleECR_DeleteRepository() { - svc := ecr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecr.New(sess) params := &ecr.DeleteRepositoryInput{ RepositoryName: aws.String("RepositoryName"), // Required @@ -159,7 +195,13 @@ func ExampleECR_DeleteRepository() { } func ExampleECR_DeleteRepositoryPolicy() { - svc := ecr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecr.New(sess) params := &ecr.DeleteRepositoryPolicyInput{ RepositoryName: aws.String("RepositoryName"), // Required @@ -179,7 +221,13 @@ func ExampleECR_DeleteRepositoryPolicy() { } func ExampleECR_DescribeRepositories() { - svc := ecr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecr.New(sess) params := &ecr.DescribeRepositoriesInput{ MaxResults: aws.Int64(1), @@ -204,7 +252,13 @@ func ExampleECR_DescribeRepositories() { } func ExampleECR_GetAuthorizationToken() { - svc := ecr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecr.New(sess) params := &ecr.GetAuthorizationTokenInput{ RegistryIds: []*string{ @@ -226,7 +280,13 @@ func ExampleECR_GetAuthorizationToken() { } func ExampleECR_GetDownloadUrlForLayer() { - svc := ecr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecr.New(sess) params := &ecr.GetDownloadUrlForLayerInput{ LayerDigest: aws.String("LayerDigest"), // Required @@ -247,7 +307,13 @@ func ExampleECR_GetDownloadUrlForLayer() { } func ExampleECR_GetRepositoryPolicy() { - svc := ecr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecr.New(sess) params := &ecr.GetRepositoryPolicyInput{ RepositoryName: aws.String("RepositoryName"), // Required @@ -267,7 +333,13 @@ func ExampleECR_GetRepositoryPolicy() { } func ExampleECR_InitiateLayerUpload() { - svc := ecr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecr.New(sess) params := &ecr.InitiateLayerUploadInput{ RepositoryName: aws.String("RepositoryName"), // Required @@ -287,7 +359,13 @@ func ExampleECR_InitiateLayerUpload() { } func ExampleECR_ListImages() { - svc := ecr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecr.New(sess) params := &ecr.ListImagesInput{ RepositoryName: aws.String("RepositoryName"), // Required @@ -309,7 +387,13 @@ func ExampleECR_ListImages() { } func ExampleECR_PutImage() { - svc := ecr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecr.New(sess) params := &ecr.PutImageInput{ ImageManifest: aws.String("ImageManifest"), // Required @@ -330,7 +414,13 @@ func ExampleECR_PutImage() { } func ExampleECR_SetRepositoryPolicy() { - svc := ecr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecr.New(sess) params := &ecr.SetRepositoryPolicyInput{ PolicyText: aws.String("RepositoryPolicyText"), // Required @@ -352,7 +442,13 @@ func ExampleECR_SetRepositoryPolicy() { } func ExampleECR_UploadLayerPart() { - svc := ecr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecr.New(sess) params := &ecr.UploadLayerPartInput{ LayerPartBlob: []byte("PAYLOAD"), // Required diff --git a/service/ecs/examples_test.go b/service/ecs/examples_test.go index be496ffe06a..0399cfcb449 100644 --- a/service/ecs/examples_test.go +++ b/service/ecs/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleECS_CreateCluster() { - svc := ecs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecs.New(sess) params := &ecs.CreateClusterInput{ ClusterName: aws.String("String"), @@ -35,7 +41,13 @@ func ExampleECS_CreateCluster() { } func ExampleECS_CreateService() { - svc := ecs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecs.New(sess) params := &ecs.CreateServiceInput{ DesiredCount: aws.Int64(1), // Required @@ -71,7 +83,13 @@ func ExampleECS_CreateService() { } func ExampleECS_DeleteCluster() { - svc := ecs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecs.New(sess) params := &ecs.DeleteClusterInput{ Cluster: aws.String("String"), // Required @@ -90,7 +108,13 @@ func ExampleECS_DeleteCluster() { } func ExampleECS_DeleteService() { - svc := ecs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecs.New(sess) params := &ecs.DeleteServiceInput{ Service: aws.String("String"), // Required @@ -110,7 +134,13 @@ func ExampleECS_DeleteService() { } func ExampleECS_DeregisterContainerInstance() { - svc := ecs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecs.New(sess) params := &ecs.DeregisterContainerInstanceInput{ ContainerInstance: aws.String("String"), // Required @@ -131,7 +161,13 @@ func ExampleECS_DeregisterContainerInstance() { } func ExampleECS_DeregisterTaskDefinition() { - svc := ecs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecs.New(sess) params := &ecs.DeregisterTaskDefinitionInput{ TaskDefinition: aws.String("String"), // Required @@ -150,7 +186,13 @@ func ExampleECS_DeregisterTaskDefinition() { } func ExampleECS_DescribeClusters() { - svc := ecs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecs.New(sess) params := &ecs.DescribeClustersInput{ Clusters: []*string{ @@ -172,7 +214,13 @@ func ExampleECS_DescribeClusters() { } func ExampleECS_DescribeContainerInstances() { - svc := ecs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecs.New(sess) params := &ecs.DescribeContainerInstancesInput{ ContainerInstances: []*string{ // Required @@ -195,7 +243,13 @@ func ExampleECS_DescribeContainerInstances() { } func ExampleECS_DescribeServices() { - svc := ecs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecs.New(sess) params := &ecs.DescribeServicesInput{ Services: []*string{ // Required @@ -218,7 +272,13 @@ func ExampleECS_DescribeServices() { } func ExampleECS_DescribeTaskDefinition() { - svc := ecs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecs.New(sess) params := &ecs.DescribeTaskDefinitionInput{ TaskDefinition: aws.String("String"), // Required @@ -237,7 +297,13 @@ func ExampleECS_DescribeTaskDefinition() { } func ExampleECS_DescribeTasks() { - svc := ecs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecs.New(sess) params := &ecs.DescribeTasksInput{ Tasks: []*string{ // Required @@ -260,7 +326,13 @@ func ExampleECS_DescribeTasks() { } func ExampleECS_DiscoverPollEndpoint() { - svc := ecs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecs.New(sess) params := &ecs.DiscoverPollEndpointInput{ Cluster: aws.String("String"), @@ -280,7 +352,13 @@ func ExampleECS_DiscoverPollEndpoint() { } func ExampleECS_ListClusters() { - svc := ecs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecs.New(sess) params := &ecs.ListClustersInput{ MaxResults: aws.Int64(1), @@ -300,7 +378,13 @@ func ExampleECS_ListClusters() { } func ExampleECS_ListContainerInstances() { - svc := ecs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecs.New(sess) params := &ecs.ListContainerInstancesInput{ Cluster: aws.String("String"), @@ -321,7 +405,13 @@ func ExampleECS_ListContainerInstances() { } func ExampleECS_ListServices() { - svc := ecs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecs.New(sess) params := &ecs.ListServicesInput{ Cluster: aws.String("String"), @@ -342,7 +432,13 @@ func ExampleECS_ListServices() { } func ExampleECS_ListTaskDefinitionFamilies() { - svc := ecs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecs.New(sess) params := &ecs.ListTaskDefinitionFamiliesInput{ FamilyPrefix: aws.String("String"), @@ -364,7 +460,13 @@ func ExampleECS_ListTaskDefinitionFamilies() { } func ExampleECS_ListTaskDefinitions() { - svc := ecs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecs.New(sess) params := &ecs.ListTaskDefinitionsInput{ FamilyPrefix: aws.String("String"), @@ -387,7 +489,13 @@ func ExampleECS_ListTaskDefinitions() { } func ExampleECS_ListTasks() { - svc := ecs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecs.New(sess) params := &ecs.ListTasksInput{ Cluster: aws.String("String"), @@ -413,7 +521,13 @@ func ExampleECS_ListTasks() { } func ExampleECS_RegisterContainerInstance() { - svc := ecs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecs.New(sess) params := &ecs.RegisterContainerInstanceInput{ Attributes: []*ecs.Attribute{ @@ -461,7 +575,13 @@ func ExampleECS_RegisterContainerInstance() { } func ExampleECS_RegisterTaskDefinition() { - svc := ecs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecs.New(sess) params := &ecs.RegisterTaskDefinitionInput{ ContainerDefinitions: []*ecs.ContainerDefinition{ // Required @@ -586,7 +706,13 @@ func ExampleECS_RegisterTaskDefinition() { } func ExampleECS_RunTask() { - svc := ecs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecs.New(sess) params := &ecs.RunTaskInput{ TaskDefinition: aws.String("String"), // Required @@ -628,7 +754,13 @@ func ExampleECS_RunTask() { } func ExampleECS_StartTask() { - svc := ecs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecs.New(sess) params := &ecs.StartTaskInput{ ContainerInstances: []*string{ // Required @@ -673,7 +805,13 @@ func ExampleECS_StartTask() { } func ExampleECS_StopTask() { - svc := ecs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecs.New(sess) params := &ecs.StopTaskInput{ Task: aws.String("String"), // Required @@ -694,7 +832,13 @@ func ExampleECS_StopTask() { } func ExampleECS_SubmitContainerStateChange() { - svc := ecs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecs.New(sess) params := &ecs.SubmitContainerStateChangeInput{ Cluster: aws.String("String"), @@ -727,7 +871,13 @@ func ExampleECS_SubmitContainerStateChange() { } func ExampleECS_SubmitTaskStateChange() { - svc := ecs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecs.New(sess) params := &ecs.SubmitTaskStateChangeInput{ Cluster: aws.String("String"), @@ -749,7 +899,13 @@ func ExampleECS_SubmitTaskStateChange() { } func ExampleECS_UpdateContainerAgent() { - svc := ecs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecs.New(sess) params := &ecs.UpdateContainerAgentInput{ ContainerInstance: aws.String("String"), // Required @@ -769,7 +925,13 @@ func ExampleECS_UpdateContainerAgent() { } func ExampleECS_UpdateService() { - svc := ecs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ecs.New(sess) params := &ecs.UpdateServiceInput{ Service: aws.String("String"), // Required diff --git a/service/efs/examples_test.go b/service/efs/examples_test.go index 72e705e15e3..6fc3dddfe99 100644 --- a/service/efs/examples_test.go +++ b/service/efs/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleEFS_CreateFileSystem() { - svc := efs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := efs.New(sess) params := &efs.CreateFileSystemInput{ CreationToken: aws.String("CreationToken"), // Required @@ -36,7 +42,13 @@ func ExampleEFS_CreateFileSystem() { } func ExampleEFS_CreateMountTarget() { - svc := efs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := efs.New(sess) params := &efs.CreateMountTargetInput{ FileSystemId: aws.String("FileSystemId"), // Required @@ -61,7 +73,13 @@ func ExampleEFS_CreateMountTarget() { } func ExampleEFS_CreateTags() { - svc := efs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := efs.New(sess) params := &efs.CreateTagsInput{ FileSystemId: aws.String("FileSystemId"), // Required @@ -87,7 +105,13 @@ func ExampleEFS_CreateTags() { } func ExampleEFS_DeleteFileSystem() { - svc := efs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := efs.New(sess) params := &efs.DeleteFileSystemInput{ FileSystemId: aws.String("FileSystemId"), // Required @@ -106,7 +130,13 @@ func ExampleEFS_DeleteFileSystem() { } func ExampleEFS_DeleteMountTarget() { - svc := efs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := efs.New(sess) params := &efs.DeleteMountTargetInput{ MountTargetId: aws.String("MountTargetId"), // Required @@ -125,7 +155,13 @@ func ExampleEFS_DeleteMountTarget() { } func ExampleEFS_DeleteTags() { - svc := efs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := efs.New(sess) params := &efs.DeleteTagsInput{ FileSystemId: aws.String("FileSystemId"), // Required @@ -148,7 +184,13 @@ func ExampleEFS_DeleteTags() { } func ExampleEFS_DescribeFileSystems() { - svc := efs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := efs.New(sess) params := &efs.DescribeFileSystemsInput{ CreationToken: aws.String("CreationToken"), @@ -170,7 +212,13 @@ func ExampleEFS_DescribeFileSystems() { } func ExampleEFS_DescribeMountTargetSecurityGroups() { - svc := efs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := efs.New(sess) params := &efs.DescribeMountTargetSecurityGroupsInput{ MountTargetId: aws.String("MountTargetId"), // Required @@ -189,7 +237,13 @@ func ExampleEFS_DescribeMountTargetSecurityGroups() { } func ExampleEFS_DescribeMountTargets() { - svc := efs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := efs.New(sess) params := &efs.DescribeMountTargetsInput{ FileSystemId: aws.String("FileSystemId"), @@ -211,7 +265,13 @@ func ExampleEFS_DescribeMountTargets() { } func ExampleEFS_DescribeTags() { - svc := efs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := efs.New(sess) params := &efs.DescribeTagsInput{ FileSystemId: aws.String("FileSystemId"), // Required @@ -232,7 +292,13 @@ func ExampleEFS_DescribeTags() { } func ExampleEFS_ModifyMountTargetSecurityGroups() { - svc := efs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := efs.New(sess) params := &efs.ModifyMountTargetSecurityGroupsInput{ MountTargetId: aws.String("MountTargetId"), // Required diff --git a/service/elasticache/examples_test.go b/service/elasticache/examples_test.go index 3f5bd7a4442..53f43b08385 100644 --- a/service/elasticache/examples_test.go +++ b/service/elasticache/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleElastiCache_AddTagsToResource() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.AddTagsToResourceInput{ ResourceName: aws.String("String"), // Required @@ -42,7 +48,13 @@ func ExampleElastiCache_AddTagsToResource() { } func ExampleElastiCache_AuthorizeCacheSecurityGroupIngress() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.AuthorizeCacheSecurityGroupIngressInput{ CacheSecurityGroupName: aws.String("String"), // Required @@ -63,7 +75,13 @@ func ExampleElastiCache_AuthorizeCacheSecurityGroupIngress() { } func ExampleElastiCache_CopySnapshot() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.CopySnapshotInput{ SourceSnapshotName: aws.String("String"), // Required @@ -84,7 +102,13 @@ func ExampleElastiCache_CopySnapshot() { } func ExampleElastiCache_CreateCacheCluster() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.CreateCacheClusterInput{ CacheClusterId: aws.String("String"), // Required @@ -142,7 +166,13 @@ func ExampleElastiCache_CreateCacheCluster() { } func ExampleElastiCache_CreateCacheParameterGroup() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.CreateCacheParameterGroupInput{ CacheParameterGroupFamily: aws.String("String"), // Required @@ -163,7 +193,13 @@ func ExampleElastiCache_CreateCacheParameterGroup() { } func ExampleElastiCache_CreateCacheSecurityGroup() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.CreateCacheSecurityGroupInput{ CacheSecurityGroupName: aws.String("String"), // Required @@ -183,7 +219,13 @@ func ExampleElastiCache_CreateCacheSecurityGroup() { } func ExampleElastiCache_CreateCacheSubnetGroup() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.CreateCacheSubnetGroupInput{ CacheSubnetGroupDescription: aws.String("String"), // Required @@ -207,7 +249,13 @@ func ExampleElastiCache_CreateCacheSubnetGroup() { } func ExampleElastiCache_CreateReplicationGroup() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.CreateReplicationGroupInput{ ReplicationGroupDescription: aws.String("String"), // Required @@ -265,7 +313,13 @@ func ExampleElastiCache_CreateReplicationGroup() { } func ExampleElastiCache_CreateSnapshot() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.CreateSnapshotInput{ CacheClusterId: aws.String("String"), // Required @@ -285,7 +339,13 @@ func ExampleElastiCache_CreateSnapshot() { } func ExampleElastiCache_DeleteCacheCluster() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.DeleteCacheClusterInput{ CacheClusterId: aws.String("String"), // Required @@ -305,7 +365,13 @@ func ExampleElastiCache_DeleteCacheCluster() { } func ExampleElastiCache_DeleteCacheParameterGroup() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.DeleteCacheParameterGroupInput{ CacheParameterGroupName: aws.String("String"), // Required @@ -324,7 +390,13 @@ func ExampleElastiCache_DeleteCacheParameterGroup() { } func ExampleElastiCache_DeleteCacheSecurityGroup() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.DeleteCacheSecurityGroupInput{ CacheSecurityGroupName: aws.String("String"), // Required @@ -343,7 +415,13 @@ func ExampleElastiCache_DeleteCacheSecurityGroup() { } func ExampleElastiCache_DeleteCacheSubnetGroup() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.DeleteCacheSubnetGroupInput{ CacheSubnetGroupName: aws.String("String"), // Required @@ -362,7 +440,13 @@ func ExampleElastiCache_DeleteCacheSubnetGroup() { } func ExampleElastiCache_DeleteReplicationGroup() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.DeleteReplicationGroupInput{ ReplicationGroupId: aws.String("String"), // Required @@ -383,7 +467,13 @@ func ExampleElastiCache_DeleteReplicationGroup() { } func ExampleElastiCache_DeleteSnapshot() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.DeleteSnapshotInput{ SnapshotName: aws.String("String"), // Required @@ -402,7 +492,13 @@ func ExampleElastiCache_DeleteSnapshot() { } func ExampleElastiCache_DescribeCacheClusters() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.DescribeCacheClustersInput{ CacheClusterId: aws.String("String"), @@ -424,7 +520,13 @@ func ExampleElastiCache_DescribeCacheClusters() { } func ExampleElastiCache_DescribeCacheEngineVersions() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.DescribeCacheEngineVersionsInput{ CacheParameterGroupFamily: aws.String("String"), @@ -448,7 +550,13 @@ func ExampleElastiCache_DescribeCacheEngineVersions() { } func ExampleElastiCache_DescribeCacheParameterGroups() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.DescribeCacheParameterGroupsInput{ CacheParameterGroupName: aws.String("String"), @@ -469,7 +577,13 @@ func ExampleElastiCache_DescribeCacheParameterGroups() { } func ExampleElastiCache_DescribeCacheParameters() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.DescribeCacheParametersInput{ CacheParameterGroupName: aws.String("String"), // Required @@ -491,7 +605,13 @@ func ExampleElastiCache_DescribeCacheParameters() { } func ExampleElastiCache_DescribeCacheSecurityGroups() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.DescribeCacheSecurityGroupsInput{ CacheSecurityGroupName: aws.String("String"), @@ -512,7 +632,13 @@ func ExampleElastiCache_DescribeCacheSecurityGroups() { } func ExampleElastiCache_DescribeCacheSubnetGroups() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.DescribeCacheSubnetGroupsInput{ CacheSubnetGroupName: aws.String("String"), @@ -533,7 +659,13 @@ func ExampleElastiCache_DescribeCacheSubnetGroups() { } func ExampleElastiCache_DescribeEngineDefaultParameters() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.DescribeEngineDefaultParametersInput{ CacheParameterGroupFamily: aws.String("String"), // Required @@ -554,7 +686,13 @@ func ExampleElastiCache_DescribeEngineDefaultParameters() { } func ExampleElastiCache_DescribeEvents() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.DescribeEventsInput{ Duration: aws.Int64(1), @@ -579,7 +717,13 @@ func ExampleElastiCache_DescribeEvents() { } func ExampleElastiCache_DescribeReplicationGroups() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.DescribeReplicationGroupsInput{ Marker: aws.String("String"), @@ -600,7 +744,13 @@ func ExampleElastiCache_DescribeReplicationGroups() { } func ExampleElastiCache_DescribeReservedCacheNodes() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.DescribeReservedCacheNodesInput{ CacheNodeType: aws.String("String"), @@ -626,7 +776,13 @@ func ExampleElastiCache_DescribeReservedCacheNodes() { } func ExampleElastiCache_DescribeReservedCacheNodesOfferings() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.DescribeReservedCacheNodesOfferingsInput{ CacheNodeType: aws.String("String"), @@ -651,7 +807,13 @@ func ExampleElastiCache_DescribeReservedCacheNodesOfferings() { } func ExampleElastiCache_DescribeSnapshots() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.DescribeSnapshotsInput{ CacheClusterId: aws.String("String"), @@ -674,7 +836,13 @@ func ExampleElastiCache_DescribeSnapshots() { } func ExampleElastiCache_ListAllowedNodeTypeModifications() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.ListAllowedNodeTypeModificationsInput{ CacheClusterId: aws.String("String"), @@ -694,7 +862,13 @@ func ExampleElastiCache_ListAllowedNodeTypeModifications() { } func ExampleElastiCache_ListTagsForResource() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.ListTagsForResourceInput{ ResourceName: aws.String("String"), // Required @@ -713,7 +887,13 @@ func ExampleElastiCache_ListTagsForResource() { } func ExampleElastiCache_ModifyCacheCluster() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.ModifyCacheClusterInput{ CacheClusterId: aws.String("String"), // Required @@ -760,7 +940,13 @@ func ExampleElastiCache_ModifyCacheCluster() { } func ExampleElastiCache_ModifyCacheParameterGroup() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.ModifyCacheParameterGroupInput{ CacheParameterGroupName: aws.String("String"), // Required @@ -786,7 +972,13 @@ func ExampleElastiCache_ModifyCacheParameterGroup() { } func ExampleElastiCache_ModifyCacheSubnetGroup() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.ModifyCacheSubnetGroupInput{ CacheSubnetGroupName: aws.String("String"), // Required @@ -810,7 +1002,13 @@ func ExampleElastiCache_ModifyCacheSubnetGroup() { } func ExampleElastiCache_ModifyReplicationGroup() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.ModifyReplicationGroupInput{ ReplicationGroupId: aws.String("String"), // Required @@ -851,7 +1049,13 @@ func ExampleElastiCache_ModifyReplicationGroup() { } func ExampleElastiCache_PurchaseReservedCacheNodesOffering() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.PurchaseReservedCacheNodesOfferingInput{ ReservedCacheNodesOfferingId: aws.String("String"), // Required @@ -872,7 +1076,13 @@ func ExampleElastiCache_PurchaseReservedCacheNodesOffering() { } func ExampleElastiCache_RebootCacheCluster() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.RebootCacheClusterInput{ CacheClusterId: aws.String("String"), // Required @@ -895,7 +1105,13 @@ func ExampleElastiCache_RebootCacheCluster() { } func ExampleElastiCache_RemoveTagsFromResource() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.RemoveTagsFromResourceInput{ ResourceName: aws.String("String"), // Required @@ -918,7 +1134,13 @@ func ExampleElastiCache_RemoveTagsFromResource() { } func ExampleElastiCache_ResetCacheParameterGroup() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.ResetCacheParameterGroupInput{ CacheParameterGroupName: aws.String("String"), // Required @@ -945,7 +1167,13 @@ func ExampleElastiCache_ResetCacheParameterGroup() { } func ExampleElastiCache_RevokeCacheSecurityGroupIngress() { - svc := elasticache.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticache.New(sess) params := &elasticache.RevokeCacheSecurityGroupIngressInput{ CacheSecurityGroupName: aws.String("String"), // Required diff --git a/service/elasticbeanstalk/examples_test.go b/service/elasticbeanstalk/examples_test.go index 9a6a634c2ea..fa4539807b0 100644 --- a/service/elasticbeanstalk/examples_test.go +++ b/service/elasticbeanstalk/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleElasticBeanstalk_AbortEnvironmentUpdate() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.AbortEnvironmentUpdateInput{ EnvironmentId: aws.String("EnvironmentId"), @@ -36,7 +42,13 @@ func ExampleElasticBeanstalk_AbortEnvironmentUpdate() { } func ExampleElasticBeanstalk_ApplyEnvironmentManagedAction() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.ApplyEnvironmentManagedActionInput{ ActionId: aws.String("String"), // Required @@ -57,7 +69,13 @@ func ExampleElasticBeanstalk_ApplyEnvironmentManagedAction() { } func ExampleElasticBeanstalk_CheckDNSAvailability() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.CheckDNSAvailabilityInput{ CNAMEPrefix: aws.String("DNSCnamePrefix"), // Required @@ -76,7 +94,13 @@ func ExampleElasticBeanstalk_CheckDNSAvailability() { } func ExampleElasticBeanstalk_ComposeEnvironments() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.ComposeEnvironmentsInput{ ApplicationName: aws.String("ApplicationName"), @@ -100,7 +124,13 @@ func ExampleElasticBeanstalk_ComposeEnvironments() { } func ExampleElasticBeanstalk_CreateApplication() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.CreateApplicationInput{ ApplicationName: aws.String("ApplicationName"), // Required @@ -120,7 +150,13 @@ func ExampleElasticBeanstalk_CreateApplication() { } func ExampleElasticBeanstalk_CreateApplicationVersion() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.CreateApplicationVersionInput{ ApplicationName: aws.String("ApplicationName"), // Required @@ -147,7 +183,13 @@ func ExampleElasticBeanstalk_CreateApplicationVersion() { } func ExampleElasticBeanstalk_CreateConfigurationTemplate() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.CreateConfigurationTemplateInput{ ApplicationName: aws.String("ApplicationName"), // Required @@ -183,7 +225,13 @@ func ExampleElasticBeanstalk_CreateConfigurationTemplate() { } func ExampleElasticBeanstalk_CreateEnvironment() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.CreateEnvironmentInput{ ApplicationName: aws.String("ApplicationName"), // Required @@ -238,7 +286,13 @@ func ExampleElasticBeanstalk_CreateEnvironment() { } func ExampleElasticBeanstalk_CreateStorageLocation() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) var params *elasticbeanstalk.CreateStorageLocationInput resp, err := svc.CreateStorageLocation(params) @@ -255,7 +309,13 @@ func ExampleElasticBeanstalk_CreateStorageLocation() { } func ExampleElasticBeanstalk_DeleteApplication() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.DeleteApplicationInput{ ApplicationName: aws.String("ApplicationName"), // Required @@ -275,7 +335,13 @@ func ExampleElasticBeanstalk_DeleteApplication() { } func ExampleElasticBeanstalk_DeleteApplicationVersion() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.DeleteApplicationVersionInput{ ApplicationName: aws.String("ApplicationName"), // Required @@ -296,7 +362,13 @@ func ExampleElasticBeanstalk_DeleteApplicationVersion() { } func ExampleElasticBeanstalk_DeleteConfigurationTemplate() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.DeleteConfigurationTemplateInput{ ApplicationName: aws.String("ApplicationName"), // Required @@ -316,7 +388,13 @@ func ExampleElasticBeanstalk_DeleteConfigurationTemplate() { } func ExampleElasticBeanstalk_DeleteEnvironmentConfiguration() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.DeleteEnvironmentConfigurationInput{ ApplicationName: aws.String("ApplicationName"), // Required @@ -336,7 +414,13 @@ func ExampleElasticBeanstalk_DeleteEnvironmentConfiguration() { } func ExampleElasticBeanstalk_DescribeApplicationVersions() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.DescribeApplicationVersionsInput{ ApplicationName: aws.String("ApplicationName"), @@ -359,7 +443,13 @@ func ExampleElasticBeanstalk_DescribeApplicationVersions() { } func ExampleElasticBeanstalk_DescribeApplications() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.DescribeApplicationsInput{ ApplicationNames: []*string{ @@ -381,7 +471,13 @@ func ExampleElasticBeanstalk_DescribeApplications() { } func ExampleElasticBeanstalk_DescribeConfigurationOptions() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.DescribeConfigurationOptionsInput{ ApplicationName: aws.String("ApplicationName"), @@ -411,7 +507,13 @@ func ExampleElasticBeanstalk_DescribeConfigurationOptions() { } func ExampleElasticBeanstalk_DescribeConfigurationSettings() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.DescribeConfigurationSettingsInput{ ApplicationName: aws.String("ApplicationName"), // Required @@ -432,7 +534,13 @@ func ExampleElasticBeanstalk_DescribeConfigurationSettings() { } func ExampleElasticBeanstalk_DescribeEnvironmentHealth() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.DescribeEnvironmentHealthInput{ AttributeNames: []*string{ @@ -456,7 +564,13 @@ func ExampleElasticBeanstalk_DescribeEnvironmentHealth() { } func ExampleElasticBeanstalk_DescribeEnvironmentManagedActionHistory() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.DescribeEnvironmentManagedActionHistoryInput{ EnvironmentId: aws.String("EnvironmentId"), @@ -478,7 +592,13 @@ func ExampleElasticBeanstalk_DescribeEnvironmentManagedActionHistory() { } func ExampleElasticBeanstalk_DescribeEnvironmentManagedActions() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.DescribeEnvironmentManagedActionsInput{ EnvironmentId: aws.String("String"), @@ -499,7 +619,13 @@ func ExampleElasticBeanstalk_DescribeEnvironmentManagedActions() { } func ExampleElasticBeanstalk_DescribeEnvironmentResources() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.DescribeEnvironmentResourcesInput{ EnvironmentId: aws.String("EnvironmentId"), @@ -519,7 +645,13 @@ func ExampleElasticBeanstalk_DescribeEnvironmentResources() { } func ExampleElasticBeanstalk_DescribeEnvironments() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.DescribeEnvironmentsInput{ ApplicationName: aws.String("ApplicationName"), @@ -549,7 +681,13 @@ func ExampleElasticBeanstalk_DescribeEnvironments() { } func ExampleElasticBeanstalk_DescribeEvents() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.DescribeEventsInput{ ApplicationName: aws.String("ApplicationName"), @@ -578,7 +716,13 @@ func ExampleElasticBeanstalk_DescribeEvents() { } func ExampleElasticBeanstalk_DescribeInstancesHealth() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.DescribeInstancesHealthInput{ AttributeNames: []*string{ @@ -603,7 +747,13 @@ func ExampleElasticBeanstalk_DescribeInstancesHealth() { } func ExampleElasticBeanstalk_ListAvailableSolutionStacks() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) var params *elasticbeanstalk.ListAvailableSolutionStacksInput resp, err := svc.ListAvailableSolutionStacks(params) @@ -620,7 +770,13 @@ func ExampleElasticBeanstalk_ListAvailableSolutionStacks() { } func ExampleElasticBeanstalk_RebuildEnvironment() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.RebuildEnvironmentInput{ EnvironmentId: aws.String("EnvironmentId"), @@ -640,7 +796,13 @@ func ExampleElasticBeanstalk_RebuildEnvironment() { } func ExampleElasticBeanstalk_RequestEnvironmentInfo() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.RequestEnvironmentInfoInput{ InfoType: aws.String("EnvironmentInfoType"), // Required @@ -661,7 +823,13 @@ func ExampleElasticBeanstalk_RequestEnvironmentInfo() { } func ExampleElasticBeanstalk_RestartAppServer() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.RestartAppServerInput{ EnvironmentId: aws.String("EnvironmentId"), @@ -681,7 +849,13 @@ func ExampleElasticBeanstalk_RestartAppServer() { } func ExampleElasticBeanstalk_RetrieveEnvironmentInfo() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.RetrieveEnvironmentInfoInput{ InfoType: aws.String("EnvironmentInfoType"), // Required @@ -702,7 +876,13 @@ func ExampleElasticBeanstalk_RetrieveEnvironmentInfo() { } func ExampleElasticBeanstalk_SwapEnvironmentCNAMEs() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.SwapEnvironmentCNAMEsInput{ DestinationEnvironmentId: aws.String("EnvironmentId"), @@ -724,7 +904,13 @@ func ExampleElasticBeanstalk_SwapEnvironmentCNAMEs() { } func ExampleElasticBeanstalk_TerminateEnvironment() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.TerminateEnvironmentInput{ EnvironmentId: aws.String("EnvironmentId"), @@ -746,7 +932,13 @@ func ExampleElasticBeanstalk_TerminateEnvironment() { } func ExampleElasticBeanstalk_UpdateApplication() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.UpdateApplicationInput{ ApplicationName: aws.String("ApplicationName"), // Required @@ -766,7 +958,13 @@ func ExampleElasticBeanstalk_UpdateApplication() { } func ExampleElasticBeanstalk_UpdateApplicationVersion() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.UpdateApplicationVersionInput{ ApplicationName: aws.String("ApplicationName"), // Required @@ -787,7 +985,13 @@ func ExampleElasticBeanstalk_UpdateApplicationVersion() { } func ExampleElasticBeanstalk_UpdateConfigurationTemplate() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.UpdateConfigurationTemplateInput{ ApplicationName: aws.String("ApplicationName"), // Required @@ -825,7 +1029,13 @@ func ExampleElasticBeanstalk_UpdateConfigurationTemplate() { } func ExampleElasticBeanstalk_UpdateEnvironment() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.UpdateEnvironmentInput{ ApplicationName: aws.String("ApplicationName"), @@ -873,7 +1083,13 @@ func ExampleElasticBeanstalk_UpdateEnvironment() { } func ExampleElasticBeanstalk_ValidateConfigurationSettings() { - svc := elasticbeanstalk.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticbeanstalk.New(sess) params := &elasticbeanstalk.ValidateConfigurationSettingsInput{ ApplicationName: aws.String("ApplicationName"), // Required diff --git a/service/elasticsearchservice/examples_test.go b/service/elasticsearchservice/examples_test.go index 7d98bca1b72..d321ae87462 100644 --- a/service/elasticsearchservice/examples_test.go +++ b/service/elasticsearchservice/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleElasticsearchService_AddTags() { - svc := elasticsearchservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticsearchservice.New(sess) params := &elasticsearchservice.AddTagsInput{ ARN: aws.String("ARN"), // Required @@ -42,7 +48,13 @@ func ExampleElasticsearchService_AddTags() { } func ExampleElasticsearchService_CreateElasticsearchDomain() { - svc := elasticsearchservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticsearchservice.New(sess) params := &elasticsearchservice.CreateElasticsearchDomainInput{ DomainName: aws.String("DomainName"), // Required @@ -84,7 +96,13 @@ func ExampleElasticsearchService_CreateElasticsearchDomain() { } func ExampleElasticsearchService_DeleteElasticsearchDomain() { - svc := elasticsearchservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticsearchservice.New(sess) params := &elasticsearchservice.DeleteElasticsearchDomainInput{ DomainName: aws.String("DomainName"), // Required @@ -103,7 +121,13 @@ func ExampleElasticsearchService_DeleteElasticsearchDomain() { } func ExampleElasticsearchService_DescribeElasticsearchDomain() { - svc := elasticsearchservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticsearchservice.New(sess) params := &elasticsearchservice.DescribeElasticsearchDomainInput{ DomainName: aws.String("DomainName"), // Required @@ -122,7 +146,13 @@ func ExampleElasticsearchService_DescribeElasticsearchDomain() { } func ExampleElasticsearchService_DescribeElasticsearchDomainConfig() { - svc := elasticsearchservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticsearchservice.New(sess) params := &elasticsearchservice.DescribeElasticsearchDomainConfigInput{ DomainName: aws.String("DomainName"), // Required @@ -141,7 +171,13 @@ func ExampleElasticsearchService_DescribeElasticsearchDomainConfig() { } func ExampleElasticsearchService_DescribeElasticsearchDomains() { - svc := elasticsearchservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticsearchservice.New(sess) params := &elasticsearchservice.DescribeElasticsearchDomainsInput{ DomainNames: []*string{ // Required @@ -163,7 +199,13 @@ func ExampleElasticsearchService_DescribeElasticsearchDomains() { } func ExampleElasticsearchService_ListDomainNames() { - svc := elasticsearchservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticsearchservice.New(sess) var params *elasticsearchservice.ListDomainNamesInput resp, err := svc.ListDomainNames(params) @@ -180,7 +222,13 @@ func ExampleElasticsearchService_ListDomainNames() { } func ExampleElasticsearchService_ListTags() { - svc := elasticsearchservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticsearchservice.New(sess) params := &elasticsearchservice.ListTagsInput{ ARN: aws.String("ARN"), // Required @@ -199,7 +247,13 @@ func ExampleElasticsearchService_ListTags() { } func ExampleElasticsearchService_RemoveTags() { - svc := elasticsearchservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticsearchservice.New(sess) params := &elasticsearchservice.RemoveTagsInput{ ARN: aws.String("ARN"), // Required @@ -222,7 +276,13 @@ func ExampleElasticsearchService_RemoveTags() { } func ExampleElasticsearchService_UpdateElasticsearchDomainConfig() { - svc := elasticsearchservice.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elasticsearchservice.New(sess) params := &elasticsearchservice.UpdateElasticsearchDomainConfigInput{ DomainName: aws.String("DomainName"), // Required diff --git a/service/elastictranscoder/examples_test.go b/service/elastictranscoder/examples_test.go index 7ab098ec72c..2b076930d10 100644 --- a/service/elastictranscoder/examples_test.go +++ b/service/elastictranscoder/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleElasticTranscoder_CancelJob() { - svc := elastictranscoder.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elastictranscoder.New(sess) params := &elastictranscoder.CancelJobInput{ Id: aws.String("Id"), // Required @@ -35,7 +41,13 @@ func ExampleElasticTranscoder_CancelJob() { } func ExampleElasticTranscoder_CreateJob() { - svc := elastictranscoder.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elastictranscoder.New(sess) params := &elastictranscoder.CreateJobInput{ Input: &elastictranscoder.JobInput{ // Required @@ -294,7 +306,13 @@ func ExampleElasticTranscoder_CreateJob() { } func ExampleElasticTranscoder_CreatePipeline() { - svc := elastictranscoder.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elastictranscoder.New(sess) params := &elastictranscoder.CreatePipelineInput{ InputBucket: aws.String("BucketName"), // Required @@ -353,7 +371,13 @@ func ExampleElasticTranscoder_CreatePipeline() { } func ExampleElasticTranscoder_CreatePreset() { - svc := elastictranscoder.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elastictranscoder.New(sess) params := &elastictranscoder.CreatePresetInput{ Container: aws.String("PresetContainer"), // Required @@ -431,7 +455,13 @@ func ExampleElasticTranscoder_CreatePreset() { } func ExampleElasticTranscoder_DeletePipeline() { - svc := elastictranscoder.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elastictranscoder.New(sess) params := &elastictranscoder.DeletePipelineInput{ Id: aws.String("Id"), // Required @@ -450,7 +480,13 @@ func ExampleElasticTranscoder_DeletePipeline() { } func ExampleElasticTranscoder_DeletePreset() { - svc := elastictranscoder.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elastictranscoder.New(sess) params := &elastictranscoder.DeletePresetInput{ Id: aws.String("Id"), // Required @@ -469,7 +505,13 @@ func ExampleElasticTranscoder_DeletePreset() { } func ExampleElasticTranscoder_ListJobsByPipeline() { - svc := elastictranscoder.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elastictranscoder.New(sess) params := &elastictranscoder.ListJobsByPipelineInput{ PipelineId: aws.String("Id"), // Required @@ -490,7 +532,13 @@ func ExampleElasticTranscoder_ListJobsByPipeline() { } func ExampleElasticTranscoder_ListJobsByStatus() { - svc := elastictranscoder.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elastictranscoder.New(sess) params := &elastictranscoder.ListJobsByStatusInput{ Status: aws.String("JobStatus"), // Required @@ -511,7 +559,13 @@ func ExampleElasticTranscoder_ListJobsByStatus() { } func ExampleElasticTranscoder_ListPipelines() { - svc := elastictranscoder.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elastictranscoder.New(sess) params := &elastictranscoder.ListPipelinesInput{ Ascending: aws.String("Ascending"), @@ -531,7 +585,13 @@ func ExampleElasticTranscoder_ListPipelines() { } func ExampleElasticTranscoder_ListPresets() { - svc := elastictranscoder.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elastictranscoder.New(sess) params := &elastictranscoder.ListPresetsInput{ Ascending: aws.String("Ascending"), @@ -551,7 +611,13 @@ func ExampleElasticTranscoder_ListPresets() { } func ExampleElasticTranscoder_ReadJob() { - svc := elastictranscoder.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elastictranscoder.New(sess) params := &elastictranscoder.ReadJobInput{ Id: aws.String("Id"), // Required @@ -570,7 +636,13 @@ func ExampleElasticTranscoder_ReadJob() { } func ExampleElasticTranscoder_ReadPipeline() { - svc := elastictranscoder.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elastictranscoder.New(sess) params := &elastictranscoder.ReadPipelineInput{ Id: aws.String("Id"), // Required @@ -589,7 +661,13 @@ func ExampleElasticTranscoder_ReadPipeline() { } func ExampleElasticTranscoder_ReadPreset() { - svc := elastictranscoder.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elastictranscoder.New(sess) params := &elastictranscoder.ReadPresetInput{ Id: aws.String("Id"), // Required @@ -608,7 +686,13 @@ func ExampleElasticTranscoder_ReadPreset() { } func ExampleElasticTranscoder_TestRole() { - svc := elastictranscoder.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elastictranscoder.New(sess) params := &elastictranscoder.TestRoleInput{ InputBucket: aws.String("BucketName"), // Required @@ -633,7 +717,13 @@ func ExampleElasticTranscoder_TestRole() { } func ExampleElasticTranscoder_UpdatePipeline() { - svc := elastictranscoder.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elastictranscoder.New(sess) params := &elastictranscoder.UpdatePipelineInput{ Id: aws.String("Id"), // Required @@ -692,7 +782,13 @@ func ExampleElasticTranscoder_UpdatePipeline() { } func ExampleElasticTranscoder_UpdatePipelineNotifications() { - svc := elastictranscoder.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elastictranscoder.New(sess) params := &elastictranscoder.UpdatePipelineNotificationsInput{ Id: aws.String("Id"), // Required @@ -717,7 +813,13 @@ func ExampleElasticTranscoder_UpdatePipelineNotifications() { } func ExampleElasticTranscoder_UpdatePipelineStatus() { - svc := elastictranscoder.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elastictranscoder.New(sess) params := &elastictranscoder.UpdatePipelineStatusInput{ Id: aws.String("Id"), // Required diff --git a/service/elb/examples_test.go b/service/elb/examples_test.go index d1da802e6cd..49aa7d79486 100644 --- a/service/elb/examples_test.go +++ b/service/elb/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleELB_AddTags() { - svc := elb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elb.New(sess) params := &elb.AddTagsInput{ LoadBalancerNames: []*string{ // Required @@ -45,7 +51,13 @@ func ExampleELB_AddTags() { } func ExampleELB_ApplySecurityGroupsToLoadBalancer() { - svc := elb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elb.New(sess) params := &elb.ApplySecurityGroupsToLoadBalancerInput{ LoadBalancerName: aws.String("AccessPointName"), // Required @@ -68,7 +80,13 @@ func ExampleELB_ApplySecurityGroupsToLoadBalancer() { } func ExampleELB_AttachLoadBalancerToSubnets() { - svc := elb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elb.New(sess) params := &elb.AttachLoadBalancerToSubnetsInput{ LoadBalancerName: aws.String("AccessPointName"), // Required @@ -91,7 +109,13 @@ func ExampleELB_AttachLoadBalancerToSubnets() { } func ExampleELB_ConfigureHealthCheck() { - svc := elb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elb.New(sess) params := &elb.ConfigureHealthCheckInput{ HealthCheck: &elb.HealthCheck{ // Required @@ -117,7 +141,13 @@ func ExampleELB_ConfigureHealthCheck() { } func ExampleELB_CreateAppCookieStickinessPolicy() { - svc := elb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elb.New(sess) params := &elb.CreateAppCookieStickinessPolicyInput{ CookieName: aws.String("CookieName"), // Required @@ -138,7 +168,13 @@ func ExampleELB_CreateAppCookieStickinessPolicy() { } func ExampleELB_CreateLBCookieStickinessPolicy() { - svc := elb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elb.New(sess) params := &elb.CreateLBCookieStickinessPolicyInput{ LoadBalancerName: aws.String("AccessPointName"), // Required @@ -159,7 +195,13 @@ func ExampleELB_CreateLBCookieStickinessPolicy() { } func ExampleELB_CreateLoadBalancer() { - svc := elb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elb.New(sess) params := &elb.CreateLoadBalancerInput{ Listeners: []*elb.Listener{ // Required @@ -208,7 +250,13 @@ func ExampleELB_CreateLoadBalancer() { } func ExampleELB_CreateLoadBalancerListeners() { - svc := elb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elb.New(sess) params := &elb.CreateLoadBalancerListenersInput{ Listeners: []*elb.Listener{ // Required @@ -237,7 +285,13 @@ func ExampleELB_CreateLoadBalancerListeners() { } func ExampleELB_CreateLoadBalancerPolicy() { - svc := elb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elb.New(sess) params := &elb.CreateLoadBalancerPolicyInput{ LoadBalancerName: aws.String("AccessPointName"), // Required @@ -265,7 +319,13 @@ func ExampleELB_CreateLoadBalancerPolicy() { } func ExampleELB_DeleteLoadBalancer() { - svc := elb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elb.New(sess) params := &elb.DeleteLoadBalancerInput{ LoadBalancerName: aws.String("AccessPointName"), // Required @@ -284,7 +344,13 @@ func ExampleELB_DeleteLoadBalancer() { } func ExampleELB_DeleteLoadBalancerListeners() { - svc := elb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elb.New(sess) params := &elb.DeleteLoadBalancerListenersInput{ LoadBalancerName: aws.String("AccessPointName"), // Required @@ -307,7 +373,13 @@ func ExampleELB_DeleteLoadBalancerListeners() { } func ExampleELB_DeleteLoadBalancerPolicy() { - svc := elb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elb.New(sess) params := &elb.DeleteLoadBalancerPolicyInput{ LoadBalancerName: aws.String("AccessPointName"), // Required @@ -327,7 +399,13 @@ func ExampleELB_DeleteLoadBalancerPolicy() { } func ExampleELB_DeregisterInstancesFromLoadBalancer() { - svc := elb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elb.New(sess) params := &elb.DeregisterInstancesFromLoadBalancerInput{ Instances: []*elb.Instance{ // Required @@ -352,7 +430,13 @@ func ExampleELB_DeregisterInstancesFromLoadBalancer() { } func ExampleELB_DescribeInstanceHealth() { - svc := elb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elb.New(sess) params := &elb.DescribeInstanceHealthInput{ LoadBalancerName: aws.String("AccessPointName"), // Required @@ -377,7 +461,13 @@ func ExampleELB_DescribeInstanceHealth() { } func ExampleELB_DescribeLoadBalancerAttributes() { - svc := elb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elb.New(sess) params := &elb.DescribeLoadBalancerAttributesInput{ LoadBalancerName: aws.String("AccessPointName"), // Required @@ -396,7 +486,13 @@ func ExampleELB_DescribeLoadBalancerAttributes() { } func ExampleELB_DescribeLoadBalancerPolicies() { - svc := elb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elb.New(sess) params := &elb.DescribeLoadBalancerPoliciesInput{ LoadBalancerName: aws.String("AccessPointName"), @@ -419,7 +515,13 @@ func ExampleELB_DescribeLoadBalancerPolicies() { } func ExampleELB_DescribeLoadBalancerPolicyTypes() { - svc := elb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elb.New(sess) params := &elb.DescribeLoadBalancerPolicyTypesInput{ PolicyTypeNames: []*string{ @@ -441,7 +543,13 @@ func ExampleELB_DescribeLoadBalancerPolicyTypes() { } func ExampleELB_DescribeLoadBalancers() { - svc := elb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elb.New(sess) params := &elb.DescribeLoadBalancersInput{ LoadBalancerNames: []*string{ @@ -465,7 +573,13 @@ func ExampleELB_DescribeLoadBalancers() { } func ExampleELB_DescribeTags() { - svc := elb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elb.New(sess) params := &elb.DescribeTagsInput{ LoadBalancerNames: []*string{ // Required @@ -487,7 +601,13 @@ func ExampleELB_DescribeTags() { } func ExampleELB_DetachLoadBalancerFromSubnets() { - svc := elb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elb.New(sess) params := &elb.DetachLoadBalancerFromSubnetsInput{ LoadBalancerName: aws.String("AccessPointName"), // Required @@ -510,7 +630,13 @@ func ExampleELB_DetachLoadBalancerFromSubnets() { } func ExampleELB_DisableAvailabilityZonesForLoadBalancer() { - svc := elb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elb.New(sess) params := &elb.DisableAvailabilityZonesForLoadBalancerInput{ AvailabilityZones: []*string{ // Required @@ -533,7 +659,13 @@ func ExampleELB_DisableAvailabilityZonesForLoadBalancer() { } func ExampleELB_EnableAvailabilityZonesForLoadBalancer() { - svc := elb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elb.New(sess) params := &elb.EnableAvailabilityZonesForLoadBalancerInput{ AvailabilityZones: []*string{ // Required @@ -556,7 +688,13 @@ func ExampleELB_EnableAvailabilityZonesForLoadBalancer() { } func ExampleELB_ModifyLoadBalancerAttributes() { - svc := elb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elb.New(sess) params := &elb.ModifyLoadBalancerAttributesInput{ LoadBalancerAttributes: &elb.LoadBalancerAttributes{ // Required @@ -600,7 +738,13 @@ func ExampleELB_ModifyLoadBalancerAttributes() { } func ExampleELB_RegisterInstancesWithLoadBalancer() { - svc := elb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elb.New(sess) params := &elb.RegisterInstancesWithLoadBalancerInput{ Instances: []*elb.Instance{ // Required @@ -625,7 +769,13 @@ func ExampleELB_RegisterInstancesWithLoadBalancer() { } func ExampleELB_RemoveTags() { - svc := elb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elb.New(sess) params := &elb.RemoveTagsInput{ LoadBalancerNames: []*string{ // Required @@ -653,7 +803,13 @@ func ExampleELB_RemoveTags() { } func ExampleELB_SetLoadBalancerListenerSSLCertificate() { - svc := elb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elb.New(sess) params := &elb.SetLoadBalancerListenerSSLCertificateInput{ LoadBalancerName: aws.String("AccessPointName"), // Required @@ -674,7 +830,13 @@ func ExampleELB_SetLoadBalancerListenerSSLCertificate() { } func ExampleELB_SetLoadBalancerPoliciesForBackendServer() { - svc := elb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elb.New(sess) params := &elb.SetLoadBalancerPoliciesForBackendServerInput{ InstancePort: aws.Int64(1), // Required @@ -698,7 +860,13 @@ func ExampleELB_SetLoadBalancerPoliciesForBackendServer() { } func ExampleELB_SetLoadBalancerPoliciesOfListener() { - svc := elb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := elb.New(sess) params := &elb.SetLoadBalancerPoliciesOfListenerInput{ LoadBalancerName: aws.String("AccessPointName"), // Required diff --git a/service/emr/examples_test.go b/service/emr/examples_test.go index d19414034bd..892d3bad9b4 100644 --- a/service/emr/examples_test.go +++ b/service/emr/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleEMR_AddInstanceGroups() { - svc := emr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := emr.New(sess) params := &emr.AddInstanceGroupsInput{ InstanceGroups: []*emr.InstanceGroupConfig{ // Required @@ -73,7 +79,13 @@ func ExampleEMR_AddInstanceGroups() { } func ExampleEMR_AddJobFlowSteps() { - svc := emr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := emr.New(sess) params := &emr.AddJobFlowStepsInput{ JobFlowId: aws.String("XmlStringMaxLen256"), // Required @@ -114,7 +126,13 @@ func ExampleEMR_AddJobFlowSteps() { } func ExampleEMR_AddTags() { - svc := emr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := emr.New(sess) params := &emr.AddTagsInput{ ResourceId: aws.String("ResourceId"), // Required @@ -140,7 +158,13 @@ func ExampleEMR_AddTags() { } func ExampleEMR_DescribeCluster() { - svc := emr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := emr.New(sess) params := &emr.DescribeClusterInput{ ClusterId: aws.String("ClusterId"), // Required @@ -159,7 +183,13 @@ func ExampleEMR_DescribeCluster() { } func ExampleEMR_DescribeJobFlows() { - svc := emr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := emr.New(sess) params := &emr.DescribeJobFlowsInput{ CreatedAfter: aws.Time(time.Now()), @@ -187,7 +217,13 @@ func ExampleEMR_DescribeJobFlows() { } func ExampleEMR_DescribeStep() { - svc := emr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := emr.New(sess) params := &emr.DescribeStepInput{ ClusterId: aws.String("ClusterId"), // Required @@ -207,7 +243,13 @@ func ExampleEMR_DescribeStep() { } func ExampleEMR_ListBootstrapActions() { - svc := emr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := emr.New(sess) params := &emr.ListBootstrapActionsInput{ ClusterId: aws.String("ClusterId"), // Required @@ -227,7 +269,13 @@ func ExampleEMR_ListBootstrapActions() { } func ExampleEMR_ListClusters() { - svc := emr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := emr.New(sess) params := &emr.ListClustersInput{ ClusterStates: []*string{ @@ -252,7 +300,13 @@ func ExampleEMR_ListClusters() { } func ExampleEMR_ListInstanceGroups() { - svc := emr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := emr.New(sess) params := &emr.ListInstanceGroupsInput{ ClusterId: aws.String("ClusterId"), // Required @@ -272,7 +326,13 @@ func ExampleEMR_ListInstanceGroups() { } func ExampleEMR_ListInstances() { - svc := emr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := emr.New(sess) params := &emr.ListInstancesInput{ ClusterId: aws.String("ClusterId"), // Required @@ -301,7 +361,13 @@ func ExampleEMR_ListInstances() { } func ExampleEMR_ListSteps() { - svc := emr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := emr.New(sess) params := &emr.ListStepsInput{ ClusterId: aws.String("ClusterId"), // Required @@ -329,7 +395,13 @@ func ExampleEMR_ListSteps() { } func ExampleEMR_ModifyInstanceGroups() { - svc := emr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := emr.New(sess) params := &emr.ModifyInstanceGroupsInput{ InstanceGroups: []*emr.InstanceGroupModifyConfig{ @@ -372,7 +444,13 @@ func ExampleEMR_ModifyInstanceGroups() { } func ExampleEMR_RemoveTags() { - svc := emr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := emr.New(sess) params := &emr.RemoveTagsInput{ ResourceId: aws.String("ResourceId"), // Required @@ -395,7 +473,13 @@ func ExampleEMR_RemoveTags() { } func ExampleEMR_RunJobFlow() { - svc := emr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := emr.New(sess) params := &emr.RunJobFlowInput{ Instances: &emr.JobFlowInstancesConfig{ // Required @@ -567,7 +651,13 @@ func ExampleEMR_RunJobFlow() { } func ExampleEMR_SetTerminationProtection() { - svc := emr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := emr.New(sess) params := &emr.SetTerminationProtectionInput{ JobFlowIds: []*string{ // Required @@ -590,7 +680,13 @@ func ExampleEMR_SetTerminationProtection() { } func ExampleEMR_SetVisibleToAllUsers() { - svc := emr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := emr.New(sess) params := &emr.SetVisibleToAllUsersInput{ JobFlowIds: []*string{ // Required @@ -613,7 +709,13 @@ func ExampleEMR_SetVisibleToAllUsers() { } func ExampleEMR_TerminateJobFlows() { - svc := emr.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := emr.New(sess) params := &emr.TerminateJobFlowsInput{ JobFlowIds: []*string{ // Required diff --git a/service/firehose/examples_test.go b/service/firehose/examples_test.go index 9c84657dbcd..74892d0e39a 100644 --- a/service/firehose/examples_test.go +++ b/service/firehose/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleFirehose_CreateDeliveryStream() { - svc := firehose.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := firehose.New(sess) params := &firehose.CreateDeliveryStreamInput{ DeliveryStreamName: aws.String("DeliveryStreamName"), // Required @@ -137,7 +143,13 @@ func ExampleFirehose_CreateDeliveryStream() { } func ExampleFirehose_DeleteDeliveryStream() { - svc := firehose.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := firehose.New(sess) params := &firehose.DeleteDeliveryStreamInput{ DeliveryStreamName: aws.String("DeliveryStreamName"), // Required @@ -156,7 +168,13 @@ func ExampleFirehose_DeleteDeliveryStream() { } func ExampleFirehose_DescribeDeliveryStream() { - svc := firehose.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := firehose.New(sess) params := &firehose.DescribeDeliveryStreamInput{ DeliveryStreamName: aws.String("DeliveryStreamName"), // Required @@ -177,7 +195,13 @@ func ExampleFirehose_DescribeDeliveryStream() { } func ExampleFirehose_ListDeliveryStreams() { - svc := firehose.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := firehose.New(sess) params := &firehose.ListDeliveryStreamsInput{ ExclusiveStartDeliveryStreamName: aws.String("DeliveryStreamName"), @@ -197,7 +221,13 @@ func ExampleFirehose_ListDeliveryStreams() { } func ExampleFirehose_PutRecord() { - svc := firehose.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := firehose.New(sess) params := &firehose.PutRecordInput{ DeliveryStreamName: aws.String("DeliveryStreamName"), // Required @@ -219,7 +249,13 @@ func ExampleFirehose_PutRecord() { } func ExampleFirehose_PutRecordBatch() { - svc := firehose.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := firehose.New(sess) params := &firehose.PutRecordBatchInput{ DeliveryStreamName: aws.String("DeliveryStreamName"), // Required @@ -244,7 +280,13 @@ func ExampleFirehose_PutRecordBatch() { } func ExampleFirehose_UpdateDestination() { - svc := firehose.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := firehose.New(sess) params := &firehose.UpdateDestinationInput{ CurrentDeliveryStreamVersionId: aws.String("DeliveryStreamVersionId"), // Required diff --git a/service/gamelift/examples_test.go b/service/gamelift/examples_test.go index af2b15bd1a0..f50262d8a2c 100644 --- a/service/gamelift/examples_test.go +++ b/service/gamelift/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleGameLift_CreateAlias() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.CreateAliasInput{ Name: aws.String("NonZeroAndMaxString"), // Required @@ -41,7 +47,13 @@ func ExampleGameLift_CreateAlias() { } func ExampleGameLift_CreateBuild() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.CreateBuildInput{ Name: aws.String("NonZeroAndMaxString"), @@ -66,7 +78,13 @@ func ExampleGameLift_CreateBuild() { } func ExampleGameLift_CreateFleet() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.CreateFleetInput{ BuildId: aws.String("BuildId"), // Required @@ -114,7 +132,13 @@ func ExampleGameLift_CreateFleet() { } func ExampleGameLift_CreateGameSession() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.CreateGameSessionInput{ MaximumPlayerSessionCount: aws.Int64(1), // Required @@ -143,7 +167,13 @@ func ExampleGameLift_CreateGameSession() { } func ExampleGameLift_CreatePlayerSession() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.CreatePlayerSessionInput{ GameSessionId: aws.String("GameSessionId"), // Required @@ -163,7 +193,13 @@ func ExampleGameLift_CreatePlayerSession() { } func ExampleGameLift_CreatePlayerSessions() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.CreatePlayerSessionsInput{ GameSessionId: aws.String("GameSessionId"), // Required @@ -186,7 +222,13 @@ func ExampleGameLift_CreatePlayerSessions() { } func ExampleGameLift_DeleteAlias() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.DeleteAliasInput{ AliasId: aws.String("AliasId"), // Required @@ -205,7 +247,13 @@ func ExampleGameLift_DeleteAlias() { } func ExampleGameLift_DeleteBuild() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.DeleteBuildInput{ BuildId: aws.String("BuildId"), // Required @@ -224,7 +272,13 @@ func ExampleGameLift_DeleteBuild() { } func ExampleGameLift_DeleteFleet() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.DeleteFleetInput{ FleetId: aws.String("FleetId"), // Required @@ -243,7 +297,13 @@ func ExampleGameLift_DeleteFleet() { } func ExampleGameLift_DeleteScalingPolicy() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.DeleteScalingPolicyInput{ FleetId: aws.String("FleetId"), // Required @@ -263,7 +323,13 @@ func ExampleGameLift_DeleteScalingPolicy() { } func ExampleGameLift_DescribeAlias() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.DescribeAliasInput{ AliasId: aws.String("AliasId"), // Required @@ -282,7 +348,13 @@ func ExampleGameLift_DescribeAlias() { } func ExampleGameLift_DescribeBuild() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.DescribeBuildInput{ BuildId: aws.String("BuildId"), // Required @@ -301,7 +373,13 @@ func ExampleGameLift_DescribeBuild() { } func ExampleGameLift_DescribeEC2InstanceLimits() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.DescribeEC2InstanceLimitsInput{ EC2InstanceType: aws.String("EC2InstanceType"), @@ -320,7 +398,13 @@ func ExampleGameLift_DescribeEC2InstanceLimits() { } func ExampleGameLift_DescribeFleetAttributes() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.DescribeFleetAttributesInput{ FleetIds: []*string{ @@ -344,7 +428,13 @@ func ExampleGameLift_DescribeFleetAttributes() { } func ExampleGameLift_DescribeFleetCapacity() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.DescribeFleetCapacityInput{ FleetIds: []*string{ @@ -368,7 +458,13 @@ func ExampleGameLift_DescribeFleetCapacity() { } func ExampleGameLift_DescribeFleetEvents() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.DescribeFleetEventsInput{ FleetId: aws.String("FleetId"), // Required @@ -391,7 +487,13 @@ func ExampleGameLift_DescribeFleetEvents() { } func ExampleGameLift_DescribeFleetPortSettings() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.DescribeFleetPortSettingsInput{ FleetId: aws.String("FleetId"), // Required @@ -410,7 +512,13 @@ func ExampleGameLift_DescribeFleetPortSettings() { } func ExampleGameLift_DescribeFleetUtilization() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.DescribeFleetUtilizationInput{ FleetIds: []*string{ @@ -434,7 +542,13 @@ func ExampleGameLift_DescribeFleetUtilization() { } func ExampleGameLift_DescribeGameSessionDetails() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.DescribeGameSessionDetailsInput{ AliasId: aws.String("AliasId"), @@ -458,7 +572,13 @@ func ExampleGameLift_DescribeGameSessionDetails() { } func ExampleGameLift_DescribeGameSessions() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.DescribeGameSessionsInput{ AliasId: aws.String("AliasId"), @@ -482,7 +602,13 @@ func ExampleGameLift_DescribeGameSessions() { } func ExampleGameLift_DescribePlayerSessions() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.DescribePlayerSessionsInput{ GameSessionId: aws.String("GameSessionId"), @@ -506,7 +632,13 @@ func ExampleGameLift_DescribePlayerSessions() { } func ExampleGameLift_DescribeRuntimeConfiguration() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.DescribeRuntimeConfigurationInput{ FleetId: aws.String("FleetId"), // Required @@ -525,7 +657,13 @@ func ExampleGameLift_DescribeRuntimeConfiguration() { } func ExampleGameLift_DescribeScalingPolicies() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.DescribeScalingPoliciesInput{ FleetId: aws.String("FleetId"), // Required @@ -547,7 +685,13 @@ func ExampleGameLift_DescribeScalingPolicies() { } func ExampleGameLift_GetGameSessionLogUrl() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.GetGameSessionLogUrlInput{ GameSessionId: aws.String("GameSessionId"), // Required @@ -566,7 +710,13 @@ func ExampleGameLift_GetGameSessionLogUrl() { } func ExampleGameLift_ListAliases() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.ListAliasesInput{ Limit: aws.Int64(1), @@ -588,7 +738,13 @@ func ExampleGameLift_ListAliases() { } func ExampleGameLift_ListBuilds() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.ListBuildsInput{ Limit: aws.Int64(1), @@ -609,7 +765,13 @@ func ExampleGameLift_ListBuilds() { } func ExampleGameLift_ListFleets() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.ListFleetsInput{ BuildId: aws.String("BuildId"), @@ -630,7 +792,13 @@ func ExampleGameLift_ListFleets() { } func ExampleGameLift_PutScalingPolicy() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.PutScalingPolicyInput{ ComparisonOperator: aws.String("ComparisonOperatorType"), // Required @@ -656,7 +824,13 @@ func ExampleGameLift_PutScalingPolicy() { } func ExampleGameLift_RequestUploadCredentials() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.RequestUploadCredentialsInput{ BuildId: aws.String("BuildId"), // Required @@ -675,7 +849,13 @@ func ExampleGameLift_RequestUploadCredentials() { } func ExampleGameLift_ResolveAlias() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.ResolveAliasInput{ AliasId: aws.String("AliasId"), // Required @@ -694,7 +874,13 @@ func ExampleGameLift_ResolveAlias() { } func ExampleGameLift_UpdateAlias() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.UpdateAliasInput{ AliasId: aws.String("AliasId"), // Required @@ -720,7 +906,13 @@ func ExampleGameLift_UpdateAlias() { } func ExampleGameLift_UpdateBuild() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.UpdateBuildInput{ BuildId: aws.String("BuildId"), // Required @@ -741,7 +933,13 @@ func ExampleGameLift_UpdateBuild() { } func ExampleGameLift_UpdateFleetAttributes() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.UpdateFleetAttributesInput{ FleetId: aws.String("FleetId"), // Required @@ -763,7 +961,13 @@ func ExampleGameLift_UpdateFleetAttributes() { } func ExampleGameLift_UpdateFleetCapacity() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.UpdateFleetCapacityInput{ FleetId: aws.String("FleetId"), // Required @@ -785,7 +989,13 @@ func ExampleGameLift_UpdateFleetCapacity() { } func ExampleGameLift_UpdateFleetPortSettings() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.UpdateFleetPortSettingsInput{ FleetId: aws.String("FleetId"), // Required @@ -822,7 +1032,13 @@ func ExampleGameLift_UpdateFleetPortSettings() { } func ExampleGameLift_UpdateGameSession() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.UpdateGameSessionInput{ GameSessionId: aws.String("GameSessionId"), // Required @@ -845,7 +1061,13 @@ func ExampleGameLift_UpdateGameSession() { } func ExampleGameLift_UpdateRuntimeConfiguration() { - svc := gamelift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := gamelift.New(sess) params := &gamelift.UpdateRuntimeConfigurationInput{ FleetId: aws.String("FleetId"), // Required diff --git a/service/glacier/examples_test.go b/service/glacier/examples_test.go index 9384d3dae0c..4127f95e1a3 100644 --- a/service/glacier/examples_test.go +++ b/service/glacier/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleGlacier_AbortMultipartUpload() { - svc := glacier.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := glacier.New(sess) params := &glacier.AbortMultipartUploadInput{ AccountId: aws.String("string"), // Required @@ -37,7 +43,13 @@ func ExampleGlacier_AbortMultipartUpload() { } func ExampleGlacier_AbortVaultLock() { - svc := glacier.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := glacier.New(sess) params := &glacier.AbortVaultLockInput{ AccountId: aws.String("string"), // Required @@ -57,7 +69,13 @@ func ExampleGlacier_AbortVaultLock() { } func ExampleGlacier_AddTagsToVault() { - svc := glacier.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := glacier.New(sess) params := &glacier.AddTagsToVaultInput{ AccountId: aws.String("string"), // Required @@ -81,7 +99,13 @@ func ExampleGlacier_AddTagsToVault() { } func ExampleGlacier_CompleteMultipartUpload() { - svc := glacier.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := glacier.New(sess) params := &glacier.CompleteMultipartUploadInput{ AccountId: aws.String("string"), // Required @@ -104,7 +128,13 @@ func ExampleGlacier_CompleteMultipartUpload() { } func ExampleGlacier_CompleteVaultLock() { - svc := glacier.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := glacier.New(sess) params := &glacier.CompleteVaultLockInput{ AccountId: aws.String("string"), // Required @@ -125,7 +155,13 @@ func ExampleGlacier_CompleteVaultLock() { } func ExampleGlacier_CreateVault() { - svc := glacier.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := glacier.New(sess) params := &glacier.CreateVaultInput{ AccountId: aws.String("string"), // Required @@ -145,7 +181,13 @@ func ExampleGlacier_CreateVault() { } func ExampleGlacier_DeleteArchive() { - svc := glacier.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := glacier.New(sess) params := &glacier.DeleteArchiveInput{ AccountId: aws.String("string"), // Required @@ -166,7 +208,13 @@ func ExampleGlacier_DeleteArchive() { } func ExampleGlacier_DeleteVault() { - svc := glacier.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := glacier.New(sess) params := &glacier.DeleteVaultInput{ AccountId: aws.String("string"), // Required @@ -186,7 +234,13 @@ func ExampleGlacier_DeleteVault() { } func ExampleGlacier_DeleteVaultAccessPolicy() { - svc := glacier.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := glacier.New(sess) params := &glacier.DeleteVaultAccessPolicyInput{ AccountId: aws.String("string"), // Required @@ -206,7 +260,13 @@ func ExampleGlacier_DeleteVaultAccessPolicy() { } func ExampleGlacier_DeleteVaultNotifications() { - svc := glacier.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := glacier.New(sess) params := &glacier.DeleteVaultNotificationsInput{ AccountId: aws.String("string"), // Required @@ -226,7 +286,13 @@ func ExampleGlacier_DeleteVaultNotifications() { } func ExampleGlacier_DescribeJob() { - svc := glacier.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := glacier.New(sess) params := &glacier.DescribeJobInput{ AccountId: aws.String("string"), // Required @@ -247,7 +313,13 @@ func ExampleGlacier_DescribeJob() { } func ExampleGlacier_DescribeVault() { - svc := glacier.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := glacier.New(sess) params := &glacier.DescribeVaultInput{ AccountId: aws.String("string"), // Required @@ -267,7 +339,13 @@ func ExampleGlacier_DescribeVault() { } func ExampleGlacier_GetDataRetrievalPolicy() { - svc := glacier.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := glacier.New(sess) params := &glacier.GetDataRetrievalPolicyInput{ AccountId: aws.String("string"), // Required @@ -286,7 +364,13 @@ func ExampleGlacier_GetDataRetrievalPolicy() { } func ExampleGlacier_GetJobOutput() { - svc := glacier.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := glacier.New(sess) params := &glacier.GetJobOutputInput{ AccountId: aws.String("string"), // Required @@ -308,7 +392,13 @@ func ExampleGlacier_GetJobOutput() { } func ExampleGlacier_GetVaultAccessPolicy() { - svc := glacier.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := glacier.New(sess) params := &glacier.GetVaultAccessPolicyInput{ AccountId: aws.String("string"), // Required @@ -328,7 +418,13 @@ func ExampleGlacier_GetVaultAccessPolicy() { } func ExampleGlacier_GetVaultLock() { - svc := glacier.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := glacier.New(sess) params := &glacier.GetVaultLockInput{ AccountId: aws.String("string"), // Required @@ -348,7 +444,13 @@ func ExampleGlacier_GetVaultLock() { } func ExampleGlacier_GetVaultNotifications() { - svc := glacier.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := glacier.New(sess) params := &glacier.GetVaultNotificationsInput{ AccountId: aws.String("string"), // Required @@ -368,7 +470,13 @@ func ExampleGlacier_GetVaultNotifications() { } func ExampleGlacier_InitiateJob() { - svc := glacier.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := glacier.New(sess) params := &glacier.InitiateJobInput{ AccountId: aws.String("string"), // Required @@ -402,7 +510,13 @@ func ExampleGlacier_InitiateJob() { } func ExampleGlacier_InitiateMultipartUpload() { - svc := glacier.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := glacier.New(sess) params := &glacier.InitiateMultipartUploadInput{ AccountId: aws.String("string"), // Required @@ -424,7 +538,13 @@ func ExampleGlacier_InitiateMultipartUpload() { } func ExampleGlacier_InitiateVaultLock() { - svc := glacier.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := glacier.New(sess) params := &glacier.InitiateVaultLockInput{ AccountId: aws.String("string"), // Required @@ -447,7 +567,13 @@ func ExampleGlacier_InitiateVaultLock() { } func ExampleGlacier_ListJobs() { - svc := glacier.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := glacier.New(sess) params := &glacier.ListJobsInput{ AccountId: aws.String("string"), // Required @@ -471,7 +597,13 @@ func ExampleGlacier_ListJobs() { } func ExampleGlacier_ListMultipartUploads() { - svc := glacier.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := glacier.New(sess) params := &glacier.ListMultipartUploadsInput{ AccountId: aws.String("string"), // Required @@ -493,7 +625,13 @@ func ExampleGlacier_ListMultipartUploads() { } func ExampleGlacier_ListParts() { - svc := glacier.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := glacier.New(sess) params := &glacier.ListPartsInput{ AccountId: aws.String("string"), // Required @@ -516,7 +654,13 @@ func ExampleGlacier_ListParts() { } func ExampleGlacier_ListTagsForVault() { - svc := glacier.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := glacier.New(sess) params := &glacier.ListTagsForVaultInput{ AccountId: aws.String("string"), // Required @@ -536,7 +680,13 @@ func ExampleGlacier_ListTagsForVault() { } func ExampleGlacier_ListVaults() { - svc := glacier.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := glacier.New(sess) params := &glacier.ListVaultsInput{ AccountId: aws.String("string"), // Required @@ -557,7 +707,13 @@ func ExampleGlacier_ListVaults() { } func ExampleGlacier_RemoveTagsFromVault() { - svc := glacier.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := glacier.New(sess) params := &glacier.RemoveTagsFromVaultInput{ AccountId: aws.String("string"), // Required @@ -581,7 +737,13 @@ func ExampleGlacier_RemoveTagsFromVault() { } func ExampleGlacier_SetDataRetrievalPolicy() { - svc := glacier.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := glacier.New(sess) params := &glacier.SetDataRetrievalPolicyInput{ AccountId: aws.String("string"), // Required @@ -609,7 +771,13 @@ func ExampleGlacier_SetDataRetrievalPolicy() { } func ExampleGlacier_SetVaultAccessPolicy() { - svc := glacier.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := glacier.New(sess) params := &glacier.SetVaultAccessPolicyInput{ AccountId: aws.String("string"), // Required @@ -632,7 +800,13 @@ func ExampleGlacier_SetVaultAccessPolicy() { } func ExampleGlacier_SetVaultNotifications() { - svc := glacier.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := glacier.New(sess) params := &glacier.SetVaultNotificationsInput{ AccountId: aws.String("string"), // Required @@ -659,7 +833,13 @@ func ExampleGlacier_SetVaultNotifications() { } func ExampleGlacier_UploadArchive() { - svc := glacier.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := glacier.New(sess) params := &glacier.UploadArchiveInput{ AccountId: aws.String("string"), // Required @@ -682,7 +862,13 @@ func ExampleGlacier_UploadArchive() { } func ExampleGlacier_UploadMultipartPart() { - svc := glacier.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := glacier.New(sess) params := &glacier.UploadMultipartPartInput{ AccountId: aws.String("string"), // Required diff --git a/service/iam/examples_test.go b/service/iam/examples_test.go index 1aebec8cd17..9671599bc74 100644 --- a/service/iam/examples_test.go +++ b/service/iam/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleIAM_AddClientIDToOpenIDConnectProvider() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.AddClientIDToOpenIDConnectProviderInput{ ClientID: aws.String("clientIDType"), // Required @@ -36,7 +42,13 @@ func ExampleIAM_AddClientIDToOpenIDConnectProvider() { } func ExampleIAM_AddRoleToInstanceProfile() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.AddRoleToInstanceProfileInput{ InstanceProfileName: aws.String("instanceProfileNameType"), // Required @@ -56,7 +68,13 @@ func ExampleIAM_AddRoleToInstanceProfile() { } func ExampleIAM_AddUserToGroup() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.AddUserToGroupInput{ GroupName: aws.String("groupNameType"), // Required @@ -76,7 +94,13 @@ func ExampleIAM_AddUserToGroup() { } func ExampleIAM_AttachGroupPolicy() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.AttachGroupPolicyInput{ GroupName: aws.String("groupNameType"), // Required @@ -96,7 +120,13 @@ func ExampleIAM_AttachGroupPolicy() { } func ExampleIAM_AttachRolePolicy() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.AttachRolePolicyInput{ PolicyArn: aws.String("arnType"), // Required @@ -116,7 +146,13 @@ func ExampleIAM_AttachRolePolicy() { } func ExampleIAM_AttachUserPolicy() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.AttachUserPolicyInput{ PolicyArn: aws.String("arnType"), // Required @@ -136,7 +172,13 @@ func ExampleIAM_AttachUserPolicy() { } func ExampleIAM_ChangePassword() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.ChangePasswordInput{ NewPassword: aws.String("passwordType"), // Required @@ -156,7 +198,13 @@ func ExampleIAM_ChangePassword() { } func ExampleIAM_CreateAccessKey() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.CreateAccessKeyInput{ UserName: aws.String("existingUserNameType"), @@ -175,7 +223,13 @@ func ExampleIAM_CreateAccessKey() { } func ExampleIAM_CreateAccountAlias() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.CreateAccountAliasInput{ AccountAlias: aws.String("accountAliasType"), // Required @@ -194,7 +248,13 @@ func ExampleIAM_CreateAccountAlias() { } func ExampleIAM_CreateGroup() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.CreateGroupInput{ GroupName: aws.String("groupNameType"), // Required @@ -214,7 +274,13 @@ func ExampleIAM_CreateGroup() { } func ExampleIAM_CreateInstanceProfile() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.CreateInstanceProfileInput{ InstanceProfileName: aws.String("instanceProfileNameType"), // Required @@ -234,7 +300,13 @@ func ExampleIAM_CreateInstanceProfile() { } func ExampleIAM_CreateLoginProfile() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.CreateLoginProfileInput{ Password: aws.String("passwordType"), // Required @@ -255,7 +327,13 @@ func ExampleIAM_CreateLoginProfile() { } func ExampleIAM_CreateOpenIDConnectProvider() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.CreateOpenIDConnectProviderInput{ ThumbprintList: []*string{ // Required @@ -282,7 +360,13 @@ func ExampleIAM_CreateOpenIDConnectProvider() { } func ExampleIAM_CreatePolicy() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.CreatePolicyInput{ PolicyDocument: aws.String("policyDocumentType"), // Required @@ -304,7 +388,13 @@ func ExampleIAM_CreatePolicy() { } func ExampleIAM_CreatePolicyVersion() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.CreatePolicyVersionInput{ PolicyArn: aws.String("arnType"), // Required @@ -325,7 +415,13 @@ func ExampleIAM_CreatePolicyVersion() { } func ExampleIAM_CreateRole() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.CreateRoleInput{ AssumeRolePolicyDocument: aws.String("policyDocumentType"), // Required @@ -346,7 +442,13 @@ func ExampleIAM_CreateRole() { } func ExampleIAM_CreateSAMLProvider() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.CreateSAMLProviderInput{ Name: aws.String("SAMLProviderNameType"), // Required @@ -366,7 +468,13 @@ func ExampleIAM_CreateSAMLProvider() { } func ExampleIAM_CreateUser() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.CreateUserInput{ UserName: aws.String("userNameType"), // Required @@ -386,7 +494,13 @@ func ExampleIAM_CreateUser() { } func ExampleIAM_CreateVirtualMFADevice() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.CreateVirtualMFADeviceInput{ VirtualMFADeviceName: aws.String("virtualMFADeviceName"), // Required @@ -406,7 +520,13 @@ func ExampleIAM_CreateVirtualMFADevice() { } func ExampleIAM_DeactivateMFADevice() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.DeactivateMFADeviceInput{ SerialNumber: aws.String("serialNumberType"), // Required @@ -426,7 +546,13 @@ func ExampleIAM_DeactivateMFADevice() { } func ExampleIAM_DeleteAccessKey() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.DeleteAccessKeyInput{ AccessKeyId: aws.String("accessKeyIdType"), // Required @@ -446,7 +572,13 @@ func ExampleIAM_DeleteAccessKey() { } func ExampleIAM_DeleteAccountAlias() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.DeleteAccountAliasInput{ AccountAlias: aws.String("accountAliasType"), // Required @@ -465,7 +597,13 @@ func ExampleIAM_DeleteAccountAlias() { } func ExampleIAM_DeleteAccountPasswordPolicy() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) var params *iam.DeleteAccountPasswordPolicyInput resp, err := svc.DeleteAccountPasswordPolicy(params) @@ -482,7 +620,13 @@ func ExampleIAM_DeleteAccountPasswordPolicy() { } func ExampleIAM_DeleteGroup() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.DeleteGroupInput{ GroupName: aws.String("groupNameType"), // Required @@ -501,7 +645,13 @@ func ExampleIAM_DeleteGroup() { } func ExampleIAM_DeleteGroupPolicy() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.DeleteGroupPolicyInput{ GroupName: aws.String("groupNameType"), // Required @@ -521,7 +671,13 @@ func ExampleIAM_DeleteGroupPolicy() { } func ExampleIAM_DeleteInstanceProfile() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.DeleteInstanceProfileInput{ InstanceProfileName: aws.String("instanceProfileNameType"), // Required @@ -540,7 +696,13 @@ func ExampleIAM_DeleteInstanceProfile() { } func ExampleIAM_DeleteLoginProfile() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.DeleteLoginProfileInput{ UserName: aws.String("userNameType"), // Required @@ -559,7 +721,13 @@ func ExampleIAM_DeleteLoginProfile() { } func ExampleIAM_DeleteOpenIDConnectProvider() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.DeleteOpenIDConnectProviderInput{ OpenIDConnectProviderArn: aws.String("arnType"), // Required @@ -578,7 +746,13 @@ func ExampleIAM_DeleteOpenIDConnectProvider() { } func ExampleIAM_DeletePolicy() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.DeletePolicyInput{ PolicyArn: aws.String("arnType"), // Required @@ -597,7 +771,13 @@ func ExampleIAM_DeletePolicy() { } func ExampleIAM_DeletePolicyVersion() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.DeletePolicyVersionInput{ PolicyArn: aws.String("arnType"), // Required @@ -617,7 +797,13 @@ func ExampleIAM_DeletePolicyVersion() { } func ExampleIAM_DeleteRole() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.DeleteRoleInput{ RoleName: aws.String("roleNameType"), // Required @@ -636,7 +822,13 @@ func ExampleIAM_DeleteRole() { } func ExampleIAM_DeleteRolePolicy() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.DeleteRolePolicyInput{ PolicyName: aws.String("policyNameType"), // Required @@ -656,7 +848,13 @@ func ExampleIAM_DeleteRolePolicy() { } func ExampleIAM_DeleteSAMLProvider() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.DeleteSAMLProviderInput{ SAMLProviderArn: aws.String("arnType"), // Required @@ -675,7 +873,13 @@ func ExampleIAM_DeleteSAMLProvider() { } func ExampleIAM_DeleteSSHPublicKey() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.DeleteSSHPublicKeyInput{ SSHPublicKeyId: aws.String("publicKeyIdType"), // Required @@ -695,7 +899,13 @@ func ExampleIAM_DeleteSSHPublicKey() { } func ExampleIAM_DeleteServerCertificate() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.DeleteServerCertificateInput{ ServerCertificateName: aws.String("serverCertificateNameType"), // Required @@ -714,7 +924,13 @@ func ExampleIAM_DeleteServerCertificate() { } func ExampleIAM_DeleteSigningCertificate() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.DeleteSigningCertificateInput{ CertificateId: aws.String("certificateIdType"), // Required @@ -734,7 +950,13 @@ func ExampleIAM_DeleteSigningCertificate() { } func ExampleIAM_DeleteUser() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.DeleteUserInput{ UserName: aws.String("existingUserNameType"), // Required @@ -753,7 +975,13 @@ func ExampleIAM_DeleteUser() { } func ExampleIAM_DeleteUserPolicy() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.DeleteUserPolicyInput{ PolicyName: aws.String("policyNameType"), // Required @@ -773,7 +1001,13 @@ func ExampleIAM_DeleteUserPolicy() { } func ExampleIAM_DeleteVirtualMFADevice() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.DeleteVirtualMFADeviceInput{ SerialNumber: aws.String("serialNumberType"), // Required @@ -792,7 +1026,13 @@ func ExampleIAM_DeleteVirtualMFADevice() { } func ExampleIAM_DetachGroupPolicy() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.DetachGroupPolicyInput{ GroupName: aws.String("groupNameType"), // Required @@ -812,7 +1052,13 @@ func ExampleIAM_DetachGroupPolicy() { } func ExampleIAM_DetachRolePolicy() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.DetachRolePolicyInput{ PolicyArn: aws.String("arnType"), // Required @@ -832,7 +1078,13 @@ func ExampleIAM_DetachRolePolicy() { } func ExampleIAM_DetachUserPolicy() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.DetachUserPolicyInput{ PolicyArn: aws.String("arnType"), // Required @@ -852,7 +1104,13 @@ func ExampleIAM_DetachUserPolicy() { } func ExampleIAM_EnableMFADevice() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.EnableMFADeviceInput{ AuthenticationCode1: aws.String("authenticationCodeType"), // Required @@ -874,7 +1132,13 @@ func ExampleIAM_EnableMFADevice() { } func ExampleIAM_GenerateCredentialReport() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) var params *iam.GenerateCredentialReportInput resp, err := svc.GenerateCredentialReport(params) @@ -891,7 +1155,13 @@ func ExampleIAM_GenerateCredentialReport() { } func ExampleIAM_GetAccessKeyLastUsed() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.GetAccessKeyLastUsedInput{ AccessKeyId: aws.String("accessKeyIdType"), // Required @@ -910,7 +1180,13 @@ func ExampleIAM_GetAccessKeyLastUsed() { } func ExampleIAM_GetAccountAuthorizationDetails() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.GetAccountAuthorizationDetailsInput{ Filter: []*string{ @@ -934,7 +1210,13 @@ func ExampleIAM_GetAccountAuthorizationDetails() { } func ExampleIAM_GetAccountPasswordPolicy() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) var params *iam.GetAccountPasswordPolicyInput resp, err := svc.GetAccountPasswordPolicy(params) @@ -951,7 +1233,13 @@ func ExampleIAM_GetAccountPasswordPolicy() { } func ExampleIAM_GetAccountSummary() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) var params *iam.GetAccountSummaryInput resp, err := svc.GetAccountSummary(params) @@ -968,7 +1256,13 @@ func ExampleIAM_GetAccountSummary() { } func ExampleIAM_GetContextKeysForCustomPolicy() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.GetContextKeysForCustomPolicyInput{ PolicyInputList: []*string{ // Required @@ -990,7 +1284,13 @@ func ExampleIAM_GetContextKeysForCustomPolicy() { } func ExampleIAM_GetContextKeysForPrincipalPolicy() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.GetContextKeysForPrincipalPolicyInput{ PolicySourceArn: aws.String("arnType"), // Required @@ -1013,7 +1313,13 @@ func ExampleIAM_GetContextKeysForPrincipalPolicy() { } func ExampleIAM_GetCredentialReport() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) var params *iam.GetCredentialReportInput resp, err := svc.GetCredentialReport(params) @@ -1030,7 +1336,13 @@ func ExampleIAM_GetCredentialReport() { } func ExampleIAM_GetGroup() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.GetGroupInput{ GroupName: aws.String("groupNameType"), // Required @@ -1051,7 +1363,13 @@ func ExampleIAM_GetGroup() { } func ExampleIAM_GetGroupPolicy() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.GetGroupPolicyInput{ GroupName: aws.String("groupNameType"), // Required @@ -1071,7 +1389,13 @@ func ExampleIAM_GetGroupPolicy() { } func ExampleIAM_GetInstanceProfile() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.GetInstanceProfileInput{ InstanceProfileName: aws.String("instanceProfileNameType"), // Required @@ -1090,7 +1414,13 @@ func ExampleIAM_GetInstanceProfile() { } func ExampleIAM_GetLoginProfile() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.GetLoginProfileInput{ UserName: aws.String("userNameType"), // Required @@ -1109,7 +1439,13 @@ func ExampleIAM_GetLoginProfile() { } func ExampleIAM_GetOpenIDConnectProvider() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.GetOpenIDConnectProviderInput{ OpenIDConnectProviderArn: aws.String("arnType"), // Required @@ -1128,7 +1464,13 @@ func ExampleIAM_GetOpenIDConnectProvider() { } func ExampleIAM_GetPolicy() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.GetPolicyInput{ PolicyArn: aws.String("arnType"), // Required @@ -1147,7 +1489,13 @@ func ExampleIAM_GetPolicy() { } func ExampleIAM_GetPolicyVersion() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.GetPolicyVersionInput{ PolicyArn: aws.String("arnType"), // Required @@ -1167,7 +1515,13 @@ func ExampleIAM_GetPolicyVersion() { } func ExampleIAM_GetRole() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.GetRoleInput{ RoleName: aws.String("roleNameType"), // Required @@ -1186,7 +1540,13 @@ func ExampleIAM_GetRole() { } func ExampleIAM_GetRolePolicy() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.GetRolePolicyInput{ PolicyName: aws.String("policyNameType"), // Required @@ -1206,7 +1566,13 @@ func ExampleIAM_GetRolePolicy() { } func ExampleIAM_GetSAMLProvider() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.GetSAMLProviderInput{ SAMLProviderArn: aws.String("arnType"), // Required @@ -1225,7 +1591,13 @@ func ExampleIAM_GetSAMLProvider() { } func ExampleIAM_GetSSHPublicKey() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.GetSSHPublicKeyInput{ Encoding: aws.String("encodingType"), // Required @@ -1246,7 +1618,13 @@ func ExampleIAM_GetSSHPublicKey() { } func ExampleIAM_GetServerCertificate() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.GetServerCertificateInput{ ServerCertificateName: aws.String("serverCertificateNameType"), // Required @@ -1265,7 +1643,13 @@ func ExampleIAM_GetServerCertificate() { } func ExampleIAM_GetUser() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.GetUserInput{ UserName: aws.String("existingUserNameType"), @@ -1284,7 +1668,13 @@ func ExampleIAM_GetUser() { } func ExampleIAM_GetUserPolicy() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.GetUserPolicyInput{ PolicyName: aws.String("policyNameType"), // Required @@ -1304,7 +1694,13 @@ func ExampleIAM_GetUserPolicy() { } func ExampleIAM_ListAccessKeys() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.ListAccessKeysInput{ Marker: aws.String("markerType"), @@ -1325,7 +1721,13 @@ func ExampleIAM_ListAccessKeys() { } func ExampleIAM_ListAccountAliases() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.ListAccountAliasesInput{ Marker: aws.String("markerType"), @@ -1345,7 +1747,13 @@ func ExampleIAM_ListAccountAliases() { } func ExampleIAM_ListAttachedGroupPolicies() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.ListAttachedGroupPoliciesInput{ GroupName: aws.String("groupNameType"), // Required @@ -1367,7 +1775,13 @@ func ExampleIAM_ListAttachedGroupPolicies() { } func ExampleIAM_ListAttachedRolePolicies() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.ListAttachedRolePoliciesInput{ RoleName: aws.String("roleNameType"), // Required @@ -1389,7 +1803,13 @@ func ExampleIAM_ListAttachedRolePolicies() { } func ExampleIAM_ListAttachedUserPolicies() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.ListAttachedUserPoliciesInput{ UserName: aws.String("userNameType"), // Required @@ -1411,7 +1831,13 @@ func ExampleIAM_ListAttachedUserPolicies() { } func ExampleIAM_ListEntitiesForPolicy() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.ListEntitiesForPolicyInput{ PolicyArn: aws.String("arnType"), // Required @@ -1434,7 +1860,13 @@ func ExampleIAM_ListEntitiesForPolicy() { } func ExampleIAM_ListGroupPolicies() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.ListGroupPoliciesInput{ GroupName: aws.String("groupNameType"), // Required @@ -1455,7 +1887,13 @@ func ExampleIAM_ListGroupPolicies() { } func ExampleIAM_ListGroups() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.ListGroupsInput{ Marker: aws.String("markerType"), @@ -1476,7 +1914,13 @@ func ExampleIAM_ListGroups() { } func ExampleIAM_ListGroupsForUser() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.ListGroupsForUserInput{ UserName: aws.String("existingUserNameType"), // Required @@ -1497,7 +1941,13 @@ func ExampleIAM_ListGroupsForUser() { } func ExampleIAM_ListInstanceProfiles() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.ListInstanceProfilesInput{ Marker: aws.String("markerType"), @@ -1518,7 +1968,13 @@ func ExampleIAM_ListInstanceProfiles() { } func ExampleIAM_ListInstanceProfilesForRole() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.ListInstanceProfilesForRoleInput{ RoleName: aws.String("roleNameType"), // Required @@ -1539,7 +1995,13 @@ func ExampleIAM_ListInstanceProfilesForRole() { } func ExampleIAM_ListMFADevices() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.ListMFADevicesInput{ Marker: aws.String("markerType"), @@ -1560,7 +2022,13 @@ func ExampleIAM_ListMFADevices() { } func ExampleIAM_ListOpenIDConnectProviders() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) var params *iam.ListOpenIDConnectProvidersInput resp, err := svc.ListOpenIDConnectProviders(params) @@ -1577,7 +2045,13 @@ func ExampleIAM_ListOpenIDConnectProviders() { } func ExampleIAM_ListPolicies() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.ListPoliciesInput{ Marker: aws.String("markerType"), @@ -1600,7 +2074,13 @@ func ExampleIAM_ListPolicies() { } func ExampleIAM_ListPolicyVersions() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.ListPolicyVersionsInput{ PolicyArn: aws.String("arnType"), // Required @@ -1621,7 +2101,13 @@ func ExampleIAM_ListPolicyVersions() { } func ExampleIAM_ListRolePolicies() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.ListRolePoliciesInput{ RoleName: aws.String("roleNameType"), // Required @@ -1642,7 +2128,13 @@ func ExampleIAM_ListRolePolicies() { } func ExampleIAM_ListRoles() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.ListRolesInput{ Marker: aws.String("markerType"), @@ -1663,7 +2155,13 @@ func ExampleIAM_ListRoles() { } func ExampleIAM_ListSAMLProviders() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) var params *iam.ListSAMLProvidersInput resp, err := svc.ListSAMLProviders(params) @@ -1680,7 +2178,13 @@ func ExampleIAM_ListSAMLProviders() { } func ExampleIAM_ListSSHPublicKeys() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.ListSSHPublicKeysInput{ Marker: aws.String("markerType"), @@ -1701,7 +2205,13 @@ func ExampleIAM_ListSSHPublicKeys() { } func ExampleIAM_ListServerCertificates() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.ListServerCertificatesInput{ Marker: aws.String("markerType"), @@ -1722,7 +2232,13 @@ func ExampleIAM_ListServerCertificates() { } func ExampleIAM_ListSigningCertificates() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.ListSigningCertificatesInput{ Marker: aws.String("markerType"), @@ -1743,7 +2259,13 @@ func ExampleIAM_ListSigningCertificates() { } func ExampleIAM_ListUserPolicies() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.ListUserPoliciesInput{ UserName: aws.String("existingUserNameType"), // Required @@ -1764,7 +2286,13 @@ func ExampleIAM_ListUserPolicies() { } func ExampleIAM_ListUsers() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.ListUsersInput{ Marker: aws.String("markerType"), @@ -1785,7 +2313,13 @@ func ExampleIAM_ListUsers() { } func ExampleIAM_ListVirtualMFADevices() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.ListVirtualMFADevicesInput{ AssignmentStatus: aws.String("assignmentStatusType"), @@ -1806,7 +2340,13 @@ func ExampleIAM_ListVirtualMFADevices() { } func ExampleIAM_PutGroupPolicy() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.PutGroupPolicyInput{ GroupName: aws.String("groupNameType"), // Required @@ -1827,7 +2367,13 @@ func ExampleIAM_PutGroupPolicy() { } func ExampleIAM_PutRolePolicy() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.PutRolePolicyInput{ PolicyDocument: aws.String("policyDocumentType"), // Required @@ -1848,7 +2394,13 @@ func ExampleIAM_PutRolePolicy() { } func ExampleIAM_PutUserPolicy() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.PutUserPolicyInput{ PolicyDocument: aws.String("policyDocumentType"), // Required @@ -1869,7 +2421,13 @@ func ExampleIAM_PutUserPolicy() { } func ExampleIAM_RemoveClientIDFromOpenIDConnectProvider() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.RemoveClientIDFromOpenIDConnectProviderInput{ ClientID: aws.String("clientIDType"), // Required @@ -1889,7 +2447,13 @@ func ExampleIAM_RemoveClientIDFromOpenIDConnectProvider() { } func ExampleIAM_RemoveRoleFromInstanceProfile() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.RemoveRoleFromInstanceProfileInput{ InstanceProfileName: aws.String("instanceProfileNameType"), // Required @@ -1909,7 +2473,13 @@ func ExampleIAM_RemoveRoleFromInstanceProfile() { } func ExampleIAM_RemoveUserFromGroup() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.RemoveUserFromGroupInput{ GroupName: aws.String("groupNameType"), // Required @@ -1929,7 +2499,13 @@ func ExampleIAM_RemoveUserFromGroup() { } func ExampleIAM_ResyncMFADevice() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.ResyncMFADeviceInput{ AuthenticationCode1: aws.String("authenticationCodeType"), // Required @@ -1951,7 +2527,13 @@ func ExampleIAM_ResyncMFADevice() { } func ExampleIAM_SetDefaultPolicyVersion() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.SetDefaultPolicyVersionInput{ PolicyArn: aws.String("arnType"), // Required @@ -1971,7 +2553,13 @@ func ExampleIAM_SetDefaultPolicyVersion() { } func ExampleIAM_SimulateCustomPolicy() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.SimulateCustomPolicyInput{ ActionNames: []*string{ // Required @@ -2018,7 +2606,13 @@ func ExampleIAM_SimulateCustomPolicy() { } func ExampleIAM_SimulatePrincipalPolicy() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.SimulatePrincipalPolicyInput{ ActionNames: []*string{ // Required @@ -2066,7 +2660,13 @@ func ExampleIAM_SimulatePrincipalPolicy() { } func ExampleIAM_UpdateAccessKey() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.UpdateAccessKeyInput{ AccessKeyId: aws.String("accessKeyIdType"), // Required @@ -2087,7 +2687,13 @@ func ExampleIAM_UpdateAccessKey() { } func ExampleIAM_UpdateAccountPasswordPolicy() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.UpdateAccountPasswordPolicyInput{ AllowUsersToChangePassword: aws.Bool(true), @@ -2114,7 +2720,13 @@ func ExampleIAM_UpdateAccountPasswordPolicy() { } func ExampleIAM_UpdateAssumeRolePolicy() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.UpdateAssumeRolePolicyInput{ PolicyDocument: aws.String("policyDocumentType"), // Required @@ -2134,7 +2746,13 @@ func ExampleIAM_UpdateAssumeRolePolicy() { } func ExampleIAM_UpdateGroup() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.UpdateGroupInput{ GroupName: aws.String("groupNameType"), // Required @@ -2155,7 +2773,13 @@ func ExampleIAM_UpdateGroup() { } func ExampleIAM_UpdateLoginProfile() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.UpdateLoginProfileInput{ UserName: aws.String("userNameType"), // Required @@ -2176,7 +2800,13 @@ func ExampleIAM_UpdateLoginProfile() { } func ExampleIAM_UpdateOpenIDConnectProviderThumbprint() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.UpdateOpenIDConnectProviderThumbprintInput{ OpenIDConnectProviderArn: aws.String("arnType"), // Required @@ -2199,7 +2829,13 @@ func ExampleIAM_UpdateOpenIDConnectProviderThumbprint() { } func ExampleIAM_UpdateSAMLProvider() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.UpdateSAMLProviderInput{ SAMLMetadataDocument: aws.String("SAMLMetadataDocumentType"), // Required @@ -2219,7 +2855,13 @@ func ExampleIAM_UpdateSAMLProvider() { } func ExampleIAM_UpdateSSHPublicKey() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.UpdateSSHPublicKeyInput{ SSHPublicKeyId: aws.String("publicKeyIdType"), // Required @@ -2240,7 +2882,13 @@ func ExampleIAM_UpdateSSHPublicKey() { } func ExampleIAM_UpdateServerCertificate() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.UpdateServerCertificateInput{ ServerCertificateName: aws.String("serverCertificateNameType"), // Required @@ -2261,7 +2909,13 @@ func ExampleIAM_UpdateServerCertificate() { } func ExampleIAM_UpdateSigningCertificate() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.UpdateSigningCertificateInput{ CertificateId: aws.String("certificateIdType"), // Required @@ -2282,7 +2936,13 @@ func ExampleIAM_UpdateSigningCertificate() { } func ExampleIAM_UpdateUser() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.UpdateUserInput{ UserName: aws.String("existingUserNameType"), // Required @@ -2303,7 +2963,13 @@ func ExampleIAM_UpdateUser() { } func ExampleIAM_UploadSSHPublicKey() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.UploadSSHPublicKeyInput{ SSHPublicKeyBody: aws.String("publicKeyMaterialType"), // Required @@ -2323,7 +2989,13 @@ func ExampleIAM_UploadSSHPublicKey() { } func ExampleIAM_UploadServerCertificate() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.UploadServerCertificateInput{ CertificateBody: aws.String("certificateBodyType"), // Required @@ -2346,7 +3018,13 @@ func ExampleIAM_UploadServerCertificate() { } func ExampleIAM_UploadSigningCertificate() { - svc := iam.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iam.New(sess) params := &iam.UploadSigningCertificateInput{ CertificateBody: aws.String("certificateBodyType"), // Required diff --git a/service/inspector/examples_test.go b/service/inspector/examples_test.go index 10180d4d906..164fad53497 100644 --- a/service/inspector/examples_test.go +++ b/service/inspector/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleInspector_AddAttributesToFindings() { - svc := inspector.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := inspector.New(sess) params := &inspector.AddAttributesToFindingsInput{ Attributes: []*inspector.Attribute{ // Required @@ -45,7 +51,13 @@ func ExampleInspector_AddAttributesToFindings() { } func ExampleInspector_CreateAssessmentTarget() { - svc := inspector.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := inspector.New(sess) params := &inspector.CreateAssessmentTargetInput{ AssessmentTargetName: aws.String("AssessmentTargetName"), // Required @@ -65,7 +77,13 @@ func ExampleInspector_CreateAssessmentTarget() { } func ExampleInspector_CreateAssessmentTemplate() { - svc := inspector.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := inspector.New(sess) params := &inspector.CreateAssessmentTemplateInput{ AssessmentTargetArn: aws.String("Arn"), // Required @@ -97,7 +115,13 @@ func ExampleInspector_CreateAssessmentTemplate() { } func ExampleInspector_CreateResourceGroup() { - svc := inspector.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := inspector.New(sess) params := &inspector.CreateResourceGroupInput{ ResourceGroupTags: []*inspector.ResourceGroupTag{ // Required @@ -122,7 +146,13 @@ func ExampleInspector_CreateResourceGroup() { } func ExampleInspector_DeleteAssessmentRun() { - svc := inspector.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := inspector.New(sess) params := &inspector.DeleteAssessmentRunInput{ AssessmentRunArn: aws.String("Arn"), // Required @@ -141,7 +171,13 @@ func ExampleInspector_DeleteAssessmentRun() { } func ExampleInspector_DeleteAssessmentTarget() { - svc := inspector.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := inspector.New(sess) params := &inspector.DeleteAssessmentTargetInput{ AssessmentTargetArn: aws.String("Arn"), // Required @@ -160,7 +196,13 @@ func ExampleInspector_DeleteAssessmentTarget() { } func ExampleInspector_DeleteAssessmentTemplate() { - svc := inspector.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := inspector.New(sess) params := &inspector.DeleteAssessmentTemplateInput{ AssessmentTemplateArn: aws.String("Arn"), // Required @@ -179,7 +221,13 @@ func ExampleInspector_DeleteAssessmentTemplate() { } func ExampleInspector_DescribeAssessmentRuns() { - svc := inspector.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := inspector.New(sess) params := &inspector.DescribeAssessmentRunsInput{ AssessmentRunArns: []*string{ // Required @@ -201,7 +249,13 @@ func ExampleInspector_DescribeAssessmentRuns() { } func ExampleInspector_DescribeAssessmentTargets() { - svc := inspector.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := inspector.New(sess) params := &inspector.DescribeAssessmentTargetsInput{ AssessmentTargetArns: []*string{ // Required @@ -223,7 +277,13 @@ func ExampleInspector_DescribeAssessmentTargets() { } func ExampleInspector_DescribeAssessmentTemplates() { - svc := inspector.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := inspector.New(sess) params := &inspector.DescribeAssessmentTemplatesInput{ AssessmentTemplateArns: []*string{ // Required @@ -245,7 +305,13 @@ func ExampleInspector_DescribeAssessmentTemplates() { } func ExampleInspector_DescribeCrossAccountAccessRole() { - svc := inspector.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := inspector.New(sess) var params *inspector.DescribeCrossAccountAccessRoleInput resp, err := svc.DescribeCrossAccountAccessRole(params) @@ -262,7 +328,13 @@ func ExampleInspector_DescribeCrossAccountAccessRole() { } func ExampleInspector_DescribeFindings() { - svc := inspector.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := inspector.New(sess) params := &inspector.DescribeFindingsInput{ FindingArns: []*string{ // Required @@ -285,7 +357,13 @@ func ExampleInspector_DescribeFindings() { } func ExampleInspector_DescribeResourceGroups() { - svc := inspector.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := inspector.New(sess) params := &inspector.DescribeResourceGroupsInput{ ResourceGroupArns: []*string{ // Required @@ -307,7 +385,13 @@ func ExampleInspector_DescribeResourceGroups() { } func ExampleInspector_DescribeRulesPackages() { - svc := inspector.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := inspector.New(sess) params := &inspector.DescribeRulesPackagesInput{ RulesPackageArns: []*string{ // Required @@ -330,7 +414,13 @@ func ExampleInspector_DescribeRulesPackages() { } func ExampleInspector_GetTelemetryMetadata() { - svc := inspector.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := inspector.New(sess) params := &inspector.GetTelemetryMetadataInput{ AssessmentRunArn: aws.String("Arn"), // Required @@ -349,7 +439,13 @@ func ExampleInspector_GetTelemetryMetadata() { } func ExampleInspector_ListAssessmentRunAgents() { - svc := inspector.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := inspector.New(sess) params := &inspector.ListAssessmentRunAgentsInput{ AssessmentRunArn: aws.String("Arn"), // Required @@ -380,7 +476,13 @@ func ExampleInspector_ListAssessmentRunAgents() { } func ExampleInspector_ListAssessmentRuns() { - svc := inspector.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := inspector.New(sess) params := &inspector.ListAssessmentRunsInput{ AssessmentTemplateArns: []*string{ @@ -431,7 +533,13 @@ func ExampleInspector_ListAssessmentRuns() { } func ExampleInspector_ListAssessmentTargets() { - svc := inspector.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := inspector.New(sess) params := &inspector.ListAssessmentTargetsInput{ Filter: &inspector.AssessmentTargetFilter{ @@ -454,7 +562,13 @@ func ExampleInspector_ListAssessmentTargets() { } func ExampleInspector_ListAssessmentTemplates() { - svc := inspector.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := inspector.New(sess) params := &inspector.ListAssessmentTemplatesInput{ AssessmentTargetArns: []*string{ @@ -489,7 +603,13 @@ func ExampleInspector_ListAssessmentTemplates() { } func ExampleInspector_ListEventSubscriptions() { - svc := inspector.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := inspector.New(sess) params := &inspector.ListEventSubscriptionsInput{ MaxResults: aws.Int64(1), @@ -510,7 +630,13 @@ func ExampleInspector_ListEventSubscriptions() { } func ExampleInspector_ListFindings() { - svc := inspector.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := inspector.New(sess) params := &inspector.ListFindingsInput{ AssessmentRunArns: []*string{ @@ -574,7 +700,13 @@ func ExampleInspector_ListFindings() { } func ExampleInspector_ListRulesPackages() { - svc := inspector.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := inspector.New(sess) params := &inspector.ListRulesPackagesInput{ MaxResults: aws.Int64(1), @@ -594,7 +726,13 @@ func ExampleInspector_ListRulesPackages() { } func ExampleInspector_ListTagsForResource() { - svc := inspector.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := inspector.New(sess) params := &inspector.ListTagsForResourceInput{ ResourceArn: aws.String("Arn"), // Required @@ -613,7 +751,13 @@ func ExampleInspector_ListTagsForResource() { } func ExampleInspector_PreviewAgents() { - svc := inspector.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := inspector.New(sess) params := &inspector.PreviewAgentsInput{ PreviewAgentsArn: aws.String("Arn"), // Required @@ -634,7 +778,13 @@ func ExampleInspector_PreviewAgents() { } func ExampleInspector_RegisterCrossAccountAccessRole() { - svc := inspector.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := inspector.New(sess) params := &inspector.RegisterCrossAccountAccessRoleInput{ RoleArn: aws.String("Arn"), // Required @@ -653,7 +803,13 @@ func ExampleInspector_RegisterCrossAccountAccessRole() { } func ExampleInspector_RemoveAttributesFromFindings() { - svc := inspector.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := inspector.New(sess) params := &inspector.RemoveAttributesFromFindingsInput{ AttributeKeys: []*string{ // Required @@ -679,7 +835,13 @@ func ExampleInspector_RemoveAttributesFromFindings() { } func ExampleInspector_SetTagsForResource() { - svc := inspector.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := inspector.New(sess) params := &inspector.SetTagsForResourceInput{ ResourceArn: aws.String("Arn"), // Required @@ -705,7 +867,13 @@ func ExampleInspector_SetTagsForResource() { } func ExampleInspector_StartAssessmentRun() { - svc := inspector.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := inspector.New(sess) params := &inspector.StartAssessmentRunInput{ AssessmentTemplateArn: aws.String("Arn"), // Required @@ -725,7 +893,13 @@ func ExampleInspector_StartAssessmentRun() { } func ExampleInspector_StopAssessmentRun() { - svc := inspector.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := inspector.New(sess) params := &inspector.StopAssessmentRunInput{ AssessmentRunArn: aws.String("Arn"), // Required @@ -744,7 +918,13 @@ func ExampleInspector_StopAssessmentRun() { } func ExampleInspector_SubscribeToEvent() { - svc := inspector.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := inspector.New(sess) params := &inspector.SubscribeToEventInput{ Event: aws.String("Event"), // Required @@ -765,7 +945,13 @@ func ExampleInspector_SubscribeToEvent() { } func ExampleInspector_UnsubscribeFromEvent() { - svc := inspector.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := inspector.New(sess) params := &inspector.UnsubscribeFromEventInput{ Event: aws.String("Event"), // Required @@ -786,7 +972,13 @@ func ExampleInspector_UnsubscribeFromEvent() { } func ExampleInspector_UpdateAssessmentTarget() { - svc := inspector.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := inspector.New(sess) params := &inspector.UpdateAssessmentTargetInput{ AssessmentTargetArn: aws.String("Arn"), // Required diff --git a/service/iot/examples_test.go b/service/iot/examples_test.go index e84fbe5772b..757990bafb6 100644 --- a/service/iot/examples_test.go +++ b/service/iot/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleIoT_AcceptCertificateTransfer() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.AcceptCertificateTransferInput{ CertificateId: aws.String("CertificateId"), // Required @@ -36,7 +42,13 @@ func ExampleIoT_AcceptCertificateTransfer() { } func ExampleIoT_AttachPrincipalPolicy() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.AttachPrincipalPolicyInput{ PolicyName: aws.String("PolicyName"), // Required @@ -56,7 +68,13 @@ func ExampleIoT_AttachPrincipalPolicy() { } func ExampleIoT_AttachThingPrincipal() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.AttachThingPrincipalInput{ Principal: aws.String("Principal"), // Required @@ -76,7 +94,13 @@ func ExampleIoT_AttachThingPrincipal() { } func ExampleIoT_CancelCertificateTransfer() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.CancelCertificateTransferInput{ CertificateId: aws.String("CertificateId"), // Required @@ -95,7 +119,13 @@ func ExampleIoT_CancelCertificateTransfer() { } func ExampleIoT_CreateCertificateFromCsr() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.CreateCertificateFromCsrInput{ CertificateSigningRequest: aws.String("CertificateSigningRequest"), // Required @@ -115,7 +145,13 @@ func ExampleIoT_CreateCertificateFromCsr() { } func ExampleIoT_CreateKeysAndCertificate() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.CreateKeysAndCertificateInput{ SetAsActive: aws.Bool(true), @@ -134,7 +170,13 @@ func ExampleIoT_CreateKeysAndCertificate() { } func ExampleIoT_CreatePolicy() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.CreatePolicyInput{ PolicyDocument: aws.String("PolicyDocument"), // Required @@ -154,7 +196,13 @@ func ExampleIoT_CreatePolicy() { } func ExampleIoT_CreatePolicyVersion() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.CreatePolicyVersionInput{ PolicyDocument: aws.String("PolicyDocument"), // Required @@ -175,7 +223,13 @@ func ExampleIoT_CreatePolicyVersion() { } func ExampleIoT_CreateThing() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.CreateThingInput{ ThingName: aws.String("ThingName"), // Required @@ -202,7 +256,13 @@ func ExampleIoT_CreateThing() { } func ExampleIoT_CreateThingType() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.CreateThingTypeInput{ ThingTypeName: aws.String("ThingTypeName"), // Required @@ -228,7 +288,13 @@ func ExampleIoT_CreateThingType() { } func ExampleIoT_CreateTopicRule() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.CreateTopicRuleInput{ RuleName: aws.String("RuleName"), // Required @@ -323,7 +389,13 @@ func ExampleIoT_CreateTopicRule() { } func ExampleIoT_DeleteCACertificate() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.DeleteCACertificateInput{ CertificateId: aws.String("CertificateId"), // Required @@ -342,7 +414,13 @@ func ExampleIoT_DeleteCACertificate() { } func ExampleIoT_DeleteCertificate() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.DeleteCertificateInput{ CertificateId: aws.String("CertificateId"), // Required @@ -361,7 +439,13 @@ func ExampleIoT_DeleteCertificate() { } func ExampleIoT_DeletePolicy() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.DeletePolicyInput{ PolicyName: aws.String("PolicyName"), // Required @@ -380,7 +464,13 @@ func ExampleIoT_DeletePolicy() { } func ExampleIoT_DeletePolicyVersion() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.DeletePolicyVersionInput{ PolicyName: aws.String("PolicyName"), // Required @@ -400,7 +490,13 @@ func ExampleIoT_DeletePolicyVersion() { } func ExampleIoT_DeleteRegistrationCode() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) var params *iot.DeleteRegistrationCodeInput resp, err := svc.DeleteRegistrationCode(params) @@ -417,7 +513,13 @@ func ExampleIoT_DeleteRegistrationCode() { } func ExampleIoT_DeleteThing() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.DeleteThingInput{ ThingName: aws.String("ThingName"), // Required @@ -437,7 +539,13 @@ func ExampleIoT_DeleteThing() { } func ExampleIoT_DeleteThingType() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.DeleteThingTypeInput{ ThingTypeName: aws.String("ThingTypeName"), // Required @@ -456,7 +564,13 @@ func ExampleIoT_DeleteThingType() { } func ExampleIoT_DeleteTopicRule() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.DeleteTopicRuleInput{ RuleName: aws.String("RuleName"), // Required @@ -475,7 +589,13 @@ func ExampleIoT_DeleteTopicRule() { } func ExampleIoT_DeprecateThingType() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.DeprecateThingTypeInput{ ThingTypeName: aws.String("ThingTypeName"), // Required @@ -495,7 +615,13 @@ func ExampleIoT_DeprecateThingType() { } func ExampleIoT_DescribeCACertificate() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.DescribeCACertificateInput{ CertificateId: aws.String("CertificateId"), // Required @@ -514,7 +640,13 @@ func ExampleIoT_DescribeCACertificate() { } func ExampleIoT_DescribeCertificate() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.DescribeCertificateInput{ CertificateId: aws.String("CertificateId"), // Required @@ -533,7 +665,13 @@ func ExampleIoT_DescribeCertificate() { } func ExampleIoT_DescribeEndpoint() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) var params *iot.DescribeEndpointInput resp, err := svc.DescribeEndpoint(params) @@ -550,7 +688,13 @@ func ExampleIoT_DescribeEndpoint() { } func ExampleIoT_DescribeThing() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.DescribeThingInput{ ThingName: aws.String("ThingName"), // Required @@ -569,7 +713,13 @@ func ExampleIoT_DescribeThing() { } func ExampleIoT_DescribeThingType() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.DescribeThingTypeInput{ ThingTypeName: aws.String("ThingTypeName"), // Required @@ -588,7 +738,13 @@ func ExampleIoT_DescribeThingType() { } func ExampleIoT_DetachPrincipalPolicy() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.DetachPrincipalPolicyInput{ PolicyName: aws.String("PolicyName"), // Required @@ -608,7 +764,13 @@ func ExampleIoT_DetachPrincipalPolicy() { } func ExampleIoT_DetachThingPrincipal() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.DetachThingPrincipalInput{ Principal: aws.String("Principal"), // Required @@ -628,7 +790,13 @@ func ExampleIoT_DetachThingPrincipal() { } func ExampleIoT_DisableTopicRule() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.DisableTopicRuleInput{ RuleName: aws.String("RuleName"), // Required @@ -647,7 +815,13 @@ func ExampleIoT_DisableTopicRule() { } func ExampleIoT_EnableTopicRule() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.EnableTopicRuleInput{ RuleName: aws.String("RuleName"), // Required @@ -666,7 +840,13 @@ func ExampleIoT_EnableTopicRule() { } func ExampleIoT_GetLoggingOptions() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) var params *iot.GetLoggingOptionsInput resp, err := svc.GetLoggingOptions(params) @@ -683,7 +863,13 @@ func ExampleIoT_GetLoggingOptions() { } func ExampleIoT_GetPolicy() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.GetPolicyInput{ PolicyName: aws.String("PolicyName"), // Required @@ -702,7 +888,13 @@ func ExampleIoT_GetPolicy() { } func ExampleIoT_GetPolicyVersion() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.GetPolicyVersionInput{ PolicyName: aws.String("PolicyName"), // Required @@ -722,7 +914,13 @@ func ExampleIoT_GetPolicyVersion() { } func ExampleIoT_GetRegistrationCode() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) var params *iot.GetRegistrationCodeInput resp, err := svc.GetRegistrationCode(params) @@ -739,7 +937,13 @@ func ExampleIoT_GetRegistrationCode() { } func ExampleIoT_GetTopicRule() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.GetTopicRuleInput{ RuleName: aws.String("RuleName"), // Required @@ -758,7 +962,13 @@ func ExampleIoT_GetTopicRule() { } func ExampleIoT_ListCACertificates() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.ListCACertificatesInput{ AscendingOrder: aws.Bool(true), @@ -779,7 +989,13 @@ func ExampleIoT_ListCACertificates() { } func ExampleIoT_ListCertificates() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.ListCertificatesInput{ AscendingOrder: aws.Bool(true), @@ -800,7 +1016,13 @@ func ExampleIoT_ListCertificates() { } func ExampleIoT_ListCertificatesByCA() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.ListCertificatesByCAInput{ CaCertificateId: aws.String("CertificateId"), // Required @@ -822,7 +1044,13 @@ func ExampleIoT_ListCertificatesByCA() { } func ExampleIoT_ListPolicies() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.ListPoliciesInput{ AscendingOrder: aws.Bool(true), @@ -843,7 +1071,13 @@ func ExampleIoT_ListPolicies() { } func ExampleIoT_ListPolicyPrincipals() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.ListPolicyPrincipalsInput{ PolicyName: aws.String("PolicyName"), // Required @@ -865,7 +1099,13 @@ func ExampleIoT_ListPolicyPrincipals() { } func ExampleIoT_ListPolicyVersions() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.ListPolicyVersionsInput{ PolicyName: aws.String("PolicyName"), // Required @@ -884,7 +1124,13 @@ func ExampleIoT_ListPolicyVersions() { } func ExampleIoT_ListPrincipalPolicies() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.ListPrincipalPoliciesInput{ Principal: aws.String("Principal"), // Required @@ -906,7 +1152,13 @@ func ExampleIoT_ListPrincipalPolicies() { } func ExampleIoT_ListPrincipalThings() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.ListPrincipalThingsInput{ Principal: aws.String("Principal"), // Required @@ -927,7 +1179,13 @@ func ExampleIoT_ListPrincipalThings() { } func ExampleIoT_ListThingPrincipals() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.ListThingPrincipalsInput{ ThingName: aws.String("ThingName"), // Required @@ -946,7 +1204,13 @@ func ExampleIoT_ListThingPrincipals() { } func ExampleIoT_ListThingTypes() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.ListThingTypesInput{ MaxResults: aws.Int64(1), @@ -967,7 +1231,13 @@ func ExampleIoT_ListThingTypes() { } func ExampleIoT_ListThings() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.ListThingsInput{ AttributeName: aws.String("AttributeName"), @@ -990,7 +1260,13 @@ func ExampleIoT_ListThings() { } func ExampleIoT_ListTopicRules() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.ListTopicRulesInput{ MaxResults: aws.Int64(1), @@ -1012,7 +1288,13 @@ func ExampleIoT_ListTopicRules() { } func ExampleIoT_RegisterCACertificate() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.RegisterCACertificateInput{ CaCertificate: aws.String("CertificatePem"), // Required @@ -1033,7 +1315,13 @@ func ExampleIoT_RegisterCACertificate() { } func ExampleIoT_RegisterCertificate() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.RegisterCertificateInput{ CertificatePem: aws.String("CertificatePem"), // Required @@ -1054,7 +1342,13 @@ func ExampleIoT_RegisterCertificate() { } func ExampleIoT_RejectCertificateTransfer() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.RejectCertificateTransferInput{ CertificateId: aws.String("CertificateId"), // Required @@ -1074,7 +1368,13 @@ func ExampleIoT_RejectCertificateTransfer() { } func ExampleIoT_ReplaceTopicRule() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.ReplaceTopicRuleInput{ RuleName: aws.String("RuleName"), // Required @@ -1169,7 +1469,13 @@ func ExampleIoT_ReplaceTopicRule() { } func ExampleIoT_SetDefaultPolicyVersion() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.SetDefaultPolicyVersionInput{ PolicyName: aws.String("PolicyName"), // Required @@ -1189,7 +1495,13 @@ func ExampleIoT_SetDefaultPolicyVersion() { } func ExampleIoT_SetLoggingOptions() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.SetLoggingOptionsInput{ LoggingOptionsPayload: &iot.LoggingOptionsPayload{ // Required @@ -1211,7 +1523,13 @@ func ExampleIoT_SetLoggingOptions() { } func ExampleIoT_TransferCertificate() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.TransferCertificateInput{ CertificateId: aws.String("CertificateId"), // Required @@ -1232,7 +1550,13 @@ func ExampleIoT_TransferCertificate() { } func ExampleIoT_UpdateCACertificate() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.UpdateCACertificateInput{ CertificateId: aws.String("CertificateId"), // Required @@ -1252,7 +1576,13 @@ func ExampleIoT_UpdateCACertificate() { } func ExampleIoT_UpdateCertificate() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.UpdateCertificateInput{ CertificateId: aws.String("CertificateId"), // Required @@ -1272,7 +1602,13 @@ func ExampleIoT_UpdateCertificate() { } func ExampleIoT_UpdateThing() { - svc := iot.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iot.New(sess) params := &iot.UpdateThingInput{ ThingName: aws.String("ThingName"), // Required diff --git a/service/iotdataplane/examples_test.go b/service/iotdataplane/examples_test.go index 32769aba87e..ca08392ad68 100644 --- a/service/iotdataplane/examples_test.go +++ b/service/iotdataplane/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleIoTDataPlane_DeleteThingShadow() { - svc := iotdataplane.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iotdataplane.New(sess) params := &iotdataplane.DeleteThingShadowInput{ ThingName: aws.String("ThingName"), // Required @@ -35,7 +41,13 @@ func ExampleIoTDataPlane_DeleteThingShadow() { } func ExampleIoTDataPlane_GetThingShadow() { - svc := iotdataplane.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iotdataplane.New(sess) params := &iotdataplane.GetThingShadowInput{ ThingName: aws.String("ThingName"), // Required @@ -54,7 +66,13 @@ func ExampleIoTDataPlane_GetThingShadow() { } func ExampleIoTDataPlane_Publish() { - svc := iotdataplane.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iotdataplane.New(sess) params := &iotdataplane.PublishInput{ Topic: aws.String("Topic"), // Required @@ -75,7 +93,13 @@ func ExampleIoTDataPlane_Publish() { } func ExampleIoTDataPlane_UpdateThingShadow() { - svc := iotdataplane.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := iotdataplane.New(sess) params := &iotdataplane.UpdateThingShadowInput{ Payload: []byte("PAYLOAD"), // Required diff --git a/service/kinesis/examples_test.go b/service/kinesis/examples_test.go index ffbb78bea2d..50923928b51 100644 --- a/service/kinesis/examples_test.go +++ b/service/kinesis/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleKinesis_AddTagsToStream() { - svc := kinesis.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kinesis.New(sess) params := &kinesis.AddTagsToStreamInput{ StreamName: aws.String("StreamName"), // Required @@ -39,7 +45,13 @@ func ExampleKinesis_AddTagsToStream() { } func ExampleKinesis_CreateStream() { - svc := kinesis.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kinesis.New(sess) params := &kinesis.CreateStreamInput{ ShardCount: aws.Int64(1), // Required @@ -59,7 +71,13 @@ func ExampleKinesis_CreateStream() { } func ExampleKinesis_DecreaseStreamRetentionPeriod() { - svc := kinesis.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kinesis.New(sess) params := &kinesis.DecreaseStreamRetentionPeriodInput{ RetentionPeriodHours: aws.Int64(1), // Required @@ -79,7 +97,13 @@ func ExampleKinesis_DecreaseStreamRetentionPeriod() { } func ExampleKinesis_DeleteStream() { - svc := kinesis.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kinesis.New(sess) params := &kinesis.DeleteStreamInput{ StreamName: aws.String("StreamName"), // Required @@ -98,7 +122,13 @@ func ExampleKinesis_DeleteStream() { } func ExampleKinesis_DescribeStream() { - svc := kinesis.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kinesis.New(sess) params := &kinesis.DescribeStreamInput{ StreamName: aws.String("StreamName"), // Required @@ -119,7 +149,13 @@ func ExampleKinesis_DescribeStream() { } func ExampleKinesis_DisableEnhancedMonitoring() { - svc := kinesis.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kinesis.New(sess) params := &kinesis.DisableEnhancedMonitoringInput{ ShardLevelMetrics: []*string{ // Required @@ -142,7 +178,13 @@ func ExampleKinesis_DisableEnhancedMonitoring() { } func ExampleKinesis_EnableEnhancedMonitoring() { - svc := kinesis.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kinesis.New(sess) params := &kinesis.EnableEnhancedMonitoringInput{ ShardLevelMetrics: []*string{ // Required @@ -165,7 +207,13 @@ func ExampleKinesis_EnableEnhancedMonitoring() { } func ExampleKinesis_GetRecords() { - svc := kinesis.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kinesis.New(sess) params := &kinesis.GetRecordsInput{ ShardIterator: aws.String("ShardIterator"), // Required @@ -185,7 +233,13 @@ func ExampleKinesis_GetRecords() { } func ExampleKinesis_GetShardIterator() { - svc := kinesis.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kinesis.New(sess) params := &kinesis.GetShardIteratorInput{ ShardId: aws.String("ShardId"), // Required @@ -208,7 +262,13 @@ func ExampleKinesis_GetShardIterator() { } func ExampleKinesis_IncreaseStreamRetentionPeriod() { - svc := kinesis.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kinesis.New(sess) params := &kinesis.IncreaseStreamRetentionPeriodInput{ RetentionPeriodHours: aws.Int64(1), // Required @@ -228,7 +288,13 @@ func ExampleKinesis_IncreaseStreamRetentionPeriod() { } func ExampleKinesis_ListStreams() { - svc := kinesis.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kinesis.New(sess) params := &kinesis.ListStreamsInput{ ExclusiveStartStreamName: aws.String("StreamName"), @@ -248,7 +314,13 @@ func ExampleKinesis_ListStreams() { } func ExampleKinesis_ListTagsForStream() { - svc := kinesis.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kinesis.New(sess) params := &kinesis.ListTagsForStreamInput{ StreamName: aws.String("StreamName"), // Required @@ -269,7 +341,13 @@ func ExampleKinesis_ListTagsForStream() { } func ExampleKinesis_MergeShards() { - svc := kinesis.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kinesis.New(sess) params := &kinesis.MergeShardsInput{ AdjacentShardToMerge: aws.String("ShardId"), // Required @@ -290,7 +368,13 @@ func ExampleKinesis_MergeShards() { } func ExampleKinesis_PutRecord() { - svc := kinesis.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kinesis.New(sess) params := &kinesis.PutRecordInput{ Data: []byte("PAYLOAD"), // Required @@ -313,7 +397,13 @@ func ExampleKinesis_PutRecord() { } func ExampleKinesis_PutRecords() { - svc := kinesis.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kinesis.New(sess) params := &kinesis.PutRecordsInput{ Records: []*kinesis.PutRecordsRequestEntry{ // Required @@ -340,7 +430,13 @@ func ExampleKinesis_PutRecords() { } func ExampleKinesis_RemoveTagsFromStream() { - svc := kinesis.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kinesis.New(sess) params := &kinesis.RemoveTagsFromStreamInput{ StreamName: aws.String("StreamName"), // Required @@ -363,7 +459,13 @@ func ExampleKinesis_RemoveTagsFromStream() { } func ExampleKinesis_SplitShard() { - svc := kinesis.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kinesis.New(sess) params := &kinesis.SplitShardInput{ NewStartingHashKey: aws.String("HashKey"), // Required diff --git a/service/kms/examples_test.go b/service/kms/examples_test.go index 7c24706029f..2075ce71e7f 100644 --- a/service/kms/examples_test.go +++ b/service/kms/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleKMS_CancelKeyDeletion() { - svc := kms.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kms.New(sess) params := &kms.CancelKeyDeletionInput{ KeyId: aws.String("KeyIdType"), // Required @@ -35,7 +41,13 @@ func ExampleKMS_CancelKeyDeletion() { } func ExampleKMS_CreateAlias() { - svc := kms.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kms.New(sess) params := &kms.CreateAliasInput{ AliasName: aws.String("AliasNameType"), // Required @@ -55,7 +67,13 @@ func ExampleKMS_CreateAlias() { } func ExampleKMS_CreateGrant() { - svc := kms.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kms.New(sess) params := &kms.CreateGrantInput{ GranteePrincipal: aws.String("PrincipalIdType"), // Required @@ -95,7 +113,13 @@ func ExampleKMS_CreateGrant() { } func ExampleKMS_CreateKey() { - svc := kms.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kms.New(sess) params := &kms.CreateKeyInput{ BypassPolicyLockoutSafetyCheck: aws.Bool(true), @@ -117,7 +141,13 @@ func ExampleKMS_CreateKey() { } func ExampleKMS_Decrypt() { - svc := kms.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kms.New(sess) params := &kms.DecryptInput{ CiphertextBlob: []byte("PAYLOAD"), // Required @@ -144,7 +174,13 @@ func ExampleKMS_Decrypt() { } func ExampleKMS_DeleteAlias() { - svc := kms.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kms.New(sess) params := &kms.DeleteAliasInput{ AliasName: aws.String("AliasNameType"), // Required @@ -163,7 +199,13 @@ func ExampleKMS_DeleteAlias() { } func ExampleKMS_DescribeKey() { - svc := kms.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kms.New(sess) params := &kms.DescribeKeyInput{ KeyId: aws.String("KeyIdType"), // Required @@ -186,7 +228,13 @@ func ExampleKMS_DescribeKey() { } func ExampleKMS_DisableKey() { - svc := kms.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kms.New(sess) params := &kms.DisableKeyInput{ KeyId: aws.String("KeyIdType"), // Required @@ -205,7 +253,13 @@ func ExampleKMS_DisableKey() { } func ExampleKMS_DisableKeyRotation() { - svc := kms.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kms.New(sess) params := &kms.DisableKeyRotationInput{ KeyId: aws.String("KeyIdType"), // Required @@ -224,7 +278,13 @@ func ExampleKMS_DisableKeyRotation() { } func ExampleKMS_EnableKey() { - svc := kms.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kms.New(sess) params := &kms.EnableKeyInput{ KeyId: aws.String("KeyIdType"), // Required @@ -243,7 +303,13 @@ func ExampleKMS_EnableKey() { } func ExampleKMS_EnableKeyRotation() { - svc := kms.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kms.New(sess) params := &kms.EnableKeyRotationInput{ KeyId: aws.String("KeyIdType"), // Required @@ -262,7 +328,13 @@ func ExampleKMS_EnableKeyRotation() { } func ExampleKMS_Encrypt() { - svc := kms.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kms.New(sess) params := &kms.EncryptInput{ KeyId: aws.String("KeyIdType"), // Required @@ -290,7 +362,13 @@ func ExampleKMS_Encrypt() { } func ExampleKMS_GenerateDataKey() { - svc := kms.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kms.New(sess) params := &kms.GenerateDataKeyInput{ KeyId: aws.String("KeyIdType"), // Required @@ -319,7 +397,13 @@ func ExampleKMS_GenerateDataKey() { } func ExampleKMS_GenerateDataKeyWithoutPlaintext() { - svc := kms.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kms.New(sess) params := &kms.GenerateDataKeyWithoutPlaintextInput{ KeyId: aws.String("KeyIdType"), // Required @@ -348,7 +432,13 @@ func ExampleKMS_GenerateDataKeyWithoutPlaintext() { } func ExampleKMS_GenerateRandom() { - svc := kms.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kms.New(sess) params := &kms.GenerateRandomInput{ NumberOfBytes: aws.Int64(1), @@ -367,7 +457,13 @@ func ExampleKMS_GenerateRandom() { } func ExampleKMS_GetKeyPolicy() { - svc := kms.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kms.New(sess) params := &kms.GetKeyPolicyInput{ KeyId: aws.String("KeyIdType"), // Required @@ -387,7 +483,13 @@ func ExampleKMS_GetKeyPolicy() { } func ExampleKMS_GetKeyRotationStatus() { - svc := kms.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kms.New(sess) params := &kms.GetKeyRotationStatusInput{ KeyId: aws.String("KeyIdType"), // Required @@ -406,7 +508,13 @@ func ExampleKMS_GetKeyRotationStatus() { } func ExampleKMS_ListAliases() { - svc := kms.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kms.New(sess) params := &kms.ListAliasesInput{ Limit: aws.Int64(1), @@ -426,7 +534,13 @@ func ExampleKMS_ListAliases() { } func ExampleKMS_ListGrants() { - svc := kms.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kms.New(sess) params := &kms.ListGrantsInput{ KeyId: aws.String("KeyIdType"), // Required @@ -447,7 +561,13 @@ func ExampleKMS_ListGrants() { } func ExampleKMS_ListKeyPolicies() { - svc := kms.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kms.New(sess) params := &kms.ListKeyPoliciesInput{ KeyId: aws.String("KeyIdType"), // Required @@ -468,7 +588,13 @@ func ExampleKMS_ListKeyPolicies() { } func ExampleKMS_ListKeys() { - svc := kms.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kms.New(sess) params := &kms.ListKeysInput{ Limit: aws.Int64(1), @@ -488,7 +614,13 @@ func ExampleKMS_ListKeys() { } func ExampleKMS_ListRetirableGrants() { - svc := kms.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kms.New(sess) params := &kms.ListRetirableGrantsInput{ RetiringPrincipal: aws.String("PrincipalIdType"), // Required @@ -509,7 +641,13 @@ func ExampleKMS_ListRetirableGrants() { } func ExampleKMS_PutKeyPolicy() { - svc := kms.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kms.New(sess) params := &kms.PutKeyPolicyInput{ KeyId: aws.String("KeyIdType"), // Required @@ -531,7 +669,13 @@ func ExampleKMS_PutKeyPolicy() { } func ExampleKMS_ReEncrypt() { - svc := kms.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kms.New(sess) params := &kms.ReEncryptInput{ CiphertextBlob: []byte("PAYLOAD"), // Required @@ -563,7 +707,13 @@ func ExampleKMS_ReEncrypt() { } func ExampleKMS_RetireGrant() { - svc := kms.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kms.New(sess) params := &kms.RetireGrantInput{ GrantId: aws.String("GrantIdType"), @@ -584,7 +734,13 @@ func ExampleKMS_RetireGrant() { } func ExampleKMS_RevokeGrant() { - svc := kms.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kms.New(sess) params := &kms.RevokeGrantInput{ GrantId: aws.String("GrantIdType"), // Required @@ -604,7 +760,13 @@ func ExampleKMS_RevokeGrant() { } func ExampleKMS_ScheduleKeyDeletion() { - svc := kms.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kms.New(sess) params := &kms.ScheduleKeyDeletionInput{ KeyId: aws.String("KeyIdType"), // Required @@ -624,7 +786,13 @@ func ExampleKMS_ScheduleKeyDeletion() { } func ExampleKMS_UpdateAlias() { - svc := kms.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kms.New(sess) params := &kms.UpdateAliasInput{ AliasName: aws.String("AliasNameType"), // Required @@ -644,7 +812,13 @@ func ExampleKMS_UpdateAlias() { } func ExampleKMS_UpdateKeyDescription() { - svc := kms.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := kms.New(sess) params := &kms.UpdateKeyDescriptionInput{ Description: aws.String("DescriptionType"), // Required diff --git a/service/lambda/examples_test.go b/service/lambda/examples_test.go index c5d9e2960fe..a4af108ef8c 100644 --- a/service/lambda/examples_test.go +++ b/service/lambda/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleLambda_AddPermission() { - svc := lambda.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := lambda.New(sess) params := &lambda.AddPermissionInput{ Action: aws.String("Action"), // Required @@ -42,7 +48,13 @@ func ExampleLambda_AddPermission() { } func ExampleLambda_CreateAlias() { - svc := lambda.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := lambda.New(sess) params := &lambda.CreateAliasInput{ FunctionName: aws.String("FunctionName"), // Required @@ -64,7 +76,13 @@ func ExampleLambda_CreateAlias() { } func ExampleLambda_CreateEventSourceMapping() { - svc := lambda.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := lambda.New(sess) params := &lambda.CreateEventSourceMappingInput{ EventSourceArn: aws.String("Arn"), // Required @@ -87,7 +105,13 @@ func ExampleLambda_CreateEventSourceMapping() { } func ExampleLambda_CreateFunction() { - svc := lambda.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := lambda.New(sess) params := &lambda.CreateFunctionInput{ Code: &lambda.FunctionCode{ // Required @@ -129,7 +153,13 @@ func ExampleLambda_CreateFunction() { } func ExampleLambda_DeleteAlias() { - svc := lambda.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := lambda.New(sess) params := &lambda.DeleteAliasInput{ FunctionName: aws.String("FunctionName"), // Required @@ -149,7 +179,13 @@ func ExampleLambda_DeleteAlias() { } func ExampleLambda_DeleteEventSourceMapping() { - svc := lambda.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := lambda.New(sess) params := &lambda.DeleteEventSourceMappingInput{ UUID: aws.String("String"), // Required @@ -168,7 +204,13 @@ func ExampleLambda_DeleteEventSourceMapping() { } func ExampleLambda_DeleteFunction() { - svc := lambda.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := lambda.New(sess) params := &lambda.DeleteFunctionInput{ FunctionName: aws.String("FunctionName"), // Required @@ -188,7 +230,13 @@ func ExampleLambda_DeleteFunction() { } func ExampleLambda_GetAlias() { - svc := lambda.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := lambda.New(sess) params := &lambda.GetAliasInput{ FunctionName: aws.String("FunctionName"), // Required @@ -208,7 +256,13 @@ func ExampleLambda_GetAlias() { } func ExampleLambda_GetEventSourceMapping() { - svc := lambda.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := lambda.New(sess) params := &lambda.GetEventSourceMappingInput{ UUID: aws.String("String"), // Required @@ -227,7 +281,13 @@ func ExampleLambda_GetEventSourceMapping() { } func ExampleLambda_GetFunction() { - svc := lambda.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := lambda.New(sess) params := &lambda.GetFunctionInput{ FunctionName: aws.String("FunctionName"), // Required @@ -247,7 +307,13 @@ func ExampleLambda_GetFunction() { } func ExampleLambda_GetFunctionConfiguration() { - svc := lambda.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := lambda.New(sess) params := &lambda.GetFunctionConfigurationInput{ FunctionName: aws.String("FunctionName"), // Required @@ -267,7 +333,13 @@ func ExampleLambda_GetFunctionConfiguration() { } func ExampleLambda_GetPolicy() { - svc := lambda.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := lambda.New(sess) params := &lambda.GetPolicyInput{ FunctionName: aws.String("FunctionName"), // Required @@ -287,7 +359,13 @@ func ExampleLambda_GetPolicy() { } func ExampleLambda_Invoke() { - svc := lambda.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := lambda.New(sess) params := &lambda.InvokeInput{ FunctionName: aws.String("FunctionName"), // Required @@ -311,7 +389,13 @@ func ExampleLambda_Invoke() { } func ExampleLambda_InvokeAsync() { - svc := lambda.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := lambda.New(sess) params := &lambda.InvokeAsyncInput{ FunctionName: aws.String("FunctionName"), // Required @@ -331,7 +415,13 @@ func ExampleLambda_InvokeAsync() { } func ExampleLambda_ListAliases() { - svc := lambda.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := lambda.New(sess) params := &lambda.ListAliasesInput{ FunctionName: aws.String("FunctionName"), // Required @@ -353,7 +443,13 @@ func ExampleLambda_ListAliases() { } func ExampleLambda_ListEventSourceMappings() { - svc := lambda.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := lambda.New(sess) params := &lambda.ListEventSourceMappingsInput{ EventSourceArn: aws.String("Arn"), @@ -375,7 +471,13 @@ func ExampleLambda_ListEventSourceMappings() { } func ExampleLambda_ListFunctions() { - svc := lambda.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := lambda.New(sess) params := &lambda.ListFunctionsInput{ Marker: aws.String("String"), @@ -395,7 +497,13 @@ func ExampleLambda_ListFunctions() { } func ExampleLambda_ListVersionsByFunction() { - svc := lambda.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := lambda.New(sess) params := &lambda.ListVersionsByFunctionInput{ FunctionName: aws.String("FunctionName"), // Required @@ -416,7 +524,13 @@ func ExampleLambda_ListVersionsByFunction() { } func ExampleLambda_PublishVersion() { - svc := lambda.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := lambda.New(sess) params := &lambda.PublishVersionInput{ FunctionName: aws.String("FunctionName"), // Required @@ -437,7 +551,13 @@ func ExampleLambda_PublishVersion() { } func ExampleLambda_RemovePermission() { - svc := lambda.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := lambda.New(sess) params := &lambda.RemovePermissionInput{ FunctionName: aws.String("FunctionName"), // Required @@ -458,7 +578,13 @@ func ExampleLambda_RemovePermission() { } func ExampleLambda_UpdateAlias() { - svc := lambda.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := lambda.New(sess) params := &lambda.UpdateAliasInput{ FunctionName: aws.String("FunctionName"), // Required @@ -480,7 +606,13 @@ func ExampleLambda_UpdateAlias() { } func ExampleLambda_UpdateEventSourceMapping() { - svc := lambda.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := lambda.New(sess) params := &lambda.UpdateEventSourceMappingInput{ UUID: aws.String("String"), // Required @@ -502,7 +634,13 @@ func ExampleLambda_UpdateEventSourceMapping() { } func ExampleLambda_UpdateFunctionCode() { - svc := lambda.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := lambda.New(sess) params := &lambda.UpdateFunctionCodeInput{ FunctionName: aws.String("FunctionName"), // Required @@ -526,7 +664,13 @@ func ExampleLambda_UpdateFunctionCode() { } func ExampleLambda_UpdateFunctionConfiguration() { - svc := lambda.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := lambda.New(sess) params := &lambda.UpdateFunctionConfigurationInput{ FunctionName: aws.String("FunctionName"), // Required diff --git a/service/machinelearning/examples_test.go b/service/machinelearning/examples_test.go index ab15d62b824..47d24047e53 100644 --- a/service/machinelearning/examples_test.go +++ b/service/machinelearning/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleMachineLearning_AddTags() { - svc := machinelearning.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := machinelearning.New(sess) params := &machinelearning.AddTagsInput{ ResourceId: aws.String("EntityId"), // Required @@ -43,7 +49,13 @@ func ExampleMachineLearning_AddTags() { } func ExampleMachineLearning_CreateBatchPrediction() { - svc := machinelearning.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := machinelearning.New(sess) params := &machinelearning.CreateBatchPredictionInput{ BatchPredictionDataSourceId: aws.String("EntityId"), // Required @@ -66,7 +78,13 @@ func ExampleMachineLearning_CreateBatchPrediction() { } func ExampleMachineLearning_CreateDataSourceFromRDS() { - svc := machinelearning.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := machinelearning.New(sess) params := &machinelearning.CreateDataSourceFromRDSInput{ DataSourceId: aws.String("EntityId"), // Required @@ -110,7 +128,13 @@ func ExampleMachineLearning_CreateDataSourceFromRDS() { } func ExampleMachineLearning_CreateDataSourceFromRedshift() { - svc := machinelearning.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := machinelearning.New(sess) params := &machinelearning.CreateDataSourceFromRedshiftInput{ DataSourceId: aws.String("EntityId"), // Required @@ -147,7 +171,13 @@ func ExampleMachineLearning_CreateDataSourceFromRedshift() { } func ExampleMachineLearning_CreateDataSourceFromS3() { - svc := machinelearning.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := machinelearning.New(sess) params := &machinelearning.CreateDataSourceFromS3Input{ DataSourceId: aws.String("EntityId"), // Required @@ -174,7 +204,13 @@ func ExampleMachineLearning_CreateDataSourceFromS3() { } func ExampleMachineLearning_CreateEvaluation() { - svc := machinelearning.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := machinelearning.New(sess) params := &machinelearning.CreateEvaluationInput{ EvaluationDataSourceId: aws.String("EntityId"), // Required @@ -196,7 +232,13 @@ func ExampleMachineLearning_CreateEvaluation() { } func ExampleMachineLearning_CreateMLModel() { - svc := machinelearning.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := machinelearning.New(sess) params := &machinelearning.CreateMLModelInput{ MLModelId: aws.String("EntityId"), // Required @@ -224,7 +266,13 @@ func ExampleMachineLearning_CreateMLModel() { } func ExampleMachineLearning_CreateRealtimeEndpoint() { - svc := machinelearning.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := machinelearning.New(sess) params := &machinelearning.CreateRealtimeEndpointInput{ MLModelId: aws.String("EntityId"), // Required @@ -243,7 +291,13 @@ func ExampleMachineLearning_CreateRealtimeEndpoint() { } func ExampleMachineLearning_DeleteBatchPrediction() { - svc := machinelearning.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := machinelearning.New(sess) params := &machinelearning.DeleteBatchPredictionInput{ BatchPredictionId: aws.String("EntityId"), // Required @@ -262,7 +316,13 @@ func ExampleMachineLearning_DeleteBatchPrediction() { } func ExampleMachineLearning_DeleteDataSource() { - svc := machinelearning.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := machinelearning.New(sess) params := &machinelearning.DeleteDataSourceInput{ DataSourceId: aws.String("EntityId"), // Required @@ -281,7 +341,13 @@ func ExampleMachineLearning_DeleteDataSource() { } func ExampleMachineLearning_DeleteEvaluation() { - svc := machinelearning.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := machinelearning.New(sess) params := &machinelearning.DeleteEvaluationInput{ EvaluationId: aws.String("EntityId"), // Required @@ -300,7 +366,13 @@ func ExampleMachineLearning_DeleteEvaluation() { } func ExampleMachineLearning_DeleteMLModel() { - svc := machinelearning.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := machinelearning.New(sess) params := &machinelearning.DeleteMLModelInput{ MLModelId: aws.String("EntityId"), // Required @@ -319,7 +391,13 @@ func ExampleMachineLearning_DeleteMLModel() { } func ExampleMachineLearning_DeleteRealtimeEndpoint() { - svc := machinelearning.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := machinelearning.New(sess) params := &machinelearning.DeleteRealtimeEndpointInput{ MLModelId: aws.String("EntityId"), // Required @@ -338,7 +416,13 @@ func ExampleMachineLearning_DeleteRealtimeEndpoint() { } func ExampleMachineLearning_DeleteTags() { - svc := machinelearning.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := machinelearning.New(sess) params := &machinelearning.DeleteTagsInput{ ResourceId: aws.String("EntityId"), // Required @@ -362,7 +446,13 @@ func ExampleMachineLearning_DeleteTags() { } func ExampleMachineLearning_DescribeBatchPredictions() { - svc := machinelearning.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := machinelearning.New(sess) params := &machinelearning.DescribeBatchPredictionsInput{ EQ: aws.String("ComparatorValue"), @@ -391,7 +481,13 @@ func ExampleMachineLearning_DescribeBatchPredictions() { } func ExampleMachineLearning_DescribeDataSources() { - svc := machinelearning.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := machinelearning.New(sess) params := &machinelearning.DescribeDataSourcesInput{ EQ: aws.String("ComparatorValue"), @@ -420,7 +516,13 @@ func ExampleMachineLearning_DescribeDataSources() { } func ExampleMachineLearning_DescribeEvaluations() { - svc := machinelearning.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := machinelearning.New(sess) params := &machinelearning.DescribeEvaluationsInput{ EQ: aws.String("ComparatorValue"), @@ -449,7 +551,13 @@ func ExampleMachineLearning_DescribeEvaluations() { } func ExampleMachineLearning_DescribeMLModels() { - svc := machinelearning.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := machinelearning.New(sess) params := &machinelearning.DescribeMLModelsInput{ EQ: aws.String("ComparatorValue"), @@ -478,7 +586,13 @@ func ExampleMachineLearning_DescribeMLModels() { } func ExampleMachineLearning_DescribeTags() { - svc := machinelearning.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := machinelearning.New(sess) params := &machinelearning.DescribeTagsInput{ ResourceId: aws.String("EntityId"), // Required @@ -498,7 +612,13 @@ func ExampleMachineLearning_DescribeTags() { } func ExampleMachineLearning_GetBatchPrediction() { - svc := machinelearning.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := machinelearning.New(sess) params := &machinelearning.GetBatchPredictionInput{ BatchPredictionId: aws.String("EntityId"), // Required @@ -517,7 +637,13 @@ func ExampleMachineLearning_GetBatchPrediction() { } func ExampleMachineLearning_GetDataSource() { - svc := machinelearning.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := machinelearning.New(sess) params := &machinelearning.GetDataSourceInput{ DataSourceId: aws.String("EntityId"), // Required @@ -537,7 +663,13 @@ func ExampleMachineLearning_GetDataSource() { } func ExampleMachineLearning_GetEvaluation() { - svc := machinelearning.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := machinelearning.New(sess) params := &machinelearning.GetEvaluationInput{ EvaluationId: aws.String("EntityId"), // Required @@ -556,7 +688,13 @@ func ExampleMachineLearning_GetEvaluation() { } func ExampleMachineLearning_GetMLModel() { - svc := machinelearning.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := machinelearning.New(sess) params := &machinelearning.GetMLModelInput{ MLModelId: aws.String("EntityId"), // Required @@ -576,7 +714,13 @@ func ExampleMachineLearning_GetMLModel() { } func ExampleMachineLearning_Predict() { - svc := machinelearning.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := machinelearning.New(sess) params := &machinelearning.PredictInput{ MLModelId: aws.String("EntityId"), // Required @@ -600,7 +744,13 @@ func ExampleMachineLearning_Predict() { } func ExampleMachineLearning_UpdateBatchPrediction() { - svc := machinelearning.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := machinelearning.New(sess) params := &machinelearning.UpdateBatchPredictionInput{ BatchPredictionId: aws.String("EntityId"), // Required @@ -620,7 +770,13 @@ func ExampleMachineLearning_UpdateBatchPrediction() { } func ExampleMachineLearning_UpdateDataSource() { - svc := machinelearning.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := machinelearning.New(sess) params := &machinelearning.UpdateDataSourceInput{ DataSourceId: aws.String("EntityId"), // Required @@ -640,7 +796,13 @@ func ExampleMachineLearning_UpdateDataSource() { } func ExampleMachineLearning_UpdateEvaluation() { - svc := machinelearning.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := machinelearning.New(sess) params := &machinelearning.UpdateEvaluationInput{ EvaluationId: aws.String("EntityId"), // Required @@ -660,7 +822,13 @@ func ExampleMachineLearning_UpdateEvaluation() { } func ExampleMachineLearning_UpdateMLModel() { - svc := machinelearning.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := machinelearning.New(sess) params := &machinelearning.UpdateMLModelInput{ MLModelId: aws.String("EntityId"), // Required diff --git a/service/marketplacecommerceanalytics/examples_test.go b/service/marketplacecommerceanalytics/examples_test.go index 319af855256..ea03b77a920 100644 --- a/service/marketplacecommerceanalytics/examples_test.go +++ b/service/marketplacecommerceanalytics/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleMarketplaceCommerceAnalytics_GenerateDataSet() { - svc := marketplacecommerceanalytics.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := marketplacecommerceanalytics.New(sess) params := &marketplacecommerceanalytics.GenerateDataSetInput{ DataSetPublicationDate: aws.Time(time.Now()), // Required diff --git a/service/marketplacemetering/examples_test.go b/service/marketplacemetering/examples_test.go index c608eb47613..ec4f5134a94 100644 --- a/service/marketplacemetering/examples_test.go +++ b/service/marketplacemetering/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleMarketplaceMetering_MeterUsage() { - svc := marketplacemetering.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := marketplacemetering.New(sess) params := &marketplacemetering.MeterUsageInput{ DryRun: aws.Bool(true), // Required diff --git a/service/mobileanalytics/examples_test.go b/service/mobileanalytics/examples_test.go index 38cd3ebb546..3a38a11f9cf 100644 --- a/service/mobileanalytics/examples_test.go +++ b/service/mobileanalytics/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleMobileAnalytics_PutEvents() { - svc := mobileanalytics.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := mobileanalytics.New(sess) params := &mobileanalytics.PutEventsInput{ ClientContext: aws.String("String"), // Required diff --git a/service/opsworks/examples_test.go b/service/opsworks/examples_test.go index 913e5d22c7a..fcb09376c87 100644 --- a/service/opsworks/examples_test.go +++ b/service/opsworks/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleOpsWorks_AssignInstance() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.AssignInstanceInput{ InstanceId: aws.String("String"), // Required @@ -39,7 +45,13 @@ func ExampleOpsWorks_AssignInstance() { } func ExampleOpsWorks_AssignVolume() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.AssignVolumeInput{ VolumeId: aws.String("String"), // Required @@ -59,7 +71,13 @@ func ExampleOpsWorks_AssignVolume() { } func ExampleOpsWorks_AssociateElasticIp() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.AssociateElasticIpInput{ ElasticIp: aws.String("String"), // Required @@ -79,7 +97,13 @@ func ExampleOpsWorks_AssociateElasticIp() { } func ExampleOpsWorks_AttachElasticLoadBalancer() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.AttachElasticLoadBalancerInput{ ElasticLoadBalancerName: aws.String("String"), // Required @@ -99,7 +123,13 @@ func ExampleOpsWorks_AttachElasticLoadBalancer() { } func ExampleOpsWorks_CloneStack() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.CloneStackInput{ ServiceRoleArn: aws.String("String"), // Required @@ -158,7 +188,13 @@ func ExampleOpsWorks_CloneStack() { } func ExampleOpsWorks_CreateApp() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.CreateAppInput{ Name: aws.String("String"), // Required @@ -219,7 +255,13 @@ func ExampleOpsWorks_CreateApp() { } func ExampleOpsWorks_CreateDeployment() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.CreateDeploymentInput{ Command: &opsworks.DeploymentCommand{ // Required @@ -259,7 +301,13 @@ func ExampleOpsWorks_CreateDeployment() { } func ExampleOpsWorks_CreateInstance() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.CreateInstanceInput{ InstanceType: aws.String("String"), // Required @@ -312,7 +360,13 @@ func ExampleOpsWorks_CreateInstance() { } func ExampleOpsWorks_CreateLayer() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.CreateLayerInput{ Name: aws.String("String"), // Required @@ -392,7 +446,13 @@ func ExampleOpsWorks_CreateLayer() { } func ExampleOpsWorks_CreateStack() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.CreateStackInput{ DefaultInstanceProfileArn: aws.String("String"), // Required @@ -445,7 +505,13 @@ func ExampleOpsWorks_CreateStack() { } func ExampleOpsWorks_CreateUserProfile() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.CreateUserProfileInput{ IamUserArn: aws.String("String"), // Required @@ -467,7 +533,13 @@ func ExampleOpsWorks_CreateUserProfile() { } func ExampleOpsWorks_DeleteApp() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.DeleteAppInput{ AppId: aws.String("String"), // Required @@ -486,7 +558,13 @@ func ExampleOpsWorks_DeleteApp() { } func ExampleOpsWorks_DeleteInstance() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.DeleteInstanceInput{ InstanceId: aws.String("String"), // Required @@ -507,7 +585,13 @@ func ExampleOpsWorks_DeleteInstance() { } func ExampleOpsWorks_DeleteLayer() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.DeleteLayerInput{ LayerId: aws.String("String"), // Required @@ -526,7 +610,13 @@ func ExampleOpsWorks_DeleteLayer() { } func ExampleOpsWorks_DeleteStack() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.DeleteStackInput{ StackId: aws.String("String"), // Required @@ -545,7 +635,13 @@ func ExampleOpsWorks_DeleteStack() { } func ExampleOpsWorks_DeleteUserProfile() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.DeleteUserProfileInput{ IamUserArn: aws.String("String"), // Required @@ -564,7 +660,13 @@ func ExampleOpsWorks_DeleteUserProfile() { } func ExampleOpsWorks_DeregisterEcsCluster() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.DeregisterEcsClusterInput{ EcsClusterArn: aws.String("String"), // Required @@ -583,7 +685,13 @@ func ExampleOpsWorks_DeregisterEcsCluster() { } func ExampleOpsWorks_DeregisterElasticIp() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.DeregisterElasticIpInput{ ElasticIp: aws.String("String"), // Required @@ -602,7 +710,13 @@ func ExampleOpsWorks_DeregisterElasticIp() { } func ExampleOpsWorks_DeregisterInstance() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.DeregisterInstanceInput{ InstanceId: aws.String("String"), // Required @@ -621,7 +735,13 @@ func ExampleOpsWorks_DeregisterInstance() { } func ExampleOpsWorks_DeregisterRdsDbInstance() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.DeregisterRdsDbInstanceInput{ RdsDbInstanceArn: aws.String("String"), // Required @@ -640,7 +760,13 @@ func ExampleOpsWorks_DeregisterRdsDbInstance() { } func ExampleOpsWorks_DeregisterVolume() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.DeregisterVolumeInput{ VolumeId: aws.String("String"), // Required @@ -659,7 +785,13 @@ func ExampleOpsWorks_DeregisterVolume() { } func ExampleOpsWorks_DescribeAgentVersions() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.DescribeAgentVersionsInput{ ConfigurationManager: &opsworks.StackConfigurationManager{ @@ -682,7 +814,13 @@ func ExampleOpsWorks_DescribeAgentVersions() { } func ExampleOpsWorks_DescribeApps() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.DescribeAppsInput{ AppIds: []*string{ @@ -705,7 +843,13 @@ func ExampleOpsWorks_DescribeApps() { } func ExampleOpsWorks_DescribeCommands() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.DescribeCommandsInput{ CommandIds: []*string{ @@ -729,7 +873,13 @@ func ExampleOpsWorks_DescribeCommands() { } func ExampleOpsWorks_DescribeDeployments() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.DescribeDeploymentsInput{ AppId: aws.String("String"), @@ -753,7 +903,13 @@ func ExampleOpsWorks_DescribeDeployments() { } func ExampleOpsWorks_DescribeEcsClusters() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.DescribeEcsClustersInput{ EcsClusterArns: []*string{ @@ -778,7 +934,13 @@ func ExampleOpsWorks_DescribeEcsClusters() { } func ExampleOpsWorks_DescribeElasticIps() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.DescribeElasticIpsInput{ InstanceId: aws.String("String"), @@ -802,7 +964,13 @@ func ExampleOpsWorks_DescribeElasticIps() { } func ExampleOpsWorks_DescribeElasticLoadBalancers() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.DescribeElasticLoadBalancersInput{ LayerIds: []*string{ @@ -825,7 +993,13 @@ func ExampleOpsWorks_DescribeElasticLoadBalancers() { } func ExampleOpsWorks_DescribeInstances() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.DescribeInstancesInput{ InstanceIds: []*string{ @@ -849,7 +1023,13 @@ func ExampleOpsWorks_DescribeInstances() { } func ExampleOpsWorks_DescribeLayers() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.DescribeLayersInput{ LayerIds: []*string{ @@ -872,7 +1052,13 @@ func ExampleOpsWorks_DescribeLayers() { } func ExampleOpsWorks_DescribeLoadBasedAutoScaling() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.DescribeLoadBasedAutoScalingInput{ LayerIds: []*string{ // Required @@ -894,7 +1080,13 @@ func ExampleOpsWorks_DescribeLoadBasedAutoScaling() { } func ExampleOpsWorks_DescribeMyUserProfile() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) var params *opsworks.DescribeMyUserProfileInput resp, err := svc.DescribeMyUserProfile(params) @@ -911,7 +1103,13 @@ func ExampleOpsWorks_DescribeMyUserProfile() { } func ExampleOpsWorks_DescribePermissions() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.DescribePermissionsInput{ IamUserArn: aws.String("String"), @@ -931,7 +1129,13 @@ func ExampleOpsWorks_DescribePermissions() { } func ExampleOpsWorks_DescribeRaidArrays() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.DescribeRaidArraysInput{ InstanceId: aws.String("String"), @@ -955,7 +1159,13 @@ func ExampleOpsWorks_DescribeRaidArrays() { } func ExampleOpsWorks_DescribeRdsDbInstances() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.DescribeRdsDbInstancesInput{ StackId: aws.String("String"), // Required @@ -978,7 +1188,13 @@ func ExampleOpsWorks_DescribeRdsDbInstances() { } func ExampleOpsWorks_DescribeServiceErrors() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.DescribeServiceErrorsInput{ InstanceId: aws.String("String"), @@ -1002,7 +1218,13 @@ func ExampleOpsWorks_DescribeServiceErrors() { } func ExampleOpsWorks_DescribeStackProvisioningParameters() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.DescribeStackProvisioningParametersInput{ StackId: aws.String("String"), // Required @@ -1021,7 +1243,13 @@ func ExampleOpsWorks_DescribeStackProvisioningParameters() { } func ExampleOpsWorks_DescribeStackSummary() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.DescribeStackSummaryInput{ StackId: aws.String("String"), // Required @@ -1040,7 +1268,13 @@ func ExampleOpsWorks_DescribeStackSummary() { } func ExampleOpsWorks_DescribeStacks() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.DescribeStacksInput{ StackIds: []*string{ @@ -1062,7 +1296,13 @@ func ExampleOpsWorks_DescribeStacks() { } func ExampleOpsWorks_DescribeTimeBasedAutoScaling() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.DescribeTimeBasedAutoScalingInput{ InstanceIds: []*string{ // Required @@ -1084,7 +1324,13 @@ func ExampleOpsWorks_DescribeTimeBasedAutoScaling() { } func ExampleOpsWorks_DescribeUserProfiles() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.DescribeUserProfilesInput{ IamUserArns: []*string{ @@ -1106,7 +1352,13 @@ func ExampleOpsWorks_DescribeUserProfiles() { } func ExampleOpsWorks_DescribeVolumes() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.DescribeVolumesInput{ InstanceId: aws.String("String"), @@ -1131,7 +1383,13 @@ func ExampleOpsWorks_DescribeVolumes() { } func ExampleOpsWorks_DetachElasticLoadBalancer() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.DetachElasticLoadBalancerInput{ ElasticLoadBalancerName: aws.String("String"), // Required @@ -1151,7 +1409,13 @@ func ExampleOpsWorks_DetachElasticLoadBalancer() { } func ExampleOpsWorks_DisassociateElasticIp() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.DisassociateElasticIpInput{ ElasticIp: aws.String("String"), // Required @@ -1170,7 +1434,13 @@ func ExampleOpsWorks_DisassociateElasticIp() { } func ExampleOpsWorks_GetHostnameSuggestion() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.GetHostnameSuggestionInput{ LayerId: aws.String("String"), // Required @@ -1189,7 +1459,13 @@ func ExampleOpsWorks_GetHostnameSuggestion() { } func ExampleOpsWorks_GrantAccess() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.GrantAccessInput{ InstanceId: aws.String("String"), // Required @@ -1209,7 +1485,13 @@ func ExampleOpsWorks_GrantAccess() { } func ExampleOpsWorks_RebootInstance() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.RebootInstanceInput{ InstanceId: aws.String("String"), // Required @@ -1228,7 +1510,13 @@ func ExampleOpsWorks_RebootInstance() { } func ExampleOpsWorks_RegisterEcsCluster() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.RegisterEcsClusterInput{ EcsClusterArn: aws.String("String"), // Required @@ -1248,7 +1536,13 @@ func ExampleOpsWorks_RegisterEcsCluster() { } func ExampleOpsWorks_RegisterElasticIp() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.RegisterElasticIpInput{ ElasticIp: aws.String("String"), // Required @@ -1268,7 +1562,13 @@ func ExampleOpsWorks_RegisterElasticIp() { } func ExampleOpsWorks_RegisterInstance() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.RegisterInstanceInput{ StackId: aws.String("String"), // Required @@ -1296,7 +1596,13 @@ func ExampleOpsWorks_RegisterInstance() { } func ExampleOpsWorks_RegisterRdsDbInstance() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.RegisterRdsDbInstanceInput{ DbPassword: aws.String("String"), // Required @@ -1318,7 +1624,13 @@ func ExampleOpsWorks_RegisterRdsDbInstance() { } func ExampleOpsWorks_RegisterVolume() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.RegisterVolumeInput{ StackId: aws.String("String"), // Required @@ -1338,7 +1650,13 @@ func ExampleOpsWorks_RegisterVolume() { } func ExampleOpsWorks_SetLoadBasedAutoScaling() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.SetLoadBasedAutoScalingInput{ LayerId: aws.String("String"), // Required @@ -1382,7 +1700,13 @@ func ExampleOpsWorks_SetLoadBasedAutoScaling() { } func ExampleOpsWorks_SetPermission() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.SetPermissionInput{ IamUserArn: aws.String("String"), // Required @@ -1405,7 +1729,13 @@ func ExampleOpsWorks_SetPermission() { } func ExampleOpsWorks_SetTimeBasedAutoScaling() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.SetTimeBasedAutoScalingInput{ InstanceId: aws.String("String"), // Required @@ -1454,7 +1784,13 @@ func ExampleOpsWorks_SetTimeBasedAutoScaling() { } func ExampleOpsWorks_StartInstance() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.StartInstanceInput{ InstanceId: aws.String("String"), // Required @@ -1473,7 +1809,13 @@ func ExampleOpsWorks_StartInstance() { } func ExampleOpsWorks_StartStack() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.StartStackInput{ StackId: aws.String("String"), // Required @@ -1492,7 +1834,13 @@ func ExampleOpsWorks_StartStack() { } func ExampleOpsWorks_StopInstance() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.StopInstanceInput{ InstanceId: aws.String("String"), // Required @@ -1511,7 +1859,13 @@ func ExampleOpsWorks_StopInstance() { } func ExampleOpsWorks_StopStack() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.StopStackInput{ StackId: aws.String("String"), // Required @@ -1530,7 +1884,13 @@ func ExampleOpsWorks_StopStack() { } func ExampleOpsWorks_UnassignInstance() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.UnassignInstanceInput{ InstanceId: aws.String("String"), // Required @@ -1549,7 +1909,13 @@ func ExampleOpsWorks_UnassignInstance() { } func ExampleOpsWorks_UnassignVolume() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.UnassignVolumeInput{ VolumeId: aws.String("String"), // Required @@ -1568,7 +1934,13 @@ func ExampleOpsWorks_UnassignVolume() { } func ExampleOpsWorks_UpdateApp() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.UpdateAppInput{ AppId: aws.String("String"), // Required @@ -1628,7 +2000,13 @@ func ExampleOpsWorks_UpdateApp() { } func ExampleOpsWorks_UpdateElasticIp() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.UpdateElasticIpInput{ ElasticIp: aws.String("String"), // Required @@ -1648,7 +2026,13 @@ func ExampleOpsWorks_UpdateElasticIp() { } func ExampleOpsWorks_UpdateInstance() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.UpdateInstanceInput{ InstanceId: aws.String("String"), // Required @@ -1681,7 +2065,13 @@ func ExampleOpsWorks_UpdateInstance() { } func ExampleOpsWorks_UpdateLayer() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.UpdateLayerInput{ LayerId: aws.String("String"), // Required @@ -1760,7 +2150,13 @@ func ExampleOpsWorks_UpdateLayer() { } func ExampleOpsWorks_UpdateMyUserProfile() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.UpdateMyUserProfileInput{ SshPublicKey: aws.String("String"), @@ -1779,7 +2175,13 @@ func ExampleOpsWorks_UpdateMyUserProfile() { } func ExampleOpsWorks_UpdateRdsDbInstance() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.UpdateRdsDbInstanceInput{ RdsDbInstanceArn: aws.String("String"), // Required @@ -1800,7 +2202,13 @@ func ExampleOpsWorks_UpdateRdsDbInstance() { } func ExampleOpsWorks_UpdateStack() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.UpdateStackInput{ StackId: aws.String("String"), // Required @@ -1852,7 +2260,13 @@ func ExampleOpsWorks_UpdateStack() { } func ExampleOpsWorks_UpdateUserProfile() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.UpdateUserProfileInput{ IamUserArn: aws.String("String"), // Required @@ -1874,7 +2288,13 @@ func ExampleOpsWorks_UpdateUserProfile() { } func ExampleOpsWorks_UpdateVolume() { - svc := opsworks.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := opsworks.New(sess) params := &opsworks.UpdateVolumeInput{ VolumeId: aws.String("String"), // Required diff --git a/service/rds/examples_test.go b/service/rds/examples_test.go index 0ded0d5404a..bf030687015 100644 --- a/service/rds/examples_test.go +++ b/service/rds/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleRDS_AddSourceIdentifierToSubscription() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.AddSourceIdentifierToSubscriptionInput{ SourceIdentifier: aws.String("String"), // Required @@ -36,7 +42,13 @@ func ExampleRDS_AddSourceIdentifierToSubscription() { } func ExampleRDS_AddTagsToResource() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.AddTagsToResourceInput{ ResourceName: aws.String("String"), // Required @@ -62,7 +74,13 @@ func ExampleRDS_AddTagsToResource() { } func ExampleRDS_ApplyPendingMaintenanceAction() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.ApplyPendingMaintenanceActionInput{ ApplyAction: aws.String("String"), // Required @@ -83,7 +101,13 @@ func ExampleRDS_ApplyPendingMaintenanceAction() { } func ExampleRDS_AuthorizeDBSecurityGroupIngress() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.AuthorizeDBSecurityGroupIngressInput{ DBSecurityGroupName: aws.String("String"), // Required @@ -106,7 +130,13 @@ func ExampleRDS_AuthorizeDBSecurityGroupIngress() { } func ExampleRDS_CopyDBClusterParameterGroup() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.CopyDBClusterParameterGroupInput{ SourceDBClusterParameterGroupIdentifier: aws.String("String"), // Required @@ -134,7 +164,13 @@ func ExampleRDS_CopyDBClusterParameterGroup() { } func ExampleRDS_CopyDBClusterSnapshot() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.CopyDBClusterSnapshotInput{ SourceDBClusterSnapshotIdentifier: aws.String("String"), // Required @@ -161,7 +197,13 @@ func ExampleRDS_CopyDBClusterSnapshot() { } func ExampleRDS_CopyDBParameterGroup() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.CopyDBParameterGroupInput{ SourceDBParameterGroupIdentifier: aws.String("String"), // Required @@ -189,7 +231,13 @@ func ExampleRDS_CopyDBParameterGroup() { } func ExampleRDS_CopyDBSnapshot() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.CopyDBSnapshotInput{ SourceDBSnapshotIdentifier: aws.String("String"), // Required @@ -218,7 +266,13 @@ func ExampleRDS_CopyDBSnapshot() { } func ExampleRDS_CopyOptionGroup() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.CopyOptionGroupInput{ SourceOptionGroupIdentifier: aws.String("String"), // Required @@ -246,7 +300,13 @@ func ExampleRDS_CopyOptionGroup() { } func ExampleRDS_CreateDBCluster() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.CreateDBClusterInput{ DBClusterIdentifier: aws.String("String"), // Required @@ -296,7 +356,13 @@ func ExampleRDS_CreateDBCluster() { } func ExampleRDS_CreateDBClusterParameterGroup() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.CreateDBClusterParameterGroupInput{ DBClusterParameterGroupName: aws.String("String"), // Required @@ -324,7 +390,13 @@ func ExampleRDS_CreateDBClusterParameterGroup() { } func ExampleRDS_CreateDBClusterSnapshot() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.CreateDBClusterSnapshotInput{ DBClusterIdentifier: aws.String("String"), // Required @@ -351,7 +423,13 @@ func ExampleRDS_CreateDBClusterSnapshot() { } func ExampleRDS_CreateDBInstance() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.CreateDBInstanceInput{ DBInstanceClass: aws.String("String"), // Required @@ -418,7 +496,13 @@ func ExampleRDS_CreateDBInstance() { } func ExampleRDS_CreateDBInstanceReadReplica() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.CreateDBInstanceReadReplicaInput{ DBInstanceIdentifier: aws.String("String"), // Required @@ -457,7 +541,13 @@ func ExampleRDS_CreateDBInstanceReadReplica() { } func ExampleRDS_CreateDBParameterGroup() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.CreateDBParameterGroupInput{ DBParameterGroupFamily: aws.String("String"), // Required @@ -485,7 +575,13 @@ func ExampleRDS_CreateDBParameterGroup() { } func ExampleRDS_CreateDBSecurityGroup() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.CreateDBSecurityGroupInput{ DBSecurityGroupDescription: aws.String("String"), // Required @@ -512,7 +608,13 @@ func ExampleRDS_CreateDBSecurityGroup() { } func ExampleRDS_CreateDBSnapshot() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.CreateDBSnapshotInput{ DBInstanceIdentifier: aws.String("String"), // Required @@ -539,7 +641,13 @@ func ExampleRDS_CreateDBSnapshot() { } func ExampleRDS_CreateDBSubnetGroup() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.CreateDBSubnetGroupInput{ DBSubnetGroupDescription: aws.String("String"), // Required @@ -570,7 +678,13 @@ func ExampleRDS_CreateDBSubnetGroup() { } func ExampleRDS_CreateEventSubscription() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.CreateEventSubscriptionInput{ SnsTopicArn: aws.String("String"), // Required @@ -607,7 +721,13 @@ func ExampleRDS_CreateEventSubscription() { } func ExampleRDS_CreateOptionGroup() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.CreateOptionGroupInput{ EngineName: aws.String("String"), // Required @@ -636,7 +756,13 @@ func ExampleRDS_CreateOptionGroup() { } func ExampleRDS_DeleteDBCluster() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DeleteDBClusterInput{ DBClusterIdentifier: aws.String("String"), // Required @@ -657,7 +783,13 @@ func ExampleRDS_DeleteDBCluster() { } func ExampleRDS_DeleteDBClusterParameterGroup() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DeleteDBClusterParameterGroupInput{ DBClusterParameterGroupName: aws.String("String"), // Required @@ -676,7 +808,13 @@ func ExampleRDS_DeleteDBClusterParameterGroup() { } func ExampleRDS_DeleteDBClusterSnapshot() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DeleteDBClusterSnapshotInput{ DBClusterSnapshotIdentifier: aws.String("String"), // Required @@ -695,7 +833,13 @@ func ExampleRDS_DeleteDBClusterSnapshot() { } func ExampleRDS_DeleteDBInstance() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DeleteDBInstanceInput{ DBInstanceIdentifier: aws.String("String"), // Required @@ -716,7 +860,13 @@ func ExampleRDS_DeleteDBInstance() { } func ExampleRDS_DeleteDBParameterGroup() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DeleteDBParameterGroupInput{ DBParameterGroupName: aws.String("String"), // Required @@ -735,7 +885,13 @@ func ExampleRDS_DeleteDBParameterGroup() { } func ExampleRDS_DeleteDBSecurityGroup() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DeleteDBSecurityGroupInput{ DBSecurityGroupName: aws.String("String"), // Required @@ -754,7 +910,13 @@ func ExampleRDS_DeleteDBSecurityGroup() { } func ExampleRDS_DeleteDBSnapshot() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DeleteDBSnapshotInput{ DBSnapshotIdentifier: aws.String("String"), // Required @@ -773,7 +935,13 @@ func ExampleRDS_DeleteDBSnapshot() { } func ExampleRDS_DeleteDBSubnetGroup() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DeleteDBSubnetGroupInput{ DBSubnetGroupName: aws.String("String"), // Required @@ -792,7 +960,13 @@ func ExampleRDS_DeleteDBSubnetGroup() { } func ExampleRDS_DeleteEventSubscription() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DeleteEventSubscriptionInput{ SubscriptionName: aws.String("String"), // Required @@ -811,7 +985,13 @@ func ExampleRDS_DeleteEventSubscription() { } func ExampleRDS_DeleteOptionGroup() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DeleteOptionGroupInput{ OptionGroupName: aws.String("String"), // Required @@ -830,7 +1010,13 @@ func ExampleRDS_DeleteOptionGroup() { } func ExampleRDS_DescribeAccountAttributes() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) var params *rds.DescribeAccountAttributesInput resp, err := svc.DescribeAccountAttributes(params) @@ -847,7 +1033,13 @@ func ExampleRDS_DescribeAccountAttributes() { } func ExampleRDS_DescribeCertificates() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DescribeCertificatesInput{ CertificateIdentifier: aws.String("String"), @@ -878,7 +1070,13 @@ func ExampleRDS_DescribeCertificates() { } func ExampleRDS_DescribeDBClusterParameterGroups() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DescribeDBClusterParameterGroupsInput{ DBClusterParameterGroupName: aws.String("String"), @@ -909,7 +1107,13 @@ func ExampleRDS_DescribeDBClusterParameterGroups() { } func ExampleRDS_DescribeDBClusterParameters() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DescribeDBClusterParametersInput{ DBClusterParameterGroupName: aws.String("String"), // Required @@ -941,7 +1145,13 @@ func ExampleRDS_DescribeDBClusterParameters() { } func ExampleRDS_DescribeDBClusterSnapshotAttributes() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DescribeDBClusterSnapshotAttributesInput{ DBClusterSnapshotIdentifier: aws.String("String"), // Required @@ -960,7 +1170,13 @@ func ExampleRDS_DescribeDBClusterSnapshotAttributes() { } func ExampleRDS_DescribeDBClusterSnapshots() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DescribeDBClusterSnapshotsInput{ DBClusterIdentifier: aws.String("String"), @@ -995,7 +1211,13 @@ func ExampleRDS_DescribeDBClusterSnapshots() { } func ExampleRDS_DescribeDBClusters() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DescribeDBClustersInput{ DBClusterIdentifier: aws.String("String"), @@ -1026,7 +1248,13 @@ func ExampleRDS_DescribeDBClusters() { } func ExampleRDS_DescribeDBEngineVersions() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DescribeDBEngineVersionsInput{ DBParameterGroupFamily: aws.String("String"), @@ -1061,7 +1289,13 @@ func ExampleRDS_DescribeDBEngineVersions() { } func ExampleRDS_DescribeDBInstances() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DescribeDBInstancesInput{ DBInstanceIdentifier: aws.String("String"), @@ -1092,7 +1326,13 @@ func ExampleRDS_DescribeDBInstances() { } func ExampleRDS_DescribeDBLogFiles() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DescribeDBLogFilesInput{ DBInstanceIdentifier: aws.String("String"), // Required @@ -1126,7 +1366,13 @@ func ExampleRDS_DescribeDBLogFiles() { } func ExampleRDS_DescribeDBParameterGroups() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DescribeDBParameterGroupsInput{ DBParameterGroupName: aws.String("String"), @@ -1157,7 +1403,13 @@ func ExampleRDS_DescribeDBParameterGroups() { } func ExampleRDS_DescribeDBParameters() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DescribeDBParametersInput{ DBParameterGroupName: aws.String("String"), // Required @@ -1189,7 +1441,13 @@ func ExampleRDS_DescribeDBParameters() { } func ExampleRDS_DescribeDBSecurityGroups() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DescribeDBSecurityGroupsInput{ DBSecurityGroupName: aws.String("String"), @@ -1220,7 +1478,13 @@ func ExampleRDS_DescribeDBSecurityGroups() { } func ExampleRDS_DescribeDBSnapshotAttributes() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DescribeDBSnapshotAttributesInput{ DBSnapshotIdentifier: aws.String("String"), // Required @@ -1239,7 +1503,13 @@ func ExampleRDS_DescribeDBSnapshotAttributes() { } func ExampleRDS_DescribeDBSnapshots() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DescribeDBSnapshotsInput{ DBInstanceIdentifier: aws.String("String"), @@ -1274,7 +1544,13 @@ func ExampleRDS_DescribeDBSnapshots() { } func ExampleRDS_DescribeDBSubnetGroups() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DescribeDBSubnetGroupsInput{ DBSubnetGroupName: aws.String("String"), @@ -1305,7 +1581,13 @@ func ExampleRDS_DescribeDBSubnetGroups() { } func ExampleRDS_DescribeEngineDefaultClusterParameters() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DescribeEngineDefaultClusterParametersInput{ DBParameterGroupFamily: aws.String("String"), // Required @@ -1336,7 +1618,13 @@ func ExampleRDS_DescribeEngineDefaultClusterParameters() { } func ExampleRDS_DescribeEngineDefaultParameters() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DescribeEngineDefaultParametersInput{ DBParameterGroupFamily: aws.String("String"), // Required @@ -1367,7 +1655,13 @@ func ExampleRDS_DescribeEngineDefaultParameters() { } func ExampleRDS_DescribeEventCategories() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DescribeEventCategoriesInput{ Filters: []*rds.Filter{ @@ -1396,7 +1690,13 @@ func ExampleRDS_DescribeEventCategories() { } func ExampleRDS_DescribeEventSubscriptions() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DescribeEventSubscriptionsInput{ Filters: []*rds.Filter{ @@ -1427,7 +1727,13 @@ func ExampleRDS_DescribeEventSubscriptions() { } func ExampleRDS_DescribeEvents() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DescribeEventsInput{ Duration: aws.Int64(1), @@ -1466,7 +1772,13 @@ func ExampleRDS_DescribeEvents() { } func ExampleRDS_DescribeOptionGroupOptions() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DescribeOptionGroupOptionsInput{ EngineName: aws.String("String"), // Required @@ -1498,7 +1810,13 @@ func ExampleRDS_DescribeOptionGroupOptions() { } func ExampleRDS_DescribeOptionGroups() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DescribeOptionGroupsInput{ EngineName: aws.String("String"), @@ -1531,7 +1849,13 @@ func ExampleRDS_DescribeOptionGroups() { } func ExampleRDS_DescribeOrderableDBInstanceOptions() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DescribeOrderableDBInstanceOptionsInput{ Engine: aws.String("String"), // Required @@ -1566,7 +1890,13 @@ func ExampleRDS_DescribeOrderableDBInstanceOptions() { } func ExampleRDS_DescribePendingMaintenanceActions() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DescribePendingMaintenanceActionsInput{ Filters: []*rds.Filter{ @@ -1597,7 +1927,13 @@ func ExampleRDS_DescribePendingMaintenanceActions() { } func ExampleRDS_DescribeReservedDBInstances() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DescribeReservedDBInstancesInput{ DBInstanceClass: aws.String("String"), @@ -1634,7 +1970,13 @@ func ExampleRDS_DescribeReservedDBInstances() { } func ExampleRDS_DescribeReservedDBInstancesOfferings() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DescribeReservedDBInstancesOfferingsInput{ DBInstanceClass: aws.String("String"), @@ -1670,7 +2012,13 @@ func ExampleRDS_DescribeReservedDBInstancesOfferings() { } func ExampleRDS_DownloadDBLogFilePortion() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.DownloadDBLogFilePortionInput{ DBInstanceIdentifier: aws.String("String"), // Required @@ -1692,7 +2040,13 @@ func ExampleRDS_DownloadDBLogFilePortion() { } func ExampleRDS_FailoverDBCluster() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.FailoverDBClusterInput{ DBClusterIdentifier: aws.String("String"), @@ -1712,7 +2066,13 @@ func ExampleRDS_FailoverDBCluster() { } func ExampleRDS_ListTagsForResource() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.ListTagsForResourceInput{ ResourceName: aws.String("String"), // Required @@ -1741,7 +2101,13 @@ func ExampleRDS_ListTagsForResource() { } func ExampleRDS_ModifyDBCluster() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.ModifyDBClusterInput{ DBClusterIdentifier: aws.String("String"), // Required @@ -1773,7 +2139,13 @@ func ExampleRDS_ModifyDBCluster() { } func ExampleRDS_ModifyDBClusterParameterGroup() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.ModifyDBClusterParameterGroupInput{ DBClusterParameterGroupName: aws.String("String"), // Required @@ -1807,7 +2179,13 @@ func ExampleRDS_ModifyDBClusterParameterGroup() { } func ExampleRDS_ModifyDBClusterSnapshotAttribute() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.ModifyDBClusterSnapshotAttributeInput{ AttributeName: aws.String("String"), // Required @@ -1835,7 +2213,13 @@ func ExampleRDS_ModifyDBClusterSnapshotAttribute() { } func ExampleRDS_ModifyDBInstance() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.ModifyDBInstanceInput{ DBInstanceIdentifier: aws.String("String"), // Required @@ -1889,7 +2273,13 @@ func ExampleRDS_ModifyDBInstance() { } func ExampleRDS_ModifyDBParameterGroup() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.ModifyDBParameterGroupInput{ DBParameterGroupName: aws.String("String"), // Required @@ -1923,7 +2313,13 @@ func ExampleRDS_ModifyDBParameterGroup() { } func ExampleRDS_ModifyDBSnapshotAttribute() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.ModifyDBSnapshotAttributeInput{ AttributeName: aws.String("String"), // Required @@ -1951,7 +2347,13 @@ func ExampleRDS_ModifyDBSnapshotAttribute() { } func ExampleRDS_ModifyDBSubnetGroup() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.ModifyDBSubnetGroupInput{ DBSubnetGroupName: aws.String("String"), // Required @@ -1975,7 +2377,13 @@ func ExampleRDS_ModifyDBSubnetGroup() { } func ExampleRDS_ModifyEventSubscription() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.ModifyEventSubscriptionInput{ SubscriptionName: aws.String("String"), // Required @@ -2001,7 +2409,13 @@ func ExampleRDS_ModifyEventSubscription() { } func ExampleRDS_ModifyOptionGroup() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.ModifyOptionGroupInput{ OptionGroupName: aws.String("String"), // Required @@ -2054,7 +2468,13 @@ func ExampleRDS_ModifyOptionGroup() { } func ExampleRDS_PromoteReadReplica() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.PromoteReadReplicaInput{ DBInstanceIdentifier: aws.String("String"), // Required @@ -2075,7 +2495,13 @@ func ExampleRDS_PromoteReadReplica() { } func ExampleRDS_PromoteReadReplicaDBCluster() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.PromoteReadReplicaDBClusterInput{ DBClusterIdentifier: aws.String("String"), // Required @@ -2094,7 +2520,13 @@ func ExampleRDS_PromoteReadReplicaDBCluster() { } func ExampleRDS_PurchaseReservedDBInstancesOffering() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.PurchaseReservedDBInstancesOfferingInput{ ReservedDBInstancesOfferingId: aws.String("String"), // Required @@ -2122,7 +2554,13 @@ func ExampleRDS_PurchaseReservedDBInstancesOffering() { } func ExampleRDS_RebootDBInstance() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.RebootDBInstanceInput{ DBInstanceIdentifier: aws.String("String"), // Required @@ -2142,7 +2580,13 @@ func ExampleRDS_RebootDBInstance() { } func ExampleRDS_RemoveSourceIdentifierFromSubscription() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.RemoveSourceIdentifierFromSubscriptionInput{ SourceIdentifier: aws.String("String"), // Required @@ -2162,7 +2606,13 @@ func ExampleRDS_RemoveSourceIdentifierFromSubscription() { } func ExampleRDS_RemoveTagsFromResource() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.RemoveTagsFromResourceInput{ ResourceName: aws.String("String"), // Required @@ -2185,7 +2635,13 @@ func ExampleRDS_RemoveTagsFromResource() { } func ExampleRDS_ResetDBClusterParameterGroup() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.ResetDBClusterParameterGroupInput{ DBClusterParameterGroupName: aws.String("String"), // Required @@ -2220,7 +2676,13 @@ func ExampleRDS_ResetDBClusterParameterGroup() { } func ExampleRDS_ResetDBParameterGroup() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.ResetDBParameterGroupInput{ DBParameterGroupName: aws.String("String"), // Required @@ -2255,7 +2717,13 @@ func ExampleRDS_ResetDBParameterGroup() { } func ExampleRDS_RestoreDBClusterFromSnapshot() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.RestoreDBClusterFromSnapshotInput{ DBClusterIdentifier: aws.String("String"), // Required @@ -2297,7 +2765,13 @@ func ExampleRDS_RestoreDBClusterFromSnapshot() { } func ExampleRDS_RestoreDBClusterToPointInTime() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.RestoreDBClusterToPointInTimeInput{ DBClusterIdentifier: aws.String("String"), // Required @@ -2334,7 +2808,13 @@ func ExampleRDS_RestoreDBClusterToPointInTime() { } func ExampleRDS_RestoreDBInstanceFromDBSnapshot() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.RestoreDBInstanceFromDBSnapshotInput{ DBInstanceIdentifier: aws.String("String"), // Required @@ -2379,7 +2859,13 @@ func ExampleRDS_RestoreDBInstanceFromDBSnapshot() { } func ExampleRDS_RestoreDBInstanceToPointInTime() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.RestoreDBInstanceToPointInTimeInput{ SourceDBInstanceIdentifier: aws.String("String"), // Required @@ -2426,7 +2912,13 @@ func ExampleRDS_RestoreDBInstanceToPointInTime() { } func ExampleRDS_RevokeDBSecurityGroupIngress() { - svc := rds.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := rds.New(sess) params := &rds.RevokeDBSecurityGroupIngressInput{ DBSecurityGroupName: aws.String("String"), // Required diff --git a/service/redshift/examples_test.go b/service/redshift/examples_test.go index c18210f23eb..6338ff4bcb4 100644 --- a/service/redshift/examples_test.go +++ b/service/redshift/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleRedshift_AuthorizeClusterSecurityGroupIngress() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.AuthorizeClusterSecurityGroupIngressInput{ ClusterSecurityGroupName: aws.String("String"), // Required @@ -38,7 +44,13 @@ func ExampleRedshift_AuthorizeClusterSecurityGroupIngress() { } func ExampleRedshift_AuthorizeSnapshotAccess() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.AuthorizeSnapshotAccessInput{ AccountWithRestoreAccess: aws.String("String"), // Required @@ -59,7 +71,13 @@ func ExampleRedshift_AuthorizeSnapshotAccess() { } func ExampleRedshift_CopyClusterSnapshot() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.CopyClusterSnapshotInput{ SourceSnapshotIdentifier: aws.String("String"), // Required @@ -80,7 +98,13 @@ func ExampleRedshift_CopyClusterSnapshot() { } func ExampleRedshift_CreateCluster() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.CreateClusterInput{ ClusterIdentifier: aws.String("String"), // Required @@ -139,7 +163,13 @@ func ExampleRedshift_CreateCluster() { } func ExampleRedshift_CreateClusterParameterGroup() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.CreateClusterParameterGroupInput{ Description: aws.String("String"), // Required @@ -167,7 +197,13 @@ func ExampleRedshift_CreateClusterParameterGroup() { } func ExampleRedshift_CreateClusterSecurityGroup() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.CreateClusterSecurityGroupInput{ ClusterSecurityGroupName: aws.String("String"), // Required @@ -194,7 +230,13 @@ func ExampleRedshift_CreateClusterSecurityGroup() { } func ExampleRedshift_CreateClusterSnapshot() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.CreateClusterSnapshotInput{ ClusterIdentifier: aws.String("String"), // Required @@ -221,7 +263,13 @@ func ExampleRedshift_CreateClusterSnapshot() { } func ExampleRedshift_CreateClusterSubnetGroup() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.CreateClusterSubnetGroupInput{ ClusterSubnetGroupName: aws.String("String"), // Required @@ -252,7 +300,13 @@ func ExampleRedshift_CreateClusterSubnetGroup() { } func ExampleRedshift_CreateEventSubscription() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.CreateEventSubscriptionInput{ SnsTopicArn: aws.String("String"), // Required @@ -290,7 +344,13 @@ func ExampleRedshift_CreateEventSubscription() { } func ExampleRedshift_CreateHsmClientCertificate() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.CreateHsmClientCertificateInput{ HsmClientCertificateIdentifier: aws.String("String"), // Required @@ -316,7 +376,13 @@ func ExampleRedshift_CreateHsmClientCertificate() { } func ExampleRedshift_CreateHsmConfiguration() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.CreateHsmConfigurationInput{ Description: aws.String("String"), // Required @@ -347,7 +413,13 @@ func ExampleRedshift_CreateHsmConfiguration() { } func ExampleRedshift_CreateSnapshotCopyGrant() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.CreateSnapshotCopyGrantInput{ SnapshotCopyGrantName: aws.String("String"), // Required @@ -374,7 +446,13 @@ func ExampleRedshift_CreateSnapshotCopyGrant() { } func ExampleRedshift_CreateTags() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.CreateTagsInput{ ResourceName: aws.String("String"), // Required @@ -400,7 +478,13 @@ func ExampleRedshift_CreateTags() { } func ExampleRedshift_DeleteCluster() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DeleteClusterInput{ ClusterIdentifier: aws.String("String"), // Required @@ -421,7 +505,13 @@ func ExampleRedshift_DeleteCluster() { } func ExampleRedshift_DeleteClusterParameterGroup() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DeleteClusterParameterGroupInput{ ParameterGroupName: aws.String("String"), // Required @@ -440,7 +530,13 @@ func ExampleRedshift_DeleteClusterParameterGroup() { } func ExampleRedshift_DeleteClusterSecurityGroup() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DeleteClusterSecurityGroupInput{ ClusterSecurityGroupName: aws.String("String"), // Required @@ -459,7 +555,13 @@ func ExampleRedshift_DeleteClusterSecurityGroup() { } func ExampleRedshift_DeleteClusterSnapshot() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DeleteClusterSnapshotInput{ SnapshotIdentifier: aws.String("String"), // Required @@ -479,7 +581,13 @@ func ExampleRedshift_DeleteClusterSnapshot() { } func ExampleRedshift_DeleteClusterSubnetGroup() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DeleteClusterSubnetGroupInput{ ClusterSubnetGroupName: aws.String("String"), // Required @@ -498,7 +606,13 @@ func ExampleRedshift_DeleteClusterSubnetGroup() { } func ExampleRedshift_DeleteEventSubscription() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DeleteEventSubscriptionInput{ SubscriptionName: aws.String("String"), // Required @@ -517,7 +631,13 @@ func ExampleRedshift_DeleteEventSubscription() { } func ExampleRedshift_DeleteHsmClientCertificate() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DeleteHsmClientCertificateInput{ HsmClientCertificateIdentifier: aws.String("String"), // Required @@ -536,7 +656,13 @@ func ExampleRedshift_DeleteHsmClientCertificate() { } func ExampleRedshift_DeleteHsmConfiguration() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DeleteHsmConfigurationInput{ HsmConfigurationIdentifier: aws.String("String"), // Required @@ -555,7 +681,13 @@ func ExampleRedshift_DeleteHsmConfiguration() { } func ExampleRedshift_DeleteSnapshotCopyGrant() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DeleteSnapshotCopyGrantInput{ SnapshotCopyGrantName: aws.String("String"), // Required @@ -574,7 +706,13 @@ func ExampleRedshift_DeleteSnapshotCopyGrant() { } func ExampleRedshift_DeleteTags() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DeleteTagsInput{ ResourceName: aws.String("String"), // Required @@ -597,7 +735,13 @@ func ExampleRedshift_DeleteTags() { } func ExampleRedshift_DescribeClusterParameterGroups() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DescribeClusterParameterGroupsInput{ Marker: aws.String("String"), @@ -626,7 +770,13 @@ func ExampleRedshift_DescribeClusterParameterGroups() { } func ExampleRedshift_DescribeClusterParameters() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DescribeClusterParametersInput{ ParameterGroupName: aws.String("String"), // Required @@ -648,7 +798,13 @@ func ExampleRedshift_DescribeClusterParameters() { } func ExampleRedshift_DescribeClusterSecurityGroups() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DescribeClusterSecurityGroupsInput{ ClusterSecurityGroupName: aws.String("String"), @@ -677,7 +833,13 @@ func ExampleRedshift_DescribeClusterSecurityGroups() { } func ExampleRedshift_DescribeClusterSnapshots() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DescribeClusterSnapshotsInput{ ClusterIdentifier: aws.String("String"), @@ -711,7 +873,13 @@ func ExampleRedshift_DescribeClusterSnapshots() { } func ExampleRedshift_DescribeClusterSubnetGroups() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DescribeClusterSubnetGroupsInput{ ClusterSubnetGroupName: aws.String("String"), @@ -740,7 +908,13 @@ func ExampleRedshift_DescribeClusterSubnetGroups() { } func ExampleRedshift_DescribeClusterVersions() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DescribeClusterVersionsInput{ ClusterParameterGroupFamily: aws.String("String"), @@ -762,7 +936,13 @@ func ExampleRedshift_DescribeClusterVersions() { } func ExampleRedshift_DescribeClusters() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DescribeClustersInput{ ClusterIdentifier: aws.String("String"), @@ -791,7 +971,13 @@ func ExampleRedshift_DescribeClusters() { } func ExampleRedshift_DescribeDefaultClusterParameters() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DescribeDefaultClusterParametersInput{ ParameterGroupFamily: aws.String("String"), // Required @@ -812,7 +998,13 @@ func ExampleRedshift_DescribeDefaultClusterParameters() { } func ExampleRedshift_DescribeEventCategories() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DescribeEventCategoriesInput{ SourceType: aws.String("String"), @@ -831,7 +1023,13 @@ func ExampleRedshift_DescribeEventCategories() { } func ExampleRedshift_DescribeEventSubscriptions() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DescribeEventSubscriptionsInput{ Marker: aws.String("String"), @@ -852,7 +1050,13 @@ func ExampleRedshift_DescribeEventSubscriptions() { } func ExampleRedshift_DescribeEvents() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DescribeEventsInput{ Duration: aws.Int64(1), @@ -877,7 +1081,13 @@ func ExampleRedshift_DescribeEvents() { } func ExampleRedshift_DescribeHsmClientCertificates() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DescribeHsmClientCertificatesInput{ HsmClientCertificateIdentifier: aws.String("String"), @@ -906,7 +1116,13 @@ func ExampleRedshift_DescribeHsmClientCertificates() { } func ExampleRedshift_DescribeHsmConfigurations() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DescribeHsmConfigurationsInput{ HsmConfigurationIdentifier: aws.String("String"), @@ -935,7 +1151,13 @@ func ExampleRedshift_DescribeHsmConfigurations() { } func ExampleRedshift_DescribeLoggingStatus() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DescribeLoggingStatusInput{ ClusterIdentifier: aws.String("String"), // Required @@ -954,7 +1176,13 @@ func ExampleRedshift_DescribeLoggingStatus() { } func ExampleRedshift_DescribeOrderableClusterOptions() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DescribeOrderableClusterOptionsInput{ ClusterVersion: aws.String("String"), @@ -976,7 +1204,13 @@ func ExampleRedshift_DescribeOrderableClusterOptions() { } func ExampleRedshift_DescribeReservedNodeOfferings() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DescribeReservedNodeOfferingsInput{ Marker: aws.String("String"), @@ -997,7 +1231,13 @@ func ExampleRedshift_DescribeReservedNodeOfferings() { } func ExampleRedshift_DescribeReservedNodes() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DescribeReservedNodesInput{ Marker: aws.String("String"), @@ -1018,7 +1258,13 @@ func ExampleRedshift_DescribeReservedNodes() { } func ExampleRedshift_DescribeResize() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DescribeResizeInput{ ClusterIdentifier: aws.String("String"), // Required @@ -1037,7 +1283,13 @@ func ExampleRedshift_DescribeResize() { } func ExampleRedshift_DescribeSnapshotCopyGrants() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DescribeSnapshotCopyGrantsInput{ Marker: aws.String("String"), @@ -1066,7 +1318,13 @@ func ExampleRedshift_DescribeSnapshotCopyGrants() { } func ExampleRedshift_DescribeTableRestoreStatus() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DescribeTableRestoreStatusInput{ ClusterIdentifier: aws.String("String"), @@ -1088,7 +1346,13 @@ func ExampleRedshift_DescribeTableRestoreStatus() { } func ExampleRedshift_DescribeTags() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DescribeTagsInput{ Marker: aws.String("String"), @@ -1118,7 +1382,13 @@ func ExampleRedshift_DescribeTags() { } func ExampleRedshift_DisableLogging() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DisableLoggingInput{ ClusterIdentifier: aws.String("String"), // Required @@ -1137,7 +1407,13 @@ func ExampleRedshift_DisableLogging() { } func ExampleRedshift_DisableSnapshotCopy() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.DisableSnapshotCopyInput{ ClusterIdentifier: aws.String("String"), // Required @@ -1156,7 +1432,13 @@ func ExampleRedshift_DisableSnapshotCopy() { } func ExampleRedshift_EnableLogging() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.EnableLoggingInput{ BucketName: aws.String("String"), // Required @@ -1177,7 +1459,13 @@ func ExampleRedshift_EnableLogging() { } func ExampleRedshift_EnableSnapshotCopy() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.EnableSnapshotCopyInput{ ClusterIdentifier: aws.String("String"), // Required @@ -1199,7 +1487,13 @@ func ExampleRedshift_EnableSnapshotCopy() { } func ExampleRedshift_ModifyCluster() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.ModifyClusterInput{ ClusterIdentifier: aws.String("String"), // Required @@ -1240,7 +1534,13 @@ func ExampleRedshift_ModifyCluster() { } func ExampleRedshift_ModifyClusterIamRoles() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.ModifyClusterIamRolesInput{ ClusterIdentifier: aws.String("String"), // Required @@ -1267,7 +1567,13 @@ func ExampleRedshift_ModifyClusterIamRoles() { } func ExampleRedshift_ModifyClusterParameterGroup() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.ModifyClusterParameterGroupInput{ ParameterGroupName: aws.String("String"), // Required @@ -1300,7 +1606,13 @@ func ExampleRedshift_ModifyClusterParameterGroup() { } func ExampleRedshift_ModifyClusterSubnetGroup() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.ModifyClusterSubnetGroupInput{ ClusterSubnetGroupName: aws.String("String"), // Required @@ -1324,7 +1636,13 @@ func ExampleRedshift_ModifyClusterSubnetGroup() { } func ExampleRedshift_ModifyEventSubscription() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.ModifyEventSubscriptionInput{ SubscriptionName: aws.String("String"), // Required @@ -1355,7 +1673,13 @@ func ExampleRedshift_ModifyEventSubscription() { } func ExampleRedshift_ModifySnapshotCopyRetentionPeriod() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.ModifySnapshotCopyRetentionPeriodInput{ ClusterIdentifier: aws.String("String"), // Required @@ -1375,7 +1699,13 @@ func ExampleRedshift_ModifySnapshotCopyRetentionPeriod() { } func ExampleRedshift_PurchaseReservedNodeOffering() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.PurchaseReservedNodeOfferingInput{ ReservedNodeOfferingId: aws.String("String"), // Required @@ -1395,7 +1725,13 @@ func ExampleRedshift_PurchaseReservedNodeOffering() { } func ExampleRedshift_RebootCluster() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.RebootClusterInput{ ClusterIdentifier: aws.String("String"), // Required @@ -1414,7 +1750,13 @@ func ExampleRedshift_RebootCluster() { } func ExampleRedshift_ResetClusterParameterGroup() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.ResetClusterParameterGroupInput{ ParameterGroupName: aws.String("String"), // Required @@ -1448,7 +1790,13 @@ func ExampleRedshift_ResetClusterParameterGroup() { } func ExampleRedshift_RestoreFromClusterSnapshot() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.RestoreFromClusterSnapshotInput{ ClusterIdentifier: aws.String("String"), // Required @@ -1496,7 +1844,13 @@ func ExampleRedshift_RestoreFromClusterSnapshot() { } func ExampleRedshift_RestoreTableFromClusterSnapshot() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.RestoreTableFromClusterSnapshotInput{ ClusterIdentifier: aws.String("String"), // Required @@ -1522,7 +1876,13 @@ func ExampleRedshift_RestoreTableFromClusterSnapshot() { } func ExampleRedshift_RevokeClusterSecurityGroupIngress() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.RevokeClusterSecurityGroupIngressInput{ ClusterSecurityGroupName: aws.String("String"), // Required @@ -1544,7 +1904,13 @@ func ExampleRedshift_RevokeClusterSecurityGroupIngress() { } func ExampleRedshift_RevokeSnapshotAccess() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.RevokeSnapshotAccessInput{ AccountWithRestoreAccess: aws.String("String"), // Required @@ -1565,7 +1931,13 @@ func ExampleRedshift_RevokeSnapshotAccess() { } func ExampleRedshift_RotateEncryptionKey() { - svc := redshift.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := redshift.New(sess) params := &redshift.RotateEncryptionKeyInput{ ClusterIdentifier: aws.String("String"), // Required diff --git a/service/route53/examples_test.go b/service/route53/examples_test.go index cdbfea1fbb6..02e39d4d178 100644 --- a/service/route53/examples_test.go +++ b/service/route53/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleRoute53_AssociateVPCWithHostedZone() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.AssociateVPCWithHostedZoneInput{ HostedZoneId: aws.String("ResourceId"), // Required @@ -40,7 +46,13 @@ func ExampleRoute53_AssociateVPCWithHostedZone() { } func ExampleRoute53_ChangeResourceRecordSets() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.ChangeResourceRecordSetsInput{ ChangeBatch: &route53.ChangeBatch{ // Required @@ -95,7 +107,13 @@ func ExampleRoute53_ChangeResourceRecordSets() { } func ExampleRoute53_ChangeTagsForResource() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.ChangeTagsForResourceInput{ ResourceId: aws.String("TagResourceId"), // Required @@ -126,7 +144,13 @@ func ExampleRoute53_ChangeTagsForResource() { } func ExampleRoute53_CreateHealthCheck() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.CreateHealthCheckInput{ CallerReference: aws.String("HealthCheckNonce"), // Required @@ -172,7 +196,13 @@ func ExampleRoute53_CreateHealthCheck() { } func ExampleRoute53_CreateHostedZone() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.CreateHostedZoneInput{ CallerReference: aws.String("Nonce"), // Required @@ -201,7 +231,13 @@ func ExampleRoute53_CreateHostedZone() { } func ExampleRoute53_CreateReusableDelegationSet() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.CreateReusableDelegationSetInput{ CallerReference: aws.String("Nonce"), // Required @@ -221,7 +257,13 @@ func ExampleRoute53_CreateReusableDelegationSet() { } func ExampleRoute53_CreateTrafficPolicy() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.CreateTrafficPolicyInput{ Document: aws.String("TrafficPolicyDocument"), // Required @@ -242,7 +284,13 @@ func ExampleRoute53_CreateTrafficPolicy() { } func ExampleRoute53_CreateTrafficPolicyInstance() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.CreateTrafficPolicyInstanceInput{ HostedZoneId: aws.String("ResourceId"), // Required @@ -265,7 +313,13 @@ func ExampleRoute53_CreateTrafficPolicyInstance() { } func ExampleRoute53_CreateTrafficPolicyVersion() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.CreateTrafficPolicyVersionInput{ Document: aws.String("TrafficPolicyDocument"), // Required @@ -286,7 +340,13 @@ func ExampleRoute53_CreateTrafficPolicyVersion() { } func ExampleRoute53_DeleteHealthCheck() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.DeleteHealthCheckInput{ HealthCheckId: aws.String("HealthCheckId"), // Required @@ -305,7 +365,13 @@ func ExampleRoute53_DeleteHealthCheck() { } func ExampleRoute53_DeleteHostedZone() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.DeleteHostedZoneInput{ Id: aws.String("ResourceId"), // Required @@ -324,7 +390,13 @@ func ExampleRoute53_DeleteHostedZone() { } func ExampleRoute53_DeleteReusableDelegationSet() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.DeleteReusableDelegationSetInput{ Id: aws.String("ResourceId"), // Required @@ -343,7 +415,13 @@ func ExampleRoute53_DeleteReusableDelegationSet() { } func ExampleRoute53_DeleteTrafficPolicy() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.DeleteTrafficPolicyInput{ Id: aws.String("TrafficPolicyId"), // Required @@ -363,7 +441,13 @@ func ExampleRoute53_DeleteTrafficPolicy() { } func ExampleRoute53_DeleteTrafficPolicyInstance() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.DeleteTrafficPolicyInstanceInput{ Id: aws.String("TrafficPolicyInstanceId"), // Required @@ -382,7 +466,13 @@ func ExampleRoute53_DeleteTrafficPolicyInstance() { } func ExampleRoute53_DisassociateVPCFromHostedZone() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.DisassociateVPCFromHostedZoneInput{ HostedZoneId: aws.String("ResourceId"), // Required @@ -406,7 +496,13 @@ func ExampleRoute53_DisassociateVPCFromHostedZone() { } func ExampleRoute53_GetChange() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.GetChangeInput{ Id: aws.String("ResourceId"), // Required @@ -425,7 +521,13 @@ func ExampleRoute53_GetChange() { } func ExampleRoute53_GetChangeDetails() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.GetChangeDetailsInput{ Id: aws.String("ResourceId"), // Required @@ -444,7 +546,13 @@ func ExampleRoute53_GetChangeDetails() { } func ExampleRoute53_GetCheckerIpRanges() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) var params *route53.GetCheckerIpRangesInput resp, err := svc.GetCheckerIpRanges(params) @@ -461,7 +569,13 @@ func ExampleRoute53_GetCheckerIpRanges() { } func ExampleRoute53_GetGeoLocation() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.GetGeoLocationInput{ ContinentCode: aws.String("GeoLocationContinentCode"), @@ -482,7 +596,13 @@ func ExampleRoute53_GetGeoLocation() { } func ExampleRoute53_GetHealthCheck() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.GetHealthCheckInput{ HealthCheckId: aws.String("HealthCheckId"), // Required @@ -501,7 +621,13 @@ func ExampleRoute53_GetHealthCheck() { } func ExampleRoute53_GetHealthCheckCount() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) var params *route53.GetHealthCheckCountInput resp, err := svc.GetHealthCheckCount(params) @@ -518,7 +644,13 @@ func ExampleRoute53_GetHealthCheckCount() { } func ExampleRoute53_GetHealthCheckLastFailureReason() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.GetHealthCheckLastFailureReasonInput{ HealthCheckId: aws.String("HealthCheckId"), // Required @@ -537,7 +669,13 @@ func ExampleRoute53_GetHealthCheckLastFailureReason() { } func ExampleRoute53_GetHealthCheckStatus() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.GetHealthCheckStatusInput{ HealthCheckId: aws.String("HealthCheckId"), // Required @@ -556,7 +694,13 @@ func ExampleRoute53_GetHealthCheckStatus() { } func ExampleRoute53_GetHostedZone() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.GetHostedZoneInput{ Id: aws.String("ResourceId"), // Required @@ -575,7 +719,13 @@ func ExampleRoute53_GetHostedZone() { } func ExampleRoute53_GetHostedZoneCount() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) var params *route53.GetHostedZoneCountInput resp, err := svc.GetHostedZoneCount(params) @@ -592,7 +742,13 @@ func ExampleRoute53_GetHostedZoneCount() { } func ExampleRoute53_GetReusableDelegationSet() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.GetReusableDelegationSetInput{ Id: aws.String("ResourceId"), // Required @@ -611,7 +767,13 @@ func ExampleRoute53_GetReusableDelegationSet() { } func ExampleRoute53_GetTrafficPolicy() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.GetTrafficPolicyInput{ Id: aws.String("TrafficPolicyId"), // Required @@ -631,7 +793,13 @@ func ExampleRoute53_GetTrafficPolicy() { } func ExampleRoute53_GetTrafficPolicyInstance() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.GetTrafficPolicyInstanceInput{ Id: aws.String("TrafficPolicyInstanceId"), // Required @@ -650,7 +818,13 @@ func ExampleRoute53_GetTrafficPolicyInstance() { } func ExampleRoute53_GetTrafficPolicyInstanceCount() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) var params *route53.GetTrafficPolicyInstanceCountInput resp, err := svc.GetTrafficPolicyInstanceCount(params) @@ -667,7 +841,13 @@ func ExampleRoute53_GetTrafficPolicyInstanceCount() { } func ExampleRoute53_ListChangeBatchesByHostedZone() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.ListChangeBatchesByHostedZoneInput{ EndDate: aws.String("Date"), // Required @@ -690,7 +870,13 @@ func ExampleRoute53_ListChangeBatchesByHostedZone() { } func ExampleRoute53_ListChangeBatchesByRRSet() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.ListChangeBatchesByRRSetInput{ EndDate: aws.String("Date"), // Required @@ -716,7 +902,13 @@ func ExampleRoute53_ListChangeBatchesByRRSet() { } func ExampleRoute53_ListGeoLocations() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.ListGeoLocationsInput{ MaxItems: aws.String("PageMaxItems"), @@ -738,7 +930,13 @@ func ExampleRoute53_ListGeoLocations() { } func ExampleRoute53_ListHealthChecks() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.ListHealthChecksInput{ Marker: aws.String("PageMarker"), @@ -758,7 +956,13 @@ func ExampleRoute53_ListHealthChecks() { } func ExampleRoute53_ListHostedZones() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.ListHostedZonesInput{ DelegationSetId: aws.String("ResourceId"), @@ -779,7 +983,13 @@ func ExampleRoute53_ListHostedZones() { } func ExampleRoute53_ListHostedZonesByName() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.ListHostedZonesByNameInput{ DNSName: aws.String("DNSName"), @@ -800,7 +1010,13 @@ func ExampleRoute53_ListHostedZonesByName() { } func ExampleRoute53_ListResourceRecordSets() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.ListResourceRecordSetsInput{ HostedZoneId: aws.String("ResourceId"), // Required @@ -823,7 +1039,13 @@ func ExampleRoute53_ListResourceRecordSets() { } func ExampleRoute53_ListReusableDelegationSets() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.ListReusableDelegationSetsInput{ Marker: aws.String("PageMarker"), @@ -843,7 +1065,13 @@ func ExampleRoute53_ListReusableDelegationSets() { } func ExampleRoute53_ListTagsForResource() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.ListTagsForResourceInput{ ResourceId: aws.String("TagResourceId"), // Required @@ -863,7 +1091,13 @@ func ExampleRoute53_ListTagsForResource() { } func ExampleRoute53_ListTagsForResources() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.ListTagsForResourcesInput{ ResourceIds: []*string{ // Required @@ -886,7 +1120,13 @@ func ExampleRoute53_ListTagsForResources() { } func ExampleRoute53_ListTrafficPolicies() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.ListTrafficPoliciesInput{ MaxItems: aws.String("PageMaxItems"), @@ -906,7 +1146,13 @@ func ExampleRoute53_ListTrafficPolicies() { } func ExampleRoute53_ListTrafficPolicyInstances() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.ListTrafficPolicyInstancesInput{ HostedZoneIdMarker: aws.String("ResourceId"), @@ -928,7 +1174,13 @@ func ExampleRoute53_ListTrafficPolicyInstances() { } func ExampleRoute53_ListTrafficPolicyInstancesByHostedZone() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.ListTrafficPolicyInstancesByHostedZoneInput{ HostedZoneId: aws.String("ResourceId"), // Required @@ -950,7 +1202,13 @@ func ExampleRoute53_ListTrafficPolicyInstancesByHostedZone() { } func ExampleRoute53_ListTrafficPolicyInstancesByPolicy() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.ListTrafficPolicyInstancesByPolicyInput{ TrafficPolicyId: aws.String("TrafficPolicyId"), // Required @@ -974,7 +1232,13 @@ func ExampleRoute53_ListTrafficPolicyInstancesByPolicy() { } func ExampleRoute53_ListTrafficPolicyVersions() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.ListTrafficPolicyVersionsInput{ Id: aws.String("TrafficPolicyId"), // Required @@ -995,7 +1259,13 @@ func ExampleRoute53_ListTrafficPolicyVersions() { } func ExampleRoute53_UpdateHealthCheck() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.UpdateHealthCheckInput{ HealthCheckId: aws.String("HealthCheckId"), // Required @@ -1037,7 +1307,13 @@ func ExampleRoute53_UpdateHealthCheck() { } func ExampleRoute53_UpdateHostedZoneComment() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.UpdateHostedZoneCommentInput{ Id: aws.String("ResourceId"), // Required @@ -1057,7 +1333,13 @@ func ExampleRoute53_UpdateHostedZoneComment() { } func ExampleRoute53_UpdateTrafficPolicyComment() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.UpdateTrafficPolicyCommentInput{ Comment: aws.String("TrafficPolicyComment"), // Required @@ -1078,7 +1360,13 @@ func ExampleRoute53_UpdateTrafficPolicyComment() { } func ExampleRoute53_UpdateTrafficPolicyInstance() { - svc := route53.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53.New(sess) params := &route53.UpdateTrafficPolicyInstanceInput{ Id: aws.String("TrafficPolicyInstanceId"), // Required diff --git a/service/route53domains/examples_test.go b/service/route53domains/examples_test.go index bcfb5d9240b..eecb1bb88c2 100644 --- a/service/route53domains/examples_test.go +++ b/service/route53domains/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleRoute53Domains_CheckDomainAvailability() { - svc := route53domains.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53domains.New(sess) params := &route53domains.CheckDomainAvailabilityInput{ DomainName: aws.String("DomainName"), // Required @@ -36,7 +42,13 @@ func ExampleRoute53Domains_CheckDomainAvailability() { } func ExampleRoute53Domains_DeleteTagsForDomain() { - svc := route53domains.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53domains.New(sess) params := &route53domains.DeleteTagsForDomainInput{ DomainName: aws.String("DomainName"), // Required @@ -59,7 +71,13 @@ func ExampleRoute53Domains_DeleteTagsForDomain() { } func ExampleRoute53Domains_DisableDomainAutoRenew() { - svc := route53domains.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53domains.New(sess) params := &route53domains.DisableDomainAutoRenewInput{ DomainName: aws.String("DomainName"), // Required @@ -78,7 +96,13 @@ func ExampleRoute53Domains_DisableDomainAutoRenew() { } func ExampleRoute53Domains_DisableDomainTransferLock() { - svc := route53domains.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53domains.New(sess) params := &route53domains.DisableDomainTransferLockInput{ DomainName: aws.String("DomainName"), // Required @@ -97,7 +121,13 @@ func ExampleRoute53Domains_DisableDomainTransferLock() { } func ExampleRoute53Domains_EnableDomainAutoRenew() { - svc := route53domains.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53domains.New(sess) params := &route53domains.EnableDomainAutoRenewInput{ DomainName: aws.String("DomainName"), // Required @@ -116,7 +146,13 @@ func ExampleRoute53Domains_EnableDomainAutoRenew() { } func ExampleRoute53Domains_EnableDomainTransferLock() { - svc := route53domains.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53domains.New(sess) params := &route53domains.EnableDomainTransferLockInput{ DomainName: aws.String("DomainName"), // Required @@ -135,7 +171,13 @@ func ExampleRoute53Domains_EnableDomainTransferLock() { } func ExampleRoute53Domains_GetContactReachabilityStatus() { - svc := route53domains.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53domains.New(sess) params := &route53domains.GetContactReachabilityStatusInput{ DomainName: aws.String("DomainName"), @@ -154,7 +196,13 @@ func ExampleRoute53Domains_GetContactReachabilityStatus() { } func ExampleRoute53Domains_GetDomainDetail() { - svc := route53domains.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53domains.New(sess) params := &route53domains.GetDomainDetailInput{ DomainName: aws.String("DomainName"), // Required @@ -173,7 +221,13 @@ func ExampleRoute53Domains_GetDomainDetail() { } func ExampleRoute53Domains_GetDomainSuggestions() { - svc := route53domains.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53domains.New(sess) params := &route53domains.GetDomainSuggestionsInput{ DomainName: aws.String("DomainName"), // Required @@ -194,7 +248,13 @@ func ExampleRoute53Domains_GetDomainSuggestions() { } func ExampleRoute53Domains_GetOperationDetail() { - svc := route53domains.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53domains.New(sess) params := &route53domains.GetOperationDetailInput{ OperationId: aws.String("OperationId"), // Required @@ -213,7 +273,13 @@ func ExampleRoute53Domains_GetOperationDetail() { } func ExampleRoute53Domains_ListDomains() { - svc := route53domains.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53domains.New(sess) params := &route53domains.ListDomainsInput{ Marker: aws.String("PageMarker"), @@ -233,7 +299,13 @@ func ExampleRoute53Domains_ListDomains() { } func ExampleRoute53Domains_ListOperations() { - svc := route53domains.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53domains.New(sess) params := &route53domains.ListOperationsInput{ Marker: aws.String("PageMarker"), @@ -253,7 +325,13 @@ func ExampleRoute53Domains_ListOperations() { } func ExampleRoute53Domains_ListTagsForDomain() { - svc := route53domains.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53domains.New(sess) params := &route53domains.ListTagsForDomainInput{ DomainName: aws.String("DomainName"), // Required @@ -272,7 +350,13 @@ func ExampleRoute53Domains_ListTagsForDomain() { } func ExampleRoute53Domains_RegisterDomain() { - svc := route53domains.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53domains.New(sess) params := &route53domains.RegisterDomainInput{ AdminContact: &route53domains.ContactDetail{ // Required @@ -363,7 +447,13 @@ func ExampleRoute53Domains_RegisterDomain() { } func ExampleRoute53Domains_RenewDomain() { - svc := route53domains.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53domains.New(sess) params := &route53domains.RenewDomainInput{ CurrentExpiryYear: aws.Int64(1), // Required @@ -384,7 +474,13 @@ func ExampleRoute53Domains_RenewDomain() { } func ExampleRoute53Domains_ResendContactReachabilityEmail() { - svc := route53domains.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53domains.New(sess) params := &route53domains.ResendContactReachabilityEmailInput{ DomainName: aws.String("DomainName"), @@ -403,7 +499,13 @@ func ExampleRoute53Domains_ResendContactReachabilityEmail() { } func ExampleRoute53Domains_RetrieveDomainAuthCode() { - svc := route53domains.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53domains.New(sess) params := &route53domains.RetrieveDomainAuthCodeInput{ DomainName: aws.String("DomainName"), // Required @@ -422,7 +524,13 @@ func ExampleRoute53Domains_RetrieveDomainAuthCode() { } func ExampleRoute53Domains_TransferDomain() { - svc := route53domains.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53domains.New(sess) params := &route53domains.TransferDomainInput{ AdminContact: &route53domains.ContactDetail{ // Required @@ -524,7 +632,13 @@ func ExampleRoute53Domains_TransferDomain() { } func ExampleRoute53Domains_UpdateDomainContact() { - svc := route53domains.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53domains.New(sess) params := &route53domains.UpdateDomainContactInput{ DomainName: aws.String("DomainName"), // Required @@ -609,7 +723,13 @@ func ExampleRoute53Domains_UpdateDomainContact() { } func ExampleRoute53Domains_UpdateDomainContactPrivacy() { - svc := route53domains.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53domains.New(sess) params := &route53domains.UpdateDomainContactPrivacyInput{ DomainName: aws.String("DomainName"), // Required @@ -631,7 +751,13 @@ func ExampleRoute53Domains_UpdateDomainContactPrivacy() { } func ExampleRoute53Domains_UpdateDomainNameservers() { - svc := route53domains.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53domains.New(sess) params := &route53domains.UpdateDomainNameserversInput{ DomainName: aws.String("DomainName"), // Required @@ -661,7 +787,13 @@ func ExampleRoute53Domains_UpdateDomainNameservers() { } func ExampleRoute53Domains_UpdateTagsForDomain() { - svc := route53domains.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53domains.New(sess) params := &route53domains.UpdateTagsForDomainInput{ DomainName: aws.String("DomainName"), // Required @@ -687,7 +819,13 @@ func ExampleRoute53Domains_UpdateTagsForDomain() { } func ExampleRoute53Domains_ViewBilling() { - svc := route53domains.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := route53domains.New(sess) params := &route53domains.ViewBillingInput{ End: aws.Time(time.Now()), diff --git a/service/s3/examples_test.go b/service/s3/examples_test.go index 1f613f5751c..f61ab6676eb 100644 --- a/service/s3/examples_test.go +++ b/service/s3/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleS3_AbortMultipartUpload() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.AbortMultipartUploadInput{ Bucket: aws.String("BucketName"), // Required @@ -38,7 +44,13 @@ func ExampleS3_AbortMultipartUpload() { } func ExampleS3_CompleteMultipartUpload() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.CompleteMultipartUploadInput{ Bucket: aws.String("BucketName"), // Required @@ -69,7 +81,13 @@ func ExampleS3_CompleteMultipartUpload() { } func ExampleS3_CopyObject() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.CopyObjectInput{ Bucket: aws.String("BucketName"), // Required @@ -121,7 +139,13 @@ func ExampleS3_CopyObject() { } func ExampleS3_CreateBucket() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.CreateBucketInput{ Bucket: aws.String("BucketName"), // Required @@ -149,7 +173,13 @@ func ExampleS3_CreateBucket() { } func ExampleS3_CreateMultipartUpload() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.CreateMultipartUploadInput{ Bucket: aws.String("BucketName"), // Required @@ -192,7 +222,13 @@ func ExampleS3_CreateMultipartUpload() { } func ExampleS3_DeleteBucket() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.DeleteBucketInput{ Bucket: aws.String("BucketName"), // Required @@ -211,7 +247,13 @@ func ExampleS3_DeleteBucket() { } func ExampleS3_DeleteBucketCors() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.DeleteBucketCorsInput{ Bucket: aws.String("BucketName"), // Required @@ -230,7 +272,13 @@ func ExampleS3_DeleteBucketCors() { } func ExampleS3_DeleteBucketLifecycle() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.DeleteBucketLifecycleInput{ Bucket: aws.String("BucketName"), // Required @@ -249,7 +297,13 @@ func ExampleS3_DeleteBucketLifecycle() { } func ExampleS3_DeleteBucketPolicy() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.DeleteBucketPolicyInput{ Bucket: aws.String("BucketName"), // Required @@ -268,7 +322,13 @@ func ExampleS3_DeleteBucketPolicy() { } func ExampleS3_DeleteBucketReplication() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.DeleteBucketReplicationInput{ Bucket: aws.String("BucketName"), // Required @@ -287,7 +347,13 @@ func ExampleS3_DeleteBucketReplication() { } func ExampleS3_DeleteBucketTagging() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.DeleteBucketTaggingInput{ Bucket: aws.String("BucketName"), // Required @@ -306,7 +372,13 @@ func ExampleS3_DeleteBucketTagging() { } func ExampleS3_DeleteBucketWebsite() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.DeleteBucketWebsiteInput{ Bucket: aws.String("BucketName"), // Required @@ -325,7 +397,13 @@ func ExampleS3_DeleteBucketWebsite() { } func ExampleS3_DeleteObject() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.DeleteObjectInput{ Bucket: aws.String("BucketName"), // Required @@ -348,7 +426,13 @@ func ExampleS3_DeleteObject() { } func ExampleS3_DeleteObjects() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.DeleteObjectsInput{ Bucket: aws.String("BucketName"), // Required @@ -379,7 +463,13 @@ func ExampleS3_DeleteObjects() { } func ExampleS3_GetBucketAccelerateConfiguration() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.GetBucketAccelerateConfigurationInput{ Bucket: aws.String("BucketName"), // Required @@ -398,7 +488,13 @@ func ExampleS3_GetBucketAccelerateConfiguration() { } func ExampleS3_GetBucketAcl() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.GetBucketAclInput{ Bucket: aws.String("BucketName"), // Required @@ -417,7 +513,13 @@ func ExampleS3_GetBucketAcl() { } func ExampleS3_GetBucketCors() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.GetBucketCorsInput{ Bucket: aws.String("BucketName"), // Required @@ -436,7 +538,13 @@ func ExampleS3_GetBucketCors() { } func ExampleS3_GetBucketLifecycle() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.GetBucketLifecycleInput{ Bucket: aws.String("BucketName"), // Required @@ -455,7 +563,13 @@ func ExampleS3_GetBucketLifecycle() { } func ExampleS3_GetBucketLifecycleConfiguration() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.GetBucketLifecycleConfigurationInput{ Bucket: aws.String("BucketName"), // Required @@ -474,7 +588,13 @@ func ExampleS3_GetBucketLifecycleConfiguration() { } func ExampleS3_GetBucketLocation() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.GetBucketLocationInput{ Bucket: aws.String("BucketName"), // Required @@ -493,7 +613,13 @@ func ExampleS3_GetBucketLocation() { } func ExampleS3_GetBucketLogging() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.GetBucketLoggingInput{ Bucket: aws.String("BucketName"), // Required @@ -512,7 +638,13 @@ func ExampleS3_GetBucketLogging() { } func ExampleS3_GetBucketNotification() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.GetBucketNotificationConfigurationRequest{ Bucket: aws.String("BucketName"), // Required @@ -531,7 +663,13 @@ func ExampleS3_GetBucketNotification() { } func ExampleS3_GetBucketNotificationConfiguration() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.GetBucketNotificationConfigurationRequest{ Bucket: aws.String("BucketName"), // Required @@ -550,7 +688,13 @@ func ExampleS3_GetBucketNotificationConfiguration() { } func ExampleS3_GetBucketPolicy() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.GetBucketPolicyInput{ Bucket: aws.String("BucketName"), // Required @@ -569,7 +713,13 @@ func ExampleS3_GetBucketPolicy() { } func ExampleS3_GetBucketReplication() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.GetBucketReplicationInput{ Bucket: aws.String("BucketName"), // Required @@ -588,7 +738,13 @@ func ExampleS3_GetBucketReplication() { } func ExampleS3_GetBucketRequestPayment() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.GetBucketRequestPaymentInput{ Bucket: aws.String("BucketName"), // Required @@ -607,7 +763,13 @@ func ExampleS3_GetBucketRequestPayment() { } func ExampleS3_GetBucketTagging() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.GetBucketTaggingInput{ Bucket: aws.String("BucketName"), // Required @@ -626,7 +788,13 @@ func ExampleS3_GetBucketTagging() { } func ExampleS3_GetBucketVersioning() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.GetBucketVersioningInput{ Bucket: aws.String("BucketName"), // Required @@ -645,7 +813,13 @@ func ExampleS3_GetBucketVersioning() { } func ExampleS3_GetBucketWebsite() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.GetBucketWebsiteInput{ Bucket: aws.String("BucketName"), // Required @@ -664,7 +838,13 @@ func ExampleS3_GetBucketWebsite() { } func ExampleS3_GetObject() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.GetObjectInput{ Bucket: aws.String("BucketName"), // Required @@ -700,7 +880,13 @@ func ExampleS3_GetObject() { } func ExampleS3_GetObjectAcl() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.GetObjectAclInput{ Bucket: aws.String("BucketName"), // Required @@ -722,7 +908,13 @@ func ExampleS3_GetObjectAcl() { } func ExampleS3_GetObjectTorrent() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.GetObjectTorrentInput{ Bucket: aws.String("BucketName"), // Required @@ -743,7 +935,13 @@ func ExampleS3_GetObjectTorrent() { } func ExampleS3_HeadBucket() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.HeadBucketInput{ Bucket: aws.String("BucketName"), // Required @@ -762,7 +960,13 @@ func ExampleS3_HeadBucket() { } func ExampleS3_HeadObject() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.HeadObjectInput{ Bucket: aws.String("BucketName"), // Required @@ -792,7 +996,13 @@ func ExampleS3_HeadObject() { } func ExampleS3_ListBuckets() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) var params *s3.ListBucketsInput resp, err := svc.ListBuckets(params) @@ -809,7 +1019,13 @@ func ExampleS3_ListBuckets() { } func ExampleS3_ListMultipartUploads() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.ListMultipartUploadsInput{ Bucket: aws.String("BucketName"), // Required @@ -834,7 +1050,13 @@ func ExampleS3_ListMultipartUploads() { } func ExampleS3_ListObjectVersions() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.ListObjectVersionsInput{ Bucket: aws.String("BucketName"), // Required @@ -859,7 +1081,13 @@ func ExampleS3_ListObjectVersions() { } func ExampleS3_ListObjects() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.ListObjectsInput{ Bucket: aws.String("BucketName"), // Required @@ -883,7 +1111,13 @@ func ExampleS3_ListObjects() { } func ExampleS3_ListObjectsV2() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.ListObjectsV2Input{ Bucket: aws.String("BucketName"), // Required @@ -909,7 +1143,13 @@ func ExampleS3_ListObjectsV2() { } func ExampleS3_ListParts() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.ListPartsInput{ Bucket: aws.String("BucketName"), // Required @@ -933,7 +1173,13 @@ func ExampleS3_ListParts() { } func ExampleS3_PutBucketAccelerateConfiguration() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.PutBucketAccelerateConfigurationInput{ AccelerateConfiguration: &s3.AccelerateConfiguration{ // Required @@ -955,7 +1201,13 @@ func ExampleS3_PutBucketAccelerateConfiguration() { } func ExampleS3_PutBucketAcl() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.PutBucketAclInput{ Bucket: aws.String("BucketName"), // Required @@ -999,7 +1251,13 @@ func ExampleS3_PutBucketAcl() { } func ExampleS3_PutBucketCors() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.PutBucketCorsInput{ Bucket: aws.String("BucketName"), // Required @@ -1042,7 +1300,13 @@ func ExampleS3_PutBucketCors() { } func ExampleS3_PutBucketLifecycle() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.PutBucketLifecycleInput{ Bucket: aws.String("BucketName"), // Required @@ -1091,7 +1355,13 @@ func ExampleS3_PutBucketLifecycle() { } func ExampleS3_PutBucketLifecycleConfiguration() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.PutBucketLifecycleConfigurationInput{ Bucket: aws.String("BucketName"), // Required @@ -1146,7 +1416,13 @@ func ExampleS3_PutBucketLifecycleConfiguration() { } func ExampleS3_PutBucketLogging() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.PutBucketLoggingInput{ Bucket: aws.String("BucketName"), // Required @@ -1184,7 +1460,13 @@ func ExampleS3_PutBucketLogging() { } func ExampleS3_PutBucketNotification() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.PutBucketNotificationInput{ Bucket: aws.String("BucketName"), // Required @@ -1233,7 +1515,13 @@ func ExampleS3_PutBucketNotification() { } func ExampleS3_PutBucketNotificationConfiguration() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.PutBucketNotificationConfigurationInput{ Bucket: aws.String("BucketName"), // Required @@ -1320,7 +1608,13 @@ func ExampleS3_PutBucketNotificationConfiguration() { } func ExampleS3_PutBucketPolicy() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.PutBucketPolicyInput{ Bucket: aws.String("BucketName"), // Required @@ -1340,7 +1634,13 @@ func ExampleS3_PutBucketPolicy() { } func ExampleS3_PutBucketReplication() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.PutBucketReplicationInput{ Bucket: aws.String("BucketName"), // Required @@ -1374,7 +1674,13 @@ func ExampleS3_PutBucketReplication() { } func ExampleS3_PutBucketRequestPayment() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.PutBucketRequestPaymentInput{ Bucket: aws.String("BucketName"), // Required @@ -1396,7 +1702,13 @@ func ExampleS3_PutBucketRequestPayment() { } func ExampleS3_PutBucketTagging() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.PutBucketTaggingInput{ Bucket: aws.String("BucketName"), // Required @@ -1424,7 +1736,13 @@ func ExampleS3_PutBucketTagging() { } func ExampleS3_PutBucketVersioning() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.PutBucketVersioningInput{ Bucket: aws.String("BucketName"), // Required @@ -1448,7 +1766,13 @@ func ExampleS3_PutBucketVersioning() { } func ExampleS3_PutBucketWebsite() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.PutBucketWebsiteInput{ Bucket: aws.String("BucketName"), // Required @@ -1495,7 +1819,13 @@ func ExampleS3_PutBucketWebsite() { } func ExampleS3_PutObject() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.PutObjectInput{ Bucket: aws.String("BucketName"), // Required @@ -1540,7 +1870,13 @@ func ExampleS3_PutObject() { } func ExampleS3_PutObjectAcl() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.PutObjectAclInput{ Bucket: aws.String("BucketName"), // Required @@ -1587,7 +1923,13 @@ func ExampleS3_PutObjectAcl() { } func ExampleS3_RestoreObject() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.RestoreObjectInput{ Bucket: aws.String("BucketName"), // Required @@ -1612,7 +1954,13 @@ func ExampleS3_RestoreObject() { } func ExampleS3_UploadPart() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.UploadPartInput{ Bucket: aws.String("BucketName"), // Required @@ -1640,7 +1988,13 @@ func ExampleS3_UploadPart() { } func ExampleS3_UploadPartCopy() { - svc := s3.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := s3.New(sess) params := &s3.UploadPartCopyInput{ Bucket: aws.String("BucketName"), // Required diff --git a/service/s3/s3manager/download.go b/service/s3/s3manager/download.go index fc0f2c0aac3..cb509ffc4b5 100644 --- a/service/s3/s3manager/download.go +++ b/service/s3/s3manager/download.go @@ -49,7 +49,7 @@ type Downloader struct { // // Example: // // The session the S3 Downloader will use -// sess := session.New() +// sess, err := session.NewSession() // // // Create a downloader with the session and default options // downloader := s3manager.NewDownloader(sess) @@ -77,8 +77,11 @@ func NewDownloader(c client.ConfigProvider, options ...func(*Downloader)) *Downl // to make S3 API calls. // // Example: +// // The session the S3 Downloader will use +// sess, err := session.NewSession() +// // // The S3 client the S3 Downloader will use -// s3Svc := s3.new(session.New()) +// s3Svc := s3.new(sess) // // // Create a downloader with the s3 client and default options // downloader := s3manager.NewDownloaderWithClient(s3Svc) diff --git a/service/s3/s3manager/upload.go b/service/s3/s3manager/upload.go index f6c9babb12c..e7bd09b550c 100644 --- a/service/s3/s3manager/upload.go +++ b/service/s3/s3manager/upload.go @@ -238,7 +238,7 @@ type Uploader struct { // // Example: // // The session the S3 Uploader will use -// sess := session.New() +// sess, err := session.NewSession() // // // Create an uploader with the session and default options // uploader := s3manager.NewUploader(sess) @@ -268,8 +268,11 @@ func NewUploader(c client.ConfigProvider, options ...func(*Uploader)) *Uploader // a S3 service client to make S3 API calls. // // Example: +// // The session the S3 Uploader will use +// sess, err := session.NewSession() +// // // S3 service client the Upload manager will use. -// s3Svc := s3.New(session.New()) +// s3Svc := s3.New(sess) // // // Create an uploader with S3 client and default options // uploader := s3manager.NewUploaderWithClient(s3Svc) diff --git a/service/servicecatalog/examples_test.go b/service/servicecatalog/examples_test.go index dbd99135d49..b2e81bd740e 100644 --- a/service/servicecatalog/examples_test.go +++ b/service/servicecatalog/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleServiceCatalog_DescribeProduct() { - svc := servicecatalog.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := servicecatalog.New(sess) params := &servicecatalog.DescribeProductInput{ Id: aws.String("Id"), // Required @@ -36,7 +42,13 @@ func ExampleServiceCatalog_DescribeProduct() { } func ExampleServiceCatalog_DescribeProductView() { - svc := servicecatalog.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := servicecatalog.New(sess) params := &servicecatalog.DescribeProductViewInput{ Id: aws.String("Id"), // Required @@ -56,7 +68,13 @@ func ExampleServiceCatalog_DescribeProductView() { } func ExampleServiceCatalog_DescribeProvisioningParameters() { - svc := servicecatalog.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := servicecatalog.New(sess) params := &servicecatalog.DescribeProvisioningParametersInput{ ProductId: aws.String("Id"), // Required @@ -78,7 +96,13 @@ func ExampleServiceCatalog_DescribeProvisioningParameters() { } func ExampleServiceCatalog_DescribeRecord() { - svc := servicecatalog.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := servicecatalog.New(sess) params := &servicecatalog.DescribeRecordInput{ Id: aws.String("Id"), // Required @@ -100,7 +124,13 @@ func ExampleServiceCatalog_DescribeRecord() { } func ExampleServiceCatalog_ListLaunchPaths() { - svc := servicecatalog.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := servicecatalog.New(sess) params := &servicecatalog.ListLaunchPathsInput{ ProductId: aws.String("Id"), // Required @@ -122,7 +152,13 @@ func ExampleServiceCatalog_ListLaunchPaths() { } func ExampleServiceCatalog_ListRecordHistory() { - svc := servicecatalog.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := servicecatalog.New(sess) params := &servicecatalog.ListRecordHistoryInput{ AcceptLanguage: aws.String("AcceptLanguage"), @@ -147,7 +183,13 @@ func ExampleServiceCatalog_ListRecordHistory() { } func ExampleServiceCatalog_ProvisionProduct() { - svc := servicecatalog.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := servicecatalog.New(sess) params := &servicecatalog.ProvisionProductInput{ ProductId: aws.String("Id"), // Required @@ -189,7 +231,13 @@ func ExampleServiceCatalog_ProvisionProduct() { } func ExampleServiceCatalog_ScanProvisionedProducts() { - svc := servicecatalog.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := servicecatalog.New(sess) params := &servicecatalog.ScanProvisionedProductsInput{ AcceptLanguage: aws.String("AcceptLanguage"), @@ -210,7 +258,13 @@ func ExampleServiceCatalog_ScanProvisionedProducts() { } func ExampleServiceCatalog_SearchProducts() { - svc := servicecatalog.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := servicecatalog.New(sess) params := &servicecatalog.SearchProductsInput{ AcceptLanguage: aws.String("AcceptLanguage"), @@ -240,7 +294,13 @@ func ExampleServiceCatalog_SearchProducts() { } func ExampleServiceCatalog_TerminateProvisionedProduct() { - svc := servicecatalog.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := servicecatalog.New(sess) params := &servicecatalog.TerminateProvisionedProductInput{ TerminateToken: aws.String("IdempotencyToken"), // Required @@ -263,7 +323,13 @@ func ExampleServiceCatalog_TerminateProvisionedProduct() { } func ExampleServiceCatalog_UpdateProvisionedProduct() { - svc := servicecatalog.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := servicecatalog.New(sess) params := &servicecatalog.UpdateProvisionedProductInput{ UpdateToken: aws.String("IdempotencyToken"), // Required diff --git a/service/ses/examples_test.go b/service/ses/examples_test.go index 3b3cd16e8bd..309c725ade4 100644 --- a/service/ses/examples_test.go +++ b/service/ses/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleSES_CloneReceiptRuleSet() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.CloneReceiptRuleSetInput{ OriginalRuleSetName: aws.String("ReceiptRuleSetName"), // Required @@ -36,7 +42,13 @@ func ExampleSES_CloneReceiptRuleSet() { } func ExampleSES_CreateReceiptFilter() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.CreateReceiptFilterInput{ Filter: &ses.ReceiptFilter{ // Required @@ -61,7 +73,13 @@ func ExampleSES_CreateReceiptFilter() { } func ExampleSES_CreateReceiptRule() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.CreateReceiptRuleInput{ Rule: &ses.ReceiptRule{ // Required @@ -130,7 +148,13 @@ func ExampleSES_CreateReceiptRule() { } func ExampleSES_CreateReceiptRuleSet() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.CreateReceiptRuleSetInput{ RuleSetName: aws.String("ReceiptRuleSetName"), // Required @@ -149,7 +173,13 @@ func ExampleSES_CreateReceiptRuleSet() { } func ExampleSES_DeleteIdentity() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.DeleteIdentityInput{ Identity: aws.String("Identity"), // Required @@ -168,7 +198,13 @@ func ExampleSES_DeleteIdentity() { } func ExampleSES_DeleteIdentityPolicy() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.DeleteIdentityPolicyInput{ Identity: aws.String("Identity"), // Required @@ -188,7 +224,13 @@ func ExampleSES_DeleteIdentityPolicy() { } func ExampleSES_DeleteReceiptFilter() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.DeleteReceiptFilterInput{ FilterName: aws.String("ReceiptFilterName"), // Required @@ -207,7 +249,13 @@ func ExampleSES_DeleteReceiptFilter() { } func ExampleSES_DeleteReceiptRule() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.DeleteReceiptRuleInput{ RuleName: aws.String("ReceiptRuleName"), // Required @@ -227,7 +275,13 @@ func ExampleSES_DeleteReceiptRule() { } func ExampleSES_DeleteReceiptRuleSet() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.DeleteReceiptRuleSetInput{ RuleSetName: aws.String("ReceiptRuleSetName"), // Required @@ -246,7 +300,13 @@ func ExampleSES_DeleteReceiptRuleSet() { } func ExampleSES_DeleteVerifiedEmailAddress() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.DeleteVerifiedEmailAddressInput{ EmailAddress: aws.String("Address"), // Required @@ -265,7 +325,13 @@ func ExampleSES_DeleteVerifiedEmailAddress() { } func ExampleSES_DescribeActiveReceiptRuleSet() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) var params *ses.DescribeActiveReceiptRuleSetInput resp, err := svc.DescribeActiveReceiptRuleSet(params) @@ -282,7 +348,13 @@ func ExampleSES_DescribeActiveReceiptRuleSet() { } func ExampleSES_DescribeReceiptRule() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.DescribeReceiptRuleInput{ RuleName: aws.String("ReceiptRuleName"), // Required @@ -302,7 +374,13 @@ func ExampleSES_DescribeReceiptRule() { } func ExampleSES_DescribeReceiptRuleSet() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.DescribeReceiptRuleSetInput{ RuleSetName: aws.String("ReceiptRuleSetName"), // Required @@ -321,7 +399,13 @@ func ExampleSES_DescribeReceiptRuleSet() { } func ExampleSES_GetIdentityDkimAttributes() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.GetIdentityDkimAttributesInput{ Identities: []*string{ // Required @@ -343,7 +427,13 @@ func ExampleSES_GetIdentityDkimAttributes() { } func ExampleSES_GetIdentityMailFromDomainAttributes() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.GetIdentityMailFromDomainAttributesInput{ Identities: []*string{ // Required @@ -365,7 +455,13 @@ func ExampleSES_GetIdentityMailFromDomainAttributes() { } func ExampleSES_GetIdentityNotificationAttributes() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.GetIdentityNotificationAttributesInput{ Identities: []*string{ // Required @@ -387,7 +483,13 @@ func ExampleSES_GetIdentityNotificationAttributes() { } func ExampleSES_GetIdentityPolicies() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.GetIdentityPoliciesInput{ Identity: aws.String("Identity"), // Required @@ -410,7 +512,13 @@ func ExampleSES_GetIdentityPolicies() { } func ExampleSES_GetIdentityVerificationAttributes() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.GetIdentityVerificationAttributesInput{ Identities: []*string{ // Required @@ -432,7 +540,13 @@ func ExampleSES_GetIdentityVerificationAttributes() { } func ExampleSES_GetSendQuota() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) var params *ses.GetSendQuotaInput resp, err := svc.GetSendQuota(params) @@ -449,7 +563,13 @@ func ExampleSES_GetSendQuota() { } func ExampleSES_GetSendStatistics() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) var params *ses.GetSendStatisticsInput resp, err := svc.GetSendStatistics(params) @@ -466,7 +586,13 @@ func ExampleSES_GetSendStatistics() { } func ExampleSES_ListIdentities() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.ListIdentitiesInput{ IdentityType: aws.String("IdentityType"), @@ -487,7 +613,13 @@ func ExampleSES_ListIdentities() { } func ExampleSES_ListIdentityPolicies() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.ListIdentityPoliciesInput{ Identity: aws.String("Identity"), // Required @@ -506,7 +638,13 @@ func ExampleSES_ListIdentityPolicies() { } func ExampleSES_ListReceiptFilters() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) var params *ses.ListReceiptFiltersInput resp, err := svc.ListReceiptFilters(params) @@ -523,7 +661,13 @@ func ExampleSES_ListReceiptFilters() { } func ExampleSES_ListReceiptRuleSets() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.ListReceiptRuleSetsInput{ NextToken: aws.String("NextToken"), @@ -542,7 +686,13 @@ func ExampleSES_ListReceiptRuleSets() { } func ExampleSES_ListVerifiedEmailAddresses() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) var params *ses.ListVerifiedEmailAddressesInput resp, err := svc.ListVerifiedEmailAddresses(params) @@ -559,7 +709,13 @@ func ExampleSES_ListVerifiedEmailAddresses() { } func ExampleSES_PutIdentityPolicy() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.PutIdentityPolicyInput{ Identity: aws.String("Identity"), // Required @@ -580,7 +736,13 @@ func ExampleSES_PutIdentityPolicy() { } func ExampleSES_ReorderReceiptRuleSet() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.ReorderReceiptRuleSetInput{ RuleNames: []*string{ // Required @@ -603,7 +765,13 @@ func ExampleSES_ReorderReceiptRuleSet() { } func ExampleSES_SendBounce() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.SendBounceInput{ BounceSender: aws.String("Address"), // Required @@ -659,7 +827,13 @@ func ExampleSES_SendBounce() { } func ExampleSES_SendEmail() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.SendEmailInput{ Destination: &ses.Destination{ // Required @@ -715,7 +889,13 @@ func ExampleSES_SendEmail() { } func ExampleSES_SendRawEmail() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.SendRawEmailInput{ RawMessage: &ses.RawMessage{ // Required @@ -744,7 +924,13 @@ func ExampleSES_SendRawEmail() { } func ExampleSES_SetActiveReceiptRuleSet() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.SetActiveReceiptRuleSetInput{ RuleSetName: aws.String("ReceiptRuleSetName"), @@ -763,7 +949,13 @@ func ExampleSES_SetActiveReceiptRuleSet() { } func ExampleSES_SetIdentityDkimEnabled() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.SetIdentityDkimEnabledInput{ DkimEnabled: aws.Bool(true), // Required @@ -783,7 +975,13 @@ func ExampleSES_SetIdentityDkimEnabled() { } func ExampleSES_SetIdentityFeedbackForwardingEnabled() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.SetIdentityFeedbackForwardingEnabledInput{ ForwardingEnabled: aws.Bool(true), // Required @@ -803,7 +1001,13 @@ func ExampleSES_SetIdentityFeedbackForwardingEnabled() { } func ExampleSES_SetIdentityHeadersInNotificationsEnabled() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.SetIdentityHeadersInNotificationsEnabledInput{ Enabled: aws.Bool(true), // Required @@ -824,7 +1028,13 @@ func ExampleSES_SetIdentityHeadersInNotificationsEnabled() { } func ExampleSES_SetIdentityMailFromDomain() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.SetIdentityMailFromDomainInput{ Identity: aws.String("Identity"), // Required @@ -845,7 +1055,13 @@ func ExampleSES_SetIdentityMailFromDomain() { } func ExampleSES_SetIdentityNotificationTopic() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.SetIdentityNotificationTopicInput{ Identity: aws.String("Identity"), // Required @@ -866,7 +1082,13 @@ func ExampleSES_SetIdentityNotificationTopic() { } func ExampleSES_SetReceiptRulePosition() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.SetReceiptRulePositionInput{ RuleName: aws.String("ReceiptRuleName"), // Required @@ -887,7 +1109,13 @@ func ExampleSES_SetReceiptRulePosition() { } func ExampleSES_UpdateReceiptRule() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.UpdateReceiptRuleInput{ Rule: &ses.ReceiptRule{ // Required @@ -955,7 +1183,13 @@ func ExampleSES_UpdateReceiptRule() { } func ExampleSES_VerifyDomainDkim() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.VerifyDomainDkimInput{ Domain: aws.String("Domain"), // Required @@ -974,7 +1208,13 @@ func ExampleSES_VerifyDomainDkim() { } func ExampleSES_VerifyDomainIdentity() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.VerifyDomainIdentityInput{ Domain: aws.String("Domain"), // Required @@ -993,7 +1233,13 @@ func ExampleSES_VerifyDomainIdentity() { } func ExampleSES_VerifyEmailAddress() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.VerifyEmailAddressInput{ EmailAddress: aws.String("Address"), // Required @@ -1012,7 +1258,13 @@ func ExampleSES_VerifyEmailAddress() { } func ExampleSES_VerifyEmailIdentity() { - svc := ses.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ses.New(sess) params := &ses.VerifyEmailIdentityInput{ EmailAddress: aws.String("Address"), // Required diff --git a/service/simpledb/examples_test.go b/service/simpledb/examples_test.go index 3cc39cc352b..567026d6d38 100644 --- a/service/simpledb/examples_test.go +++ b/service/simpledb/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleSimpleDB_BatchDeleteAttributes() { - svc := simpledb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := simpledb.New(sess) params := &simpledb.BatchDeleteAttributesInput{ DomainName: aws.String("String"), // Required @@ -48,7 +54,13 @@ func ExampleSimpleDB_BatchDeleteAttributes() { } func ExampleSimpleDB_BatchPutAttributes() { - svc := simpledb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := simpledb.New(sess) params := &simpledb.BatchPutAttributesInput{ DomainName: aws.String("String"), // Required @@ -81,7 +93,13 @@ func ExampleSimpleDB_BatchPutAttributes() { } func ExampleSimpleDB_CreateDomain() { - svc := simpledb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := simpledb.New(sess) params := &simpledb.CreateDomainInput{ DomainName: aws.String("String"), // Required @@ -100,7 +118,13 @@ func ExampleSimpleDB_CreateDomain() { } func ExampleSimpleDB_DeleteAttributes() { - svc := simpledb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := simpledb.New(sess) params := &simpledb.DeleteAttributesInput{ DomainName: aws.String("String"), // Required @@ -132,7 +156,13 @@ func ExampleSimpleDB_DeleteAttributes() { } func ExampleSimpleDB_DeleteDomain() { - svc := simpledb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := simpledb.New(sess) params := &simpledb.DeleteDomainInput{ DomainName: aws.String("String"), // Required @@ -151,7 +181,13 @@ func ExampleSimpleDB_DeleteDomain() { } func ExampleSimpleDB_DomainMetadata() { - svc := simpledb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := simpledb.New(sess) params := &simpledb.DomainMetadataInput{ DomainName: aws.String("String"), // Required @@ -170,7 +206,13 @@ func ExampleSimpleDB_DomainMetadata() { } func ExampleSimpleDB_GetAttributes() { - svc := simpledb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := simpledb.New(sess) params := &simpledb.GetAttributesInput{ DomainName: aws.String("String"), // Required @@ -195,7 +237,13 @@ func ExampleSimpleDB_GetAttributes() { } func ExampleSimpleDB_ListDomains() { - svc := simpledb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := simpledb.New(sess) params := &simpledb.ListDomainsInput{ MaxNumberOfDomains: aws.Int64(1), @@ -215,7 +263,13 @@ func ExampleSimpleDB_ListDomains() { } func ExampleSimpleDB_PutAttributes() { - svc := simpledb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := simpledb.New(sess) params := &simpledb.PutAttributesInput{ Attributes: []*simpledb.ReplaceableAttribute{ // Required @@ -248,7 +302,13 @@ func ExampleSimpleDB_PutAttributes() { } func ExampleSimpleDB_Select() { - svc := simpledb.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := simpledb.New(sess) params := &simpledb.SelectInput{ SelectExpression: aws.String("String"), // Required diff --git a/service/sns/examples_test.go b/service/sns/examples_test.go index e2b8cce07db..4fe35b39d5a 100644 --- a/service/sns/examples_test.go +++ b/service/sns/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleSNS_AddPermission() { - svc := sns.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sns.New(sess) params := &sns.AddPermissionInput{ AWSAccountId: []*string{ // Required @@ -44,7 +50,13 @@ func ExampleSNS_AddPermission() { } func ExampleSNS_CheckIfPhoneNumberIsOptedOut() { - svc := sns.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sns.New(sess) params := &sns.CheckIfPhoneNumberIsOptedOutInput{ PhoneNumber: aws.String("PhoneNumber"), // Required @@ -63,7 +75,13 @@ func ExampleSNS_CheckIfPhoneNumberIsOptedOut() { } func ExampleSNS_ConfirmSubscription() { - svc := sns.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sns.New(sess) params := &sns.ConfirmSubscriptionInput{ Token: aws.String("token"), // Required @@ -84,7 +102,13 @@ func ExampleSNS_ConfirmSubscription() { } func ExampleSNS_CreatePlatformApplication() { - svc := sns.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sns.New(sess) params := &sns.CreatePlatformApplicationInput{ Attributes: map[string]*string{ // Required @@ -108,7 +132,13 @@ func ExampleSNS_CreatePlatformApplication() { } func ExampleSNS_CreatePlatformEndpoint() { - svc := sns.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sns.New(sess) params := &sns.CreatePlatformEndpointInput{ PlatformApplicationArn: aws.String("String"), // Required @@ -133,7 +163,13 @@ func ExampleSNS_CreatePlatformEndpoint() { } func ExampleSNS_CreateTopic() { - svc := sns.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sns.New(sess) params := &sns.CreateTopicInput{ Name: aws.String("topicName"), // Required @@ -152,7 +188,13 @@ func ExampleSNS_CreateTopic() { } func ExampleSNS_DeleteEndpoint() { - svc := sns.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sns.New(sess) params := &sns.DeleteEndpointInput{ EndpointArn: aws.String("String"), // Required @@ -171,7 +213,13 @@ func ExampleSNS_DeleteEndpoint() { } func ExampleSNS_DeletePlatformApplication() { - svc := sns.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sns.New(sess) params := &sns.DeletePlatformApplicationInput{ PlatformApplicationArn: aws.String("String"), // Required @@ -190,7 +238,13 @@ func ExampleSNS_DeletePlatformApplication() { } func ExampleSNS_DeleteTopic() { - svc := sns.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sns.New(sess) params := &sns.DeleteTopicInput{ TopicArn: aws.String("topicARN"), // Required @@ -209,7 +263,13 @@ func ExampleSNS_DeleteTopic() { } func ExampleSNS_GetEndpointAttributes() { - svc := sns.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sns.New(sess) params := &sns.GetEndpointAttributesInput{ EndpointArn: aws.String("String"), // Required @@ -228,7 +288,13 @@ func ExampleSNS_GetEndpointAttributes() { } func ExampleSNS_GetPlatformApplicationAttributes() { - svc := sns.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sns.New(sess) params := &sns.GetPlatformApplicationAttributesInput{ PlatformApplicationArn: aws.String("String"), // Required @@ -247,7 +313,13 @@ func ExampleSNS_GetPlatformApplicationAttributes() { } func ExampleSNS_GetSMSAttributes() { - svc := sns.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sns.New(sess) params := &sns.GetSMSAttributesInput{ Attributes: []*string{ @@ -269,7 +341,13 @@ func ExampleSNS_GetSMSAttributes() { } func ExampleSNS_GetSubscriptionAttributes() { - svc := sns.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sns.New(sess) params := &sns.GetSubscriptionAttributesInput{ SubscriptionArn: aws.String("subscriptionARN"), // Required @@ -288,7 +366,13 @@ func ExampleSNS_GetSubscriptionAttributes() { } func ExampleSNS_GetTopicAttributes() { - svc := sns.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sns.New(sess) params := &sns.GetTopicAttributesInput{ TopicArn: aws.String("topicARN"), // Required @@ -307,7 +391,13 @@ func ExampleSNS_GetTopicAttributes() { } func ExampleSNS_ListEndpointsByPlatformApplication() { - svc := sns.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sns.New(sess) params := &sns.ListEndpointsByPlatformApplicationInput{ PlatformApplicationArn: aws.String("String"), // Required @@ -327,7 +417,13 @@ func ExampleSNS_ListEndpointsByPlatformApplication() { } func ExampleSNS_ListPhoneNumbersOptedOut() { - svc := sns.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sns.New(sess) params := &sns.ListPhoneNumbersOptedOutInput{ NextToken: aws.String("string"), @@ -346,7 +442,13 @@ func ExampleSNS_ListPhoneNumbersOptedOut() { } func ExampleSNS_ListPlatformApplications() { - svc := sns.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sns.New(sess) params := &sns.ListPlatformApplicationsInput{ NextToken: aws.String("String"), @@ -365,7 +467,13 @@ func ExampleSNS_ListPlatformApplications() { } func ExampleSNS_ListSubscriptions() { - svc := sns.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sns.New(sess) params := &sns.ListSubscriptionsInput{ NextToken: aws.String("nextToken"), @@ -384,7 +492,13 @@ func ExampleSNS_ListSubscriptions() { } func ExampleSNS_ListSubscriptionsByTopic() { - svc := sns.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sns.New(sess) params := &sns.ListSubscriptionsByTopicInput{ TopicArn: aws.String("topicARN"), // Required @@ -404,7 +518,13 @@ func ExampleSNS_ListSubscriptionsByTopic() { } func ExampleSNS_ListTopics() { - svc := sns.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sns.New(sess) params := &sns.ListTopicsInput{ NextToken: aws.String("nextToken"), @@ -423,7 +543,13 @@ func ExampleSNS_ListTopics() { } func ExampleSNS_OptInPhoneNumber() { - svc := sns.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sns.New(sess) params := &sns.OptInPhoneNumberInput{ PhoneNumber: aws.String("PhoneNumber"), // Required @@ -442,7 +568,13 @@ func ExampleSNS_OptInPhoneNumber() { } func ExampleSNS_Publish() { - svc := sns.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sns.New(sess) params := &sns.PublishInput{ Message: aws.String("message"), // Required @@ -474,7 +606,13 @@ func ExampleSNS_Publish() { } func ExampleSNS_RemovePermission() { - svc := sns.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sns.New(sess) params := &sns.RemovePermissionInput{ Label: aws.String("label"), // Required @@ -494,7 +632,13 @@ func ExampleSNS_RemovePermission() { } func ExampleSNS_SetEndpointAttributes() { - svc := sns.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sns.New(sess) params := &sns.SetEndpointAttributesInput{ Attributes: map[string]*string{ // Required @@ -517,7 +661,13 @@ func ExampleSNS_SetEndpointAttributes() { } func ExampleSNS_SetPlatformApplicationAttributes() { - svc := sns.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sns.New(sess) params := &sns.SetPlatformApplicationAttributesInput{ Attributes: map[string]*string{ // Required @@ -540,7 +690,13 @@ func ExampleSNS_SetPlatformApplicationAttributes() { } func ExampleSNS_SetSMSAttributes() { - svc := sns.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sns.New(sess) params := &sns.SetSMSAttributesInput{ Attributes: map[string]*string{ // Required @@ -562,7 +718,13 @@ func ExampleSNS_SetSMSAttributes() { } func ExampleSNS_SetSubscriptionAttributes() { - svc := sns.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sns.New(sess) params := &sns.SetSubscriptionAttributesInput{ AttributeName: aws.String("attributeName"), // Required @@ -583,7 +745,13 @@ func ExampleSNS_SetSubscriptionAttributes() { } func ExampleSNS_SetTopicAttributes() { - svc := sns.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sns.New(sess) params := &sns.SetTopicAttributesInput{ AttributeName: aws.String("attributeName"), // Required @@ -604,7 +772,13 @@ func ExampleSNS_SetTopicAttributes() { } func ExampleSNS_Subscribe() { - svc := sns.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sns.New(sess) params := &sns.SubscribeInput{ Protocol: aws.String("protocol"), // Required @@ -625,7 +799,13 @@ func ExampleSNS_Subscribe() { } func ExampleSNS_Unsubscribe() { - svc := sns.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sns.New(sess) params := &sns.UnsubscribeInput{ SubscriptionArn: aws.String("subscriptionARN"), // Required diff --git a/service/sqs/api_test.go b/service/sqs/api_test.go index 3f5517e605f..4cec7788d66 100644 --- a/service/sqs/api_test.go +++ b/service/sqs/api_test.go @@ -8,12 +8,12 @@ import ( "github.com/stretchr/testify/assert" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/awstesting/unit" "github.com/aws/aws-sdk-go/service/sqs" ) func TestFlattenedTraits(t *testing.T) { - s := sqs.New(session.New()) + s := sqs.New(unit.Session) _, err := s.DeleteMessageBatch(&sqs.DeleteMessageBatchInput{ QueueURL: aws.String("QUEUE"), Entries: []*sqs.DeleteMessageBatchRequestEntry{ diff --git a/service/sqs/examples_test.go b/service/sqs/examples_test.go index 2b862677382..b39289e2a76 100644 --- a/service/sqs/examples_test.go +++ b/service/sqs/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleSQS_AddPermission() { - svc := sqs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sqs.New(sess) params := &sqs.AddPermissionInput{ AWSAccountIds: []*string{ // Required @@ -44,7 +50,13 @@ func ExampleSQS_AddPermission() { } func ExampleSQS_ChangeMessageVisibility() { - svc := sqs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sqs.New(sess) params := &sqs.ChangeMessageVisibilityInput{ QueueUrl: aws.String("String"), // Required @@ -65,7 +77,13 @@ func ExampleSQS_ChangeMessageVisibility() { } func ExampleSQS_ChangeMessageVisibilityBatch() { - svc := sqs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sqs.New(sess) params := &sqs.ChangeMessageVisibilityBatchInput{ Entries: []*sqs.ChangeMessageVisibilityBatchRequestEntry{ // Required @@ -92,7 +110,13 @@ func ExampleSQS_ChangeMessageVisibilityBatch() { } func ExampleSQS_CreateQueue() { - svc := sqs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sqs.New(sess) params := &sqs.CreateQueueInput{ QueueName: aws.String("String"), // Required @@ -115,7 +139,13 @@ func ExampleSQS_CreateQueue() { } func ExampleSQS_DeleteMessage() { - svc := sqs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sqs.New(sess) params := &sqs.DeleteMessageInput{ QueueUrl: aws.String("String"), // Required @@ -135,7 +165,13 @@ func ExampleSQS_DeleteMessage() { } func ExampleSQS_DeleteMessageBatch() { - svc := sqs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sqs.New(sess) params := &sqs.DeleteMessageBatchInput{ Entries: []*sqs.DeleteMessageBatchRequestEntry{ // Required @@ -161,7 +197,13 @@ func ExampleSQS_DeleteMessageBatch() { } func ExampleSQS_DeleteQueue() { - svc := sqs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sqs.New(sess) params := &sqs.DeleteQueueInput{ QueueUrl: aws.String("String"), // Required @@ -180,7 +222,13 @@ func ExampleSQS_DeleteQueue() { } func ExampleSQS_GetQueueAttributes() { - svc := sqs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sqs.New(sess) params := &sqs.GetQueueAttributesInput{ QueueUrl: aws.String("String"), // Required @@ -203,7 +251,13 @@ func ExampleSQS_GetQueueAttributes() { } func ExampleSQS_GetQueueUrl() { - svc := sqs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sqs.New(sess) params := &sqs.GetQueueUrlInput{ QueueName: aws.String("String"), // Required @@ -223,7 +277,13 @@ func ExampleSQS_GetQueueUrl() { } func ExampleSQS_ListDeadLetterSourceQueues() { - svc := sqs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sqs.New(sess) params := &sqs.ListDeadLetterSourceQueuesInput{ QueueUrl: aws.String("String"), // Required @@ -242,7 +302,13 @@ func ExampleSQS_ListDeadLetterSourceQueues() { } func ExampleSQS_ListQueues() { - svc := sqs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sqs.New(sess) params := &sqs.ListQueuesInput{ QueueNamePrefix: aws.String("String"), @@ -261,7 +327,13 @@ func ExampleSQS_ListQueues() { } func ExampleSQS_PurgeQueue() { - svc := sqs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sqs.New(sess) params := &sqs.PurgeQueueInput{ QueueUrl: aws.String("String"), // Required @@ -280,7 +352,13 @@ func ExampleSQS_PurgeQueue() { } func ExampleSQS_ReceiveMessage() { - svc := sqs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sqs.New(sess) params := &sqs.ReceiveMessageInput{ QueueUrl: aws.String("String"), // Required @@ -310,7 +388,13 @@ func ExampleSQS_ReceiveMessage() { } func ExampleSQS_RemovePermission() { - svc := sqs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sqs.New(sess) params := &sqs.RemovePermissionInput{ Label: aws.String("String"), // Required @@ -330,7 +414,13 @@ func ExampleSQS_RemovePermission() { } func ExampleSQS_SendMessage() { - svc := sqs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sqs.New(sess) params := &sqs.SendMessageInput{ MessageBody: aws.String("String"), // Required @@ -367,7 +457,13 @@ func ExampleSQS_SendMessage() { } func ExampleSQS_SendMessageBatch() { - svc := sqs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sqs.New(sess) params := &sqs.SendMessageBatchInput{ Entries: []*sqs.SendMessageBatchRequestEntry{ // Required @@ -410,7 +506,13 @@ func ExampleSQS_SendMessageBatch() { } func ExampleSQS_SetQueueAttributes() { - svc := sqs.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sqs.New(sess) params := &sqs.SetQueueAttributesInput{ Attributes: map[string]*string{ // Required diff --git a/service/ssm/examples_test.go b/service/ssm/examples_test.go index f10b2f88491..fc0cc656947 100644 --- a/service/ssm/examples_test.go +++ b/service/ssm/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleSSM_AddTagsToResource() { - svc := ssm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ssm.New(sess) params := &ssm.AddTagsToResourceInput{ ResourceId: aws.String("ResourceId"), // Required @@ -43,7 +49,13 @@ func ExampleSSM_AddTagsToResource() { } func ExampleSSM_CancelCommand() { - svc := ssm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ssm.New(sess) params := &ssm.CancelCommandInput{ CommandId: aws.String("CommandId"), // Required @@ -66,7 +78,13 @@ func ExampleSSM_CancelCommand() { } func ExampleSSM_CreateActivation() { - svc := ssm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ssm.New(sess) params := &ssm.CreateActivationInput{ IamRole: aws.String("IamRole"), // Required @@ -89,7 +107,13 @@ func ExampleSSM_CreateActivation() { } func ExampleSSM_CreateAssociation() { - svc := ssm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ssm.New(sess) params := &ssm.CreateAssociationInput{ InstanceId: aws.String("InstanceId"), // Required @@ -116,7 +140,13 @@ func ExampleSSM_CreateAssociation() { } func ExampleSSM_CreateAssociationBatch() { - svc := ssm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ssm.New(sess) params := &ssm.CreateAssociationBatchInput{ Entries: []*ssm.CreateAssociationBatchRequestEntry{ // Required @@ -148,7 +178,13 @@ func ExampleSSM_CreateAssociationBatch() { } func ExampleSSM_CreateDocument() { - svc := ssm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ssm.New(sess) params := &ssm.CreateDocumentInput{ Content: aws.String("DocumentContent"), // Required @@ -168,7 +204,13 @@ func ExampleSSM_CreateDocument() { } func ExampleSSM_DeleteActivation() { - svc := ssm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ssm.New(sess) params := &ssm.DeleteActivationInput{ ActivationId: aws.String("ActivationId"), // Required @@ -187,7 +229,13 @@ func ExampleSSM_DeleteActivation() { } func ExampleSSM_DeleteAssociation() { - svc := ssm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ssm.New(sess) params := &ssm.DeleteAssociationInput{ InstanceId: aws.String("InstanceId"), // Required @@ -207,7 +255,13 @@ func ExampleSSM_DeleteAssociation() { } func ExampleSSM_DeleteDocument() { - svc := ssm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ssm.New(sess) params := &ssm.DeleteDocumentInput{ Name: aws.String("DocumentName"), // Required @@ -226,7 +280,13 @@ func ExampleSSM_DeleteDocument() { } func ExampleSSM_DeregisterManagedInstance() { - svc := ssm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ssm.New(sess) params := &ssm.DeregisterManagedInstanceInput{ InstanceId: aws.String("ManagedInstanceId"), // Required @@ -245,7 +305,13 @@ func ExampleSSM_DeregisterManagedInstance() { } func ExampleSSM_DescribeActivations() { - svc := ssm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ssm.New(sess) params := &ssm.DescribeActivationsInput{ Filters: []*ssm.DescribeActivationsFilter{ @@ -275,7 +341,13 @@ func ExampleSSM_DescribeActivations() { } func ExampleSSM_DescribeAssociation() { - svc := ssm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ssm.New(sess) params := &ssm.DescribeAssociationInput{ InstanceId: aws.String("InstanceId"), // Required @@ -295,7 +367,13 @@ func ExampleSSM_DescribeAssociation() { } func ExampleSSM_DescribeDocument() { - svc := ssm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ssm.New(sess) params := &ssm.DescribeDocumentInput{ Name: aws.String("DocumentARN"), // Required @@ -314,7 +392,13 @@ func ExampleSSM_DescribeDocument() { } func ExampleSSM_DescribeDocumentPermission() { - svc := ssm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ssm.New(sess) params := &ssm.DescribeDocumentPermissionInput{ Name: aws.String("DocumentName"), // Required @@ -334,7 +418,13 @@ func ExampleSSM_DescribeDocumentPermission() { } func ExampleSSM_DescribeInstanceInformation() { - svc := ssm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ssm.New(sess) params := &ssm.DescribeInstanceInformationInput{ InstanceInformationFilterList: []*ssm.InstanceInformationFilter{ @@ -364,7 +454,13 @@ func ExampleSSM_DescribeInstanceInformation() { } func ExampleSSM_GetDocument() { - svc := ssm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ssm.New(sess) params := &ssm.GetDocumentInput{ Name: aws.String("DocumentARN"), // Required @@ -383,7 +479,13 @@ func ExampleSSM_GetDocument() { } func ExampleSSM_ListAssociations() { - svc := ssm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ssm.New(sess) params := &ssm.ListAssociationsInput{ AssociationFilterList: []*ssm.AssociationFilter{ // Required @@ -410,7 +512,13 @@ func ExampleSSM_ListAssociations() { } func ExampleSSM_ListCommandInvocations() { - svc := ssm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ssm.New(sess) params := &ssm.ListCommandInvocationsInput{ CommandId: aws.String("CommandId"), @@ -440,7 +548,13 @@ func ExampleSSM_ListCommandInvocations() { } func ExampleSSM_ListCommands() { - svc := ssm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ssm.New(sess) params := &ssm.ListCommandsInput{ CommandId: aws.String("CommandId"), @@ -469,7 +583,13 @@ func ExampleSSM_ListCommands() { } func ExampleSSM_ListDocuments() { - svc := ssm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ssm.New(sess) params := &ssm.ListDocumentsInput{ DocumentFilterList: []*ssm.DocumentFilter{ @@ -496,7 +616,13 @@ func ExampleSSM_ListDocuments() { } func ExampleSSM_ListTagsForResource() { - svc := ssm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ssm.New(sess) params := &ssm.ListTagsForResourceInput{ ResourceId: aws.String("ResourceId"), // Required @@ -516,7 +642,13 @@ func ExampleSSM_ListTagsForResource() { } func ExampleSSM_ModifyDocumentPermission() { - svc := ssm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ssm.New(sess) params := &ssm.ModifyDocumentPermissionInput{ Name: aws.String("DocumentName"), // Required @@ -544,7 +676,13 @@ func ExampleSSM_ModifyDocumentPermission() { } func ExampleSSM_RemoveTagsFromResource() { - svc := ssm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ssm.New(sess) params := &ssm.RemoveTagsFromResourceInput{ ResourceId: aws.String("ResourceId"), // Required @@ -568,7 +706,13 @@ func ExampleSSM_RemoveTagsFromResource() { } func ExampleSSM_SendCommand() { - svc := ssm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ssm.New(sess) params := &ssm.SendCommandInput{ DocumentName: aws.String("DocumentARN"), // Required @@ -613,7 +757,13 @@ func ExampleSSM_SendCommand() { } func ExampleSSM_UpdateAssociationStatus() { - svc := ssm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ssm.New(sess) params := &ssm.UpdateAssociationStatusInput{ AssociationStatus: &ssm.AssociationStatus{ // Required @@ -639,7 +789,13 @@ func ExampleSSM_UpdateAssociationStatus() { } func ExampleSSM_UpdateManagedInstanceRole() { - svc := ssm.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := ssm.New(sess) params := &ssm.UpdateManagedInstanceRoleInput{ IamRole: aws.String("IamRole"), // Required diff --git a/service/storagegateway/examples_test.go b/service/storagegateway/examples_test.go index 5f03167fabb..813e49e61fb 100644 --- a/service/storagegateway/examples_test.go +++ b/service/storagegateway/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleStorageGateway_ActivateGateway() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.ActivateGatewayInput{ ActivationKey: aws.String("ActivationKey"), // Required @@ -41,7 +47,13 @@ func ExampleStorageGateway_ActivateGateway() { } func ExampleStorageGateway_AddCache() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.AddCacheInput{ DiskIds: []*string{ // Required @@ -64,7 +76,13 @@ func ExampleStorageGateway_AddCache() { } func ExampleStorageGateway_AddTagsToResource() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.AddTagsToResourceInput{ ResourceARN: aws.String("ResourceARN"), // Required @@ -90,7 +108,13 @@ func ExampleStorageGateway_AddTagsToResource() { } func ExampleStorageGateway_AddUploadBuffer() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.AddUploadBufferInput{ DiskIds: []*string{ // Required @@ -113,7 +137,13 @@ func ExampleStorageGateway_AddUploadBuffer() { } func ExampleStorageGateway_AddWorkingStorage() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.AddWorkingStorageInput{ DiskIds: []*string{ // Required @@ -136,7 +166,13 @@ func ExampleStorageGateway_AddWorkingStorage() { } func ExampleStorageGateway_CancelArchival() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.CancelArchivalInput{ GatewayARN: aws.String("GatewayARN"), // Required @@ -156,7 +192,13 @@ func ExampleStorageGateway_CancelArchival() { } func ExampleStorageGateway_CancelRetrieval() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.CancelRetrievalInput{ GatewayARN: aws.String("GatewayARN"), // Required @@ -176,7 +218,13 @@ func ExampleStorageGateway_CancelRetrieval() { } func ExampleStorageGateway_CreateCachediSCSIVolume() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.CreateCachediSCSIVolumeInput{ ClientToken: aws.String("ClientToken"), // Required @@ -200,7 +248,13 @@ func ExampleStorageGateway_CreateCachediSCSIVolume() { } func ExampleStorageGateway_CreateSnapshot() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.CreateSnapshotInput{ SnapshotDescription: aws.String("SnapshotDescription"), // Required @@ -220,7 +274,13 @@ func ExampleStorageGateway_CreateSnapshot() { } func ExampleStorageGateway_CreateSnapshotFromVolumeRecoveryPoint() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.CreateSnapshotFromVolumeRecoveryPointInput{ SnapshotDescription: aws.String("SnapshotDescription"), // Required @@ -240,7 +300,13 @@ func ExampleStorageGateway_CreateSnapshotFromVolumeRecoveryPoint() { } func ExampleStorageGateway_CreateStorediSCSIVolume() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.CreateStorediSCSIVolumeInput{ DiskId: aws.String("DiskId"), // Required @@ -264,7 +330,13 @@ func ExampleStorageGateway_CreateStorediSCSIVolume() { } func ExampleStorageGateway_CreateTapeWithBarcode() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.CreateTapeWithBarcodeInput{ GatewayARN: aws.String("GatewayARN"), // Required @@ -285,7 +357,13 @@ func ExampleStorageGateway_CreateTapeWithBarcode() { } func ExampleStorageGateway_CreateTapes() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.CreateTapesInput{ ClientToken: aws.String("ClientToken"), // Required @@ -308,7 +386,13 @@ func ExampleStorageGateway_CreateTapes() { } func ExampleStorageGateway_DeleteBandwidthRateLimit() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.DeleteBandwidthRateLimitInput{ BandwidthType: aws.String("BandwidthType"), // Required @@ -328,7 +412,13 @@ func ExampleStorageGateway_DeleteBandwidthRateLimit() { } func ExampleStorageGateway_DeleteChapCredentials() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.DeleteChapCredentialsInput{ InitiatorName: aws.String("IqnName"), // Required @@ -348,7 +438,13 @@ func ExampleStorageGateway_DeleteChapCredentials() { } func ExampleStorageGateway_DeleteGateway() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.DeleteGatewayInput{ GatewayARN: aws.String("GatewayARN"), // Required @@ -367,7 +463,13 @@ func ExampleStorageGateway_DeleteGateway() { } func ExampleStorageGateway_DeleteSnapshotSchedule() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.DeleteSnapshotScheduleInput{ VolumeARN: aws.String("VolumeARN"), // Required @@ -386,7 +488,13 @@ func ExampleStorageGateway_DeleteSnapshotSchedule() { } func ExampleStorageGateway_DeleteTape() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.DeleteTapeInput{ GatewayARN: aws.String("GatewayARN"), // Required @@ -406,7 +514,13 @@ func ExampleStorageGateway_DeleteTape() { } func ExampleStorageGateway_DeleteTapeArchive() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.DeleteTapeArchiveInput{ TapeARN: aws.String("TapeARN"), // Required @@ -425,7 +539,13 @@ func ExampleStorageGateway_DeleteTapeArchive() { } func ExampleStorageGateway_DeleteVolume() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.DeleteVolumeInput{ VolumeARN: aws.String("VolumeARN"), // Required @@ -444,7 +564,13 @@ func ExampleStorageGateway_DeleteVolume() { } func ExampleStorageGateway_DescribeBandwidthRateLimit() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.DescribeBandwidthRateLimitInput{ GatewayARN: aws.String("GatewayARN"), // Required @@ -463,7 +589,13 @@ func ExampleStorageGateway_DescribeBandwidthRateLimit() { } func ExampleStorageGateway_DescribeCache() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.DescribeCacheInput{ GatewayARN: aws.String("GatewayARN"), // Required @@ -482,7 +614,13 @@ func ExampleStorageGateway_DescribeCache() { } func ExampleStorageGateway_DescribeCachediSCSIVolumes() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.DescribeCachediSCSIVolumesInput{ VolumeARNs: []*string{ // Required @@ -504,7 +642,13 @@ func ExampleStorageGateway_DescribeCachediSCSIVolumes() { } func ExampleStorageGateway_DescribeChapCredentials() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.DescribeChapCredentialsInput{ TargetARN: aws.String("TargetARN"), // Required @@ -523,7 +667,13 @@ func ExampleStorageGateway_DescribeChapCredentials() { } func ExampleStorageGateway_DescribeGatewayInformation() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.DescribeGatewayInformationInput{ GatewayARN: aws.String("GatewayARN"), // Required @@ -542,7 +692,13 @@ func ExampleStorageGateway_DescribeGatewayInformation() { } func ExampleStorageGateway_DescribeMaintenanceStartTime() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.DescribeMaintenanceStartTimeInput{ GatewayARN: aws.String("GatewayARN"), // Required @@ -561,7 +717,13 @@ func ExampleStorageGateway_DescribeMaintenanceStartTime() { } func ExampleStorageGateway_DescribeSnapshotSchedule() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.DescribeSnapshotScheduleInput{ VolumeARN: aws.String("VolumeARN"), // Required @@ -580,7 +742,13 @@ func ExampleStorageGateway_DescribeSnapshotSchedule() { } func ExampleStorageGateway_DescribeStorediSCSIVolumes() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.DescribeStorediSCSIVolumesInput{ VolumeARNs: []*string{ // Required @@ -602,7 +770,13 @@ func ExampleStorageGateway_DescribeStorediSCSIVolumes() { } func ExampleStorageGateway_DescribeTapeArchives() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.DescribeTapeArchivesInput{ Limit: aws.Int64(1), @@ -626,7 +800,13 @@ func ExampleStorageGateway_DescribeTapeArchives() { } func ExampleStorageGateway_DescribeTapeRecoveryPoints() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.DescribeTapeRecoveryPointsInput{ GatewayARN: aws.String("GatewayARN"), // Required @@ -647,7 +827,13 @@ func ExampleStorageGateway_DescribeTapeRecoveryPoints() { } func ExampleStorageGateway_DescribeTapes() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.DescribeTapesInput{ GatewayARN: aws.String("GatewayARN"), // Required @@ -672,7 +858,13 @@ func ExampleStorageGateway_DescribeTapes() { } func ExampleStorageGateway_DescribeUploadBuffer() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.DescribeUploadBufferInput{ GatewayARN: aws.String("GatewayARN"), // Required @@ -691,7 +883,13 @@ func ExampleStorageGateway_DescribeUploadBuffer() { } func ExampleStorageGateway_DescribeVTLDevices() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.DescribeVTLDevicesInput{ GatewayARN: aws.String("GatewayARN"), // Required @@ -716,7 +914,13 @@ func ExampleStorageGateway_DescribeVTLDevices() { } func ExampleStorageGateway_DescribeWorkingStorage() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.DescribeWorkingStorageInput{ GatewayARN: aws.String("GatewayARN"), // Required @@ -735,7 +939,13 @@ func ExampleStorageGateway_DescribeWorkingStorage() { } func ExampleStorageGateway_DisableGateway() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.DisableGatewayInput{ GatewayARN: aws.String("GatewayARN"), // Required @@ -754,7 +964,13 @@ func ExampleStorageGateway_DisableGateway() { } func ExampleStorageGateway_ListGateways() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.ListGatewaysInput{ Limit: aws.Int64(1), @@ -774,7 +990,13 @@ func ExampleStorageGateway_ListGateways() { } func ExampleStorageGateway_ListLocalDisks() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.ListLocalDisksInput{ GatewayARN: aws.String("GatewayARN"), // Required @@ -793,7 +1015,13 @@ func ExampleStorageGateway_ListLocalDisks() { } func ExampleStorageGateway_ListTagsForResource() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.ListTagsForResourceInput{ ResourceARN: aws.String("ResourceARN"), // Required @@ -814,7 +1042,13 @@ func ExampleStorageGateway_ListTagsForResource() { } func ExampleStorageGateway_ListTapes() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.ListTapesInput{ Limit: aws.Int64(1), @@ -838,7 +1072,13 @@ func ExampleStorageGateway_ListTapes() { } func ExampleStorageGateway_ListVolumeInitiators() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.ListVolumeInitiatorsInput{ VolumeARN: aws.String("VolumeARN"), // Required @@ -857,7 +1097,13 @@ func ExampleStorageGateway_ListVolumeInitiators() { } func ExampleStorageGateway_ListVolumeRecoveryPoints() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.ListVolumeRecoveryPointsInput{ GatewayARN: aws.String("GatewayARN"), // Required @@ -876,7 +1122,13 @@ func ExampleStorageGateway_ListVolumeRecoveryPoints() { } func ExampleStorageGateway_ListVolumes() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.ListVolumesInput{ GatewayARN: aws.String("GatewayARN"), @@ -897,7 +1149,13 @@ func ExampleStorageGateway_ListVolumes() { } func ExampleStorageGateway_RemoveTagsFromResource() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.RemoveTagsFromResourceInput{ ResourceARN: aws.String("ResourceARN"), // Required @@ -920,7 +1178,13 @@ func ExampleStorageGateway_RemoveTagsFromResource() { } func ExampleStorageGateway_ResetCache() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.ResetCacheInput{ GatewayARN: aws.String("GatewayARN"), // Required @@ -939,7 +1203,13 @@ func ExampleStorageGateway_ResetCache() { } func ExampleStorageGateway_RetrieveTapeArchive() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.RetrieveTapeArchiveInput{ GatewayARN: aws.String("GatewayARN"), // Required @@ -959,7 +1229,13 @@ func ExampleStorageGateway_RetrieveTapeArchive() { } func ExampleStorageGateway_RetrieveTapeRecoveryPoint() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.RetrieveTapeRecoveryPointInput{ GatewayARN: aws.String("GatewayARN"), // Required @@ -979,7 +1255,13 @@ func ExampleStorageGateway_RetrieveTapeRecoveryPoint() { } func ExampleStorageGateway_SetLocalConsolePassword() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.SetLocalConsolePasswordInput{ GatewayARN: aws.String("GatewayARN"), // Required @@ -999,7 +1281,13 @@ func ExampleStorageGateway_SetLocalConsolePassword() { } func ExampleStorageGateway_ShutdownGateway() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.ShutdownGatewayInput{ GatewayARN: aws.String("GatewayARN"), // Required @@ -1018,7 +1306,13 @@ func ExampleStorageGateway_ShutdownGateway() { } func ExampleStorageGateway_StartGateway() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.StartGatewayInput{ GatewayARN: aws.String("GatewayARN"), // Required @@ -1037,7 +1331,13 @@ func ExampleStorageGateway_StartGateway() { } func ExampleStorageGateway_UpdateBandwidthRateLimit() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.UpdateBandwidthRateLimitInput{ GatewayARN: aws.String("GatewayARN"), // Required @@ -1058,7 +1358,13 @@ func ExampleStorageGateway_UpdateBandwidthRateLimit() { } func ExampleStorageGateway_UpdateChapCredentials() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.UpdateChapCredentialsInput{ InitiatorName: aws.String("IqnName"), // Required @@ -1080,7 +1386,13 @@ func ExampleStorageGateway_UpdateChapCredentials() { } func ExampleStorageGateway_UpdateGatewayInformation() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.UpdateGatewayInformationInput{ GatewayARN: aws.String("GatewayARN"), // Required @@ -1101,7 +1413,13 @@ func ExampleStorageGateway_UpdateGatewayInformation() { } func ExampleStorageGateway_UpdateGatewaySoftwareNow() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.UpdateGatewaySoftwareNowInput{ GatewayARN: aws.String("GatewayARN"), // Required @@ -1120,7 +1438,13 @@ func ExampleStorageGateway_UpdateGatewaySoftwareNow() { } func ExampleStorageGateway_UpdateMaintenanceStartTime() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.UpdateMaintenanceStartTimeInput{ DayOfWeek: aws.Int64(1), // Required @@ -1142,7 +1466,13 @@ func ExampleStorageGateway_UpdateMaintenanceStartTime() { } func ExampleStorageGateway_UpdateSnapshotSchedule() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.UpdateSnapshotScheduleInput{ RecurrenceInHours: aws.Int64(1), // Required @@ -1164,7 +1494,13 @@ func ExampleStorageGateway_UpdateSnapshotSchedule() { } func ExampleStorageGateway_UpdateVTLDeviceType() { - svc := storagegateway.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := storagegateway.New(sess) params := &storagegateway.UpdateVTLDeviceTypeInput{ DeviceType: aws.String("DeviceType"), // Required diff --git a/service/sts/examples_test.go b/service/sts/examples_test.go index c77c93d7e6e..2724ed4d4e6 100644 --- a/service/sts/examples_test.go +++ b/service/sts/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleSTS_AssumeRole() { - svc := sts.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sts.New(sess) params := &sts.AssumeRoleInput{ RoleArn: aws.String("arnType"), // Required @@ -41,7 +47,13 @@ func ExampleSTS_AssumeRole() { } func ExampleSTS_AssumeRoleWithSAML() { - svc := sts.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sts.New(sess) params := &sts.AssumeRoleWithSAMLInput{ PrincipalArn: aws.String("arnType"), // Required @@ -64,7 +76,13 @@ func ExampleSTS_AssumeRoleWithSAML() { } func ExampleSTS_AssumeRoleWithWebIdentity() { - svc := sts.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sts.New(sess) params := &sts.AssumeRoleWithWebIdentityInput{ RoleArn: aws.String("arnType"), // Required @@ -88,7 +106,13 @@ func ExampleSTS_AssumeRoleWithWebIdentity() { } func ExampleSTS_DecodeAuthorizationMessage() { - svc := sts.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sts.New(sess) params := &sts.DecodeAuthorizationMessageInput{ EncodedMessage: aws.String("encodedMessageType"), // Required @@ -107,7 +131,13 @@ func ExampleSTS_DecodeAuthorizationMessage() { } func ExampleSTS_GetCallerIdentity() { - svc := sts.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sts.New(sess) var params *sts.GetCallerIdentityInput resp, err := svc.GetCallerIdentity(params) @@ -124,7 +154,13 @@ func ExampleSTS_GetCallerIdentity() { } func ExampleSTS_GetFederationToken() { - svc := sts.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sts.New(sess) params := &sts.GetFederationTokenInput{ Name: aws.String("userNameType"), // Required @@ -145,7 +181,13 @@ func ExampleSTS_GetFederationToken() { } func ExampleSTS_GetSessionToken() { - svc := sts.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := sts.New(sess) params := &sts.GetSessionTokenInput{ DurationSeconds: aws.Int64(1), diff --git a/service/support/examples_test.go b/service/support/examples_test.go index b67d41b8bf0..3914e5cb41b 100644 --- a/service/support/examples_test.go +++ b/service/support/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleSupport_AddAttachmentsToSet() { - svc := support.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := support.New(sess) params := &support.AddAttachmentsToSetInput{ Attachments: []*support.Attachment{ // Required @@ -42,7 +48,13 @@ func ExampleSupport_AddAttachmentsToSet() { } func ExampleSupport_AddCommunicationToCase() { - svc := support.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := support.New(sess) params := &support.AddCommunicationToCaseInput{ CommunicationBody: aws.String("CommunicationBody"), // Required @@ -67,7 +79,13 @@ func ExampleSupport_AddCommunicationToCase() { } func ExampleSupport_CreateCase() { - svc := support.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := support.New(sess) params := &support.CreateCaseInput{ CommunicationBody: aws.String("CommunicationBody"), // Required @@ -97,7 +115,13 @@ func ExampleSupport_CreateCase() { } func ExampleSupport_DescribeAttachment() { - svc := support.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := support.New(sess) params := &support.DescribeAttachmentInput{ AttachmentId: aws.String("AttachmentId"), // Required @@ -116,7 +140,13 @@ func ExampleSupport_DescribeAttachment() { } func ExampleSupport_DescribeCases() { - svc := support.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := support.New(sess) params := &support.DescribeCasesInput{ AfterTime: aws.String("AfterTime"), @@ -146,7 +176,13 @@ func ExampleSupport_DescribeCases() { } func ExampleSupport_DescribeCommunications() { - svc := support.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := support.New(sess) params := &support.DescribeCommunicationsInput{ CaseId: aws.String("CaseId"), // Required @@ -169,7 +205,13 @@ func ExampleSupport_DescribeCommunications() { } func ExampleSupport_DescribeServices() { - svc := support.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := support.New(sess) params := &support.DescribeServicesInput{ Language: aws.String("Language"), @@ -192,7 +234,13 @@ func ExampleSupport_DescribeServices() { } func ExampleSupport_DescribeSeverityLevels() { - svc := support.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := support.New(sess) params := &support.DescribeSeverityLevelsInput{ Language: aws.String("Language"), @@ -211,7 +259,13 @@ func ExampleSupport_DescribeSeverityLevels() { } func ExampleSupport_DescribeTrustedAdvisorCheckRefreshStatuses() { - svc := support.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := support.New(sess) params := &support.DescribeTrustedAdvisorCheckRefreshStatusesInput{ CheckIds: []*string{ // Required @@ -233,7 +287,13 @@ func ExampleSupport_DescribeTrustedAdvisorCheckRefreshStatuses() { } func ExampleSupport_DescribeTrustedAdvisorCheckResult() { - svc := support.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := support.New(sess) params := &support.DescribeTrustedAdvisorCheckResultInput{ CheckId: aws.String("String"), // Required @@ -253,7 +313,13 @@ func ExampleSupport_DescribeTrustedAdvisorCheckResult() { } func ExampleSupport_DescribeTrustedAdvisorCheckSummaries() { - svc := support.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := support.New(sess) params := &support.DescribeTrustedAdvisorCheckSummariesInput{ CheckIds: []*string{ // Required @@ -275,7 +341,13 @@ func ExampleSupport_DescribeTrustedAdvisorCheckSummaries() { } func ExampleSupport_DescribeTrustedAdvisorChecks() { - svc := support.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := support.New(sess) params := &support.DescribeTrustedAdvisorChecksInput{ Language: aws.String("String"), // Required @@ -294,7 +366,13 @@ func ExampleSupport_DescribeTrustedAdvisorChecks() { } func ExampleSupport_RefreshTrustedAdvisorCheck() { - svc := support.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := support.New(sess) params := &support.RefreshTrustedAdvisorCheckInput{ CheckId: aws.String("String"), // Required @@ -313,7 +391,13 @@ func ExampleSupport_RefreshTrustedAdvisorCheck() { } func ExampleSupport_ResolveCase() { - svc := support.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := support.New(sess) params := &support.ResolveCaseInput{ CaseId: aws.String("CaseId"), diff --git a/service/swf/examples_test.go b/service/swf/examples_test.go index 7c993fbaf73..9491ef7dd7d 100644 --- a/service/swf/examples_test.go +++ b/service/swf/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleSWF_CountClosedWorkflowExecutions() { - svc := swf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := swf.New(sess) params := &swf.CountClosedWorkflowExecutionsInput{ Domain: aws.String("DomainName"), // Required @@ -56,7 +62,13 @@ func ExampleSWF_CountClosedWorkflowExecutions() { } func ExampleSWF_CountOpenWorkflowExecutions() { - svc := swf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := swf.New(sess) params := &swf.CountOpenWorkflowExecutionsInput{ Domain: aws.String("DomainName"), // Required @@ -89,7 +101,13 @@ func ExampleSWF_CountOpenWorkflowExecutions() { } func ExampleSWF_CountPendingActivityTasks() { - svc := swf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := swf.New(sess) params := &swf.CountPendingActivityTasksInput{ Domain: aws.String("DomainName"), // Required @@ -111,7 +129,13 @@ func ExampleSWF_CountPendingActivityTasks() { } func ExampleSWF_CountPendingDecisionTasks() { - svc := swf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := swf.New(sess) params := &swf.CountPendingDecisionTasksInput{ Domain: aws.String("DomainName"), // Required @@ -133,7 +157,13 @@ func ExampleSWF_CountPendingDecisionTasks() { } func ExampleSWF_DeprecateActivityType() { - svc := swf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := swf.New(sess) params := &swf.DeprecateActivityTypeInput{ ActivityType: &swf.ActivityType{ // Required @@ -156,7 +186,13 @@ func ExampleSWF_DeprecateActivityType() { } func ExampleSWF_DeprecateDomain() { - svc := swf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := swf.New(sess) params := &swf.DeprecateDomainInput{ Name: aws.String("DomainName"), // Required @@ -175,7 +211,13 @@ func ExampleSWF_DeprecateDomain() { } func ExampleSWF_DeprecateWorkflowType() { - svc := swf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := swf.New(sess) params := &swf.DeprecateWorkflowTypeInput{ Domain: aws.String("DomainName"), // Required @@ -198,7 +240,13 @@ func ExampleSWF_DeprecateWorkflowType() { } func ExampleSWF_DescribeActivityType() { - svc := swf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := swf.New(sess) params := &swf.DescribeActivityTypeInput{ ActivityType: &swf.ActivityType{ // Required @@ -221,7 +269,13 @@ func ExampleSWF_DescribeActivityType() { } func ExampleSWF_DescribeDomain() { - svc := swf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := swf.New(sess) params := &swf.DescribeDomainInput{ Name: aws.String("DomainName"), // Required @@ -240,7 +294,13 @@ func ExampleSWF_DescribeDomain() { } func ExampleSWF_DescribeWorkflowExecution() { - svc := swf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := swf.New(sess) params := &swf.DescribeWorkflowExecutionInput{ Domain: aws.String("DomainName"), // Required @@ -263,7 +323,13 @@ func ExampleSWF_DescribeWorkflowExecution() { } func ExampleSWF_DescribeWorkflowType() { - svc := swf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := swf.New(sess) params := &swf.DescribeWorkflowTypeInput{ Domain: aws.String("DomainName"), // Required @@ -286,7 +352,13 @@ func ExampleSWF_DescribeWorkflowType() { } func ExampleSWF_GetWorkflowExecutionHistory() { - svc := swf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := swf.New(sess) params := &swf.GetWorkflowExecutionHistoryInput{ Domain: aws.String("DomainName"), // Required @@ -312,7 +384,13 @@ func ExampleSWF_GetWorkflowExecutionHistory() { } func ExampleSWF_ListActivityTypes() { - svc := swf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := swf.New(sess) params := &swf.ListActivityTypesInput{ Domain: aws.String("DomainName"), // Required @@ -336,7 +414,13 @@ func ExampleSWF_ListActivityTypes() { } func ExampleSWF_ListClosedWorkflowExecutions() { - svc := swf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := swf.New(sess) params := &swf.ListClosedWorkflowExecutionsInput{ Domain: aws.String("DomainName"), // Required @@ -379,7 +463,13 @@ func ExampleSWF_ListClosedWorkflowExecutions() { } func ExampleSWF_ListDomains() { - svc := swf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := swf.New(sess) params := &swf.ListDomainsInput{ RegistrationStatus: aws.String("RegistrationStatus"), // Required @@ -401,7 +491,13 @@ func ExampleSWF_ListDomains() { } func ExampleSWF_ListOpenWorkflowExecutions() { - svc := swf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := swf.New(sess) params := &swf.ListOpenWorkflowExecutionsInput{ Domain: aws.String("DomainName"), // Required @@ -437,7 +533,13 @@ func ExampleSWF_ListOpenWorkflowExecutions() { } func ExampleSWF_ListWorkflowTypes() { - svc := swf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := swf.New(sess) params := &swf.ListWorkflowTypesInput{ Domain: aws.String("DomainName"), // Required @@ -461,7 +563,13 @@ func ExampleSWF_ListWorkflowTypes() { } func ExampleSWF_PollForActivityTask() { - svc := swf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := swf.New(sess) params := &swf.PollForActivityTaskInput{ Domain: aws.String("DomainName"), // Required @@ -484,7 +592,13 @@ func ExampleSWF_PollForActivityTask() { } func ExampleSWF_PollForDecisionTask() { - svc := swf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := swf.New(sess) params := &swf.PollForDecisionTaskInput{ Domain: aws.String("DomainName"), // Required @@ -510,7 +624,13 @@ func ExampleSWF_PollForDecisionTask() { } func ExampleSWF_RecordActivityTaskHeartbeat() { - svc := swf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := swf.New(sess) params := &swf.RecordActivityTaskHeartbeatInput{ TaskToken: aws.String("TaskToken"), // Required @@ -530,7 +650,13 @@ func ExampleSWF_RecordActivityTaskHeartbeat() { } func ExampleSWF_RegisterActivityType() { - svc := swf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := swf.New(sess) params := &swf.RegisterActivityTypeInput{ Domain: aws.String("DomainName"), // Required @@ -560,7 +686,13 @@ func ExampleSWF_RegisterActivityType() { } func ExampleSWF_RegisterDomain() { - svc := swf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := swf.New(sess) params := &swf.RegisterDomainInput{ Name: aws.String("DomainName"), // Required @@ -581,7 +713,13 @@ func ExampleSWF_RegisterDomain() { } func ExampleSWF_RegisterWorkflowType() { - svc := swf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := swf.New(sess) params := &swf.RegisterWorkflowTypeInput{ Domain: aws.String("DomainName"), // Required @@ -611,7 +749,13 @@ func ExampleSWF_RegisterWorkflowType() { } func ExampleSWF_RequestCancelWorkflowExecution() { - svc := swf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := swf.New(sess) params := &swf.RequestCancelWorkflowExecutionInput{ Domain: aws.String("DomainName"), // Required @@ -632,7 +776,13 @@ func ExampleSWF_RequestCancelWorkflowExecution() { } func ExampleSWF_RespondActivityTaskCanceled() { - svc := swf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := swf.New(sess) params := &swf.RespondActivityTaskCanceledInput{ TaskToken: aws.String("TaskToken"), // Required @@ -652,7 +802,13 @@ func ExampleSWF_RespondActivityTaskCanceled() { } func ExampleSWF_RespondActivityTaskCompleted() { - svc := swf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := swf.New(sess) params := &swf.RespondActivityTaskCompletedInput{ TaskToken: aws.String("TaskToken"), // Required @@ -672,7 +828,13 @@ func ExampleSWF_RespondActivityTaskCompleted() { } func ExampleSWF_RespondActivityTaskFailed() { - svc := swf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := swf.New(sess) params := &swf.RespondActivityTaskFailedInput{ TaskToken: aws.String("TaskToken"), // Required @@ -693,7 +855,13 @@ func ExampleSWF_RespondActivityTaskFailed() { } func ExampleSWF_RespondDecisionTaskCompleted() { - svc := swf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := swf.New(sess) params := &swf.RespondDecisionTaskCompletedInput{ TaskToken: aws.String("TaskToken"), // Required @@ -816,7 +984,13 @@ func ExampleSWF_RespondDecisionTaskCompleted() { } func ExampleSWF_SignalWorkflowExecution() { - svc := swf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := swf.New(sess) params := &swf.SignalWorkflowExecutionInput{ Domain: aws.String("DomainName"), // Required @@ -839,7 +1013,13 @@ func ExampleSWF_SignalWorkflowExecution() { } func ExampleSWF_StartWorkflowExecution() { - svc := swf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := swf.New(sess) params := &swf.StartWorkflowExecutionInput{ Domain: aws.String("DomainName"), // Required @@ -876,7 +1056,13 @@ func ExampleSWF_StartWorkflowExecution() { } func ExampleSWF_TerminateWorkflowExecution() { - svc := swf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := swf.New(sess) params := &swf.TerminateWorkflowExecutionInput{ Domain: aws.String("DomainName"), // Required diff --git a/service/waf/examples_test.go b/service/waf/examples_test.go index d5aed3d0c32..1c6068eff5e 100644 --- a/service/waf/examples_test.go +++ b/service/waf/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleWAF_CreateByteMatchSet() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.CreateByteMatchSetInput{ ChangeToken: aws.String("ChangeToken"), // Required @@ -36,7 +42,13 @@ func ExampleWAF_CreateByteMatchSet() { } func ExampleWAF_CreateIPSet() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.CreateIPSetInput{ ChangeToken: aws.String("ChangeToken"), // Required @@ -56,7 +68,13 @@ func ExampleWAF_CreateIPSet() { } func ExampleWAF_CreateRule() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.CreateRuleInput{ ChangeToken: aws.String("ChangeToken"), // Required @@ -77,7 +95,13 @@ func ExampleWAF_CreateRule() { } func ExampleWAF_CreateSizeConstraintSet() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.CreateSizeConstraintSetInput{ ChangeToken: aws.String("ChangeToken"), // Required @@ -97,7 +121,13 @@ func ExampleWAF_CreateSizeConstraintSet() { } func ExampleWAF_CreateSqlInjectionMatchSet() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.CreateSqlInjectionMatchSetInput{ ChangeToken: aws.String("ChangeToken"), // Required @@ -117,7 +147,13 @@ func ExampleWAF_CreateSqlInjectionMatchSet() { } func ExampleWAF_CreateWebACL() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.CreateWebACLInput{ ChangeToken: aws.String("ChangeToken"), // Required @@ -141,7 +177,13 @@ func ExampleWAF_CreateWebACL() { } func ExampleWAF_CreateXssMatchSet() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.CreateXssMatchSetInput{ ChangeToken: aws.String("ChangeToken"), // Required @@ -161,7 +203,13 @@ func ExampleWAF_CreateXssMatchSet() { } func ExampleWAF_DeleteByteMatchSet() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.DeleteByteMatchSetInput{ ByteMatchSetId: aws.String("ResourceId"), // Required @@ -181,7 +229,13 @@ func ExampleWAF_DeleteByteMatchSet() { } func ExampleWAF_DeleteIPSet() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.DeleteIPSetInput{ ChangeToken: aws.String("ChangeToken"), // Required @@ -201,7 +255,13 @@ func ExampleWAF_DeleteIPSet() { } func ExampleWAF_DeleteRule() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.DeleteRuleInput{ ChangeToken: aws.String("ChangeToken"), // Required @@ -221,7 +281,13 @@ func ExampleWAF_DeleteRule() { } func ExampleWAF_DeleteSizeConstraintSet() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.DeleteSizeConstraintSetInput{ ChangeToken: aws.String("ChangeToken"), // Required @@ -241,7 +307,13 @@ func ExampleWAF_DeleteSizeConstraintSet() { } func ExampleWAF_DeleteSqlInjectionMatchSet() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.DeleteSqlInjectionMatchSetInput{ ChangeToken: aws.String("ChangeToken"), // Required @@ -261,7 +333,13 @@ func ExampleWAF_DeleteSqlInjectionMatchSet() { } func ExampleWAF_DeleteWebACL() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.DeleteWebACLInput{ ChangeToken: aws.String("ChangeToken"), // Required @@ -281,7 +359,13 @@ func ExampleWAF_DeleteWebACL() { } func ExampleWAF_DeleteXssMatchSet() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.DeleteXssMatchSetInput{ ChangeToken: aws.String("ChangeToken"), // Required @@ -301,7 +385,13 @@ func ExampleWAF_DeleteXssMatchSet() { } func ExampleWAF_GetByteMatchSet() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.GetByteMatchSetInput{ ByteMatchSetId: aws.String("ResourceId"), // Required @@ -320,7 +410,13 @@ func ExampleWAF_GetByteMatchSet() { } func ExampleWAF_GetChangeToken() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) var params *waf.GetChangeTokenInput resp, err := svc.GetChangeToken(params) @@ -337,7 +433,13 @@ func ExampleWAF_GetChangeToken() { } func ExampleWAF_GetChangeTokenStatus() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.GetChangeTokenStatusInput{ ChangeToken: aws.String("ChangeToken"), // Required @@ -356,7 +458,13 @@ func ExampleWAF_GetChangeTokenStatus() { } func ExampleWAF_GetIPSet() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.GetIPSetInput{ IPSetId: aws.String("ResourceId"), // Required @@ -375,7 +483,13 @@ func ExampleWAF_GetIPSet() { } func ExampleWAF_GetRule() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.GetRuleInput{ RuleId: aws.String("ResourceId"), // Required @@ -394,7 +508,13 @@ func ExampleWAF_GetRule() { } func ExampleWAF_GetSampledRequests() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.GetSampledRequestsInput{ MaxItems: aws.Int64(1), // Required @@ -419,7 +539,13 @@ func ExampleWAF_GetSampledRequests() { } func ExampleWAF_GetSizeConstraintSet() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.GetSizeConstraintSetInput{ SizeConstraintSetId: aws.String("ResourceId"), // Required @@ -438,7 +564,13 @@ func ExampleWAF_GetSizeConstraintSet() { } func ExampleWAF_GetSqlInjectionMatchSet() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.GetSqlInjectionMatchSetInput{ SqlInjectionMatchSetId: aws.String("ResourceId"), // Required @@ -457,7 +589,13 @@ func ExampleWAF_GetSqlInjectionMatchSet() { } func ExampleWAF_GetWebACL() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.GetWebACLInput{ WebACLId: aws.String("ResourceId"), // Required @@ -476,7 +614,13 @@ func ExampleWAF_GetWebACL() { } func ExampleWAF_GetXssMatchSet() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.GetXssMatchSetInput{ XssMatchSetId: aws.String("ResourceId"), // Required @@ -495,7 +639,13 @@ func ExampleWAF_GetXssMatchSet() { } func ExampleWAF_ListByteMatchSets() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.ListByteMatchSetsInput{ Limit: aws.Int64(1), // Required @@ -515,7 +665,13 @@ func ExampleWAF_ListByteMatchSets() { } func ExampleWAF_ListIPSets() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.ListIPSetsInput{ Limit: aws.Int64(1), // Required @@ -535,7 +691,13 @@ func ExampleWAF_ListIPSets() { } func ExampleWAF_ListRules() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.ListRulesInput{ Limit: aws.Int64(1), // Required @@ -555,7 +717,13 @@ func ExampleWAF_ListRules() { } func ExampleWAF_ListSizeConstraintSets() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.ListSizeConstraintSetsInput{ Limit: aws.Int64(1), // Required @@ -575,7 +743,13 @@ func ExampleWAF_ListSizeConstraintSets() { } func ExampleWAF_ListSqlInjectionMatchSets() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.ListSqlInjectionMatchSetsInput{ Limit: aws.Int64(1), // Required @@ -595,7 +769,13 @@ func ExampleWAF_ListSqlInjectionMatchSets() { } func ExampleWAF_ListWebACLs() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.ListWebACLsInput{ Limit: aws.Int64(1), // Required @@ -615,7 +795,13 @@ func ExampleWAF_ListWebACLs() { } func ExampleWAF_ListXssMatchSets() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.ListXssMatchSetsInput{ Limit: aws.Int64(1), // Required @@ -635,7 +821,13 @@ func ExampleWAF_ListXssMatchSets() { } func ExampleWAF_UpdateByteMatchSet() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.UpdateByteMatchSetInput{ ByteMatchSetId: aws.String("ResourceId"), // Required @@ -670,7 +862,13 @@ func ExampleWAF_UpdateByteMatchSet() { } func ExampleWAF_UpdateIPSet() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.UpdateIPSetInput{ ChangeToken: aws.String("ChangeToken"), // Required @@ -700,7 +898,13 @@ func ExampleWAF_UpdateIPSet() { } func ExampleWAF_UpdateRule() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.UpdateRuleInput{ ChangeToken: aws.String("ChangeToken"), // Required @@ -731,7 +935,13 @@ func ExampleWAF_UpdateRule() { } func ExampleWAF_UpdateSizeConstraintSet() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.UpdateSizeConstraintSetInput{ ChangeToken: aws.String("ChangeToken"), // Required @@ -766,7 +976,13 @@ func ExampleWAF_UpdateSizeConstraintSet() { } func ExampleWAF_UpdateSqlInjectionMatchSet() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.UpdateSqlInjectionMatchSetInput{ ChangeToken: aws.String("ChangeToken"), // Required @@ -799,7 +1015,13 @@ func ExampleWAF_UpdateSqlInjectionMatchSet() { } func ExampleWAF_UpdateWebACL() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.UpdateWebACLInput{ ChangeToken: aws.String("ChangeToken"), // Required @@ -835,7 +1057,13 @@ func ExampleWAF_UpdateWebACL() { } func ExampleWAF_UpdateXssMatchSet() { - svc := waf.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := waf.New(sess) params := &waf.UpdateXssMatchSetInput{ ChangeToken: aws.String("ChangeToken"), // Required diff --git a/service/workspaces/examples_test.go b/service/workspaces/examples_test.go index 17bbc877e28..d9ef650a27e 100644 --- a/service/workspaces/examples_test.go +++ b/service/workspaces/examples_test.go @@ -16,7 +16,13 @@ var _ time.Duration var _ bytes.Buffer func ExampleWorkSpaces_CreateTags() { - svc := workspaces.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := workspaces.New(sess) params := &workspaces.CreateTagsInput{ ResourceId: aws.String("NonEmptyString"), // Required @@ -42,7 +48,13 @@ func ExampleWorkSpaces_CreateTags() { } func ExampleWorkSpaces_CreateWorkspaces() { - svc := workspaces.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := workspaces.New(sess) params := &workspaces.CreateWorkspacesInput{ Workspaces: []*workspaces.WorkspaceRequest{ // Required @@ -78,7 +90,13 @@ func ExampleWorkSpaces_CreateWorkspaces() { } func ExampleWorkSpaces_DeleteTags() { - svc := workspaces.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := workspaces.New(sess) params := &workspaces.DeleteTagsInput{ ResourceId: aws.String("NonEmptyString"), // Required @@ -101,7 +119,13 @@ func ExampleWorkSpaces_DeleteTags() { } func ExampleWorkSpaces_DescribeTags() { - svc := workspaces.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := workspaces.New(sess) params := &workspaces.DescribeTagsInput{ ResourceId: aws.String("NonEmptyString"), // Required @@ -120,7 +144,13 @@ func ExampleWorkSpaces_DescribeTags() { } func ExampleWorkSpaces_DescribeWorkspaceBundles() { - svc := workspaces.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := workspaces.New(sess) params := &workspaces.DescribeWorkspaceBundlesInput{ BundleIds: []*string{ @@ -144,7 +174,13 @@ func ExampleWorkSpaces_DescribeWorkspaceBundles() { } func ExampleWorkSpaces_DescribeWorkspaceDirectories() { - svc := workspaces.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := workspaces.New(sess) params := &workspaces.DescribeWorkspaceDirectoriesInput{ DirectoryIds: []*string{ @@ -167,7 +203,13 @@ func ExampleWorkSpaces_DescribeWorkspaceDirectories() { } func ExampleWorkSpaces_DescribeWorkspaces() { - svc := workspaces.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := workspaces.New(sess) params := &workspaces.DescribeWorkspacesInput{ BundleId: aws.String("BundleId"), @@ -194,7 +236,13 @@ func ExampleWorkSpaces_DescribeWorkspaces() { } func ExampleWorkSpaces_RebootWorkspaces() { - svc := workspaces.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := workspaces.New(sess) params := &workspaces.RebootWorkspacesInput{ RebootWorkspaceRequests: []*workspaces.RebootRequest{ // Required @@ -218,7 +266,13 @@ func ExampleWorkSpaces_RebootWorkspaces() { } func ExampleWorkSpaces_RebuildWorkspaces() { - svc := workspaces.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := workspaces.New(sess) params := &workspaces.RebuildWorkspacesInput{ RebuildWorkspaceRequests: []*workspaces.RebuildRequest{ // Required @@ -242,7 +296,13 @@ func ExampleWorkSpaces_RebuildWorkspaces() { } func ExampleWorkSpaces_TerminateWorkspaces() { - svc := workspaces.New(session.New()) + sess, err := session.NewSession() + if err != nil { + fmt.Println("failed to create session,", err) + return + } + + svc := workspaces.New(sess) params := &workspaces.TerminateWorkspacesInput{ TerminateWorkspaceRequests: []*workspaces.TerminateRequest{ // Required