diff --git a/controller/controller_test.go b/controller/controller_test.go index b3d359085..ac298daff 100644 --- a/controller/controller_test.go +++ b/controller/controller_test.go @@ -21,10 +21,13 @@ import ( "testing" "github.com/kubernetes-incubator/external-dns/endpoint" + "github.com/kubernetes-incubator/external-dns/internal/testutils" "github.com/kubernetes-incubator/external-dns/plan" "github.com/kubernetes-incubator/external-dns/provider" "github.com/kubernetes-incubator/external-dns/registry" - "github.com/kubernetes-incubator/external-dns/source" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) // mockProvider returns mock endpoints and validates changes. @@ -84,18 +87,17 @@ func newMockProvider(endpoints []*endpoint.Endpoint, changes *plan.Changes) prov // TestRunOnce tests that RunOnce correctly orchestrates the different components. func TestRunOnce(t *testing.T) { // Fake some desired endpoints coming from our source. - source := source.NewMockSource( - []*endpoint.Endpoint{ - { - DNSName: "create-record", - Target: "1.2.3.4", - }, - { - DNSName: "update-record", - Target: "8.8.4.4", - }, + source := new(testutils.MockSource) + source.On("Endpoints").Return([]*endpoint.Endpoint{ + { + DNSName: "create-record", + Target: "1.2.3.4", }, - ) + { + DNSName: "update-record", + Target: "8.8.4.4", + }, + }, nil) // Fake some existing records in our DNS provider and validate some desired changes. provider := newMockProvider( @@ -125,7 +127,8 @@ func TestRunOnce(t *testing.T) { }, ) - r, _ := registry.NewNoopRegistry(provider) + r, err := registry.NewNoopRegistry(provider) + require.NoError(t, err) // Run our controller once to trigger the validation. ctrl := &Controller{ @@ -134,9 +137,8 @@ func TestRunOnce(t *testing.T) { Policy: &plan.SyncPolicy{}, } - err := ctrl.RunOnce() + assert.NoError(t, ctrl.RunOnce()) - if err != nil { - t.Fatal(err) - } + // Validate that the mock source was called. + source.AssertExpectations(t) } diff --git a/endpoint/endpoint_test.go b/endpoint/endpoint_test.go index 1642a3609..f73404d44 100644 --- a/endpoint/endpoint_test.go +++ b/endpoint/endpoint_test.go @@ -17,8 +17,9 @@ limitations under the License. package endpoint import ( - "reflect" "testing" + + "github.com/stretchr/testify/assert" ) func TestNewEndpoint(t *testing.T) { @@ -43,7 +44,5 @@ func TestMergeLabels(t *testing.T) { "baz": "qux", } e.MergeLabels(map[string]string{"baz": "baz", "new": "fox"}) - if !reflect.DeepEqual(e.Labels, map[string]string{"foo": "bar", "baz": "qux", "new": "fox"}) { - t.Error("invalid merge result") - } + assert.Equal(t, map[string]string{"foo": "bar", "baz": "qux", "new": "fox"}, e.Labels) } diff --git a/glide.lock b/glide.lock index 58004e69b..03852a953 100644 --- a/glide.lock +++ b/glide.lock @@ -1,5 +1,5 @@ -hash: 9acd732aa42d366638309eb85248ff41cdef27870c09a060502d9fec5ed84e8f -updated: 2017-05-15T11:29:00.450041553+02:00 +hash: c00aa897138844c5db59c71eabfeb24df7b9632db00ef8f038027d4b022a428b +updated: 2017-05-23T16:20:11.952490108+02:00 imports: - name: bitbucket.org/ww/goautoneg version: 75cd24fc2f2c2a2088577d12123ddee5f54e0675 @@ -17,7 +17,7 @@ imports: - name: github.com/alecthomas/units version: 2efee857e7cfd4f3d0138cc3cbb1b4966962b93a - name: github.com/aws/aws-sdk-go - version: cea091b5b8fe6fcecf0eb6ec8f1a2570ff4ee6a7 + version: 48385c808742c8f5f3d3a466d172a52b961ecd7c subpackages: - aws - aws/awserr @@ -97,7 +97,7 @@ imports: - name: github.com/kubernetes/repo-infra version: 4667983ff6a1c7dff07191106392ad4bcad60c29 - name: github.com/linki/instrumented_http - version: 74fdeadb7e945ec3cc9dcbefed6a6b148ef00d18 + version: 0a1a371dd29c69916c8a13be23849354332674c7 - name: github.com/mailru/easyjson version: d5b7844b561a7bc640052f1b935f7b800330d7e0 subpackages: @@ -108,6 +108,10 @@ imports: version: fc2b8d3a73c4867e51861bbdd5ae3c1f0869dd6a subpackages: - pbutil +- name: github.com/pmezard/go-difflib + version: d8ed2627bdf02c080bf22230dbb337003b7aba2d + subpackages: + - difflib - name: github.com/prometheus/client_golang version: c5b7fccd204277076155f10851dad72b76a49317 subpackages: @@ -132,6 +136,14 @@ imports: version: ba1b36c82c5e05c4f912a88eab0dcd91a171688f - name: github.com/spf13/pflag version: 9ff6c6923cfffbcd502984b8e0c80539a94968b7 +- name: github.com/stretchr/objx + version: cbeaeb16a013161a98496fad62933b1d21786672 +- name: github.com/stretchr/testify + version: 69483b4bd14f5845b5a1e55bca19e954e827f1d0 + subpackages: + - assert + - mock + - require - name: github.com/ugorji/go version: ded73eae5db7e7a0ef6f55aace87a2873c5d2b74 subpackages: diff --git a/glide.yaml b/glide.yaml index e651d5fd3..7cc554cbd 100644 --- a/glide.yaml +++ b/glide.yaml @@ -14,6 +14,12 @@ import: version: ~0.8.0 subpackages: - prometheus/promhttp +- package: github.com/stretchr/testify + version: ~1.1.4 + subpackages: + - assert + - mock + - require - package: golang.org/x/net subpackages: - context diff --git a/source/mock_source.go b/internal/testutils/mock_source.go similarity index 59% rename from source/mock_source.go rename to internal/testutils/mock_source.go index ccec172c9..30c5d871d 100644 --- a/source/mock_source.go +++ b/internal/testutils/mock_source.go @@ -14,21 +14,27 @@ See the License for the specific language governing permissions and limitations under the License. */ -package source +package testutils -import "github.com/kubernetes-incubator/external-dns/endpoint" +import ( + "github.com/stretchr/testify/mock" -// mockSource returns mock endpoints. -type mockSource struct { - store []*endpoint.Endpoint -} + "github.com/kubernetes-incubator/external-dns/endpoint" +) -// NewMockSource creates a new mockSource returning the given endpoints. -func NewMockSource(endpoints []*endpoint.Endpoint) Source { - return &mockSource{store: endpoints} +// MockSource returns mock endpoints. +type MockSource struct { + mock.Mock } // Endpoints returns the desired mock endpoints. -func (s *mockSource) Endpoints() ([]*endpoint.Endpoint, error) { - return s.store, nil +func (m *MockSource) Endpoints() ([]*endpoint.Endpoint, error) { + args := m.Called() + + endpoints := args.Get(0) + if endpoints == nil { + return nil, args.Error(1) + } + + return endpoints.([]*endpoint.Endpoint), args.Error(1) } diff --git a/pkg/apis/externaldns/types_test.go b/pkg/apis/externaldns/types_test.go index b964a8006..fd6b2c9c9 100644 --- a/pkg/apis/externaldns/types_test.go +++ b/pkg/apis/externaldns/types_test.go @@ -18,9 +18,11 @@ package externaldns import ( "os" - "reflect" "testing" "time" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) var ( @@ -141,38 +143,23 @@ func TestParseFlags(t *testing.T) { } { t.Run(ti.title, func(t *testing.T) { originalEnv := setEnv(t, ti.envVars) - defer func() { - restoreEnv(t, originalEnv) - }() + defer func() { restoreEnv(t, originalEnv) }() cfg := NewConfig() - - if err := cfg.ParseFlags(ti.args); err != nil { - t.Error(err) - } - - validateConfig(t, cfg, ti.expected) + require.NoError(t, cfg.ParseFlags(ti.args)) + assert.Equal(t, ti.expected, cfg) }) } } // helper functions -func validateConfig(t *testing.T, got, expected *Config) { - if !reflect.DeepEqual(got, expected) { - t.Errorf("config is wrong") - } -} - func setEnv(t *testing.T, env map[string]string) map[string]string { originalEnv := map[string]string{} for k, v := range env { originalEnv[k] = os.Getenv(k) - - if err := os.Setenv(k, v); err != nil { - t.Fatal(err) - } + require.NoError(t, os.Setenv(k, v)) } return originalEnv @@ -180,8 +167,6 @@ func setEnv(t *testing.T, env map[string]string) map[string]string { func restoreEnv(t *testing.T, originalEnv map[string]string) { for k, v := range originalEnv { - if err := os.Setenv(k, v); err != nil { - t.Fatal(err) - } + require.NoError(t, os.Setenv(k, v)) } } diff --git a/pkg/apis/externaldns/validation/validation_test.go b/pkg/apis/externaldns/validation/validation_test.go index ec511018c..9c048a838 100644 --- a/pkg/apis/externaldns/validation/validation_test.go +++ b/pkg/apis/externaldns/validation/validation_test.go @@ -20,45 +20,36 @@ import ( "testing" "github.com/kubernetes-incubator/external-dns/pkg/apis/externaldns" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) func TestValidateFlags(t *testing.T) { cfg := newValidConfig(t) - if err := ValidateConfig(cfg); err != nil { - t.Errorf("valid config should be valid: %s", err) - } + assert.NoError(t, ValidateConfig(cfg)) cfg = newValidConfig(t) cfg.LogFormat = "test" - if err := ValidateConfig(cfg); err == nil { - t.Errorf("unsupported log format should fail: %s", cfg.LogFormat) - } + assert.Error(t, ValidateConfig(cfg)) cfg = newValidConfig(t) cfg.LogFormat = "" - if err := ValidateConfig(cfg); err == nil { - t.Errorf("unsupported log format should fail: %s", cfg.LogFormat) - } + assert.Error(t, ValidateConfig(cfg)) for _, format := range []string{"text", "json"} { cfg = newValidConfig(t) cfg.LogFormat = format - if err := ValidateConfig(cfg); err != nil { - t.Errorf("supported log format: %s should not fail", format) - } + assert.NoError(t, ValidateConfig(cfg)) } cfg = newValidConfig(t) cfg.Sources = []string{} - if err := ValidateConfig(cfg); err == nil { - t.Error("missing at least one source should fail") - } + assert.Error(t, ValidateConfig(cfg)) cfg = newValidConfig(t) cfg.Provider = "" - if err := ValidateConfig(cfg); err == nil { - t.Error("missing provider should fail") - } + assert.Error(t, ValidateConfig(cfg)) } func newValidConfig(t *testing.T) *externaldns.Config { @@ -68,9 +59,7 @@ func newValidConfig(t *testing.T) *externaldns.Config { cfg.Sources = []string{"test-source"} cfg.Provider = "test-provider" - if err := ValidateConfig(cfg); err != nil { - t.Fatalf("newValidConfig should return valid config") - } + require.NoError(t, ValidateConfig(cfg)) return cfg } diff --git a/provider/aws_test.go b/provider/aws_test.go index 1193aa0e2..09f8c3efe 100644 --- a/provider/aws_test.go +++ b/provider/aws_test.go @@ -19,16 +19,17 @@ package provider import ( "fmt" "net" - "reflect" "testing" "github.com/aws/aws-sdk-go/aws" - "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/service/route53" "github.com/kubernetes-incubator/external-dns/endpoint" "github.com/kubernetes-incubator/external-dns/internal/testutils" "github.com/kubernetes-incubator/external-dns/plan" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) // Compile time check for interface conformance @@ -147,9 +148,7 @@ func TestAWSZones(t *testing.T) { provider := newAWSProvider(t, "ext-dns-test-2.teapot.zalan.do.", false, []*endpoint.Endpoint{}) zones, err := provider.Zones() - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) validateAWSZones(t, zones, map[string]*route53.HostedZone{ "/hostedzone/zone-1.ext-dns-test-2.teapot.zalan.do.": { @@ -175,9 +174,7 @@ func TestAWSRecords(t *testing.T) { }) records, err := provider.Records() - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) validateEndpoints(t, records, []*endpoint.Endpoint{ endpoint.NewEndpoint("list-test.zone-1.ext-dns-test-2.teapot.zalan.do", "1.2.3.4", "A"), @@ -195,14 +192,10 @@ func TestAWSCreateRecords(t *testing.T) { endpoint.NewEndpoint("create-test-cname.zone-1.ext-dns-test-2.teapot.zalan.do", "foo.elb.amazonaws.com", ""), } - if err := provider.CreateRecords(records); err != nil { - t.Fatal(err) - } + require.NoError(t, provider.CreateRecords(records)) records, err := provider.Records() - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) validateEndpoints(t, records, []*endpoint.Endpoint{ endpoint.NewEndpoint("create-test.zone-1.ext-dns-test-2.teapot.zalan.do", "1.2.3.4", "A"), @@ -229,14 +222,10 @@ func TestAWSUpdateRecords(t *testing.T) { endpoint.NewEndpoint("update-test-cname.zone-1.ext-dns-test-2.teapot.zalan.do", "bar.elb.amazonaws.com", "CNAME"), } - if err := provider.UpdateRecords(updatedRecords, currentRecords); err != nil { - t.Fatal(err) - } + require.NoError(t, provider.UpdateRecords(updatedRecords, currentRecords)) records, err := provider.Records() - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) validateEndpoints(t, records, []*endpoint.Endpoint{ endpoint.NewEndpoint("update-test.zone-1.ext-dns-test-2.teapot.zalan.do", "1.2.3.4", "A"), @@ -256,14 +245,10 @@ func TestAWSDeleteRecords(t *testing.T) { provider := newAWSProvider(t, "ext-dns-test-2.teapot.zalan.do.", false, originalEndpoints) - if err := provider.DeleteRecords(originalEndpoints); err != nil { - t.Fatal(err) - } + require.NoError(t, provider.DeleteRecords(originalEndpoints)) records, err := provider.Records() - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) validateEndpoints(t, records, []*endpoint.Endpoint{}) } @@ -314,14 +299,10 @@ func TestAWSApplyChanges(t *testing.T) { Delete: deleteRecords, } - if err := provider.ApplyChanges(changes); err != nil { - t.Fatal(err) - } + require.NoError(t, provider.ApplyChanges(changes)) records, err := provider.Records() - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) validateEndpoints(t, records, []*endpoint.Endpoint{ endpoint.NewEndpoint("create-test.zone-1.ext-dns-test-2.teapot.zalan.do", "8.8.8.8", "A"), @@ -383,14 +364,10 @@ func TestAWSApplyChangesDryRun(t *testing.T) { Delete: deleteRecords, } - if err := provider.ApplyChanges(changes); err != nil { - t.Fatal(err) - } + require.NoError(t, provider.ApplyChanges(changes)) records, err := provider.Records() - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) validateEndpoints(t, records, originalEndpoints) } @@ -439,10 +416,7 @@ func TestAWSChangesByZones(t *testing.T) { } changesByZone := changesByZone(zones, changes) - - if len(changesByZone) != 2 { - t.Fatalf("expected %d change(s), got %d", 2, len(changesByZone)) - } + require.Len(t, changesByZone, 2) validateAWSChangeRecords(t, changesByZone["foo-example-org"], []*route53.Change{ { @@ -476,15 +450,11 @@ func TestAWSChangesByZones(t *testing.T) { } func validateEndpoints(t *testing.T, endpoints []*endpoint.Endpoint, expected []*endpoint.Endpoint) { - if !testutils.SameEndpoints(endpoints, expected) { - t.Errorf("expected and actual endpoints don't match") - } + assert.True(t, testutils.SameEndpoints(endpoints, expected), "expected and actual endpoints don't match") } func validateAWSZones(t *testing.T, zones map[string]*route53.HostedZone, expected map[string]*route53.HostedZone) { - if len(zones) != len(expected) { - t.Fatalf("expected %d zone(s), got %d", len(expected), len(zones)) - } + require.Len(t, zones, len(expected)) for i, zone := range zones { validateAWSZone(t, zone, expected[i]) @@ -492,19 +462,12 @@ func validateAWSZones(t *testing.T, zones map[string]*route53.HostedZone, expect } func validateAWSZone(t *testing.T, zone *route53.HostedZone, expected *route53.HostedZone) { - if aws.StringValue(zone.Id) != aws.StringValue(expected.Id) { - t.Errorf("expected %s, got %s", aws.StringValue(expected.Id), aws.StringValue(zone.Id)) - } - - if aws.StringValue(zone.Name) != aws.StringValue(expected.Name) { - t.Errorf("expected %s, got %s", aws.StringValue(expected.Name), aws.StringValue(zone.Name)) - } + assert.Equal(t, aws.StringValue(expected.Id), aws.StringValue(zone.Id)) + assert.Equal(t, aws.StringValue(expected.Name), aws.StringValue(zone.Name)) } func validateAWSChangeRecords(t *testing.T, records []*route53.Change, expected []*route53.Change) { - if len(records) != len(expected) { - t.Fatalf("expected %d change(s), got %d", len(expected), len(records)) - } + require.Len(t, records, len(expected)) for i := range records { validateAWSChangeRecord(t, records[i], expected[i]) @@ -512,13 +475,8 @@ func validateAWSChangeRecords(t *testing.T, records []*route53.Change, expected } func validateAWSChangeRecord(t *testing.T, record *route53.Change, expected *route53.Change) { - if aws.StringValue(record.Action) != aws.StringValue(expected.Action) { - t.Errorf("expected %s, got %s", aws.StringValue(expected.Action), aws.StringValue(record.Action)) - } - - if aws.StringValue(record.ResourceRecordSet.Name) != aws.StringValue(expected.ResourceRecordSet.Name) { - t.Errorf("expected %s, got %s", aws.StringValue(expected.ResourceRecordSet.Name), aws.StringValue(record.ResourceRecordSet.Name)) - } + assert.Equal(t, aws.StringValue(expected.Action), aws.StringValue(record.Action)) + assert.Equal(t, aws.StringValue(expected.ResourceRecordSet.Name), aws.StringValue(record.ResourceRecordSet.Name)) } func TestAWSCreateRecordsWithCNAME(t *testing.T) { @@ -528,9 +486,7 @@ func TestAWSCreateRecordsWithCNAME(t *testing.T) { {DNSName: "create-test.zone-1.ext-dns-test-2.teapot.zalan.do", Target: "foo.example.org"}, } - if err := provider.CreateRecords(records); err != nil { - t.Fatal(err) - } + require.NoError(t, provider.CreateRecords(records)) recordSets := listAWSRecords(t, provider.client, "/hostedzone/zone-1.ext-dns-test-2.teapot.zalan.do.") @@ -555,9 +511,7 @@ func TestAWSCreateRecordsWithALIAS(t *testing.T) { {DNSName: "create-test.zone-1.ext-dns-test-2.teapot.zalan.do", Target: "foo.eu-central-1.elb.amazonaws.com"}, } - if err := provider.CreateRecords(records); err != nil { - t.Fatal(err) - } + require.NoError(t, provider.CreateRecords(records)) recordSets := listAWSRecords(t, provider.client, "/hostedzone/zone-1.ext-dns-test-2.teapot.zalan.do.") @@ -591,12 +545,7 @@ func TestAWSisLoadBalancer(t *testing.T) { Target: tc.target, RecordType: tc.recordType, } - - isLB := isAWSLoadBalancer(ep) - - if isLB != tc.expected { - t.Errorf("expected %t, got %t", tc.expected, isLB) - } + assert.Equal(t, tc.expected, isAWSLoadBalancer(ep)) } } @@ -622,10 +571,7 @@ func TestAWSCanonicalHostedZone(t *testing.T) { {"foo.example.org", ""}, } { zone := canonicalHostedZone(tc.hostname) - - if zone != tc.expected { - t.Errorf("expected %v, got %v", tc.expected, zone) - } + assert.Equal(t, tc.expected, zone) } } @@ -644,10 +590,7 @@ func TestAWSSuitableZone(t *testing.T) { {"foo.kubernetes.io.", nil}, } { suitableZone := suitableZone(tc.hostname, zones) - - if suitableZone != tc.expected { - t.Errorf("expected %s, got %s", tc.expected, suitableZone) - } + assert.Equal(t, tc.expected, suitableZone) } } @@ -658,9 +601,7 @@ func createAWSZone(t *testing.T, provider *AWSProvider, zone *route53.HostedZone } if _, err := provider.client.CreateHostedZone(params); err != nil { - if err, ok := err.(awserr.Error); !ok || err.Code() != route53.ErrCodeHostedZoneAlreadyExists { - t.Fatal(err) - } + require.EqualError(t, err, route53.ErrCodeHostedZoneAlreadyExists) } } @@ -670,27 +611,21 @@ func setupAWSRecords(t *testing.T, provider *AWSProvider, endpoints []*endpoint. clearAWSRecords(t, provider, "/hostedzone/zone-3.ext-dns-test-2.teapot.zalan.do.") records, err := provider.Records() - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) validateEndpoints(t, records, []*endpoint.Endpoint{}) - if err = provider.CreateRecords(endpoints); err != nil { - t.Fatal(err) - } + require.NoError(t, provider.CreateRecords(endpoints)) records, err = provider.Records() - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) validateEndpoints(t, records, endpoints) } func listAWSRecords(t *testing.T, client Route53API, zone string) []*route53.ResourceRecordSet { recordSets := []*route53.ResourceRecordSet{} - if err := client.ListResourceRecordSetsPages(&route53.ListResourceRecordSetsInput{ + require.NoError(t, client.ListResourceRecordSetsPages(&route53.ListResourceRecordSetsInput{ HostedZoneId: aws.String(zone), }, func(resp *route53.ListResourceRecordSetsOutput, _ bool) bool { for _, recordSet := range resp.ResourceRecordSets { @@ -700,9 +635,8 @@ func listAWSRecords(t *testing.T, client Route53API, zone string) []*route53.Res } } return true - }); err != nil { - t.Fatal(err) - } + })) + return recordSets } @@ -718,14 +652,13 @@ func clearAWSRecords(t *testing.T, provider *AWSProvider, zone string) { } if len(changes) != 0 { - if _, err := provider.client.ChangeResourceRecordSets(&route53.ChangeResourceRecordSetsInput{ + _, err := provider.client.ChangeResourceRecordSets(&route53.ChangeResourceRecordSetsInput{ HostedZoneId: aws.String(zone), ChangeBatch: &route53.ChangeBatch{ Changes: changes, }, - }); err != nil { - t.Fatal(err) - } + }) + require.NoError(t, err) } } @@ -761,13 +694,5 @@ func newAWSProvider(t *testing.T, domainFilter string, dryRun bool, records []*e } func validateRecords(t *testing.T, records []*route53.ResourceRecordSet, expected []*route53.ResourceRecordSet) { - if len(records) != len(expected) { - t.Errorf("expected %d records, got %d", len(expected), len(records)) - } - - for i := range records { - if !reflect.DeepEqual(records[i], expected[i]) { - t.Errorf("record is wrong") - } - } + assert.Equal(t, expected, records) } diff --git a/provider/google_test.go b/provider/google_test.go index 33ec6bf3e..bb35ad3d8 100644 --- a/provider/google_test.go +++ b/provider/google_test.go @@ -29,6 +29,9 @@ import ( "google.golang.org/api/dns/v1" "google.golang.org/api/googleapi" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) var ( @@ -192,9 +195,7 @@ func TestGoogleZones(t *testing.T) { provider := newGoogleProvider(t, "ext-dns-test-2.gcp.zalan.do.", false, []*endpoint.Endpoint{}) zones, err := provider.Zones() - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) validateZones(t, zones, map[string]*dns.ManagedZone{ "zone-1-ext-dns-test-2-gcp-zalan-do": {Name: "zone-1-ext-dns-test-2-gcp-zalan-do", DnsName: "zone-1.ext-dns-test-2.gcp.zalan.do."}, @@ -213,9 +214,7 @@ func TestGoogleRecords(t *testing.T) { provider := newGoogleProvider(t, "ext-dns-test-2.gcp.zalan.do.", false, originalEndpoints) records, err := provider.Records() - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) validateEndpoints(t, records, originalEndpoints) } @@ -229,14 +228,10 @@ func TestGoogleCreateRecords(t *testing.T) { endpoint.NewEndpoint("create-test-cname.zone-1.ext-dns-test-2.gcp.zalan.do", "foo.elb.amazonaws.com", ""), } - if err := provider.CreateRecords(records); err != nil { - t.Fatal(err) - } + require.NoError(t, provider.CreateRecords(records)) records, err := provider.Records() - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) validateEndpoints(t, records, []*endpoint.Endpoint{ endpoint.NewEndpoint("create-test.zone-1.ext-dns-test-2.gcp.zalan.do", "1.2.3.4", "A"), @@ -263,14 +258,10 @@ func TestGoogleUpdateRecords(t *testing.T) { endpoint.NewEndpoint("update-test-cname.zone-1.ext-dns-test-2.gcp.zalan.do", "bar.elb.amazonaws.com", "CNAME"), } - if err := provider.UpdateRecords(updatedRecords, currentRecords); err != nil { - t.Fatal(err) - } + require.NoError(t, provider.UpdateRecords(updatedRecords, currentRecords)) records, err := provider.Records() - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) validateEndpoints(t, records, []*endpoint.Endpoint{ endpoint.NewEndpoint("update-test.zone-1.ext-dns-test-2.gcp.zalan.do", "1.2.3.4", "A"), @@ -288,14 +279,10 @@ func TestGoogleDeleteRecords(t *testing.T) { provider := newGoogleProvider(t, "ext-dns-test-2.gcp.zalan.do.", false, originalEndpoints) - if err := provider.DeleteRecords(originalEndpoints); err != nil { - t.Fatal(err) - } + require.NoError(t, provider.DeleteRecords(originalEndpoints)) records, err := provider.Records() - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) validateEndpoints(t, records, []*endpoint.Endpoint{}) } @@ -340,14 +327,10 @@ func TestGoogleApplyChanges(t *testing.T) { Delete: deleteRecords, } - if err := provider.ApplyChanges(changes); err != nil { - t.Fatal(err) - } + require.NoError(t, provider.ApplyChanges(changes)) records, err := provider.Records() - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) validateEndpoints(t, records, []*endpoint.Endpoint{ endpoint.NewEndpoint("create-test.zone-1.ext-dns-test-2.gcp.zalan.do", "8.8.8.8", "A"), @@ -401,24 +384,17 @@ func TestGoogleApplyChangesDryRun(t *testing.T) { Delete: deleteRecords, } - if err := provider.ApplyChanges(changes); err != nil { - t.Fatal(err) - } + require.NoError(t, provider.ApplyChanges(changes)) records, err := provider.Records() - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) validateEndpoints(t, records, originalEndpoints) } func TestGoogleApplyChangesEmpty(t *testing.T) { provider := newGoogleProvider(t, "ext-dns-test-2.gcp.zalan.do.", false, []*endpoint.Endpoint{}) - - if err := provider.ApplyChanges(&plan.Changes{}); err != nil { - t.Error(err) - } + assert.NoError(t, provider.ApplyChanges(&plan.Changes{})) } func TestSeparateChanges(t *testing.T) { @@ -449,10 +425,7 @@ func TestSeparateChanges(t *testing.T) { } changes := separateChange(zones, change) - - if len(changes) != 2 { - t.Fatalf("expected %d change(s), got %d", 2, len(changes)) - } + require.Len(t, changes, 2) validateChange(t, changes["foo-example-org"], &dns.Change{ Additions: []*dns.ResourceRecordSet{ @@ -488,17 +461,12 @@ func TestGoogleSuitableZone(t *testing.T) { {"foo.kubernetes.io.", nil}, } { suitableZone := suitableManagedZone(tc.hostname, zones) - - if suitableZone != tc.expected { - t.Errorf("expected %v, got %v", tc.expected, suitableZone) - } + assert.Equal(t, suitableZone, tc.expected) } } func validateZones(t *testing.T, zones map[string]*dns.ManagedZone, expected map[string]*dns.ManagedZone) { - if len(zones) != len(expected) { - t.Fatalf("expected %d zone(s), got %d", len(expected), len(zones)) - } + require.Len(t, zones, len(expected)) for i, zone := range zones { validateZone(t, zone, expected[i]) @@ -506,13 +474,8 @@ func validateZones(t *testing.T, zones map[string]*dns.ManagedZone, expected map } func validateZone(t *testing.T, zone *dns.ManagedZone, expected *dns.ManagedZone) { - if zone.Name != expected.Name { - t.Errorf("expected %s, got %s", expected.Name, zone.Name) - } - - if zone.DnsName != expected.DnsName { - t.Errorf("expected %s, got %s", expected.DnsName, zone.DnsName) - } + assert.Equal(t, expected.Name, zone.Name) + assert.Equal(t, expected.DnsName, zone.DnsName) } func validateChange(t *testing.T, change *dns.Change, expected *dns.Change) { @@ -521,9 +484,7 @@ func validateChange(t *testing.T, change *dns.Change, expected *dns.Change) { } func validateChangeRecords(t *testing.T, records []*dns.ResourceRecordSet, expected []*dns.ResourceRecordSet) { - if len(records) != len(expected) { - t.Fatalf("expected %d change(s), got %d", len(expected), len(records)) - } + require.Len(t, records, len(expected)) for i := range records { validateChangeRecord(t, records[i], expected[i]) @@ -531,13 +492,8 @@ func validateChangeRecords(t *testing.T, records []*dns.ResourceRecordSet, expec } func validateChangeRecord(t *testing.T, record *dns.ResourceRecordSet, expected *dns.ResourceRecordSet) { - if record.Name != expected.Name { - t.Errorf("expected %s, got %s", expected.Name, record.Name) - } - - if record.Ttl != expected.Ttl { - t.Errorf("expected %d, got %d", expected.Ttl, record.Ttl) - } + assert.Equal(t, expected.Name, record.Name) + assert.Equal(t, expected.Ttl, record.Ttl) } func newGoogleProvider(t *testing.T, domainFilter string, dryRun bool, records []*endpoint.Endpoint) *googleProvider { @@ -577,7 +533,7 @@ func createZone(t *testing.T, provider *googleProvider, zone *dns.ManagedZone) { if _, err := provider.managedZonesClient.Create("zalando-external-dns-test", zone).Do(); err != nil { if err, ok := err.(*googleapi.Error); !ok || err.Code != http.StatusConflict { - t.Fatal(err) + require.NoError(t, err) } } } @@ -587,27 +543,21 @@ func setupGoogleRecords(t *testing.T, provider *googleProvider, endpoints []*end clearGoogleRecords(t, provider, "zone-2-ext-dns-test-2-gcp-zalan-do") records, err := provider.Records() - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) validateEndpoints(t, records, []*endpoint.Endpoint{}) - if err = provider.CreateRecords(endpoints); err != nil { - t.Fatal(err) - } + require.NoError(t, provider.CreateRecords(endpoints)) records, err = provider.Records() - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) validateEndpoints(t, records, endpoints) } func clearGoogleRecords(t *testing.T, provider *googleProvider, zone string) { recordSets := []*dns.ResourceRecordSet{} - if err := provider.resourceRecordSetsClient.List(provider.project, zone).Pages(context.TODO(), func(resp *dns.ResourceRecordSetsListResponse) error { + require.NoError(t, provider.resourceRecordSetsClient.List(provider.project, zone).Pages(context.TODO(), func(resp *dns.ResourceRecordSetsListResponse) error { for _, r := range resp.Rrsets { switch r.Type { case "A", "CNAME": @@ -615,15 +565,12 @@ func clearGoogleRecords(t *testing.T, provider *googleProvider, zone string) { } } return nil - }); err != nil { - t.Fatal(err) - } + })) if len(recordSets) != 0 { - if _, err := provider.changesClient.Create(provider.project, zone, &dns.Change{ + _, err := provider.changesClient.Create(provider.project, zone, &dns.Change{ Deletions: recordSets, - }).Do(); err != nil { - t.Fatal(err) - } + }).Do() + require.NoError(t, err) } } diff --git a/provider/inmemory_test.go b/provider/inmemory_test.go index 881844ace..1f1cace58 100644 --- a/provider/inmemory_test.go +++ b/provider/inmemory_test.go @@ -17,12 +17,14 @@ limitations under the License. package provider import ( - "reflect" "testing" "github.com/kubernetes-incubator/external-dns/endpoint" "github.com/kubernetes-incubator/external-dns/internal/testutils" "github.com/kubernetes-incubator/external-dns/plan" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) var ( @@ -113,14 +115,11 @@ func testInMemoryFindByType(t *testing.T) { t.Run(ti.title, func(t *testing.T) { c := newInMemoryClient() record := c.findByType(ti.findType, ti.records) - if ti.expectedEmpty && record != nil { - t.Errorf("should return nil") - } - if !ti.expectedEmpty && record == nil { - t.Errorf("should not return nil") - } - if !ti.expectedEmpty && record != nil && !reflect.DeepEqual(*record, *ti.expected) { - t.Errorf("wrong record found") + if ti.expectedEmpty { + assert.Nil(t, record) + } else { + require.NotNil(t, record) + assert.Equal(t, *ti.expected, *record) } }) } @@ -210,17 +209,12 @@ func testInMemoryRecords(t *testing.T) { f := filter{domain: ti.zone} im.filter = &f records, err := im.Records() - if ti.expectError && records != nil { - t.Errorf("wrong zone should not return records") - } - if ti.expectError && err != ErrZoneNotFound { - t.Errorf("expected error") - } - if !ti.expectError && err != nil { - t.Errorf("unexpected error") - } - if !ti.expectError && !testutils.SameEndpoints(ti.expected, records) { - t.Errorf("endpoints returned wrong set") + if ti.expectError { + assert.Nil(t, records) + assert.EqualError(t, err, ErrZoneNotFound.Error()) + } else { + require.NoError(t, err) + assert.True(t, testutils.SameEndpoints(ti.expected, records)) } }) } @@ -533,11 +527,10 @@ func testInMemoryValidateChangeBatch(t *testing.T) { Delete: convertToInMemoryRecord(ti.changes.Delete), } err := c.validateChangeBatch(ti.zone, ichanges) - if ti.expectError && err != ti.errorType { - t.Errorf("returns wrong type of error: %v, expected: %v", err, ti.errorType) - } - if !ti.expectError && err != nil { - t.Error(err) + if ti.expectError { + assert.EqualError(t, err, ti.errorType.Error()) + } else { + assert.NoError(t, err) } }) } @@ -741,16 +734,11 @@ func testInMemoryApplyChanges(t *testing.T) { im.client = c err := im.ApplyChanges(ti.changes) - if ti.expectError && err == nil { - t.Errorf("should return an error") - } - if !ti.expectError && err != nil { - t.Error(err) - } - if !ti.expectError { - if !reflect.DeepEqual(c.zones, ti.expectedZonesState) { - t.Errorf("invalid update") - } + if ti.expectError { + assert.Error(t, err) + } else { + require.NoError(t, err) + assert.Equal(t, ti.expectedZonesState, c.zones) } }) } @@ -758,17 +746,13 @@ func testInMemoryApplyChanges(t *testing.T) { func testNewInMemoryProvider(t *testing.T) { cfg := NewInMemoryProvider() - if cfg.client == nil { - t.Error("nil map") - } + assert.NotNil(t, cfg.client) } func testInMemoryCreateZone(t *testing.T) { im := NewInMemoryProvider() - if err := im.CreateZone("zone"); err != nil { - t.Error(err) - } - if err := im.CreateZone("zone"); err != ErrZoneAlreadyExists { - t.Errorf("should fail with zone already exists") - } + err := im.CreateZone("zone") + assert.NoError(t, err) + err = im.CreateZone("zone") + assert.EqualError(t, err, ErrZoneAlreadyExists.Error()) } diff --git a/registry/noop_test.go b/registry/noop_test.go index 4e6fd27a4..b08ed5556 100644 --- a/registry/noop_test.go +++ b/registry/noop_test.go @@ -23,6 +23,9 @@ import ( "github.com/kubernetes-incubator/external-dns/internal/testutils" "github.com/kubernetes-incubator/external-dns/plan" "github.com/kubernetes-incubator/external-dns/provider" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) var _ Registry = &NoopRegistry{} @@ -36,12 +39,8 @@ func TestNoopRegistry(t *testing.T) { func testNoopInit(t *testing.T) { p := provider.NewInMemoryProvider() r, err := NewNoopRegistry(p) - if err != nil { - t.Fatal(err) - } - if r.provider != p { - t.Error("noop registry incorrectly initialized") - } + require.NoError(t, err) + assert.Equal(t, p, r.provider) } func testNoopRecords(t *testing.T) { @@ -61,12 +60,8 @@ func testNoopRecords(t *testing.T) { r, _ := NewNoopRegistry(p) eps, err := r.Records() - if err != nil { - t.Error(err) - } - if !testutils.SameEndpoints(eps, providerRecords) { - t.Error("incorrect result is returned") - } + require.NoError(t, err) + assert.True(t, testutils.SameEndpoints(eps, providerRecords)) } func testNoopApplyChanges(t *testing.T) { @@ -106,12 +101,10 @@ func testNoopApplyChanges(t *testing.T) { }, }, }) - if err != provider.ErrRecordAlreadyExists { - t.Error("should return record already exists") - } + assert.EqualError(t, err, provider.ErrRecordAlreadyExists.Error()) //correct changes - err = r.ApplyChanges(&plan.Changes{ + require.NoError(t, r.ApplyChanges(&plan.Changes{ Create: []*endpoint.Endpoint{ { DNSName: "new-record.org", @@ -130,12 +123,7 @@ func testNoopApplyChanges(t *testing.T) { Target: "old-lb.com", }, }, - }) - if err != nil { - t.Fatal(err) - } + })) res, _ := p.Records() - if !testutils.SameEndpoints(res, expectedUpdate) { - t.Error("incorrectly updated dns provider") - } + assert.True(t, testutils.SameEndpoints(res, expectedUpdate)) } diff --git a/registry/txt_test.go b/registry/txt_test.go index f9618dc4a..637cede49 100644 --- a/registry/txt_test.go +++ b/registry/txt_test.go @@ -23,6 +23,9 @@ import ( "github.com/kubernetes-incubator/external-dns/internal/testutils" "github.com/kubernetes-incubator/external-dns/plan" "github.com/kubernetes-incubator/external-dns/provider" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) const ( @@ -38,28 +41,21 @@ func TestTXTRegistry(t *testing.T) { func testTXTRegistryNew(t *testing.T) { p := provider.NewInMemoryProvider() _, err := NewTXTRegistry(p, "txt", "") - if err == nil { - t.Fatal("owner should be specified") - } + require.Error(t, err) r, err := NewTXTRegistry(p, "txt", "owner") - if err != nil { - t.Fatal(err) - } - if _, ok := r.mapper.(prefixNameMapper); !ok { - t.Error("incorrectly initialized txt registry instance") - } - if r.ownerID != "owner" || r.provider != p { - t.Error("incorrectly initialized txt registry instance") - } + require.NoError(t, err) + + _, ok := r.mapper.(prefixNameMapper) + require.True(t, ok) + assert.Equal(t, "owner", r.ownerID) + assert.Equal(t, p, r.provider) r, err = NewTXTRegistry(p, "", "owner") - if err != nil { - t.Fatal(err) - } - if _, ok := r.mapper.(prefixNameMapper); !ok { - t.Error("Incorrect type of prefix name mapper") - } + require.NoError(t, err) + + _, ok = r.mapper.(prefixNameMapper) + assert.True(t, ok) } func testTXTRegistryRecords(t *testing.T) { @@ -136,9 +132,7 @@ func testTXTRegistryRecordsPrefixed(t *testing.T) { r, _ := NewTXTRegistry(p, "txt.", "owner") records, _ := r.Records() - if !testutils.SameEndpoints(records, expectedRecords) { - t.Error("incorrect result returned from txt registry") - } + assert.True(t, testutils.SameEndpoints(records, expectedRecords)) } func testTXTRegistryRecordsNoPrefix(t *testing.T) { @@ -211,9 +205,7 @@ func testTXTRegistryRecordsNoPrefix(t *testing.T) { r, _ := NewTXTRegistry(p, "", "owner") records, _ := r.Records() - if !testutils.SameEndpoints(records, expectedRecords) { - t.Error("incorrect result returned from txt registry") - } + assert.True(t, testutils.SameEndpoints(records, expectedRecords)) } func testTXTRegistryApplyChanges(t *testing.T) { @@ -282,14 +274,10 @@ func testTXTRegistryApplyChangesWithPrefix(t *testing.T) { "UpdateOld": got.UpdateOld, "Delete": got.Delete, } - if !testutils.SamePlanChanges(mGot, mExpected) { - t.Error("incorrect plan changes are passed to provider") - } + assert.True(t, testutils.SamePlanChanges(mGot, mExpected)) } err := r.ApplyChanges(changes) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) } func testTXTRegistryApplyChangesNoPrefix(t *testing.T) { @@ -349,14 +337,10 @@ func testTXTRegistryApplyChangesNoPrefix(t *testing.T) { "UpdateOld": got.UpdateOld, "Delete": got.Delete, } - if !testutils.SamePlanChanges(mGot, mExpected) { - t.Error("incorrect plan changes are passed to provider") - } + assert.True(t, testutils.SamePlanChanges(mGot, mExpected)) } err := r.ApplyChanges(changes) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) } /** diff --git a/source/dedup_source_test.go b/source/dedup_source_test.go index ae760d656..bd6bffcd6 100644 --- a/source/dedup_source_test.go +++ b/source/dedup_source_test.go @@ -20,6 +20,7 @@ import ( "testing" "github.com/kubernetes-incubator/external-dns/endpoint" + "github.com/kubernetes-incubator/external-dns/internal/testutils" ) // Validates that dedupSource is a Source @@ -90,8 +91,11 @@ func testDedupEndpoints(t *testing.T) { }, } { t.Run(tc.title, func(t *testing.T) { + mockSource := new(testutils.MockSource) + mockSource.On("Endpoints").Return(tc.endpoints, nil) + // Create our object under test and get the endpoints. - source := NewDedupSource(NewMockSource(tc.endpoints)) + source := NewDedupSource(mockSource) endpoints, err := source.Endpoints() if err != nil { @@ -100,6 +104,9 @@ func testDedupEndpoints(t *testing.T) { // Validate returned endpoints against desired endpoints. validateEndpoints(t, endpoints, tc.expected) + + // Validate that the mock source was called. + mockSource.AssertExpectations(t) }) } } diff --git a/source/ingress_test.go b/source/ingress_test.go index b7ada8680..fbbb614fa 100644 --- a/source/ingress_test.go +++ b/source/ingress_test.go @@ -25,6 +25,9 @@ import ( "k8s.io/client-go/pkg/apis/extensions/v1beta1" "github.com/kubernetes-incubator/external-dns/endpoint" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) // Validates that ingressSource is a Source @@ -58,11 +61,10 @@ func TestNewIngressSource(t *testing.T) { } { t.Run(ti.title, func(t *testing.T) { _, err := NewIngressSource(fake.NewSimpleClientset(), "", ti.fqdntemplate) - if ti.expectError && err == nil { - t.Error("invalid template should return err") - } - if !ti.expectError && err != nil { - t.Error(err) + if ti.expectError { + assert.Error(t, err) + } else { + assert.NoError(t, err) } }) } @@ -343,17 +345,13 @@ func testIngressEndpoints(t *testing.T) { ingressSource, _ := NewIngressSource(fakeClient, ti.targetNamespace, ti.fqdntemplate) for _, ingress := range ingresses { _, err := fakeClient.Extensions().Ingresses(ingress.Namespace).Create(ingress) - if err != nil { - t.Errorf("fake kubernetes ingress creation should not fail. Ingress %v. Error: %v", *ingress, err) - } + require.NoError(t, err) } res, err := ingressSource.Endpoints() - if err != nil { - t.Errorf("ingress endpoints should not fail on valid fake client call") - } - validateEndpoints(t, res, ti.expected) + require.NoError(t, err) + validateEndpoints(t, res, ti.expected) }) } } diff --git a/source/mock_source_test.go b/source/mock_source_test.go deleted file mode 100644 index d4e4a1d99..000000000 --- a/source/mock_source_test.go +++ /dev/null @@ -1,62 +0,0 @@ -/* -Copyright 2017 The Kubernetes Authors. - -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at - - http://www.apache.org/licenses/LICENSE-2.0 - -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. -*/ - -package source - -import ( - "testing" - - "github.com/kubernetes-incubator/external-dns/endpoint" -) - -// Validates that mockSource is a Source -var _ Source = &mockSource{} - -func TestMockSource(t *testing.T) { - t.Run("Endpoints", testMockSourceEndpoints) -} - -// testMockSourceEndpoints tests that endpoints are returned as given. -func testMockSourceEndpoints(t *testing.T) { - for _, tc := range []struct { - title string - givenAndExpected []*endpoint.Endpoint - }{ - { - "no endpoints given return no endpoints", - []*endpoint.Endpoint{}, - }, - { - "single endpoint given returns single endpoint", - []*endpoint.Endpoint{ - {DNSName: "foo", Target: "8.8.8.8"}, - }, - }, - } { - t.Run(tc.title, func(t *testing.T) { - // Create our object under test and get the endpoints. - source := NewMockSource(tc.givenAndExpected) - - endpoints, err := source.Endpoints() - if err != nil { - t.Fatal(err) - } - - // Validate returned endpoints against desired endpoints. - validateEndpoints(t, endpoints, tc.givenAndExpected) - }) - } -} diff --git a/source/multi_source_test.go b/source/multi_source_test.go index 79397495c..4205d6443 100644 --- a/source/multi_source_test.go +++ b/source/multi_source_test.go @@ -17,16 +17,25 @@ limitations under the License. package source import ( + "errors" "testing" "github.com/kubernetes-incubator/external-dns/endpoint" + "github.com/kubernetes-incubator/external-dns/internal/testutils" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) -// Validates that multiSource is a Source -var _ Source = &multiSource{} - func TestMultiSource(t *testing.T) { + t.Run("Interface", testMultiSourceImplementsSource) t.Run("Endpoints", testMultiSourceEndpoints) + t.Run("EndpointsWithError", testMultiSourceEndpointsWithError) +} + +// testMultiSourceImplementsSource tests that multiSource is a valid Source. +func testMultiSourceImplementsSource(t *testing.T) { + assert.Implements(t, (*Source)(nil), new(multiSource)) } // testMultiSourceEndpoints tests merged endpoints from children are returned. @@ -61,23 +70,51 @@ func testMultiSourceEndpoints(t *testing.T) { }, } { t.Run(tc.title, func(t *testing.T) { - // Prepare the nested mock sources + // Prepare the nested mock sources. sources := make([]Source, 0, len(tc.nestedEndpoints)) + // Populate the nested mock sources. for _, endpoints := range tc.nestedEndpoints { - sources = append(sources, NewMockSource(endpoints)) + src := new(testutils.MockSource) + src.On("Endpoints").Return(endpoints, nil) + + sources = append(sources, src) } // Create our object under test and get the endpoints. source := NewMultiSource(sources) + // Get endpoints from the source. endpoints, err := source.Endpoints() - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) // Validate returned endpoints against desired endpoints. validateEndpoints(t, endpoints, tc.expected) + + // Validate that the nested sources were called. + for _, src := range sources { + src.(*testutils.MockSource).AssertExpectations(t) + } }) } } + +// testMultiSourceEndpointsWithError tests that an error by a nested source is bubbled up. +func testMultiSourceEndpointsWithError(t *testing.T) { + // Create the expected error. + errSomeError := errors.New("some error") + + // Create a mocked source returning that error. + src := new(testutils.MockSource) + src.On("Endpoints").Return(nil, errSomeError) + + // Create our object under test and get the endpoints. + source := NewMultiSource([]Source{src}) + + // Get endpoints from our source. + _, err := source.Endpoints() + assert.EqualError(t, err, "some error") + + // Validate that the nested source was called. + src.AssertExpectations(t) +} diff --git a/source/service_test.go b/source/service_test.go index b42781a49..3aa04c197 100644 --- a/source/service_test.go +++ b/source/service_test.go @@ -25,16 +25,24 @@ import ( "k8s.io/client-go/pkg/api/v1" "github.com/kubernetes-incubator/external-dns/endpoint" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" ) -// Validates that serviceSource is a Source -var _ Source = &serviceSource{} - -func TestService(t *testing.T) { - t.Run("Endpoints", testServiceEndpoints) +func TestServiceSource(t *testing.T) { + t.Run("Interface", testServiceSourceImplementsSource) + t.Run("NewServiceSource", testServiceSourceNewServiceSource) + t.Run("Endpoints", testServiceSourceEndpoints) } -func TestNewServiceSource(t *testing.T) { +// testServiceSourceImplementsSource tests that serviceSource is a valid Source. +func testServiceSourceImplementsSource(t *testing.T) { + assert.Implements(t, (*Source)(nil), new(serviceSource)) +} + +// testServiceSourceNewServiceSource tests that NewServiceSource doesn't return an error. +func testServiceSourceNewServiceSource(t *testing.T) { for _, ti := range []struct { title string fqdntemplate string @@ -57,18 +65,18 @@ func TestNewServiceSource(t *testing.T) { } { t.Run(ti.title, func(t *testing.T) { _, err := NewServiceSource(fake.NewSimpleClientset(), "", ti.fqdntemplate, "") - if ti.expectError && err == nil { - t.Error("invalid template should return err") - } - if !ti.expectError && err != nil { - t.Error(err) + + if ti.expectError { + assert.Error(t, err) + } else { + assert.NoError(t, err) } }) } } -// testServiceEndpoints tests that various services generate the correct endpoints. -func testServiceEndpoints(t *testing.T) { +// testServiceSourceEndpoints tests that various services generate the correct endpoints. +func testServiceSourceEndpoints(t *testing.T) { for _, tc := range []struct { title string targetNamespace string @@ -390,20 +398,17 @@ func testServiceEndpoints(t *testing.T) { } _, err := kubernetes.CoreV1().Services(service.Namespace).Create(service) - if err != nil { - t.Fatal(err) - } + require.NoError(t, err) // Create our object under test and get the endpoints. - client, _ := NewServiceSource(kubernetes, tc.targetNamespace, tc.fqdntemplate, tc.compatibility) + client, err := NewServiceSource(kubernetes, tc.targetNamespace, tc.fqdntemplate, tc.compatibility) + require.NoError(t, err) endpoints, err := client.Endpoints() - - if !tc.expectError && err != nil { - t.Fatal(err) - } - if tc.expectError && err == nil { - t.Fatal("expected error") + if tc.expectError { + require.Error(t, err) + } else { + require.NoError(t, err) } // Validate returned endpoints against desired endpoints. @@ -434,16 +439,13 @@ func BenchmarkServiceEndpoints(b *testing.B) { } _, err := kubernetes.CoreV1().Services(service.Namespace).Create(service) - if err != nil { - b.Fatal(err) - } + require.NoError(b, err) - client, _ := NewServiceSource(kubernetes, v1.NamespaceAll, "", "") + client, err := NewServiceSource(kubernetes, v1.NamespaceAll, "", "") + require.NoError(b, err) for i := 0; i < b.N; i++ { _, err := client.Endpoints() - if err != nil { - b.Fatal(err) - } + require.NoError(b, err) } } diff --git a/source/store_test.go b/source/store_test.go index c5918961c..fe3d8cb78 100644 --- a/source/store_test.go +++ b/source/store_test.go @@ -16,7 +16,14 @@ limitations under the License. package source -import "testing" +import ( + "testing" + + "github.com/kubernetes-incubator/external-dns/internal/testutils" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) func TestStore(t *testing.T) { t.Run("RegisterAndLookup", testRegisterAndLookup) @@ -32,7 +39,7 @@ func testRegisterAndLookup(t *testing.T) { { "registered source is found by name", map[string]Source{ - "foo": NewMockSource(nil), + "foo": &testutils.MockSource{}, }, }, } { @@ -42,9 +49,7 @@ func testRegisterAndLookup(t *testing.T) { } for k, v := range tc.givenAndExpected { - if Lookup(k) != v { - t.Errorf("expected %#v, got %#v", v, Lookup(k)) - } + assert.Equal(t, v, Lookup(k)) } }) } @@ -61,8 +66,8 @@ func testLookupMultiple(t *testing.T) { { "multiple registered sources are found by names", map[string]Source{ - "foo": NewMockSource(nil), - "bar": NewMockSource(nil), + "foo": &testutils.MockSource{}, + "bar": &testutils.MockSource{}, }, []string{"foo", "bar"}, false, @@ -70,10 +75,10 @@ func testLookupMultiple(t *testing.T) { { "multiple registered sources, one source not registered", map[string]Source{ - "foo": NewMockSource(nil), - "bar": NewMockSource(nil), + "foo": &testutils.MockSource{}, + "bar": &testutils.MockSource{}, }, - []string{"foo", "baz"}, + []string{"foo", "bar", "baz"}, true, }, } { @@ -83,20 +88,13 @@ func testLookupMultiple(t *testing.T) { } lookup, err := LookupMultiple(tc.names) - if !tc.expectError && err != nil { - t.Fatal(err) - } - if tc.expectError { - if err == nil { - t.Fatal("look up should fail if source not registered") - } - t.Skip() - } - - for i, name := range tc.names { - if lookup[i] != tc.registered[name] { - t.Errorf("expected %#v, got %#v", tc.registered[name], lookup[i]) + require.Error(t, err) + } else { + require.NoError(t, err) + require.Len(t, lookup, len(tc.registered)) + for _, source := range tc.registered { + assert.Contains(t, lookup, source) } } }) diff --git a/vendor/github.com/aws/aws-sdk-go/CHANGELOG.md b/vendor/github.com/aws/aws-sdk-go/CHANGELOG.md index c3fc3280f..c91e2219b 100644 --- a/vendor/github.com/aws/aws-sdk-go/CHANGELOG.md +++ b/vendor/github.com/aws/aws-sdk-go/CHANGELOG.md @@ -1,3 +1,68 @@ +Release v1.8.27 (2017-05-22) +=== + +### Service Client Updates +* `aws/endpoints`: Updated Regions and Endpoints metadata. +* `service/resourcegroupstaggingapi`: Updates service API, documentation, and paginators + * You can now specify the number of resources returned per page in GetResources operation, as an optional parameter, to easily manage the list of resources returned by your queries. + +### SDK Bugs +* `aws/request`: Add support for PUT temporary redirects (307) [#1283](https://github.com/aws/aws-sdk-go/issues/1283) + * Adds support for Go 1.8's GetBody function allowing the SDK's http request using PUT and POST methods to be redirected with temporary redirects with 307 status code. + * Fixes: [#1267](https://github.com/aws/aws-sdk-go/issues/1267) +* `aws/request`: Add handling for retrying temporary errors during unmarshal [#1289](https://github.com/aws/aws-sdk-go/issues/1289) + * Adds support for retrying temporary errors that occur during unmarshaling of a request's response body. + * Fixes: [#1275](https://github.com/aws/aws-sdk-go/issues/1275) +Release v1.8.26 (2017-05-18) +=== + +### Service Client Updates +* `service/athena`: Adds new service + * This release adds support for Amazon Athena. Amazon Athena is an interactive query service that makes it easy to analyze data in Amazon S3 using standard SQL. Athena is serverless, so there is no infrastructure to manage, and you pay only for the queries that you run. +* `service/lightsail`: Updates service API, documentation, and paginators + * This release adds new APIs that make it easier to set network port configurations on Lightsail instances. Developers can now make a single request to both open and close public ports on an instance using the PutInstancePublicPorts operation. + +### SDK Bugs +* `aws/request`: Fix logging from reporting wrong retry request errors #1281 + * Fixes the SDK's retry request logging to report the the actual error that occurred, not a stubbed Unknown error message. + * Fixes the SDK's response logger to not output the response log multiple times per retry. +Release v1.8.25 (2017-05-17) +=== + +### Service Client Updates +* `service/autoscaling`: Updates service documentation, paginators, and examples + * Various Auto Scaling documentation updates +* `service/cloudwatchevents`: Updates service documentation + * Various CloudWatch Events documentation updates. +* `service/cloudwatchlogs`: Updates service documentation and paginators + * Various CloudWatch Logs documentation updates. +* `service/polly`: Updates service API + * Amazon Polly adds new German voice "Vicki" + +Release v1.8.24 (2017-05-16) +=== + +### Service Client Updates +* `service/codedeploy`: Updates service API and documentation + * This release introduces the previousRevision field in the responses to the GetDeployment and BatchGetDeployments actions. previousRevision provides information about the application revision that was deployed to the deployment group before the most recent successful deployment. Also, the fileExistsBehavior parameter has been added for CreateDeployment action requests. In the past, if the AWS CodeDeploy agent detected files in a target location that weren't part of the application revision from the most recent successful deployment, it would fail the current deployment by default. This new parameter provides options for how the agent handles these files: fail the deployment, retain the content, or overwrite the content. +* `service/gamelift`: Updates service API and documentation + * Allow developers to specify how metrics are grouped in CloudWatch for their GameLift fleets. Developers can also specify how many concurrent game sessions activate on a per-instance basis. +* `service/inspector`: Updates service API, documentation, paginators, and examples + * Adds ability to produce an assessment report that includes detailed and comprehensive results of a specified assessment run. +* `service/kms`: Updates service documentation + * Update documentation for KMS. + +Release v1.8.23 (2017-05-15) +=== + +### Service Client Updates +* `service/ssm`: Updates service API and documentation + * UpdateAssociation API now supports updating document name and targets of an association. GetAutomationExecution API can return FailureDetails as an optional field to the StepExecution Object, which contains failure type, failure stage as well as other failure related information for a failed step. + +### SDK Enhancements +* `aws/session`: SDK should be able to load multiple custom shared config files. [#1258](https://github.com/aws/aws-sdk-go/issues/1258) + * This change adds a `SharedConfigFiles` field to the `session.Options` type that allows you to specify the files, and their order, the SDK will use for loading shared configuration and credentials from when the `Session` is created. Use the `NewSessionWithOptions` Session constructor to specify these options. You'll also most likely want to enable support for the shared configuration file's additional attributes by setting `session.Option`'s `SharedConfigState` to `session.SharedConfigEnabled`. + Release v1.8.22 (2017-05-11) === diff --git a/vendor/github.com/aws/aws-sdk-go/Makefile b/vendor/github.com/aws/aws-sdk-go/Makefile index e73585b78..931bfd694 100644 --- a/vendor/github.com/aws/aws-sdk-go/Makefile +++ b/vendor/github.com/aws/aws-sdk-go/Makefile @@ -153,6 +153,7 @@ get-deps-tests: go get github.com/stretchr/testify go get github.com/smartystreets/goconvey go get golang.org/x/net/html + go get golang.org/x/net/http2 get-deps-verify: @echo "go get SDK verification utilities" diff --git a/vendor/github.com/aws/aws-sdk-go/aws/client/logger.go b/vendor/github.com/aws/aws-sdk-go/aws/client/logger.go index 21ecfa190..1f39c91f2 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/client/logger.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/client/logger.go @@ -97,6 +97,12 @@ func logResponse(r *request.Request) { } } - r.Handlers.Unmarshal.PushBack(handlerFn) - r.Handlers.UnmarshalError.PushBack(handlerFn) + const handlerName = "awsdk.client.LogResponse.ResponseBody" + + r.Handlers.Unmarshal.SetBackNamed(request.NamedHandler{ + Name: handlerName, Fn: handlerFn, + }) + r.Handlers.UnmarshalError.SetBackNamed(request.NamedHandler{ + Name: handlerName, Fn: handlerFn, + }) } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go index 25b461c31..495e3ef62 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers.go @@ -106,6 +106,22 @@ var SendHandler = request.NamedHandler{ sender = sendWithoutFollowRedirects } + if request.NoBody == r.HTTPRequest.Body { + // Strip off the request body if the NoBody reader was used as a + // place holder for a request body. This prevents the SDK from + // making requests with a request body when it would be invalid + // to do so. + // + // Use a shallow copy of the http.Request to ensure the race condition + // of transport on Body will not trigger + reqOrig, reqCopy := r.HTTPRequest, *r.HTTPRequest + reqCopy.Body = nil + r.HTTPRequest = &reqCopy + defer func() { + r.HTTPRequest = reqOrig + }() + } + var err error r.HTTPResponse, err = sender(r) if err != nil { diff --git a/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_1_8_test.go b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_1_8_test.go new file mode 100644 index 000000000..b47afc249 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/aws/corehandlers/handlers_1_8_test.go @@ -0,0 +1,64 @@ +// +build go1.8 + +package corehandlers_test + +import ( + "crypto/tls" + "net/http" + "testing" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/credentials" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/awstesting" + "github.com/aws/aws-sdk-go/service/s3" + "golang.org/x/net/http2" +) + +func TestSendHandler_HEADNoBody(t *testing.T) { + TLSBundleCertFile, TLSBundleKeyFile, TLSBundleCAFile, err := awstesting.CreateTLSBundleFiles() + if err != nil { + panic(err) + } + defer awstesting.CleanupTLSBundleFiles(TLSBundleCertFile, TLSBundleKeyFile, TLSBundleCAFile) + + endpoint, err := awstesting.CreateTLSServer(TLSBundleCertFile, TLSBundleKeyFile, nil) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + + transport := http.DefaultTransport.(*http.Transport) + // test server's certificate is self-signed certificate + transport.TLSClientConfig = &tls.Config{InsecureSkipVerify: true} + http2.ConfigureTransport(transport) + + sess, err := session.NewSessionWithOptions(session.Options{ + Config: aws.Config{ + HTTPClient: &http.Client{}, + Endpoint: aws.String(endpoint), + Region: aws.String("mock-region"), + Credentials: credentials.AnonymousCredentials, + S3ForcePathStyle: aws.Bool(true), + }, + }) + + svc := s3.New(sess) + + req, _ := svc.HeadObjectRequest(&s3.HeadObjectInput{ + Bucket: aws.String("bucketname"), + Key: aws.String("keyname"), + }) + + if e, a := request.NoBody, req.HTTPRequest.Body; e != a { + t.Fatalf("expect %T request body, got %T", e, a) + } + + err = req.Send() + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + if e, a := http.StatusOK, req.HTTPResponse.StatusCode; e != a { + t.Errorf("expect %d status code, got %d", e, a) + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go index e6d7ede6d..b1ae6794e 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/endpoints/defaults.go @@ -639,11 +639,15 @@ var awsPartition = partition{ Endpoints: endpoints{ "ap-northeast-1": endpoint{}, + "ap-northeast-2": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "us-east-1": endpoint{}, + "us-east-2": endpoint{}, "us-west-2": endpoint{}, }, }, @@ -1075,7 +1079,12 @@ var awsPartition = partition{ "lightsail": service{ Endpoints: endpoints{ - "us-east-1": endpoint{}, + "eu-central-1": endpoint{}, + "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, + "us-east-1": endpoint{}, + "us-east-2": endpoint{}, + "us-west-2": endpoint{}, }, }, "logs": service{ @@ -1531,7 +1540,7 @@ var awsPartition = partition{ }, "streams.dynamodb": service{ Defaults: endpoint{ - Protocols: []string{"http", "http", "https", "https"}, + Protocols: []string{"http", "https"}, CredentialScope: credentialScope{ Service: "dynamodb", }, @@ -1586,9 +1595,33 @@ var awsPartition = partition{ "eu-west-2": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, - "us-east-2": endpoint{}, - "us-west-1": endpoint{}, - "us-west-2": endpoint{}, + "us-east-1-fips": endpoint{ + Hostname: "sts-fips.us-east-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-1", + }, + }, + "us-east-2": endpoint{}, + "us-east-2-fips": endpoint{ + Hostname: "sts-fips.us-east-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-east-2", + }, + }, + "us-west-1": endpoint{}, + "us-west-1-fips": endpoint{ + Hostname: "sts-fips.us-west-1.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-1", + }, + }, + "us-west-2": endpoint{}, + "us-west-2-fips": endpoint{ + Hostname: "sts-fips.us-west-2.amazonaws.com", + CredentialScope: credentialScope{ + Region: "us-west-2", + }, + }, }, }, "support": service{ @@ -1688,8 +1721,10 @@ var awsPartition = partition{ "ap-south-1": endpoint{}, "ap-southeast-1": endpoint{}, "ap-southeast-2": endpoint{}, + "ca-central-1": endpoint{}, "eu-central-1": endpoint{}, "eu-west-1": endpoint{}, + "eu-west-2": endpoint{}, "sa-east-1": endpoint{}, "us-east-1": endpoint{}, "us-east-2": endpoint{}, @@ -1912,7 +1947,7 @@ var awscnPartition = partition{ }, "streams.dynamodb": service{ Defaults: endpoint{ - Protocols: []string{"http", "http", "https", "https"}, + Protocols: []string{"http", "https"}, CredentialScope: credentialScope{ Service: "dynamodb", }, @@ -2051,6 +2086,12 @@ var awsusgovPartition = partition{ }, }, }, + "events": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, "glacier": service{ Endpoints: endpoints{ @@ -2084,6 +2125,12 @@ var awsusgovPartition = partition{ "us-gov-west-1": endpoint{}, }, }, + "lambda": service{ + + Endpoints: endpoints{ + "us-gov-west-1": endpoint{}, + }, + }, "logs": service{ Endpoints: endpoints{ diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go b/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go index 6c14336f6..802ac88ad 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/handlers.go @@ -158,6 +158,37 @@ func (l *HandlerList) RemoveByName(name string) { } } +// SwapNamed will swap out any existing handlers with the same name as the +// passed in NamedHandler returning true if handlers were swapped. False is +// returned otherwise. +func (l *HandlerList) SwapNamed(n NamedHandler) (swapped bool) { + for i := 0; i < len(l.list); i++ { + if l.list[i].Name == n.Name { + l.list[i].Fn = n.Fn + swapped = true + } + } + + return swapped +} + +// SetBackNamed will replace the named handler if it exists in the handler list. +// If the handler does not exist the handler will be added to the end of the list. +func (l *HandlerList) SetBackNamed(n NamedHandler) { + if !l.SwapNamed(n) { + l.PushBackNamed(n) + } +} + +// SetFrontNamed will replace the named handler if it exists in the handler list. +// If the handler does not exist the handler will be added to the beginning of +// the list. +func (l *HandlerList) SetFrontNamed(n NamedHandler) { + if !l.SwapNamed(n) { + l.PushFrontNamed(n) + } +} + // Run executes all handlers in the list with a given request object. func (l *HandlerList) Run(r *Request) { for i, h := range l.list { diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/handlers_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/handlers_test.go index e375a998f..b2da558d6 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/handlers_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/handlers_test.go @@ -1,10 +1,9 @@ package request_test import ( + "reflect" "testing" - "github.com/stretchr/testify/assert" - "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/request" "github.com/aws/aws-sdk-go/awstesting/unit" @@ -20,8 +19,12 @@ func TestHandlerList(t *testing.T) { r.Data = s }) l.Run(r) - assert.Equal(t, "a", s) - assert.Equal(t, "a", r.Data) + if e, a := "a", s; e != a { + t.Errorf("expect %q update got %q", e, a) + } + if e, a := "a", r.Data.(string); e != a { + t.Errorf("expect %q data update got %q", e, a) + } } func TestMultipleHandlers(t *testing.T) { @@ -43,9 +46,110 @@ func TestNamedHandlers(t *testing.T) { l.PushBackNamed(named) l.PushBackNamed(named2) l.PushBack(func(r *request.Request) {}) - assert.Equal(t, 4, l.Len()) + if e, a := 4, l.Len(); e != a { + t.Errorf("expect %d list length, got %d", e, a) + } l.Remove(named) - assert.Equal(t, 2, l.Len()) + if e, a := 2, l.Len(); e != a { + t.Errorf("expect %d list length, got %d", e, a) + } +} + +func TestSwapHandlers(t *testing.T) { + firstHandlerCalled := 0 + swappedOutHandlerCalled := 0 + swappedInHandlerCalled := 0 + + l := request.HandlerList{} + named := request.NamedHandler{Name: "Name", Fn: func(r *request.Request) { + firstHandlerCalled++ + }} + named2 := request.NamedHandler{Name: "SwapOutName", Fn: func(r *request.Request) { + swappedOutHandlerCalled++ + }} + l.PushBackNamed(named) + l.PushBackNamed(named2) + l.PushBackNamed(named) + + l.SwapNamed(request.NamedHandler{Name: "SwapOutName", Fn: func(r *request.Request) { + swappedInHandlerCalled++ + }}) + + l.Run(&request.Request{}) + + if e, a := 2, firstHandlerCalled; e != a { + t.Errorf("expect first handler to be called %d, was called %d times", e, a) + } + if n := swappedOutHandlerCalled; n != 0 { + t.Errorf("expect swapped out handler to not be called, was called %d times", n) + } + if e, a := 1, swappedInHandlerCalled; e != a { + t.Errorf("expect swapped in handler to be called %d, was called %d times", e, a) + } +} + +func TestSetBackNamed_Exists(t *testing.T) { + firstHandlerCalled := 0 + swappedOutHandlerCalled := 0 + swappedInHandlerCalled := 0 + + l := request.HandlerList{} + named := request.NamedHandler{Name: "Name", Fn: func(r *request.Request) { + firstHandlerCalled++ + }} + named2 := request.NamedHandler{Name: "SwapOutName", Fn: func(r *request.Request) { + swappedOutHandlerCalled++ + }} + l.PushBackNamed(named) + l.PushBackNamed(named2) + + l.SetBackNamed(request.NamedHandler{Name: "SwapOutName", Fn: func(r *request.Request) { + swappedInHandlerCalled++ + }}) + + l.Run(&request.Request{}) + + if e, a := 1, firstHandlerCalled; e != a { + t.Errorf("expect first handler to be called %d, was called %d times", e, a) + } + if n := swappedOutHandlerCalled; n != 0 { + t.Errorf("expect swapped out handler to not be called, was called %d times", n) + } + if e, a := 1, swappedInHandlerCalled; e != a { + t.Errorf("expect swapped in handler to be called %d, was called %d times", e, a) + } +} + +func TestSetBackNamed_NotExists(t *testing.T) { + firstHandlerCalled := 0 + secondHandlerCalled := 0 + swappedInHandlerCalled := 0 + + l := request.HandlerList{} + named := request.NamedHandler{Name: "Name", Fn: func(r *request.Request) { + firstHandlerCalled++ + }} + named2 := request.NamedHandler{Name: "OtherName", Fn: func(r *request.Request) { + secondHandlerCalled++ + }} + l.PushBackNamed(named) + l.PushBackNamed(named2) + + l.SetBackNamed(request.NamedHandler{Name: "SwapOutName", Fn: func(r *request.Request) { + swappedInHandlerCalled++ + }}) + + l.Run(&request.Request{}) + + if e, a := 1, firstHandlerCalled; e != a { + t.Errorf("expect first handler to be called %d, was called %d times", e, a) + } + if e, a := 1, secondHandlerCalled; e != a { + t.Errorf("expect second handler to be called %d, was called %d times", e, a) + } + if e, a := 1, swappedInHandlerCalled; e != a { + t.Errorf("expect swapped in handler to be called %d, was called %d times", e, a) + } } func TestLoggedHandlers(t *testing.T) { @@ -63,7 +167,10 @@ func TestLoggedHandlers(t *testing.T) { l.PushBackNamed(named2) l.Run(&request.Request{Config: cfg}) - assert.Equal(t, expectedHandlers, loggedHandlers) + if !reflect.DeepEqual(expectedHandlers, loggedHandlers) { + t.Errorf("expect handlers executed %v to match logged handlers, %v", + expectedHandlers, loggedHandlers) + } } func TestStopHandlers(t *testing.T) { @@ -81,11 +188,13 @@ func TestStopHandlers(t *testing.T) { called++ }}) l.PushBackNamed(request.NamedHandler{Name: "name3", Fn: func(r *request.Request) { - assert.Fail(t, "third handler should not be called") + t.Fatalf("third handler should not be called") }}) l.Run(&request.Request{}) - assert.Equal(t, 2, called, "Expect only two handlers to be called") + if e, a := 2, called; e != a { + t.Errorf("expect %d handlers called, got %d", e, a) + } } func BenchmarkNewRequest(b *testing.B) { diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request.go index 4f4f1123a..299dc379d 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request.go @@ -338,10 +338,7 @@ func (r *Request) Sign() error { return r.Error } -// ResetBody rewinds the request body backto its starting position, and -// set's the HTTP Request body reference. When the body is read prior -// to being sent in the HTTP request it will need to be rewound. -func (r *Request) ResetBody() { +func (r *Request) getNextRequestBody() (io.ReadCloser, error) { if r.safeBody != nil { r.safeBody.Close() } @@ -363,14 +360,14 @@ func (r *Request) ResetBody() { // Related golang/go#18257 l, err := computeBodyLength(r.Body) if err != nil { - r.Error = awserr.New(ErrCodeSerialization, "failed to compute request body size", err) - return + return nil, awserr.New(ErrCodeSerialization, "failed to compute request body size", err) } + var body io.ReadCloser if l == 0 { - r.HTTPRequest.Body = noBodyReader + body = NoBody } else if l > 0 { - r.HTTPRequest.Body = r.safeBody + body = r.safeBody } else { // Hack to prevent sending bodies for methods where the body // should be ignored by the server. Sending bodies on these @@ -382,11 +379,13 @@ func (r *Request) ResetBody() { // a io.Reader that was not also an io.Seeker. switch r.Operation.HTTPMethod { case "GET", "HEAD", "DELETE": - r.HTTPRequest.Body = noBodyReader + body = NoBody default: - r.HTTPRequest.Body = r.safeBody + body = r.safeBody } } + + return body, nil } // Attempts to compute the length of the body of the reader using the @@ -488,7 +487,7 @@ func (r *Request) Send() error { r.Handlers.Retry.Run(r) r.Handlers.AfterRetry.Run(r) if r.Error != nil { - debugLogReqError(r, "Send Request", false, r.Error) + debugLogReqError(r, "Send Request", false, err) return r.Error } debugLogReqError(r, "Send Request", true, err) @@ -497,12 +496,13 @@ func (r *Request) Send() error { r.Handlers.UnmarshalMeta.Run(r) r.Handlers.ValidateResponse.Run(r) if r.Error != nil { - err := r.Error r.Handlers.UnmarshalError.Run(r) + err := r.Error + r.Handlers.Retry.Run(r) r.Handlers.AfterRetry.Run(r) if r.Error != nil { - debugLogReqError(r, "Validate Response", false, r.Error) + debugLogReqError(r, "Validate Response", false, err) return r.Error } debugLogReqError(r, "Validate Response", true, err) @@ -515,7 +515,7 @@ func (r *Request) Send() error { r.Handlers.Retry.Run(r) r.Handlers.AfterRetry.Run(r) if r.Error != nil { - debugLogReqError(r, "Unmarshal Response", false, r.Error) + debugLogReqError(r, "Unmarshal Response", false, err) return r.Error } debugLogReqError(r, "Unmarshal Response", true, err) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_7.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_7.go index 1323af900..869b97a1a 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_7.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_7.go @@ -16,6 +16,24 @@ func (noBody) Read([]byte) (int, error) { return 0, io.EOF } func (noBody) Close() error { return nil } func (noBody) WriteTo(io.Writer) (int64, error) { return 0, nil } -// Is an empty reader that will trigger the Go HTTP client to not include +// NoBody is an empty reader that will trigger the Go HTTP client to not include // and body in the HTTP request. -var noBodyReader = noBody{} +var NoBody = noBody{} + +// ResetBody rewinds the request body back to its starting position, and +// set's the HTTP Request body reference. When the body is read prior +// to being sent in the HTTP request it will need to be rewound. +// +// ResetBody will automatically be called by the SDK's build handler, but if +// the request is being used directly ResetBody must be called before the request +// is Sent. SetStringBody, SetBufferBody, and SetReaderBody will automatically +// call ResetBody. +func (r *Request) ResetBody() { + body, err := r.getNextRequestBody() + if err != nil { + r.Error = err + return + } + + r.HTTPRequest.Body = body +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8.go index 8b963f4de..c32fc69bc 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8.go @@ -2,8 +2,32 @@ package request -import "net/http" +import ( + "net/http" +) -// Is a http.NoBody reader instructing Go HTTP client to not include +// NoBody is a http.NoBody reader instructing Go HTTP client to not include // and body in the HTTP request. -var noBodyReader = http.NoBody +var NoBody = http.NoBody + +// ResetBody rewinds the request body back to its starting position, and +// set's the HTTP Request body reference. When the body is read prior +// to being sent in the HTTP request it will need to be rewound. +// +// ResetBody will automatically be called by the SDK's build handler, but if +// the request is being used directly ResetBody must be called before the request +// is Sent. SetStringBody, SetBufferBody, and SetReaderBody will automatically +// call ResetBody. +// +// Will also set the Go 1.8's http.Request.GetBody member to allow retrying +// PUT/POST redirects. +func (r *Request) ResetBody() { + body, err := r.getNextRequestBody() + if err != nil { + r.Error = err + return + } + + r.HTTPRequest.Body = body + r.HTTPRequest.GetBody = r.getNextRequestBody +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8_test.go index 6a3aba68f..8f3b0f04e 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request_1_8_test.go @@ -1,15 +1,23 @@ // +build go1.8 -package request +package request_test import ( + "bytes" + "io" "net/http" + "net/http/httptest" "strings" "testing" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/awstesting" + "github.com/aws/aws-sdk-go/awstesting/unit" ) func TestResetBody_WithEmptyBody(t *testing.T) { - r := Request{ + r := request.Request{ HTTPRequest: &http.Request{}, } @@ -23,3 +31,55 @@ func TestResetBody_WithEmptyBody(t *testing.T) { r.HTTPRequest.Body) } } + +func TestRequest_FollowPUTRedirects(t *testing.T) { + const bodySize = 1024 + + redirectHit := 0 + endpointHit := 0 + + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + switch r.URL.Path { + case "/redirect-me": + u := *r.URL + u.Path = "/endpoint" + w.Header().Set("Location", u.String()) + w.WriteHeader(307) + redirectHit++ + case "/endpoint": + b := bytes.Buffer{} + io.Copy(&b, r.Body) + r.Body.Close() + if e, a := bodySize, b.Len(); e != a { + t.Fatalf("expect %d body size, got %d", e, a) + } + endpointHit++ + default: + t.Fatalf("unexpected endpoint used, %q", r.URL.String()) + } + })) + + svc := awstesting.NewClient(&aws.Config{ + Region: unit.Session.Config.Region, + DisableSSL: aws.Bool(true), + Endpoint: aws.String(server.URL), + }) + + req := svc.NewRequest(&request.Operation{ + Name: "Operation", + HTTPMethod: "PUT", + HTTPPath: "/redirect-me", + }, &struct{}{}, &struct{}{}) + req.SetReaderBody(bytes.NewReader(make([]byte, bodySize))) + + err := req.Send() + if err != nil { + t.Errorf("expect no error, got %v", err) + } + if e, a := 1, redirectHit; e != a { + t.Errorf("expect %d redirect hits, got %d", e, a) + } + if e, a := 1, endpointHit; e != a { + t.Errorf("expect %d endpoint hits, got %d", e, a) + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_resetbody_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_resetbody_test.go index 4efc5057d..4a9172480 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_resetbody_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request_resetbody_test.go @@ -50,7 +50,7 @@ func TestResetBody_ExcludeUnseekableBodyByMethod(t *testing.T) { r.SetReaderBody(reader) - if a, e := r.HTTPRequest.Body == noBodyReader, c.IsNoBody; a != e { + if a, e := r.HTTPRequest.Body == NoBody, c.IsNoBody; a != e { t.Errorf("%d, expect body to be set to noBody(%t), but was %t", i, e, a) } } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/request_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/request_test.go index eebf53cba..0082fa8b3 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/request_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/request_test.go @@ -760,3 +760,83 @@ func (reader *errReader) Read(b []byte) (int, error) { func (reader *errReader) Close() error { return nil } + +func TestIsNoBodyReader(t *testing.T) { + cases := []struct { + reader io.ReadCloser + expect bool + }{ + {ioutil.NopCloser(bytes.NewReader([]byte("abc"))), false}, + {ioutil.NopCloser(bytes.NewReader(nil)), false}, + {nil, false}, + {request.NoBody, true}, + } + + for i, c := range cases { + if e, a := c.expect, request.NoBody == c.reader; e != a { + t.Errorf("%d, expect %t match, but was %t", i, e, a) + } + } +} + +func TestRequest_TemporaryRetry(t *testing.T) { + done := make(chan struct{}) + + server := httptest.NewServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { + w.Header().Set("Content-Length", "1024") + w.WriteHeader(http.StatusOK) + + w.Write(make([]byte, 100)) + + f := w.(http.Flusher) + f.Flush() + + <-done + })) + + client := &http.Client{ + Timeout: 100 * time.Millisecond, + } + + svc := awstesting.NewClient(&aws.Config{ + Region: unit.Session.Config.Region, + MaxRetries: aws.Int(1), + HTTPClient: client, + DisableSSL: aws.Bool(true), + Endpoint: aws.String(server.URL), + }) + + req := svc.NewRequest(&request.Operation{ + Name: "name", HTTPMethod: "GET", HTTPPath: "/path", + }, &struct{}{}, &struct{}{}) + + req.Handlers.Unmarshal.PushBack(func(r *request.Request) { + defer req.HTTPResponse.Body.Close() + _, err := io.Copy(ioutil.Discard, req.HTTPResponse.Body) + r.Error = awserr.New(request.ErrCodeSerialization, "error", err) + }) + + err := req.Send() + if err == nil { + t.Errorf("expect error, got none") + } + close(done) + + aerr := err.(awserr.Error) + if e, a := request.ErrCodeSerialization, aerr.Code(); e != a { + t.Errorf("expect %q error code, got %q", e, a) + } + + if e, a := 1, req.RetryCount; e != a { + t.Errorf("expect %d retries, got %d", e, a) + } + + type temporary interface { + Temporary() bool + } + + terr := aerr.OrigErr().(temporary) + if !terr.Temporary() { + t.Errorf("expect temporary error, was not") + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go b/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go index 7af81de2a..8d369c1b8 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/retryer.go @@ -38,7 +38,6 @@ var throttleCodes = map[string]struct{}{ "ThrottlingException": {}, "RequestLimitExceeded": {}, "RequestThrottled": {}, - "LimitExceededException": {}, // Deleting 10+ DynamoDb tables at once "TooManyRequestsException": {}, // Lambda functions "PriorRequestNotComplete": {}, // Route53 } @@ -75,6 +74,10 @@ var validParentCodes = map[string]struct{}{ ErrCodeRead: struct{}{}, } +type temporaryError interface { + Temporary() bool +} + func isNestedErrorRetryable(parentErr awserr.Error) bool { if parentErr == nil { return false @@ -93,6 +96,10 @@ func isNestedErrorRetryable(parentErr awserr.Error) bool { return isCodeRetryable(aerr.Code()) } + if t, ok := err.(temporaryError); ok { + return t.Temporary() + } + return isErrConnectionReset(err) } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/request/retryer_test.go b/vendor/github.com/aws/aws-sdk-go/aws/request/retryer_test.go index b1926e3d6..a8787487e 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/request/retryer_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/request/retryer_test.go @@ -1,10 +1,10 @@ package request import ( + "errors" + "fmt" "testing" - "github.com/stretchr/testify/assert" - "github.com/aws/aws-sdk-go/aws/awserr" ) @@ -12,5 +12,51 @@ func TestRequestThrottling(t *testing.T) { req := Request{} req.Error = awserr.New("Throttling", "", nil) - assert.True(t, req.IsErrorThrottle()) + if e, a := true, req.IsErrorThrottle(); e != a { + t.Errorf("expect %t to be throttled, was %t", e, a) + } +} + +type mockTempError bool + +func (e mockTempError) Error() string { + return fmt.Sprintf("mock temporary error: %t", e.Temporary()) +} +func (e mockTempError) Temporary() bool { + return bool(e) +} + +func TestIsErrorRetryable(t *testing.T) { + cases := []struct { + Err error + IsTemp bool + }{ + { + Err: awserr.New(ErrCodeSerialization, "temporary error", mockTempError(true)), + IsTemp: true, + }, + { + Err: awserr.New(ErrCodeSerialization, "temporary error", mockTempError(false)), + IsTemp: false, + }, + { + Err: awserr.New(ErrCodeSerialization, "some error", errors.New("blah")), + IsTemp: false, + }, + { + Err: awserr.New("SomeError", "some error", nil), + IsTemp: false, + }, + { + Err: awserr.New("RequestError", "some error", nil), + IsTemp: true, + }, + } + + for i, c := range cases { + retryable := IsErrorRetryable(c.Err) + if e, a := c.IsTemp, retryable; e != a { + t.Errorf("%d, expect %t temporary error, got %t", i, e, a) + } + } } diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/custom_ca_bundle_test.go b/vendor/github.com/aws/aws-sdk-go/aws/session/custom_ca_bundle_test.go index 8a5a3a04e..52e59d99c 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/custom_ca_bundle_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/custom_ca_bundle_test.go @@ -2,90 +2,76 @@ package session import ( "bytes" - "crypto/tls" - "io/ioutil" + "fmt" "net" "net/http" - "net/http/httptest" "os" + "strings" "testing" "time" "github.com/aws/aws-sdk-go/aws" "github.com/aws/aws-sdk-go/aws/awserr" "github.com/aws/aws-sdk-go/aws/credentials" - "github.com/stretchr/testify/assert" + "github.com/aws/aws-sdk-go/awstesting" ) -func createTLSServer(cert, key []byte, done <-chan struct{}) (*httptest.Server, error) { - c, err := tls.X509KeyPair(cert, key) +var TLSBundleCertFile string +var TLSBundleKeyFile string +var TLSBundleCAFile string + +func TestMain(m *testing.M) { + var err error + + TLSBundleCertFile, TLSBundleKeyFile, TLSBundleCAFile, err = awstesting.CreateTLSBundleFiles() if err != nil { - return nil, err + panic(err) } - s := httptest.NewUnstartedServer(http.HandlerFunc(func(w http.ResponseWriter, r *http.Request) { - w.WriteHeader(http.StatusOK) - })) - s.TLS = &tls.Config{ - Certificates: []tls.Certificate{c}, - } - s.TLS.BuildNameToCertificate() - s.StartTLS() + fmt.Println("TestMain", TLSBundleCertFile, TLSBundleKeyFile) - go func() { - <-done - s.Close() - }() + code := m.Run() - return s, nil -} - -func setupTestCAFile(b []byte) (string, error) { - bundleFile, err := ioutil.TempFile(os.TempDir(), "aws-sdk-go-session-test") + err = awstesting.CleanupTLSBundleFiles(TLSBundleCertFile, TLSBundleKeyFile, TLSBundleCAFile) if err != nil { - return "", err + panic(err) } - _, err = bundleFile.Write(b) - if err != nil { - return "", err - } - - defer bundleFile.Close() - return bundleFile.Name(), nil + os.Exit(code) } func TestNewSession_WithCustomCABundle_Env(t *testing.T) { oldEnv := initSessionTestEnv() defer popEnv(oldEnv) - done := make(chan struct{}) - server, err := createTLSServer(testTLSBundleCert, testTLSBundleKey, done) - assert.NoError(t, err) + endpoint, err := awstesting.CreateTLSServer(TLSBundleCertFile, TLSBundleKeyFile, nil) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } - // Write bundle to file - caFilename, err := setupTestCAFile(testTLSBundleCA) - defer func() { - os.Remove(caFilename) - }() - assert.NoError(t, err) - - os.Setenv("AWS_CA_BUNDLE", caFilename) + os.Setenv("AWS_CA_BUNDLE", TLSBundleCAFile) s, err := NewSession(&aws.Config{ HTTPClient: &http.Client{}, - Endpoint: aws.String(server.URL), + Endpoint: aws.String(endpoint), Region: aws.String("mock-region"), Credentials: credentials.AnonymousCredentials, }) - assert.NoError(t, err) - assert.NotNil(t, s) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + if s == nil { + t.Fatalf("expect session to be created, got none") + } req, _ := http.NewRequest("GET", *s.Config.Endpoint, nil) resp, err := s.Config.HTTPClient.Do(req) - assert.NoError(t, err) - - assert.Equal(t, http.StatusOK, resp.StatusCode) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + if e, a := http.StatusOK, resp.StatusCode; e != a { + t.Errorf("expect %d status code, got %d", e, a) + } } func TestNewSession_WithCustomCABundle_EnvNotExists(t *testing.T) { @@ -95,65 +81,87 @@ func TestNewSession_WithCustomCABundle_EnvNotExists(t *testing.T) { os.Setenv("AWS_CA_BUNDLE", "file-not-exists") s, err := NewSession() - assert.Error(t, err) - assert.Equal(t, "LoadCustomCABundleError", err.(awserr.Error).Code()) - assert.Nil(t, s) + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "LoadCustomCABundleError", err.(awserr.Error).Code(); e != a { + t.Errorf("expect %s error code, got %s", e, a) + } + if s != nil { + t.Errorf("expect nil session, got %v", s) + } } func TestNewSession_WithCustomCABundle_Option(t *testing.T) { oldEnv := initSessionTestEnv() defer popEnv(oldEnv) - done := make(chan struct{}) - server, err := createTLSServer(testTLSBundleCert, testTLSBundleKey, done) - assert.NoError(t, err) + endpoint, err := awstesting.CreateTLSServer(TLSBundleCertFile, TLSBundleKeyFile, nil) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } s, err := NewSessionWithOptions(Options{ Config: aws.Config{ HTTPClient: &http.Client{}, - Endpoint: aws.String(server.URL), + Endpoint: aws.String(endpoint), Region: aws.String("mock-region"), Credentials: credentials.AnonymousCredentials, }, - CustomCABundle: bytes.NewReader(testTLSBundleCA), + CustomCABundle: bytes.NewReader(awstesting.TLSBundleCA), }) - assert.NoError(t, err) - assert.NotNil(t, s) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + if s == nil { + t.Fatalf("expect session to be created, got none") + } req, _ := http.NewRequest("GET", *s.Config.Endpoint, nil) resp, err := s.Config.HTTPClient.Do(req) - assert.NoError(t, err) - - assert.Equal(t, http.StatusOK, resp.StatusCode) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + if e, a := http.StatusOK, resp.StatusCode; e != a { + t.Errorf("expect %d status code, got %d", e, a) + } } func TestNewSession_WithCustomCABundle_OptionPriority(t *testing.T) { oldEnv := initSessionTestEnv() defer popEnv(oldEnv) - done := make(chan struct{}) - server, err := createTLSServer(testTLSBundleCert, testTLSBundleKey, done) - assert.NoError(t, err) + endpoint, err := awstesting.CreateTLSServer(TLSBundleCertFile, TLSBundleKeyFile, nil) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } os.Setenv("AWS_CA_BUNDLE", "file-not-exists") s, err := NewSessionWithOptions(Options{ Config: aws.Config{ HTTPClient: &http.Client{}, - Endpoint: aws.String(server.URL), + Endpoint: aws.String(endpoint), Region: aws.String("mock-region"), Credentials: credentials.AnonymousCredentials, }, - CustomCABundle: bytes.NewReader(testTLSBundleCA), + CustomCABundle: bytes.NewReader(awstesting.TLSBundleCA), }) - assert.NoError(t, err) - assert.NotNil(t, s) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + if s == nil { + t.Fatalf("expect session to be created, got none") + } req, _ := http.NewRequest("GET", *s.Config.Endpoint, nil) resp, err := s.Config.HTTPClient.Do(req) - assert.NoError(t, err) - - assert.Equal(t, http.StatusOK, resp.StatusCode) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + if e, a := http.StatusOK, resp.StatusCode; e != a { + t.Errorf("expect %d status code, got %d", e, a) + } } type mockRoundTripper struct{} @@ -172,25 +180,35 @@ func TestNewSession_WithCustomCABundle_UnsupportedTransport(t *testing.T) { Transport: &mockRoundTripper{}, }, }, - CustomCABundle: bytes.NewReader(testTLSBundleCA), + CustomCABundle: bytes.NewReader(awstesting.TLSBundleCA), }) - assert.Error(t, err) - assert.Equal(t, "LoadCustomCABundleError", err.(awserr.Error).Code()) - assert.Contains(t, err.(awserr.Error).Message(), "transport unsupported type") - assert.Nil(t, s) + if err == nil { + t.Fatalf("expect error, got none") + } + if e, a := "LoadCustomCABundleError", err.(awserr.Error).Code(); e != a { + t.Errorf("expect %s error code, got %s", e, a) + } + if s != nil { + t.Errorf("expect nil session, got %v", s) + } + aerrMsg := err.(awserr.Error).Message() + if e, a := "transport unsupported type", aerrMsg; !strings.Contains(a, e) { + t.Errorf("expect %s to be in %s", e, a) + } } func TestNewSession_WithCustomCABundle_TransportSet(t *testing.T) { oldEnv := initSessionTestEnv() defer popEnv(oldEnv) - done := make(chan struct{}) - server, err := createTLSServer(testTLSBundleCert, testTLSBundleKey, done) - assert.NoError(t, err) + endpoint, err := awstesting.CreateTLSServer(TLSBundleCertFile, TLSBundleKeyFile, nil) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } s, err := NewSessionWithOptions(Options{ Config: aws.Config{ - Endpoint: aws.String(server.URL), + Endpoint: aws.String(endpoint), Region: aws.String("mock-region"), Credentials: credentials.AnonymousCredentials, HTTPClient: &http.Client{ @@ -205,115 +223,21 @@ func TestNewSession_WithCustomCABundle_TransportSet(t *testing.T) { }, }, }, - CustomCABundle: bytes.NewReader(testTLSBundleCA), + CustomCABundle: bytes.NewReader(awstesting.TLSBundleCA), }) - assert.NoError(t, err) - assert.NotNil(t, s) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + if s == nil { + t.Fatalf("expect session to be created, got none") + } req, _ := http.NewRequest("GET", *s.Config.Endpoint, nil) resp, err := s.Config.HTTPClient.Do(req) - assert.NoError(t, err) - - assert.Equal(t, http.StatusOK, resp.StatusCode) + if err != nil { + t.Fatalf("expect no error, got %v", err) + } + if e, a := http.StatusOK, resp.StatusCode; e != a { + t.Errorf("expect %d status code, got %d", e, a) + } } - -/* Cert generation steps -# Create the CA key -openssl genrsa -des3 -out ca.key 1024 - -# Create the CA Cert -openssl req -new -sha256 -x509 -days 3650 \ - -subj "/C=GO/ST=Gopher/O=Testing ROOT CA" \ - -key ca.key -out ca.crt - -# Create config -cat > csr_details.txt <<-EOF - -[req] -default_bits = 1024 -prompt = no -default_md = sha256 -req_extensions = SAN -distinguished_name = dn - -[ dn ] -C=GO -ST=Gopher -O=Testing Certificate -OU=Testing IP - -[SAN] -subjectAltName = IP:127.0.0.1 -EOF - -# Create certificate signing request -openssl req -new -sha256 -nodes -newkey rsa:1024 \ - -config <( cat csr_details.txt ) \ - -keyout ia.key -out ia.csr - -# Create a signed certificate -openssl x509 -req -days 3650 \ - -CAcreateserial \ - -extfile <( cat csr_details.txt ) \ - -extensions SAN \ - -CA ca.crt -CAkey ca.key -in ia.csr -out ia.crt - -# Verify -openssl req -noout -text -in ia.csr -openssl x509 -noout -text -in ia.crt -*/ -var ( - // ca.crt - testTLSBundleCA = []byte(`-----BEGIN CERTIFICATE----- -MIICiTCCAfKgAwIBAgIJAJ5X1olt05XjMA0GCSqGSIb3DQEBCwUAMDgxCzAJBgNV -BAYTAkdPMQ8wDQYDVQQIEwZHb3BoZXIxGDAWBgNVBAoTD1Rlc3RpbmcgUk9PVCBD -QTAeFw0xNzAzMDkwMDAyMDZaFw0yNzAzMDcwMDAyMDZaMDgxCzAJBgNVBAYTAkdP -MQ8wDQYDVQQIEwZHb3BoZXIxGDAWBgNVBAoTD1Rlc3RpbmcgUk9PVCBDQTCBnzAN -BgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAw/8DN+t9XQR60jx42rsQ2WE2Dx85rb3n -GQxnKZZLNddsT8rDyxJNP18aFalbRbFlyln5fxWxZIblu9Xkm/HRhOpbSimSqo1y -uDx21NVZ1YsOvXpHby71jx3gPrrhSc/t/zikhi++6D/C6m1CiIGuiJ0GBiJxtrub -UBMXT0QtI2ECAwEAAaOBmjCBlzAdBgNVHQ4EFgQU8XG3X/YHBA6T04kdEkq6+4GV -YykwaAYDVR0jBGEwX4AU8XG3X/YHBA6T04kdEkq6+4GVYymhPKQ6MDgxCzAJBgNV -BAYTAkdPMQ8wDQYDVQQIEwZHb3BoZXIxGDAWBgNVBAoTD1Rlc3RpbmcgUk9PVCBD -QYIJAJ5X1olt05XjMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADgYEAeILv -z49+uxmPcfOZzonuOloRcpdvyjiXblYxbzz6ch8GsE7Q886FTZbvwbgLhzdwSVgG -G8WHkodDUsymVepdqAamS3f8PdCUk8xIk9mop8LgaB9Ns0/TssxDvMr3sOD2Grb3 -xyWymTWMcj6uCiEBKtnUp4rPiefcvCRYZ17/hLE= ------END CERTIFICATE----- -`) - - // ai.crt - testTLSBundleCert = []byte(`-----BEGIN CERTIFICATE----- -MIICGjCCAYOgAwIBAgIJAIIu+NOoxxM0MA0GCSqGSIb3DQEBBQUAMDgxCzAJBgNV -BAYTAkdPMQ8wDQYDVQQIEwZHb3BoZXIxGDAWBgNVBAoTD1Rlc3RpbmcgUk9PVCBD -QTAeFw0xNzAzMDkwMDAzMTRaFw0yNzAzMDcwMDAzMTRaMFExCzAJBgNVBAYTAkdP -MQ8wDQYDVQQIDAZHb3BoZXIxHDAaBgNVBAoME1Rlc3RpbmcgQ2VydGlmaWNhdGUx -EzARBgNVBAsMClRlc3RpbmcgSVAwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGB -AN1hWHeioo/nASvbrjwCQzXCiWiEzGkw353NxsAB54/NqDL3LXNATtiSJu8kJBrm -Ah12IFLtWLGXjGjjYlHbQWnOR6awveeXnQZukJyRWh7m/Qlt9Ho0CgZE1U+832ac -5GWVldNxW1Lz4I+W9/ehzqe8I80RS6eLEKfUFXGiW+9RAgMBAAGjEzARMA8GA1Ud -EQQIMAaHBH8AAAEwDQYJKoZIhvcNAQEFBQADgYEAdF4WQHfVdPCbgv9sxgJjcR1H -Hgw9rZ47gO1IiIhzglnLXQ6QuemRiHeYFg4kjcYBk1DJguxzDTGnUwhUXOibAB+S -zssmrkdYYvn9aUhjc3XK3tjAoDpsPpeBeTBamuUKDHoH/dNRXxerZ8vu6uPR3Pgs -5v/KCV6IAEcvNyOXMPo= ------END CERTIFICATE----- -`) - - // ai.key - testTLSBundleKey = []byte(`-----BEGIN RSA PRIVATE KEY----- -MIICXAIBAAKBgQDdYVh3oqKP5wEr2648AkM1wolohMxpMN+dzcbAAeePzagy9y1z -QE7YkibvJCQa5gIddiBS7Vixl4xo42JR20FpzkemsL3nl50GbpCckVoe5v0JbfR6 -NAoGRNVPvN9mnORllZXTcVtS8+CPlvf3oc6nvCPNEUunixCn1BVxolvvUQIDAQAB -AoGBAMISrcirddGrlLZLLrKC1ULS2T0cdkqdQtwHYn4+7S5+/z42vMx1iumHLsSk -rVY7X41OWkX4trFxhvEIrc/O48bo2zw78P7flTxHy14uxXnllU8cLThE29SlUU7j -AVBNxJZMsXMlS/DowwD4CjFe+x4Pu9wZcReF2Z9ntzMpySABAkEA+iWoJCPE2JpS -y78q3HYYgpNY3gF3JqQ0SI/zTNkb3YyEIUffEYq0Y9pK13HjKtdsSuX4osTIhQkS -+UgRp6tCAQJBAOKPYTfQ2FX8ijgUpHZRuEAVaxASAS0UATiLgzXxLvOh/VC2at5x -wjOX6sD65pPz/0D8Qj52Cq6Q1TQ+377SDVECQAIy0od+yPweXxvrUjUd1JlRMjbB -TIrKZqs8mKbUQapw0bh5KTy+O1elU4MRPS3jNtBxtP25PQnuSnxmZcFTgAECQFzg -DiiFcsn9FuRagfkHExMiNJuH5feGxeFaP9WzI144v9GAllrOI6Bm3JNzx2ZLlg4b -20Qju8lIEj6yr6JYFaECQHM1VSojGRKpOl9Ox/R4yYSA9RV5Gyn00/aJNxVYyPD5 -i3acL2joQm2kLD/LO8paJ4+iQdRXCOMMIpjxSNjGQjQ= ------END RSA PRIVATE KEY----- -`) -) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/session.go b/vendor/github.com/aws/aws-sdk-go/aws/session/session.go index 4792d3ae8..34a292085 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/session.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/session.go @@ -155,6 +155,10 @@ type Options struct { // and enable or disable the shared config functionality. SharedConfigState SharedConfigState + // Ordered list of files the session will load configuration from. + // It will override environment variable AWS_SHARED_CREDENTIALS_FILE, AWS_CONFIG_FILE. + SharedConfigFiles []string + // When the SDK's shared config is configured to assume a role with MFA // this option is required in order to provide the mechanism that will // retrieve the MFA token. There is no default value for this field. If @@ -304,13 +308,18 @@ func newSession(opts Options, envCfg envConfig, cfgs ...*aws.Config) (*Session, userCfg := &aws.Config{} userCfg.MergeIn(cfgs...) - // Order config files will be loaded in with later files overwriting + // Ordered config files will be loaded in with later files overwriting // previous config file values. - cfgFiles := []string{envCfg.SharedConfigFile, envCfg.SharedCredentialsFile} - if !envCfg.EnableSharedConfig { - // The shared config file (~/.aws/config) is only loaded if instructed - // to load via the envConfig.EnableSharedConfig (AWS_SDK_LOAD_CONFIG). - cfgFiles = cfgFiles[1:] + var cfgFiles []string + if opts.SharedConfigFiles != nil { + cfgFiles = opts.SharedConfigFiles + } else { + cfgFiles = []string{envCfg.SharedConfigFile, envCfg.SharedCredentialsFile} + if !envCfg.EnableSharedConfig { + // The shared config file (~/.aws/config) is only loaded if instructed + // to load via the envConfig.EnableSharedConfig (AWS_SDK_LOAD_CONFIG). + cfgFiles = cfgFiles[1:] + } } // Load additional config from file(s) diff --git a/vendor/github.com/aws/aws-sdk-go/aws/session/session_test.go b/vendor/github.com/aws/aws-sdk-go/aws/session/session_test.go index 877af02e5..25aed6892 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/session/session_test.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/session/session_test.go @@ -178,6 +178,29 @@ func TestNewSessionWithOptions_OverrideSharedConfigDisable(t *testing.T) { assert.Contains(t, creds.ProviderName, "SharedConfigCredentials") } +func TestNewSessionWithOptions_OverrideSharedConfigFiles(t *testing.T) { + oldEnv := initSessionTestEnv() + defer popEnv(oldEnv) + + os.Setenv("AWS_SDK_LOAD_CONFIG", "1") + os.Setenv("AWS_SHARED_CREDENTIALS_FILE", testConfigFilename) + os.Setenv("AWS_PROFILE", "config_file_load_order") + + s, err := NewSessionWithOptions(Options{ + SharedConfigFiles: []string{testConfigOtherFilename}, + }) + assert.NoError(t, err) + + assert.Equal(t, "shared_config_other_region", *s.Config.Region) + + creds, err := s.Config.Credentials.Get() + assert.NoError(t, err) + assert.Equal(t, "shared_config_other_akid", creds.AccessKeyID) + assert.Equal(t, "shared_config_other_secret", creds.SecretAccessKey) + assert.Empty(t, creds.SessionToken) + assert.Contains(t, creds.ProviderName, "SharedConfigCredentials") +} + func TestNewSessionWithOptions_Overrides(t *testing.T) { cases := []struct { InEnvs map[string]string diff --git a/vendor/github.com/aws/aws-sdk-go/aws/version.go b/vendor/github.com/aws/aws-sdk-go/aws/version.go index f48976231..83acc9a93 100644 --- a/vendor/github.com/aws/aws-sdk-go/aws/version.go +++ b/vendor/github.com/aws/aws-sdk-go/aws/version.go @@ -5,4 +5,4 @@ package aws const SDKName = "aws-sdk-go" // SDKVersion is the version of this SDK -const SDKVersion = "1.8.22" +const SDKVersion = "1.8.27" diff --git a/vendor/github.com/aws/aws-sdk-go/awstesting/custom_ca_bundle.go b/vendor/github.com/aws/aws-sdk-go/awstesting/custom_ca_bundle.go new file mode 100644 index 000000000..33d175534 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/awstesting/custom_ca_bundle.go @@ -0,0 +1,191 @@ +package awstesting + +import ( + "io/ioutil" + "net" + "net/http" + "os" + "time" +) + +func availableLocalAddr(ip string) (string, error) { + l, err := net.Listen("tcp", ip+":0") + if err != nil { + return "", err + } + defer l.Close() + + return l.Addr().String(), nil +} + +// CreateTLSServer will create the TLS server on an open port using the +// certificate and key. The address will be returned that the server is running on. +func CreateTLSServer(cert, key string, mux *http.ServeMux) (string, error) { + addr, err := availableLocalAddr("127.0.0.1") + if err != nil { + return "", err + } + + if mux == nil { + mux = http.NewServeMux() + mux.HandleFunc("/", func(w http.ResponseWriter, r *http.Request) {}) + } + + go func() { + if err := http.ListenAndServeTLS(addr, cert, key, mux); err != nil { + panic(err) + } + }() + time.Sleep(1 * time.Second) + + return "https://" + addr, nil +} + +// CreateTLSBundleFiles returns the temporary filenames for the certificate +// key, and CA PEM content. These files should be deleted when no longer +// needed. CleanupTLSBundleFiles can be used for this cleanup. +func CreateTLSBundleFiles() (cert, key, ca string, err error) { + cert, err = createTmpFile(TLSBundleCert) + if err != nil { + return "", "", "", err + } + + key, err = createTmpFile(TLSBundleKey) + if err != nil { + return "", "", "", err + } + + ca, err = createTmpFile(TLSBundleCA) + if err != nil { + return "", "", "", err + } + + return cert, key, ca, nil +} + +// CleanupTLSBundleFiles takes variadic list of files to be deleted. +func CleanupTLSBundleFiles(files ...string) error { + for _, file := range files { + if err := os.Remove(file); err != nil { + return err + } + } + + return nil +} + +func createTmpFile(b []byte) (string, error) { + bundleFile, err := ioutil.TempFile(os.TempDir(), "aws-sdk-go-session-test") + if err != nil { + return "", err + } + + _, err = bundleFile.Write(b) + if err != nil { + return "", err + } + + defer bundleFile.Close() + return bundleFile.Name(), nil +} + +/* Cert generation steps +# Create the CA key +openssl genrsa -des3 -out ca.key 1024 + +# Create the CA Cert +openssl req -new -sha256 -x509 -days 3650 \ + -subj "/C=GO/ST=Gopher/O=Testing ROOT CA" \ + -key ca.key -out ca.crt + +# Create config +cat > csr_details.txt <<-EOF + +[req] +default_bits = 1024 +prompt = no +default_md = sha256 +req_extensions = SAN +distinguished_name = dn + +[ dn ] +C=GO +ST=Gopher +O=Testing Certificate +OU=Testing IP + +[SAN] +subjectAltName = IP:127.0.0.1 +EOF + +# Create certificate signing request +openssl req -new -sha256 -nodes -newkey rsa:1024 \ + -config <( cat csr_details.txt ) \ + -keyout ia.key -out ia.csr + +# Create a signed certificate +openssl x509 -req -days 3650 \ + -CAcreateserial \ + -extfile <( cat csr_details.txt ) \ + -extensions SAN \ + -CA ca.crt -CAkey ca.key -in ia.csr -out ia.crt + +# Verify +openssl req -noout -text -in ia.csr +openssl x509 -noout -text -in ia.crt +*/ +var ( + // TLSBundleCA ca.crt + TLSBundleCA = []byte(`-----BEGIN CERTIFICATE----- +MIICiTCCAfKgAwIBAgIJAJ5X1olt05XjMA0GCSqGSIb3DQEBCwUAMDgxCzAJBgNV +BAYTAkdPMQ8wDQYDVQQIEwZHb3BoZXIxGDAWBgNVBAoTD1Rlc3RpbmcgUk9PVCBD +QTAeFw0xNzAzMDkwMDAyMDZaFw0yNzAzMDcwMDAyMDZaMDgxCzAJBgNVBAYTAkdP +MQ8wDQYDVQQIEwZHb3BoZXIxGDAWBgNVBAoTD1Rlc3RpbmcgUk9PVCBDQTCBnzAN +BgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAw/8DN+t9XQR60jx42rsQ2WE2Dx85rb3n +GQxnKZZLNddsT8rDyxJNP18aFalbRbFlyln5fxWxZIblu9Xkm/HRhOpbSimSqo1y +uDx21NVZ1YsOvXpHby71jx3gPrrhSc/t/zikhi++6D/C6m1CiIGuiJ0GBiJxtrub +UBMXT0QtI2ECAwEAAaOBmjCBlzAdBgNVHQ4EFgQU8XG3X/YHBA6T04kdEkq6+4GV +YykwaAYDVR0jBGEwX4AU8XG3X/YHBA6T04kdEkq6+4GVYymhPKQ6MDgxCzAJBgNV +BAYTAkdPMQ8wDQYDVQQIEwZHb3BoZXIxGDAWBgNVBAoTD1Rlc3RpbmcgUk9PVCBD +QYIJAJ5X1olt05XjMAwGA1UdEwQFMAMBAf8wDQYJKoZIhvcNAQELBQADgYEAeILv +z49+uxmPcfOZzonuOloRcpdvyjiXblYxbzz6ch8GsE7Q886FTZbvwbgLhzdwSVgG +G8WHkodDUsymVepdqAamS3f8PdCUk8xIk9mop8LgaB9Ns0/TssxDvMr3sOD2Grb3 +xyWymTWMcj6uCiEBKtnUp4rPiefcvCRYZ17/hLE= +-----END CERTIFICATE----- +`) + + // TLSBundleCert ai.crt + TLSBundleCert = []byte(`-----BEGIN CERTIFICATE----- +MIICGjCCAYOgAwIBAgIJAIIu+NOoxxM0MA0GCSqGSIb3DQEBBQUAMDgxCzAJBgNV +BAYTAkdPMQ8wDQYDVQQIEwZHb3BoZXIxGDAWBgNVBAoTD1Rlc3RpbmcgUk9PVCBD +QTAeFw0xNzAzMDkwMDAzMTRaFw0yNzAzMDcwMDAzMTRaMFExCzAJBgNVBAYTAkdP +MQ8wDQYDVQQIDAZHb3BoZXIxHDAaBgNVBAoME1Rlc3RpbmcgQ2VydGlmaWNhdGUx +EzARBgNVBAsMClRlc3RpbmcgSVAwgZ8wDQYJKoZIhvcNAQEBBQADgY0AMIGJAoGB +AN1hWHeioo/nASvbrjwCQzXCiWiEzGkw353NxsAB54/NqDL3LXNATtiSJu8kJBrm +Ah12IFLtWLGXjGjjYlHbQWnOR6awveeXnQZukJyRWh7m/Qlt9Ho0CgZE1U+832ac +5GWVldNxW1Lz4I+W9/ehzqe8I80RS6eLEKfUFXGiW+9RAgMBAAGjEzARMA8GA1Ud +EQQIMAaHBH8AAAEwDQYJKoZIhvcNAQEFBQADgYEAdF4WQHfVdPCbgv9sxgJjcR1H +Hgw9rZ47gO1IiIhzglnLXQ6QuemRiHeYFg4kjcYBk1DJguxzDTGnUwhUXOibAB+S +zssmrkdYYvn9aUhjc3XK3tjAoDpsPpeBeTBamuUKDHoH/dNRXxerZ8vu6uPR3Pgs +5v/KCV6IAEcvNyOXMPo= +-----END CERTIFICATE----- +`) + + // TLSBundleKey ai.key + TLSBundleKey = []byte(`-----BEGIN RSA PRIVATE KEY----- +MIICXAIBAAKBgQDdYVh3oqKP5wEr2648AkM1wolohMxpMN+dzcbAAeePzagy9y1z +QE7YkibvJCQa5gIddiBS7Vixl4xo42JR20FpzkemsL3nl50GbpCckVoe5v0JbfR6 +NAoGRNVPvN9mnORllZXTcVtS8+CPlvf3oc6nvCPNEUunixCn1BVxolvvUQIDAQAB +AoGBAMISrcirddGrlLZLLrKC1ULS2T0cdkqdQtwHYn4+7S5+/z42vMx1iumHLsSk +rVY7X41OWkX4trFxhvEIrc/O48bo2zw78P7flTxHy14uxXnllU8cLThE29SlUU7j +AVBNxJZMsXMlS/DowwD4CjFe+x4Pu9wZcReF2Z9ntzMpySABAkEA+iWoJCPE2JpS +y78q3HYYgpNY3gF3JqQ0SI/zTNkb3YyEIUffEYq0Y9pK13HjKtdsSuX4osTIhQkS ++UgRp6tCAQJBAOKPYTfQ2FX8ijgUpHZRuEAVaxASAS0UATiLgzXxLvOh/VC2at5x +wjOX6sD65pPz/0D8Qj52Cq6Q1TQ+377SDVECQAIy0od+yPweXxvrUjUd1JlRMjbB +TIrKZqs8mKbUQapw0bh5KTy+O1elU4MRPS3jNtBxtP25PQnuSnxmZcFTgAECQFzg +DiiFcsn9FuRagfkHExMiNJuH5feGxeFaP9WzI144v9GAllrOI6Bm3JNzx2ZLlg4b +20Qju8lIEj6yr6JYFaECQHM1VSojGRKpOl9Ox/R4yYSA9RV5Gyn00/aJNxVYyPD5 +i3acL2joQm2kLD/LO8paJ4+iQdRXCOMMIpjxSNjGQjQ= +-----END RSA PRIVATE KEY----- +`) +) diff --git a/vendor/github.com/aws/aws-sdk-go/example/service/rds/rdsutils/authentication/README.md b/vendor/github.com/aws/aws-sdk-go/example/service/rds/rdsutils/authentication/README.md new file mode 100644 index 000000000..2a569b29e --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/example/service/rds/rdsutils/authentication/README.md @@ -0,0 +1,15 @@ +# Example + +This is an example using the AWS SDK for Go to create an Amazon RDS DB token using the +rdsutils package. + +# Usage + +```sh +go run -tags example iam_authetnication.go +``` + +Output: +``` +Successfully opened connection to database +``` diff --git a/vendor/github.com/aws/aws-sdk-go/example/service/rds/rdsutils/authentication/iam_authentication.go b/vendor/github.com/aws/aws-sdk-go/example/service/rds/rdsutils/authentication/iam_authentication.go new file mode 100644 index 000000000..fe749a1de --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/example/service/rds/rdsutils/authentication/iam_authentication.go @@ -0,0 +1,47 @@ +// +build example,skip + +package main + +import ( + "database/sql" + "fmt" + "log" + "os" + + "github.com/go-sql-driver/mysql" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/credentials/stscreds" + "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/service/rds/rdsutils" +) + +// Usage ./iam_authentication +func main() { + if len(os.Args) < 5 { + log.Println("USAGE ERROR: go run concatenateObjects.go ") + os.Exit(1) + } + + awsRegion := os.Args[1] + dbUser := os.Args[2] + dbName := os.Args[3] + dbEndpoint := os.Args[4] + awsCreds := stscreds.NewCredentials(session.New(&aws.Config{Region: &awsRegion}), os.Args[5]) + authToken, err := rdsutils.BuildAuthToken(dbEndpoint, awsRegion, dbUser, awsCreds) + + // Create the MySQL DNS string for the DB connection + // user:password@protocol(endpoint)/dbname? + dnsStr := fmt.Sprintf("%s:%s@tcp(%s)/%s?tls=true", + dbUser, authToken, dbEndpoint, dbName, + ) + + driver := mysql.MySQLDriver{} + _ = driver + // Use db to perform SQL operations on database + if _, err = sql.Open("mysql", dnsStr); err != nil { + panic(err) + } + + fmt.Println("Successfully opened connection to database") +} diff --git a/vendor/github.com/aws/aws-sdk-go/example/service/s3/presignURL/README.md b/vendor/github.com/aws/aws-sdk-go/example/service/s3/presignURL/README.md new file mode 100644 index 000000000..b0e004544 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/example/service/s3/presignURL/README.md @@ -0,0 +1,124 @@ +# Presigned Amazon S3 API Operation Example + +This example demonstrates how you can build a client application to retrieve and +upload object data from Amazon S3 without needing to know anything about Amazon +S3 or have access to any AWS credentials. Only the service would have knowledge +of how and where the objects are stored in Amazon S3. + +The example is split into two parts `server.go` and `client.go`. These two parts +simulate the client/server architecture. In this example the client will represent +a third part user that will request resource URLs from the service. The service +will generate presigned S3 URLs which the client can use to download and +upload S3 object content. + +The service supports generating presigned URLs for two S3 APIs; `GetObject` and +`PutObject`. The client will request a presigned URL from the service with an +object Key. In this example the value is the S3 object's `key`. Alternatively, +you could use your own pattern with no visible relation to the S3 object's key. +The server would then perform a cross reference with client provided value to +one that maps to the S3 object's key. + +Before using the client to upload and download S3 objects you'll need to start the +service. The service will use the SDK's default credential chain to source your +AWS credentials. See the [`Configuring Credentials`](http://docs.aws.amazon.com/sdk-for-go/api/) +section of the SDK's API Reference guide on how the SDK loads your AWS credentials. + +The server requires the S3 `-b bucket` the presigned URLs will be generated for. A +`-r region` is only needed if the bucket is in AWS China or AWS Gov Cloud. For +buckets in AWS the server will use the [`s3manager.GetBucketRegion`](http://docs.aws.amazon.com/sdk-for-go/api/service/s3/s3manager/#GetBucketRegion) utility to lookup the bucket's region. + +You should run the service in the background or in a separate terminal tab before +moving onto the client. + + +```sh +go run -tags example server/server.go -b mybucket +> Starting Server On: 127.0.0.1:8080 +``` + +Use the `--help` flag to see a list of additional configuration flags, and their +defaults. + +## Downloading an Amazon S3 Object + +Use the client application to request a presigned URL from the server and use +that presigned URL to download the object from S3. Calling the client with the +`-get key` flag will do this. An optional `-f filename` flag can be provided as +well to write the object to. If no flag is provided the object will be written +to `stdout` + +```sh +go run -tags example client/client.go -get "my-object/key" -f outputfilename +``` + +Use the `--help` flag to see a list of additional configuration flags, and their +defaults. + +The following curl request demonstrates the request the client makes to the server +for the presigned URL for the `my-object/key` S3 object. The `method` query +parameter lets the server know that we are requesting the `GetObject`'s presigned +URL. The `method` value can be `GET` or `PUT` for the `GetObject` or `PutObject` APIs. + +```sh +curl -v "http://127.0.0.1:8080/presign/my-object/key?method=GET" +``` + +The server will respond with a JSON value. The value contains three pieces of +information that the client will need to correctly make the request. First is +the presigned URL. This is the URL the client will make the request to. Second +is the HTTP method the request should be sent as. This is included to simplify +the client's request building. Finally the response will include a list of +additional headers that the client should include that the presigned request +was signed with. + +```json +{ + "URL": "https://mybucket.s3-us-west-2.amazonaws.com/my-object/key?", + "Method": "GET", + "Header": { + "x-amz-content-sha256":["UNSIGNED-PAYLOAD"] + } +} +``` + +With this URL our client will build a HTTP request for the S3 object's data. The +`client.go` will then write the object's data to the `filename` if one is provided, +or to `stdout` of a filename is not set in the command line arguments. + +## Uploading a File to Amazon S3 + +Just like the download, uploading a file to S3 will use a presigned URL requested +from the server. The resigned URL will be built into an HTTP request using the +URL, Method, and Headers. The `-put key` flag will upload the content of `-f filename` +or stdin if no filename is provided to S3 using a presigned URL provided by the +service + +```sh +go run -tags example client/client.go -put "my-object/key" -f filename +``` + +Like the download case this will make a HTTP request to the server for the +presigned URL. The Server will respond with a presigned URL for S3's `PutObject` +API operation. In addition the `method` query parameter the client will also +include a `contentLength` this value instructs the server to generate the presigned +PutObject request with a `Content-Length` header value included in the signature. +This is done so the content that is uploaded by the client can only be the size +the presigned request was generated for. + +```sh +curl -v "http://127.0.0.1:8080/presign/my-object/key?method=PUT&contentLength=1024" +``` + +## Expanding the Example + +This example provides a spring board you can use to vend presigned URLs to your +clients instead of streaming the object's content through your service. This +client and server example can be expanded and customized. Adding new functionality +such as additional constraints the server puts on the presigned URLs like +`Content-Type`. + +In addition to adding constraints to the presigned URLs the service could be +updated to obfuscate S3 object's key. Instead of the client knowing the object's +key, a lookup system could be used instead. This could be substitution based, +or lookup into an external data store such as DynamoDB. + diff --git a/vendor/github.com/aws/aws-sdk-go/example/service/s3/presignURL/client/client.go b/vendor/github.com/aws/aws-sdk-go/example/service/s3/presignURL/client/client.go new file mode 100644 index 000000000..df63aa228 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/example/service/s3/presignURL/client/client.go @@ -0,0 +1,266 @@ +// +build example + +package main + +import ( + "bytes" + "encoding/json" + "flag" + "fmt" + "io" + "io/ioutil" + "net/http" + "os" + "strconv" + "strings" +) + +// client.go is an example of a client that will request URLs from a service that +// the client will use to upload and download content with. +// +// The server must be started before the client is run. +// +// Use "--help" command line argument flag to see all options and defaults. If +// filename is not provided the client will read from stdin for uploads and +// write to stdout for downloads. +// +// Usage: +// go run -tags example client.go -get myObjectKey -f filename +func main() { + method, filename, key, serverURL := loadConfig() + + var err error + + switch method { + case GetMethod: + // Requests the URL from the server that the client will use to download + // the content from. The content will be written to the file pointed to + // by filename. Creating it if the file does not exist. If filename is + // not set the contents will be written to stdout. + err = downloadFile(serverURL, key, filename) + case PutMethod: + // Requests the URL from the service that the client will use to upload + // content to. The content will be read from the file pointed to by the + // filename. If the filename is not set, content will be read from stdin. + err = uploadFile(serverURL, key, filename) + } + + if err != nil { + exitError(err) + } +} + +// loadConfig configures the client based on the command line arguments used. +func loadConfig() (method Method, serverURL, key, filename string) { + var getKey, putKey string + flag.StringVar(&getKey, "get", "", + "Downloads the object from S3 by the `key`. Writes the object to a file the filename is provided, otherwise writes to stdout.") + flag.StringVar(&putKey, "put", "", + "Uploads data to S3 at the `key` provided. Uploads the file if filename is provided, otherwise reads from stdin.") + flag.StringVar(&serverURL, "s", "http://127.0.0.1:8080", "Required `URL` the client will request presigned S3 operation from.") + flag.StringVar(&filename, "f", "", "The `filename` of the file to upload and get from S3.") + flag.Parse() + + var errs Errors + + if len(serverURL) == 0 { + errs = append(errs, fmt.Errorf("server URL required")) + } + + if !((len(getKey) != 0) != (len(putKey) != 0)) { + errs = append(errs, fmt.Errorf("either `get` or `put` can be provided, and one of the two is required.")) + } + + if len(getKey) > 0 { + method = GetMethod + key = getKey + } else { + method = PutMethod + key = putKey + } + + if len(errs) > 0 { + fmt.Fprintf(os.Stderr, "Failed to load configuration:%v\n", errs) + flag.PrintDefaults() + os.Exit(1) + } + + return method, filename, key, serverURL +} + +// downloadFile will request a URL from the server that the client can download +// the content pointed to by "key". The content will be written to the file +// pointed to by filename, creating the file if it doesn't exist. If filename +// is not set the content will be written to stdout. +func downloadFile(serverURL, key, filename string) error { + var w *os.File + if len(filename) > 0 { + f, err := os.Create(filename) + if err != nil { + return fmt.Errorf("failed to create download file %s, %v", filename, err) + } + w = f + } else { + w = os.Stdout + } + defer w.Close() + + // Get the presigned URL from the remote service. + req, err := getPresignedRequest(serverURL, "GET", key, 0) + if err != nil { + return fmt.Errorf("failed to get get presigned request, %v", err) + } + + // Gets the file contents with the URL provided by the service. + resp, err := http.DefaultClient.Do(req) + if err != nil { + return fmt.Errorf("failed to do GET request, %v", err) + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return fmt.Errorf("failed to get S3 object, %d:%s", + resp.StatusCode, resp.Status) + } + + if _, err = io.Copy(w, resp.Body); err != nil { + return fmt.Errorf("failed to write S3 object, %v", err) + } + + return nil +} + +// uploadFile will request a URL from the service that the client can use to +// upload content to. The content will be read from the file pointed to by filename. +// If filename is not set the content will be read from stdin. +func uploadFile(serverURL, key, filename string) error { + var r io.ReadCloser + var size int64 + if len(filename) > 0 { + f, err := os.Open(filename) + if err != nil { + return fmt.Errorf("failed to open upload file %s, %v", filename, err) + } + + // Get the size of the file so that the constraint of Content-Length + // can be included with the presigned URL. This can be used by the + // server or client to ensure the content uploaded is of a certain size. + // + // These constraints can further be expanded to include things like + // Content-Type. Additionally constraints such as X-Amz-Content-Sha256 + // header set restricting the content of the file to only the content + // the client initially made the request with. This prevents the object + // from being overwritten or used to upload other unintended content. + stat, err := f.Stat() + if err != nil { + return fmt.Errorf("failed to stat file, %s, %v", filename, err) + } + + size = stat.Size() + r = f + } else { + buf := &bytes.Buffer{} + io.Copy(buf, os.Stdin) + size = int64(buf.Len()) + + r = ioutil.NopCloser(buf) + } + defer r.Close() + + // Get the Presigned URL from the remote service. Pass in the file's + // size if it is known so that the presigned URL returned will be required + // to be used with the size of content requested. + req, err := getPresignedRequest(serverURL, "PUT", key, size) + if err != nil { + return fmt.Errorf("failed to get get presigned request, %v", err) + } + req.Body = r + + // Upload the file contents to S3. + resp, err := http.DefaultClient.Do(req) + if err != nil { + return fmt.Errorf("failed to do GET request, %v", err) + } + + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return fmt.Errorf("failed to put S3 object, %d:%s", + resp.StatusCode, resp.Status) + } + + return nil +} + +// getPresignRequest will request a URL from the service for the content specified +// by the key and method. Returns a constructed Request that can be used to +// upload or download content with based on the method used. +// +// If the PUT method is used the request's Body will need to be set on the returned +// request value. +func getPresignedRequest(serverURL, method, key string, contentLen int64) (*http.Request, error) { + u := fmt.Sprintf("%s/presign/%s?method=%s&contentLength=%d", + serverURL, key, method, contentLen, + ) + + resp, err := http.Get(u) + if err != nil { + return nil, fmt.Errorf("failed to make request for presigned URL, %v", err) + } + defer resp.Body.Close() + + if resp.StatusCode != http.StatusOK { + return nil, fmt.Errorf("failed to get valid presign response, %s", resp.Status) + } + + p := PresignResp{} + if err := json.NewDecoder(resp.Body).Decode(&p); err != nil { + return nil, fmt.Errorf("failed to decode response body, %v", err) + } + + req, err := http.NewRequest(p.Method, p.URL, nil) + if err != nil { + return nil, fmt.Errorf("failed to build presigned request, %v", err) + } + + for k, vs := range p.Header { + for _, v := range vs { + req.Header.Add(k, v) + } + } + // Need to ensure that the content length member is set of the HTTP Request + // or the request will not be transmitted correctly with a content length + // value across the wire. + if contLen := req.Header.Get("Content-Length"); len(contLen) > 0 { + req.ContentLength, _ = strconv.ParseInt(contLen, 10, 64) + } + + return req, nil +} + +type Method int + +const ( + PutMethod Method = iota + GetMethod +) + +type Errors []error + +func (es Errors) Error() string { + out := make([]string, len(es)) + for _, e := range es { + out = append(out, e.Error()) + } + return strings.Join(out, "\n") +} + +type PresignResp struct { + Method, URL string + Header http.Header +} + +func exitError(err error) { + fmt.Fprintln(os.Stderr, err.Error()) + os.Exit(1) +} diff --git a/vendor/github.com/aws/aws-sdk-go/example/service/s3/presignURL/server/server.go b/vendor/github.com/aws/aws-sdk-go/example/service/s3/presignURL/server/server.go new file mode 100644 index 000000000..ddf3f42e2 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/example/service/s3/presignURL/server/server.go @@ -0,0 +1,186 @@ +// +build example + +package main + +import ( + "encoding/json" + "flag" + "fmt" + "net" + "net/http" + "os" + "strconv" + "strings" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/endpoints" + "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/service/s3" + "github.com/aws/aws-sdk-go/service/s3/s3iface" + "github.com/aws/aws-sdk-go/service/s3/s3manager" +) + +// server.go is an example of a service that vends lists for requests for presigned +// URLs for S3 objects. The service supports two S3 operations, "GetObject" and +// "PutObject". +// +// Example GetObject request to the service for the object with the key "MyObjectKey": +// +// curl -v "http://127.0.0.1:8080/presign/my-object/key?method=GET" +// +// Example PutObject request to the service for the object with the key "MyObjectKey": +// +// curl -v "http://127.0.0.1:8080/presign/my-object/key?method=PUT&contentLength=1024" +// +// Use "--help" command line argument flag to see all options and defaults. +// +// Usage: +// go run -tags example service.go -b myBucket +func main() { + addr, bucket, region := loadConfig() + + // Create a AWS SDK for Go Session that will load credentials using the SDK's + // default credential change. + sess := session.Must(session.NewSession()) + + // Use the GetBucketRegion utility to lookup the bucket's region automatically. + // The service.go will only do this correctly for AWS regions. For AWS China + // and AWS Gov Cloud the region needs to be specified to let the service know + // to look in those partitions instead of AWS. + if len(region) == 0 { + var err error + region, err = s3manager.GetBucketRegion(aws.BackgroundContext(), sess, bucket, endpoints.UsWest2RegionID) + if err != nil { + exitError(fmt.Errorf("failed to get bucket region, %v", err)) + } + } + + // Create a new S3 service client that will be use by the service to generate + // presigned URLs with. Not actual API requests will be made with this client. + // The credentials loaded when the Session was created above will be used + // to sign the requests with. + s3Svc := s3.New(sess, &aws.Config{ + Region: aws.String(region), + }) + + // Start the server listening and serve presigned URLs for GetObject and + // PutObject requests. + if err := listenAndServe(addr, bucket, s3Svc); err != nil { + exitError(err) + } +} + +func loadConfig() (addr, bucket, region string) { + flag.StringVar(&bucket, "b", "", "S3 `bucket` object should be uploaded to.") + flag.StringVar(®ion, "r", "", "AWS `region` the bucket exists in, If not set region will be looked up, only valid for AWS Regions, not AWS China or Gov Cloud.") + flag.StringVar(&addr, "a", "127.0.0.1:8080", "The TCP `address` the server will be started on.") + flag.Parse() + + if len(bucket) == 0 { + fmt.Fprintln(os.Stderr, "bucket is required") + flag.PrintDefaults() + os.Exit(1) + } + + return addr, bucket, region +} + +func listenAndServe(addr, bucket string, svc s3iface.S3API) error { + l, err := net.Listen("tcp", addr) + if err != nil { + return fmt.Errorf("failed to start service listener, %v", err) + } + + const presignPath = "/presign/" + + // Create the HTTP handler for the "/presign/" path prefix. This will handle + // all requests on this path, extracting the object's key from the path. + http.HandleFunc(presignPath, func(w http.ResponseWriter, r *http.Request) { + var u string + var err error + var signedHeaders http.Header + + query := r.URL.Query() + + var contentLen int64 + // Optionally the Content-Length header can be included with the signature + // of the request. This is helpful to ensure the content uploaded is the + // size that is expected. Constraints like these can be further expanded + // with headers such as `Content-Type`. These can be enforced by the service + // requiring the client to satisfying those constraints when uploading + // + // In addition the client could provide the service with a SHA256 of the + // content to be uploaded. This prevents any other third party from uploading + // anything else with the presigned URL + if contLenStr := query.Get("contentLength"); len(contLenStr) > 0 { + contentLen, err = strconv.ParseInt(contLenStr, 10, 64) + if err != nil { + fmt.Fprintf(os.Stderr, "unable to parse request content length, %v", err) + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + } + + // Extract the object key from the path + key := strings.Replace(r.URL.Path, presignPath, "", 1) + method := query.Get("method") + + switch method { + case "PUT": + // For creating PutObject presigned URLs + fmt.Println("Received request to presign PutObject for,", key) + sdkReq, _ := svc.PutObjectRequest(&s3.PutObjectInput{ + Bucket: aws.String(bucket), + Key: aws.String(key), + + // If ContentLength is 0 the header will not be included in the signature. + ContentLength: aws.Int64(contentLen), + }) + u, signedHeaders, err = sdkReq.PresignRequest(15 * time.Minute) + case "GET": + // For creating GetObject presigned URLs + fmt.Println("Received request to presign GetObject for,", key) + sdkReq, _ := svc.GetObjectRequest(&s3.GetObjectInput{ + Bucket: aws.String(bucket), + Key: aws.String(key), + }) + u, signedHeaders, err = sdkReq.PresignRequest(15 * time.Minute) + default: + fmt.Fprintf(os.Stderr, "invalid method provided, %s, %v\n", method, err) + err = fmt.Errorf("invalid request") + } + + if err != nil { + http.Error(w, err.Error(), http.StatusBadRequest) + return + } + + // Create the response back to the client with the information on the + // presigned request and additional headers to include. + if err := json.NewEncoder(w).Encode(PresignResp{ + Method: method, + URL: u, + Header: signedHeaders, + }); err != nil { + fmt.Fprintf(os.Stderr, "failed to encode presign response, %v", err) + } + }) + + fmt.Println("Starting Server On:", "http://"+l.Addr().String()) + + s := &http.Server{} + return s.Serve(l) +} + +// PresignResp provides the Go representation of the JSON value that will be +// sent to the client. +type PresignResp struct { + Method, URL string + Header http.Header +} + +func exitError(err error) { + fmt.Fprintln(os.Stderr, err.Error()) + os.Exit(1) +} diff --git a/vendor/github.com/aws/aws-sdk-go/models/apis/athena/2017-05-18/api-2.json b/vendor/github.com/aws/aws-sdk-go/models/apis/athena/2017-05-18/api-2.json new file mode 100644 index 000000000..b0d7c07ac --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/models/apis/athena/2017-05-18/api-2.json @@ -0,0 +1,615 @@ +{ + "version":"2.0", + "metadata":{ + "apiVersion":"2017-05-18", + "endpointPrefix":"athena", + "jsonVersion":"1.1", + "protocol":"json", + "serviceFullName":"Amazon Athena", + "signatureVersion":"v4", + "targetPrefix":"AmazonAthena", + "uid":"athena-2017-05-18" + }, + "operations":{ + "BatchGetNamedQuery":{ + "name":"BatchGetNamedQuery", + "http":{ + "method":"POST", + "requestUri":"/" + }, + "input":{"shape":"BatchGetNamedQueryInput"}, + "output":{"shape":"BatchGetNamedQueryOutput"}, + "errors":[ + {"shape":"InternalServerException"}, + {"shape":"InvalidRequestException"} + ] + }, + "BatchGetQueryExecution":{ + "name":"BatchGetQueryExecution", + "http":{ + "method":"POST", + "requestUri":"/" + }, + "input":{"shape":"BatchGetQueryExecutionInput"}, + "output":{"shape":"BatchGetQueryExecutionOutput"}, + "errors":[ + {"shape":"InternalServerException"}, + {"shape":"InvalidRequestException"} + ] + }, + "CreateNamedQuery":{ + "name":"CreateNamedQuery", + "http":{ + "method":"POST", + "requestUri":"/" + }, + "input":{"shape":"CreateNamedQueryInput"}, + "output":{"shape":"CreateNamedQueryOutput"}, + "errors":[ + {"shape":"InternalServerException"}, + {"shape":"InvalidRequestException"} + ], + "idempotent":true + }, + "DeleteNamedQuery":{ + "name":"DeleteNamedQuery", + "http":{ + "method":"POST", + "requestUri":"/" + }, + "input":{"shape":"DeleteNamedQueryInput"}, + "output":{"shape":"DeleteNamedQueryOutput"}, + "errors":[ + {"shape":"InternalServerException"}, + {"shape":"InvalidRequestException"} + ], + "idempotent":true + }, + "GetNamedQuery":{ + "name":"GetNamedQuery", + "http":{ + "method":"POST", + "requestUri":"/" + }, + "input":{"shape":"GetNamedQueryInput"}, + "output":{"shape":"GetNamedQueryOutput"}, + "errors":[ + {"shape":"InternalServerException"}, + {"shape":"InvalidRequestException"} + ] + }, + "GetQueryExecution":{ + "name":"GetQueryExecution", + "http":{ + "method":"POST", + "requestUri":"/" + }, + "input":{"shape":"GetQueryExecutionInput"}, + "output":{"shape":"GetQueryExecutionOutput"}, + "errors":[ + {"shape":"InternalServerException"}, + {"shape":"InvalidRequestException"} + ] + }, + "GetQueryResults":{ + "name":"GetQueryResults", + "http":{ + "method":"POST", + "requestUri":"/" + }, + "input":{"shape":"GetQueryResultsInput"}, + "output":{"shape":"GetQueryResultsOutput"}, + "errors":[ + {"shape":"InternalServerException"}, + {"shape":"InvalidRequestException"} + ] + }, + "ListNamedQueries":{ + "name":"ListNamedQueries", + "http":{ + "method":"POST", + "requestUri":"/" + }, + "input":{"shape":"ListNamedQueriesInput"}, + "output":{"shape":"ListNamedQueriesOutput"}, + "errors":[ + {"shape":"InternalServerException"}, + {"shape":"InvalidRequestException"} + ] + }, + "ListQueryExecutions":{ + "name":"ListQueryExecutions", + "http":{ + "method":"POST", + "requestUri":"/" + }, + "input":{"shape":"ListQueryExecutionsInput"}, + "output":{"shape":"ListQueryExecutionsOutput"}, + "errors":[ + {"shape":"InternalServerException"}, + {"shape":"InvalidRequestException"} + ] + }, + "StartQueryExecution":{ + "name":"StartQueryExecution", + "http":{ + "method":"POST", + "requestUri":"/" + }, + "input":{"shape":"StartQueryExecutionInput"}, + "output":{"shape":"StartQueryExecutionOutput"}, + "errors":[ + {"shape":"InternalServerException"}, + {"shape":"InvalidRequestException"}, + {"shape":"TooManyRequestsException"} + ], + "idempotent":true + }, + "StopQueryExecution":{ + "name":"StopQueryExecution", + "http":{ + "method":"POST", + "requestUri":"/" + }, + "input":{"shape":"StopQueryExecutionInput"}, + "output":{"shape":"StopQueryExecutionOutput"}, + "errors":[ + {"shape":"InternalServerException"}, + {"shape":"InvalidRequestException"} + ], + "idempotent":true + } + }, + "shapes":{ + "BatchGetNamedQueryInput":{ + "type":"structure", + "required":["NamedQueryIds"], + "members":{ + "NamedQueryIds":{"shape":"NamedQueryIdList"} + } + }, + "BatchGetNamedQueryOutput":{ + "type":"structure", + "members":{ + "NamedQueries":{"shape":"NamedQueryList"}, + "UnprocessedNamedQueryIds":{"shape":"UnprocessedNamedQueryIdList"} + } + }, + "BatchGetQueryExecutionInput":{ + "type":"structure", + "required":["QueryExecutionIds"], + "members":{ + "QueryExecutionIds":{"shape":"QueryExecutionIdList"} + } + }, + "BatchGetQueryExecutionOutput":{ + "type":"structure", + "members":{ + "QueryExecutions":{"shape":"QueryExecutionList"}, + "UnprocessedQueryExecutionIds":{"shape":"UnprocessedQueryExecutionIdList"} + } + }, + "Boolean":{"type":"boolean"}, + "ColumnInfo":{ + "type":"structure", + "required":[ + "Name", + "Type" + ], + "members":{ + "CatalogName":{"shape":"String"}, + "SchemaName":{"shape":"String"}, + "TableName":{"shape":"String"}, + "Name":{"shape":"String"}, + "Label":{"shape":"String"}, + "Type":{"shape":"String"}, + "Precision":{"shape":"Integer"}, + "Scale":{"shape":"Integer"}, + "Nullable":{"shape":"ColumnNullable"}, + "CaseSensitive":{"shape":"Boolean"} + } + }, + "ColumnInfoList":{ + "type":"list", + "member":{"shape":"ColumnInfo"} + }, + "ColumnNullable":{ + "type":"string", + "enum":[ + "NOT_NULL", + "NULLABLE", + "UNKNOWN" + ] + }, + "CreateNamedQueryInput":{ + "type":"structure", + "required":[ + "Name", + "Database", + "QueryString" + ], + "members":{ + "Name":{"shape":"NameString"}, + "Description":{"shape":"DescriptionString"}, + "Database":{"shape":"DatabaseString"}, + "QueryString":{"shape":"QueryString"}, + "ClientRequestToken":{ + "shape":"IdempotencyToken", + "idempotencyToken":true + } + } + }, + "CreateNamedQueryOutput":{ + "type":"structure", + "members":{ + "NamedQueryId":{"shape":"NamedQueryId"} + } + }, + "DatabaseString":{ + "type":"string", + "max":32, + "min":1 + }, + "Date":{"type":"timestamp"}, + "Datum":{ + "type":"structure", + "members":{ + "VarCharValue":{"shape":"datumString"} + } + }, + "DeleteNamedQueryInput":{ + "type":"structure", + "required":["NamedQueryId"], + "members":{ + "NamedQueryId":{ + "shape":"NamedQueryId", + "idempotencyToken":true + } + } + }, + "DeleteNamedQueryOutput":{ + "type":"structure", + "members":{ + } + }, + "DescriptionString":{ + "type":"string", + "max":1024, + "min":1 + }, + "EncryptionConfiguration":{ + "type":"structure", + "required":["EncryptionOption"], + "members":{ + "EncryptionOption":{"shape":"EncryptionOption"}, + "KmsKey":{"shape":"String"} + } + }, + "EncryptionOption":{ + "type":"string", + "enum":[ + "SSE_S3", + "SSE_KMS", + "CSE_KMS" + ] + }, + "ErrorCode":{ + "type":"string", + "max":256, + "min":1 + }, + "ErrorMessage":{"type":"string"}, + "GetNamedQueryInput":{ + "type":"structure", + "required":["NamedQueryId"], + "members":{ + "NamedQueryId":{"shape":"NamedQueryId"} + } + }, + "GetNamedQueryOutput":{ + "type":"structure", + "members":{ + "NamedQuery":{"shape":"NamedQuery"} + } + }, + "GetQueryExecutionInput":{ + "type":"structure", + "required":["QueryExecutionId"], + "members":{ + "QueryExecutionId":{"shape":"QueryExecutionId"} + } + }, + "GetQueryExecutionOutput":{ + "type":"structure", + "members":{ + "QueryExecution":{"shape":"QueryExecution"} + } + }, + "GetQueryResultsInput":{ + "type":"structure", + "required":["QueryExecutionId"], + "members":{ + "QueryExecutionId":{"shape":"QueryExecutionId"}, + "NextToken":{"shape":"Token"}, + "MaxResults":{"shape":"MaxQueryResults"} + } + }, + "GetQueryResultsOutput":{ + "type":"structure", + "members":{ + "ResultSet":{"shape":"ResultSet"}, + "NextToken":{"shape":"Token"} + } + }, + "IdempotencyToken":{ + "type":"string", + "max":128, + "min":32 + }, + "Integer":{"type":"integer"}, + "InternalServerException":{ + "type":"structure", + "members":{ + "Message":{"shape":"ErrorMessage"} + }, + "exception":true, + "fault":true + }, + "InvalidRequestException":{ + "type":"structure", + "members":{ + "AthenaErrorCode":{"shape":"ErrorCode"}, + "Message":{"shape":"ErrorMessage"} + }, + "exception":true + }, + "ListNamedQueriesInput":{ + "type":"structure", + "members":{ + "NextToken":{"shape":"Token"}, + "MaxResults":{"shape":"MaxNamedQueriesCount"} + } + }, + "ListNamedQueriesOutput":{ + "type":"structure", + "members":{ + "NamedQueryIds":{"shape":"NamedQueryIdList"}, + "NextToken":{"shape":"Token"} + } + }, + "ListQueryExecutionsInput":{ + "type":"structure", + "members":{ + "NextToken":{"shape":"Token"}, + "MaxResults":{"shape":"MaxQueryExecutionsCount"} + } + }, + "ListQueryExecutionsOutput":{ + "type":"structure", + "members":{ + "QueryExecutionIds":{"shape":"QueryExecutionIdList"}, + "NextToken":{"shape":"Token"} + } + }, + "Long":{"type":"long"}, + "MaxNamedQueriesCount":{ + "type":"integer", + "box":true, + "max":50, + "min":0 + }, + "MaxQueryExecutionsCount":{ + "type":"integer", + "box":true, + "max":50, + "min":0 + }, + "MaxQueryResults":{ + "type":"integer", + "box":true, + "max":1000, + "min":0 + }, + "NameString":{ + "type":"string", + "max":128, + "min":1 + }, + "NamedQuery":{ + "type":"structure", + "required":[ + "Name", + "Database", + "QueryString" + ], + "members":{ + "Name":{"shape":"NameString"}, + "Description":{"shape":"DescriptionString"}, + "Database":{"shape":"DatabaseString"}, + "QueryString":{"shape":"QueryString"}, + "NamedQueryId":{"shape":"NamedQueryId"} + } + }, + "NamedQueryId":{"type":"string"}, + "NamedQueryIdList":{ + "type":"list", + "member":{"shape":"NamedQueryId"}, + "max":50, + "min":1 + }, + "NamedQueryList":{ + "type":"list", + "member":{"shape":"NamedQuery"} + }, + "QueryExecution":{ + "type":"structure", + "members":{ + "QueryExecutionId":{"shape":"QueryExecutionId"}, + "Query":{"shape":"QueryString"}, + "ResultConfiguration":{"shape":"ResultConfiguration"}, + "QueryExecutionContext":{"shape":"QueryExecutionContext"}, + "Status":{"shape":"QueryExecutionStatus"}, + "Statistics":{"shape":"QueryExecutionStatistics"} + } + }, + "QueryExecutionContext":{ + "type":"structure", + "members":{ + "Database":{"shape":"DatabaseString"} + } + }, + "QueryExecutionId":{"type":"string"}, + "QueryExecutionIdList":{ + "type":"list", + "member":{"shape":"QueryExecutionId"}, + "max":50, + "min":1 + }, + "QueryExecutionList":{ + "type":"list", + "member":{"shape":"QueryExecution"} + }, + "QueryExecutionState":{ + "type":"string", + "enum":[ + "QUEUED", + "RUNNING", + "SUCCEEDED", + "FAILED", + "CANCELLED" + ] + }, + "QueryExecutionStatistics":{ + "type":"structure", + "members":{ + "EngineExecutionTimeInMillis":{"shape":"Long"}, + "DataScannedInBytes":{"shape":"Long"} + } + }, + "QueryExecutionStatus":{ + "type":"structure", + "members":{ + "State":{"shape":"QueryExecutionState"}, + "StateChangeReason":{"shape":"String"}, + "SubmissionDateTime":{"shape":"Date"}, + "CompletionDateTime":{"shape":"Date"} + } + }, + "QueryString":{ + "type":"string", + "max":262144, + "min":1 + }, + "ResultConfiguration":{ + "type":"structure", + "required":["OutputLocation"], + "members":{ + "OutputLocation":{"shape":"String"}, + "EncryptionConfiguration":{"shape":"EncryptionConfiguration"} + } + }, + "ResultSet":{ + "type":"structure", + "members":{ + "Rows":{"shape":"RowList"}, + "ResultSetMetadata":{"shape":"ResultSetMetadata"} + } + }, + "ResultSetMetadata":{ + "type":"structure", + "members":{ + "ColumnInfo":{"shape":"ColumnInfoList"} + } + }, + "Row":{ + "type":"structure", + "members":{ + "Data":{"shape":"datumList"} + } + }, + "RowList":{ + "type":"list", + "member":{"shape":"Row"} + }, + "StartQueryExecutionInput":{ + "type":"structure", + "required":[ + "QueryString", + "ResultConfiguration" + ], + "members":{ + "QueryString":{"shape":"QueryString"}, + "ClientRequestToken":{ + "shape":"IdempotencyToken", + "idempotencyToken":true + }, + "QueryExecutionContext":{"shape":"QueryExecutionContext"}, + "ResultConfiguration":{"shape":"ResultConfiguration"} + } + }, + "StartQueryExecutionOutput":{ + "type":"structure", + "members":{ + "QueryExecutionId":{"shape":"QueryExecutionId"} + } + }, + "StopQueryExecutionInput":{ + "type":"structure", + "required":["QueryExecutionId"], + "members":{ + "QueryExecutionId":{ + "shape":"QueryExecutionId", + "idempotencyToken":true + } + } + }, + "StopQueryExecutionOutput":{ + "type":"structure", + "members":{ + } + }, + "String":{"type":"string"}, + "ThrottleReason":{ + "type":"string", + "enum":["CONCURRENT_QUERY_LIMIT_EXCEEDED"] + }, + "Token":{"type":"string"}, + "TooManyRequestsException":{ + "type":"structure", + "members":{ + "Message":{"shape":"ErrorMessage"}, + "Reason":{"shape":"ThrottleReason"} + }, + "exception":true + }, + "UnprocessedNamedQueryId":{ + "type":"structure", + "members":{ + "NamedQueryId":{"shape":"NamedQueryId"}, + "ErrorCode":{"shape":"ErrorCode"}, + "ErrorMessage":{"shape":"ErrorMessage"} + } + }, + "UnprocessedNamedQueryIdList":{ + "type":"list", + "member":{"shape":"UnprocessedNamedQueryId"} + }, + "UnprocessedQueryExecutionId":{ + "type":"structure", + "members":{ + "QueryExecutionId":{"shape":"QueryExecutionId"}, + "ErrorCode":{"shape":"ErrorCode"}, + "ErrorMessage":{"shape":"ErrorMessage"} + } + }, + "UnprocessedQueryExecutionIdList":{ + "type":"list", + "member":{"shape":"UnprocessedQueryExecutionId"} + }, + "datumList":{ + "type":"list", + "member":{"shape":"Datum"} + }, + "datumString":{"type":"string"} + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/models/apis/athena/2017-05-18/docs-2.json b/vendor/github.com/aws/aws-sdk-go/models/apis/athena/2017-05-18/docs-2.json new file mode 100644 index 000000000..fc6ef23eb --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/models/apis/athena/2017-05-18/docs-2.json @@ -0,0 +1,467 @@ +{ + "version": "2.0", + "service": "

Amazon Athena is an interactive query service that lets you use standard SQL to analyze data directly in Amazon S3. You can point Athena at your data in Amazon S3 and run ad-hoc queries and get results in seconds. Athena is serverless, so there is no infrastructure to set up or manage. You pay only for the queries you run. Athena scales automatically—executing queries in parallel—so results are fast, even with large datasets and complex queries. For more information, see What is Amazon Athena in the Amazon Athena User Guide.

For code samples using the AWS SDK for Java, see Examples and Code Samples in the Amazon Athena User Guide.

", + "operations": { + "BatchGetNamedQuery": "

Returns the details of a single named query or a list of up to 50 queries, which you provide as an array of query ID strings. Use ListNamedQueries to get the list of named query IDs. If information could not be retrieved for a submitted query ID, information about the query ID submitted is listed under UnprocessedNamedQueryId. Named queries are different from executed queries. Use BatchGetQueryExecution to get details about each unique query execution, and ListQueryExecutions to get a list of query execution IDs.

", + "BatchGetQueryExecution": "

Returns the details of a single query execution or a list of up to 50 query executions, which you provide as an array of query execution ID strings. To get a list of query execution IDs, use ListQueryExecutions. Query executions are different from named (saved) queries. Use BatchGetNamedQuery to get details about named queries.

", + "CreateNamedQuery": "

Creates a named query.

For code samples using the AWS SDK for Java, see Examples and Code Samples in the Amazon Athena User Guide.

", + "DeleteNamedQuery": "

Deletes a named query.

For code samples using the AWS SDK for Java, see Examples and Code Samples in the Amazon Athena User Guide.

", + "GetNamedQuery": "

Returns information about a single query.

", + "GetQueryExecution": "

Returns information about a single execution of a query. Each time a query executes, information about the query execution is saved with a unique ID.

", + "GetQueryResults": "

Returns the results of a single query execution specified by QueryExecutionId. This request does not execute the query but returns results. Use StartQueryExecution to run a query.

", + "ListNamedQueries": "

Provides a list of all available query IDs.

For code samples using the AWS SDK for Java, see Examples and Code Samples in the Amazon Athena User Guide.

", + "ListQueryExecutions": "

Provides a list of all available query execution IDs.

For code samples using the AWS SDK for Java, see Examples and Code Samples in the Amazon Athena User Guide.

", + "StartQueryExecution": "

Runs (executes) the SQL query statements contained in the Query string.

For code samples using the AWS SDK for Java, see Examples and Code Samples in the Amazon Athena User Guide.

", + "StopQueryExecution": "

Stops a query execution.

For code samples using the AWS SDK for Java, see Examples and Code Samples in the Amazon Athena User Guide.

" + }, + "shapes": { + "BatchGetNamedQueryInput": { + "base": null, + "refs": { + } + }, + "BatchGetNamedQueryOutput": { + "base": null, + "refs": { + } + }, + "BatchGetQueryExecutionInput": { + "base": null, + "refs": { + } + }, + "BatchGetQueryExecutionOutput": { + "base": null, + "refs": { + } + }, + "Boolean": { + "base": null, + "refs": { + "ColumnInfo$CaseSensitive": "

Indicates whether values in the column are case-sensitive.

" + } + }, + "ColumnInfo": { + "base": "

Information about the columns in a query execution result.

", + "refs": { + "ColumnInfoList$member": null + } + }, + "ColumnInfoList": { + "base": null, + "refs": { + "ResultSetMetadata$ColumnInfo": "

Information about the columns in a query execution result.

" + } + }, + "ColumnNullable": { + "base": null, + "refs": { + "ColumnInfo$Nullable": "

Indicates the column's nullable status.

" + } + }, + "CreateNamedQueryInput": { + "base": null, + "refs": { + } + }, + "CreateNamedQueryOutput": { + "base": null, + "refs": { + } + }, + "DatabaseString": { + "base": null, + "refs": { + "CreateNamedQueryInput$Database": "

The database to which the query belongs.

", + "NamedQuery$Database": "

The database to which the query belongs.

", + "QueryExecutionContext$Database": "

The name of the database.

" + } + }, + "Date": { + "base": null, + "refs": { + "QueryExecutionStatus$SubmissionDateTime": "

The date and time that the query was submitted.

", + "QueryExecutionStatus$CompletionDateTime": "

The date and time that the query completed.

" + } + }, + "Datum": { + "base": "

A piece of data (a field in the table).

", + "refs": { + "datumList$member": null + } + }, + "DeleteNamedQueryInput": { + "base": null, + "refs": { + } + }, + "DeleteNamedQueryOutput": { + "base": null, + "refs": { + } + }, + "DescriptionString": { + "base": null, + "refs": { + "CreateNamedQueryInput$Description": "

A brief explanation of the query.

", + "NamedQuery$Description": "

A brief description of the query.

" + } + }, + "EncryptionConfiguration": { + "base": "

If query results are encrypted in Amazon S3, indicates the Amazon S3 encryption option used.

", + "refs": { + "ResultConfiguration$EncryptionConfiguration": "

If query results are encrypted in S3, indicates the S3 encryption option used (for example, SSE-KMS or CSE-KMS and key information.

" + } + }, + "EncryptionOption": { + "base": null, + "refs": { + "EncryptionConfiguration$EncryptionOption": "

Indicates whether Amazon S3 server-side encryption with Amazon S3-managed keys (SSE-S3), server-side encryption with KMS-managed keys (SSE-KMS), or client-side encryption with KMS-managed keys (CSE-KMS) is used.

" + } + }, + "ErrorCode": { + "base": null, + "refs": { + "InvalidRequestException$AthenaErrorCode": null, + "UnprocessedNamedQueryId$ErrorCode": "

The error code returned when the processing request for the named query failed, if applicable.

", + "UnprocessedQueryExecutionId$ErrorCode": "

The error code returned when the query execution failed to process, if applicable.

" + } + }, + "ErrorMessage": { + "base": null, + "refs": { + "InternalServerException$Message": null, + "InvalidRequestException$Message": null, + "TooManyRequestsException$Message": null, + "UnprocessedNamedQueryId$ErrorMessage": "

The error message returned when the processing request for the named query failed, if applicable.

", + "UnprocessedQueryExecutionId$ErrorMessage": "

The error message returned when the query execution failed to process, if applicable.

" + } + }, + "GetNamedQueryInput": { + "base": null, + "refs": { + } + }, + "GetNamedQueryOutput": { + "base": null, + "refs": { + } + }, + "GetQueryExecutionInput": { + "base": null, + "refs": { + } + }, + "GetQueryExecutionOutput": { + "base": null, + "refs": { + } + }, + "GetQueryResultsInput": { + "base": null, + "refs": { + } + }, + "GetQueryResultsOutput": { + "base": null, + "refs": { + } + }, + "IdempotencyToken": { + "base": null, + "refs": { + "CreateNamedQueryInput$ClientRequestToken": "

A unique case-sensitive string used to ensure the request to create the query is idempotent (executes only once). If another CreateNamedQuery request is received, the same response is returned and another query is not created. If a parameter has changed, for example, the QueryString, an error is returned.

This token is listed as not required because AWS SDKs (for example the AWS SDK for Java) auto-generate the token for users. If you are not using the AWS SDK or the AWS CLI, you must provide this token or the action will fail.

", + "StartQueryExecutionInput$ClientRequestToken": "

A unique case-sensitive string used to ensure the request to create the query is idempotent (executes only once). If another StartQueryExecution request is received, the same response is returned and another query is not created. If a parameter has changed, for example, the QueryString, an error is returned.

This token is listed as not required because AWS SDKs (for example the AWS SDK for Java) auto-generate the token for users. If you are not using the AWS SDK or the AWS CLI, you must provide this token or the action will fail.

" + } + }, + "Integer": { + "base": null, + "refs": { + "ColumnInfo$Precision": "

For DECIMAL data types, specifies the total number of digits, up to 38. For performance reasons, we recommend up to 18 digits.

", + "ColumnInfo$Scale": "

For DECIMAL data types, specifies the total number of digits in the fractional part of the value. Defaults to 0.

" + } + }, + "InternalServerException": { + "base": "

Indicates a platform issue, which may be due to a transient condition or outage.

", + "refs": { + } + }, + "InvalidRequestException": { + "base": "

Indicates that something is wrong with the input to the request. For example, a required parameter may be missing or out of range.

", + "refs": { + } + }, + "ListNamedQueriesInput": { + "base": null, + "refs": { + } + }, + "ListNamedQueriesOutput": { + "base": null, + "refs": { + } + }, + "ListQueryExecutionsInput": { + "base": null, + "refs": { + } + }, + "ListQueryExecutionsOutput": { + "base": null, + "refs": { + } + }, + "Long": { + "base": null, + "refs": { + "QueryExecutionStatistics$EngineExecutionTimeInMillis": "

The number of milliseconds that the query took to execute.

", + "QueryExecutionStatistics$DataScannedInBytes": "

The number of bytes in the data that was queried.

" + } + }, + "MaxNamedQueriesCount": { + "base": null, + "refs": { + "ListNamedQueriesInput$MaxResults": "

The maximum number of queries to return in this request.

" + } + }, + "MaxQueryExecutionsCount": { + "base": null, + "refs": { + "ListQueryExecutionsInput$MaxResults": "

The maximum number of query executions to return in this request.

" + } + }, + "MaxQueryResults": { + "base": null, + "refs": { + "GetQueryResultsInput$MaxResults": "

The maximum number of results (rows) to return in this request.

" + } + }, + "NameString": { + "base": null, + "refs": { + "CreateNamedQueryInput$Name": "

The plain language name for the query.

", + "NamedQuery$Name": "

The plain-language name of the query.

" + } + }, + "NamedQuery": { + "base": "

A query, where QueryString is the SQL query statements that comprise the query.

", + "refs": { + "GetNamedQueryOutput$NamedQuery": "

Information about the query.

", + "NamedQueryList$member": null + } + }, + "NamedQueryId": { + "base": null, + "refs": { + "CreateNamedQueryOutput$NamedQueryId": "

The unique ID of the query.

", + "DeleteNamedQueryInput$NamedQueryId": "

The unique ID of the query to delete.

", + "GetNamedQueryInput$NamedQueryId": "

The unique ID of the query. Use ListNamedQueries to get query IDs.

", + "NamedQuery$NamedQueryId": "

The unique identifier of the query.

", + "NamedQueryIdList$member": null, + "UnprocessedNamedQueryId$NamedQueryId": "

The unique identifier of the named query.

" + } + }, + "NamedQueryIdList": { + "base": null, + "refs": { + "BatchGetNamedQueryInput$NamedQueryIds": "

An array of query IDs.

", + "ListNamedQueriesOutput$NamedQueryIds": "

The list of unique query IDs.

" + } + }, + "NamedQueryList": { + "base": null, + "refs": { + "BatchGetNamedQueryOutput$NamedQueries": "

Information about the named query IDs submitted.

" + } + }, + "QueryExecution": { + "base": "

Information about a single instance of a query execution.

", + "refs": { + "GetQueryExecutionOutput$QueryExecution": "

Information about the query execution.

", + "QueryExecutionList$member": null + } + }, + "QueryExecutionContext": { + "base": "

The database in which the query execution occurs.

", + "refs": { + "QueryExecution$QueryExecutionContext": "

The database in which the query execution occurred.

", + "StartQueryExecutionInput$QueryExecutionContext": "

The database within which the query executes.

" + } + }, + "QueryExecutionId": { + "base": null, + "refs": { + "GetQueryExecutionInput$QueryExecutionId": "

The unique ID of the query execution.

", + "GetQueryResultsInput$QueryExecutionId": "

The unique ID of the query execution.

", + "QueryExecution$QueryExecutionId": "

The unique identifier for each query execution.

", + "QueryExecutionIdList$member": null, + "StartQueryExecutionOutput$QueryExecutionId": "

The unique ID of the query that ran as a result of this request.

", + "StopQueryExecutionInput$QueryExecutionId": "

The unique ID of the query execution to stop.

", + "UnprocessedQueryExecutionId$QueryExecutionId": "

The unique identifier of the query execution.

" + } + }, + "QueryExecutionIdList": { + "base": null, + "refs": { + "BatchGetQueryExecutionInput$QueryExecutionIds": "

An array of query execution IDs.

", + "ListQueryExecutionsOutput$QueryExecutionIds": "

The unique IDs of each query execution as an array of strings.

" + } + }, + "QueryExecutionList": { + "base": null, + "refs": { + "BatchGetQueryExecutionOutput$QueryExecutions": "

Information about a query execution.

" + } + }, + "QueryExecutionState": { + "base": null, + "refs": { + "QueryExecutionStatus$State": "

The state of query execution. SUBMITTED indicates that the query is queued for execution. RUNNING indicates that the query is scanning data and returning results. SUCCEEDED indicates that the query completed without error. FAILED indicates that the query experienced an error and did not complete processing. CANCELLED indicates that user input interrupted query execution.

" + } + }, + "QueryExecutionStatistics": { + "base": "

The amount of data scanned during the query execution and the amount of time that it took to execute.

", + "refs": { + "QueryExecution$Statistics": "

The amount of data scanned during the query execution and the amount of time that it took to execute.

" + } + }, + "QueryExecutionStatus": { + "base": "

The completion date, current state, submission time, and state change reason (if applicable) for the query execution.

", + "refs": { + "QueryExecution$Status": "

The completion date, current state, submission time, and state change reason (if applicable) for the query execution.

" + } + }, + "QueryString": { + "base": null, + "refs": { + "CreateNamedQueryInput$QueryString": "

The text of the query itself. In other words, all query statements.

", + "NamedQuery$QueryString": "

The SQL query statements that comprise the query.

", + "QueryExecution$Query": "

The SQL query statements which the query execution ran.

", + "StartQueryExecutionInput$QueryString": "

The SQL query statements to be executed.

" + } + }, + "ResultConfiguration": { + "base": "

The location in Amazon S3 where query results are stored and the encryption option, if any, used for query results.

", + "refs": { + "QueryExecution$ResultConfiguration": "

The location in Amazon S3 where query results were stored and the encryption option, if any, used for query results.

", + "StartQueryExecutionInput$ResultConfiguration": "

Specifies information about where and how to save the results of the query execution.

" + } + }, + "ResultSet": { + "base": "

The metadata and rows that comprise a query result set. The metadata describes the column structure and data types.

", + "refs": { + "GetQueryResultsOutput$ResultSet": "

The results of the query execution.

" + } + }, + "ResultSetMetadata": { + "base": "

The metadata that describes the column structure and data types of a table of query results.

", + "refs": { + "ResultSet$ResultSetMetadata": "

The metadata that describes the column structure and data types of a table of query results.

" + } + }, + "Row": { + "base": "

The rows that comprise a query result table.

", + "refs": { + "RowList$member": null + } + }, + "RowList": { + "base": null, + "refs": { + "ResultSet$Rows": "

The rows in the table.

" + } + }, + "StartQueryExecutionInput": { + "base": null, + "refs": { + } + }, + "StartQueryExecutionOutput": { + "base": null, + "refs": { + } + }, + "StopQueryExecutionInput": { + "base": null, + "refs": { + } + }, + "StopQueryExecutionOutput": { + "base": null, + "refs": { + } + }, + "String": { + "base": null, + "refs": { + "ColumnInfo$CatalogName": "

The catalog to which the query results belong.

", + "ColumnInfo$SchemaName": "

The schema name (database name) to which the query results belong.

", + "ColumnInfo$TableName": "

The table name for the query results.

", + "ColumnInfo$Name": "

The name of the column.

", + "ColumnInfo$Label": "

A column label.

", + "ColumnInfo$Type": "

The data type of the column.

", + "EncryptionConfiguration$KmsKey": "

For SSE-KMS and CSE-KMS, this is the KMS key ARN or ID.

", + "QueryExecutionStatus$StateChangeReason": "

Further detail about the status of the query.

", + "ResultConfiguration$OutputLocation": "

The location in S3 where query results are stored.

" + } + }, + "ThrottleReason": { + "base": null, + "refs": { + "TooManyRequestsException$Reason": null + } + }, + "Token": { + "base": null, + "refs": { + "GetQueryResultsInput$NextToken": "

The token that specifies where to start pagination if a previous request was truncated.

", + "GetQueryResultsOutput$NextToken": "

A token to be used by the next request if this request is truncated.

", + "ListNamedQueriesInput$NextToken": "

The token that specifies where to start pagination if a previous request was truncated.

", + "ListNamedQueriesOutput$NextToken": "

A token to be used by the next request if this request is truncated.

", + "ListQueryExecutionsInput$NextToken": "

The token that specifies where to start pagination if a previous request was truncated.

", + "ListQueryExecutionsOutput$NextToken": "

A token to be used by the next request if this request is truncated.

" + } + }, + "TooManyRequestsException": { + "base": "

Indicates that the request was throttled.

", + "refs": { + } + }, + "UnprocessedNamedQueryId": { + "base": "

Information about a named query ID that could not be processed.

", + "refs": { + "UnprocessedNamedQueryIdList$member": null + } + }, + "UnprocessedNamedQueryIdList": { + "base": null, + "refs": { + "BatchGetNamedQueryOutput$UnprocessedNamedQueryIds": "

Information about provided query IDs.

" + } + }, + "UnprocessedQueryExecutionId": { + "base": "

Describes a query execution that failed to process.

", + "refs": { + "UnprocessedQueryExecutionIdList$member": null + } + }, + "UnprocessedQueryExecutionIdList": { + "base": null, + "refs": { + "BatchGetQueryExecutionOutput$UnprocessedQueryExecutionIds": "

Information about the query executions that failed to run.

" + } + }, + "datumList": { + "base": null, + "refs": { + "Row$Data": "

The data that populates a row in a query result table.

" + } + }, + "datumString": { + "base": null, + "refs": { + "Datum$VarCharValue": "

The value of the datum.

" + } + } + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/models/apis/athena/2017-05-18/examples-1.json b/vendor/github.com/aws/aws-sdk-go/models/apis/athena/2017-05-18/examples-1.json new file mode 100644 index 000000000..0ea7e3b0b --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/models/apis/athena/2017-05-18/examples-1.json @@ -0,0 +1,5 @@ +{ + "version": "1.0", + "examples": { + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/models/apis/athena/2017-05-18/paginators-1.json b/vendor/github.com/aws/aws-sdk-go/models/apis/athena/2017-05-18/paginators-1.json new file mode 100644 index 000000000..be4b1f01d --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/models/apis/athena/2017-05-18/paginators-1.json @@ -0,0 +1,19 @@ +{ + "pagination": { + "GetQueryResults": { + "input_token": "NextToken", + "output_token": "NextToken", + "limit_key": "MaxResults" + }, + "ListNamedQueries": { + "input_token": "NextToken", + "output_token": "NextToken", + "limit_key": "MaxResults" + }, + "ListQueryExecutions": { + "input_token": "NextToken", + "output_token": "NextToken", + "limit_key": "MaxResults" + } + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/models/apis/autoscaling/2011-01-01/docs-2.json b/vendor/github.com/aws/aws-sdk-go/models/apis/autoscaling/2011-01-01/docs-2.json index 9509d0de7..a2014c9ef 100644 --- a/vendor/github.com/aws/aws-sdk-go/models/apis/autoscaling/2011-01-01/docs-2.json +++ b/vendor/github.com/aws/aws-sdk-go/models/apis/autoscaling/2011-01-01/docs-2.json @@ -2,9 +2,9 @@ "version": "2.0", "service": "Auto Scaling

Auto Scaling is designed to automatically launch or terminate EC2 instances based on user-defined policies, schedules, and health checks. Use this service in conjunction with the Amazon CloudWatch and Elastic Load Balancing services.

", "operations": { - "AttachInstances": "

Attaches one or more EC2 instances to the specified Auto Scaling group.

When you attach instances, Auto Scaling increases the desired capacity of the group by the number of instances being attached. If the number of instances being attached plus the desired capacity of the group exceeds the maximum size of the group, the operation fails.

If there is a Classic load balancer attached to your Auto Scaling group, the instances are also registered with the load balancer. If there are target groups attached to your Auto Scaling group, the instances are also registered with the target groups.

For more information, see Attach EC2 Instances to Your Auto Scaling Group in the Auto Scaling User Guide.

", + "AttachInstances": "

Attaches one or more EC2 instances to the specified Auto Scaling group.

When you attach instances, Auto Scaling increases the desired capacity of the group by the number of instances being attached. If the number of instances being attached plus the desired capacity of the group exceeds the maximum size of the group, the operation fails.

If there is a Classic Load Balancer attached to your Auto Scaling group, the instances are also registered with the load balancer. If there are target groups attached to your Auto Scaling group, the instances are also registered with the target groups.

For more information, see Attach EC2 Instances to Your Auto Scaling Group in the Auto Scaling User Guide.

", "AttachLoadBalancerTargetGroups": "

Attaches one or more target groups to the specified Auto Scaling group.

To describe the target groups for an Auto Scaling group, use DescribeLoadBalancerTargetGroups. To detach the target group from the Auto Scaling group, use DetachLoadBalancerTargetGroups.

For more information, see Attach a Load Balancer to Your Auto Scaling Group in the Auto Scaling User Guide.

", - "AttachLoadBalancers": "

Attaches one or more Classic load balancers to the specified Auto Scaling group.

To attach an Application load balancer instead, see AttachLoadBalancerTargetGroups.

To describe the load balancers for an Auto Scaling group, use DescribeLoadBalancers. To detach the load balancer from the Auto Scaling group, use DetachLoadBalancers.

For more information, see Attach a Load Balancer to Your Auto Scaling Group in the Auto Scaling User Guide.

", + "AttachLoadBalancers": "

Attaches one or more Classic Load Balancers to the specified Auto Scaling group.

To attach an Application Load Balancer instead, see AttachLoadBalancerTargetGroups.

To describe the load balancers for an Auto Scaling group, use DescribeLoadBalancers. To detach the load balancer from the Auto Scaling group, use DetachLoadBalancers.

For more information, see Attach a Load Balancer to Your Auto Scaling Group in the Auto Scaling User Guide.

", "CompleteLifecycleAction": "

Completes the lifecycle action for the specified token or instance with the specified result.

This step is a part of the procedure for adding a lifecycle hook to an Auto Scaling group:

  1. (Optional) Create a Lambda function and a rule that allows CloudWatch Events to invoke your Lambda function when Auto Scaling launches or terminates instances.

  2. (Optional) Create a notification target and an IAM role. The target can be either an Amazon SQS queue or an Amazon SNS topic. The role allows Auto Scaling to publish lifecycle notifications to the target.

  3. Create the lifecycle hook. Specify whether the hook is used when the instances launch or terminate.

  4. If you need more time, record the lifecycle action heartbeat to keep the instance in a pending state.

  5. If you finish before the timeout period ends, complete the lifecycle action.

For more information, see Auto Scaling Lifecycle in the Auto Scaling User Guide.

", "CreateAutoScalingGroup": "

Creates an Auto Scaling group with the specified name and attributes.

If you exceed your maximum limit of Auto Scaling groups, which by default is 20 per region, the call fails. For information about viewing and updating this limit, see DescribeAccountLimits.

For more information, see Auto Scaling Groups in the Auto Scaling User Guide.

", "CreateLaunchConfiguration": "

Creates a launch configuration.

If you exceed your maximum limit of launch configurations, which by default is 100 per region, the call fails. For information about viewing and updating this limit, see DescribeAccountLimits.

For more information, see Launch Configurations in the Auto Scaling User Guide.

", @@ -25,7 +25,7 @@ "DescribeLifecycleHookTypes": "

Describes the available types of lifecycle hooks.

", "DescribeLifecycleHooks": "

Describes the lifecycle hooks for the specified Auto Scaling group.

", "DescribeLoadBalancerTargetGroups": "

Describes the target groups for the specified Auto Scaling group.

", - "DescribeLoadBalancers": "

Describes the load balancers for the specified Auto Scaling group.

Note that this operation describes only Classic load balancers. If you have Application load balancers, use DescribeLoadBalancerTargetGroups instead.

", + "DescribeLoadBalancers": "

Describes the load balancers for the specified Auto Scaling group.

Note that this operation describes only Classic Load Balancers. If you have Application Load Balancers, use DescribeLoadBalancerTargetGroups instead.

", "DescribeMetricCollectionTypes": "

Describes the available CloudWatch metrics for Auto Scaling.

Note that the GroupStandbyInstances metric is not returned by default. You must explicitly request this metric when calling EnableMetricsCollection.

", "DescribeNotificationConfigurations": "

Describes the notification actions associated with the specified Auto Scaling group.

", "DescribePolicies": "

Describes the policies for the specified Auto Scaling group.

", @@ -34,14 +34,14 @@ "DescribeScheduledActions": "

Describes the actions scheduled for your Auto Scaling group that haven't run. To describe the actions that have already run, use DescribeScalingActivities.

", "DescribeTags": "

Describes the specified tags.

You can use filters to limit the results. For example, you can query for the tags for a specific Auto Scaling group. You can specify multiple values for a filter. A tag must match at least one of the specified values for it to be included in the results.

You can also specify multiple filters. The result includes information for a particular tag only if it matches all the filters. If there's no match, no special message is returned.

", "DescribeTerminationPolicyTypes": "

Describes the termination policies supported by Auto Scaling.

", - "DetachInstances": "

Removes one or more instances from the specified Auto Scaling group.

After the instances are detached, you can manage them independently from the rest of the Auto Scaling group.

If you do not specify the option to decrement the desired capacity, Auto Scaling launches instances to replace the ones that are detached.

If there is a Classic load balancer attached to the Auto Scaling group, the instances are deregistered from the load balancer. If there are target groups attached to the Auto Scaling group, the instances are deregistered from the target groups.

For more information, see Detach EC2 Instances from Your Auto Scaling Group in the Auto Scaling User Guide.

", + "DetachInstances": "

Removes one or more instances from the specified Auto Scaling group.

After the instances are detached, you can manage them independent of the Auto Scaling group.

If you do not specify the option to decrement the desired capacity, Auto Scaling launches instances to replace the ones that are detached.

If there is a Classic Load Balancer attached to the Auto Scaling group, the instances are deregistered from the load balancer. If there are target groups attached to the Auto Scaling group, the instances are deregistered from the target groups.

For more information, see Detach EC2 Instances from Your Auto Scaling Group in the Auto Scaling User Guide.

", "DetachLoadBalancerTargetGroups": "

Detaches one or more target groups from the specified Auto Scaling group.

", - "DetachLoadBalancers": "

Detaches one or more Classic load balancers from the specified Auto Scaling group.

Note that this operation detaches only Classic load balancers. If you have Application load balancers, use DetachLoadBalancerTargetGroups instead.

When you detach a load balancer, it enters the Removing state while deregistering the instances in the group. When all instances are deregistered, then you can no longer describe the load balancer using DescribeLoadBalancers. Note that the instances remain running.

", + "DetachLoadBalancers": "

Detaches one or more Classic Load Balancers from the specified Auto Scaling group.

Note that this operation detaches only Classic Load Balancers. If you have Application Load Balancers, use DetachLoadBalancerTargetGroups instead.

When you detach a load balancer, it enters the Removing state while deregistering the instances in the group. When all instances are deregistered, then you can no longer describe the load balancer using DescribeLoadBalancers. Note that the instances remain running.

", "DisableMetricsCollection": "

Disables group metrics for the specified Auto Scaling group.

", "EnableMetricsCollection": "

Enables group metrics for the specified Auto Scaling group. For more information, see Monitoring Your Auto Scaling Groups and Instances in the Auto Scaling User Guide.

", - "EnterStandby": "

Moves the specified instances into Standby mode.

For more information, see Auto Scaling Lifecycle in the Auto Scaling User Guide.

", + "EnterStandby": "

Moves the specified instances into the standby state.

For more information, see Temporarily Removing Instances from Your Auto Scaling Group in the Auto Scaling User Guide.

", "ExecutePolicy": "

Executes the specified policy.

", - "ExitStandby": "

Moves the specified instances out of Standby mode.

For more information, see Auto Scaling Lifecycle in the Auto Scaling User Guide.

", + "ExitStandby": "

Moves the specified instances out of the standby state.

For more information, see Temporarily Removing Instances from Your Auto Scaling Group in the Auto Scaling User Guide.

", "PutLifecycleHook": "

Creates or updates a lifecycle hook for the specified Auto Scaling Group.

A lifecycle hook tells Auto Scaling that you want to perform an action on an instance that is not actively in service; for example, either when the instance launches or before the instance terminates.

This step is a part of the procedure for adding a lifecycle hook to an Auto Scaling group:

  1. (Optional) Create a Lambda function and a rule that allows CloudWatch Events to invoke your Lambda function when Auto Scaling launches or terminates instances.

  2. (Optional) Create a notification target and an IAM role. The target can be either an Amazon SQS queue or an Amazon SNS topic. The role allows Auto Scaling to publish lifecycle notifications to the target.

  3. Create the lifecycle hook. Specify whether the hook is used when the instances launch or terminate.

  4. If you need more time, record the lifecycle action heartbeat to keep the instance in a pending state.

  5. If you finish before the timeout period ends, complete the lifecycle action.

For more information, see Auto Scaling Lifecycle Hooks in the Auto Scaling User Guide.

If you exceed your maximum limit of lifecycle hooks, which by default is 50 per Auto Scaling group, the call fails. For information about updating this limit, see AWS Service Limits in the Amazon Web Services General Reference.

", "PutNotificationConfiguration": "

Configures an Auto Scaling group to send notifications when specified events take place. Subscribers to the specified topic can have messages delivered to an endpoint such as a web server or an email address.

This configuration overwrites any existing configuration.

For more information see Getting SNS Notifications When Your Auto Scaling Group Scales in the Auto Scaling User Guide.

", "PutScalingPolicy": "

Creates or updates a policy for an Auto Scaling group. To update an existing policy, use the existing policy name and set the parameters you want to change. Any existing parameter not changed in an update to an existing policy is not changed in this update request.

If you exceed your maximum limit of step adjustments, which by default is 20 per region, the call fails. For information about updating this limit, see AWS Service Limits in the Amazon Web Services General Reference.

", @@ -53,7 +53,7 @@ "SetInstanceProtection": "

Updates the instance protection settings of the specified instances.

For more information, see Instance Protection in the Auto Scaling User Guide.

", "SuspendProcesses": "

Suspends the specified Auto Scaling processes, or all processes, for the specified Auto Scaling group.

Note that if you suspend either the Launch or Terminate process types, it can prevent other process types from functioning properly.

To resume processes that have been suspended, use ResumeProcesses.

For more information, see Suspending and Resuming Auto Scaling Processes in the Auto Scaling User Guide.

", "TerminateInstanceInAutoScalingGroup": "

Terminates the specified instance and optionally adjusts the desired group size.

This call simply makes a termination request. The instance is not terminated immediately.

", - "UpdateAutoScalingGroup": "

Updates the configuration for the specified Auto Scaling group.

To update an Auto Scaling group with a launch configuration with InstanceMonitoring set to False, you must first disable the collection of group metrics. Otherwise, you will get an error. If you have previously enabled the collection of group metrics, you can disable it using DisableMetricsCollection.

The new settings are registered upon the completion of this call. Any launch configuration settings take effect on any triggers after this call returns. Scaling activities that are currently in progress aren't affected.

Note the following:

  • If you specify a new value for MinSize without specifying a value for DesiredCapacity, and the new MinSize is larger than the current size of the group, we implicitly call SetDesiredCapacity to set the size of the group to the new value of MinSize.

  • If you specify a new value for MaxSize without specifying a value for DesiredCapacity, and the new MaxSize is smaller than the current size of the group, we implicitly call SetDesiredCapacity to set the size of the group to the new value of MaxSize.

  • All other optional parameters are left unchanged if not specified.

" + "UpdateAutoScalingGroup": "

Updates the configuration for the specified Auto Scaling group.

The new settings take effect on any scaling activities after this call returns. Scaling activities that are currently in progress aren't affected.

To update an Auto Scaling group with a launch configuration with InstanceMonitoring set to false, you must first disable the collection of group metrics. Otherwise, you will get an error. If you have previously enabled the collection of group metrics, you can disable it using DisableMetricsCollection.

Note the following:

  • If you specify a new value for MinSize without specifying a value for DesiredCapacity, and the new MinSize is larger than the current size of the group, we implicitly call SetDesiredCapacity to set the size of the group to the new value of MinSize.

  • If you specify a new value for MaxSize without specifying a value for DesiredCapacity, and the new MaxSize is smaller than the current size of the group, we implicitly call SetDesiredCapacity to set the size of the group to the new value of MaxSize.

  • All other optional parameters are left unchanged if not specified.

" }, "shapes": { "Activities": { @@ -66,7 +66,7 @@ } }, "ActivitiesType": { - "base": "

Contains the output of DescribeScalingActivities.

", + "base": null, "refs": { } }, @@ -84,7 +84,7 @@ } }, "ActivityType": { - "base": "

Contains the output of TerminateInstancesInAutoScalingGroup.

", + "base": null, "refs": { } }, @@ -136,7 +136,7 @@ } }, "AttachInstancesQuery": { - "base": "

Contains the parameters for AttachInstances.

", + "base": null, "refs": { } }, @@ -146,17 +146,17 @@ } }, "AttachLoadBalancerTargetGroupsType": { - "base": "

Contains the parameters for AttachLoadBalancerTargetGroups.

", + "base": null, "refs": { } }, "AttachLoadBalancersResultType": { - "base": "

Contains the output of AttachLoadBalancers.

", + "base": null, "refs": { } }, "AttachLoadBalancersType": { - "base": "

Contains the parameters for AttachLoadBalancers.

", + "base": null, "refs": { } }, @@ -170,7 +170,7 @@ "base": null, "refs": { "AutoScalingGroup$DesiredCapacity": "

The desired size of the group.

", - "CreateAutoScalingGroupType$DesiredCapacity": "

The number of EC2 instances that should be running in the group. This number must be greater than or equal to the minimum size of the group and less than or equal to the maximum size of the group.

", + "CreateAutoScalingGroupType$DesiredCapacity": "

The number of EC2 instances that should be running in the group. This number must be greater than or equal to the minimum size of the group and less than or equal to the maximum size of the group. If you do not specify a desired capacity, the default is the minimum size of the group.

", "PutScheduledUpdateGroupActionType$DesiredCapacity": "

The number of EC2 instances that should be running in the group.

", "ScheduledUpdateGroupAction$DesiredCapacity": "

The number of instances you prefer to maintain in the group.

", "SetDesiredCapacityType$DesiredCapacity": "

The number of EC2 instances that should be running in the Auto Scaling group.

", @@ -205,7 +205,7 @@ } }, "AutoScalingGroupNamesType": { - "base": "

Contains the parameters for DescribeAutoScalingGroups.

", + "base": null, "refs": { } }, @@ -216,7 +216,7 @@ } }, "AutoScalingGroupsType": { - "base": "

Contains the output for DescribeAutoScalingGroups.

", + "base": null, "refs": { } }, @@ -233,7 +233,7 @@ } }, "AutoScalingInstancesType": { - "base": "

Contains the output of DescribeAutoScalingInstances.

", + "base": null, "refs": { } }, @@ -304,12 +304,12 @@ } }, "CompleteLifecycleActionAnswer": { - "base": "

Contains the output of CompleteLifecycleAction.

", + "base": null, "refs": { } }, "CompleteLifecycleActionType": { - "base": "

Contains the parameters for CompleteLifecycleAction.

", + "base": null, "refs": { } }, @@ -319,162 +319,162 @@ "AutoScalingGroup$DefaultCooldown": "

The amount of time, in seconds, after a scaling activity completes before another scaling activity can start.

", "CreateAutoScalingGroupType$DefaultCooldown": "

The amount of time, in seconds, after a scaling activity completes before another scaling activity can start. The default is 300.

For more information, see Auto Scaling Cooldowns in the Auto Scaling User Guide.

", "PutScalingPolicyType$Cooldown": "

The amount of time, in seconds, after a scaling activity completes and before the next scaling activity can start. If this parameter is not specified, the default cooldown period for the group applies.

This parameter is not supported unless the policy type is SimpleScaling.

For more information, see Auto Scaling Cooldowns in the Auto Scaling User Guide.

", - "ScalingPolicy$Cooldown": "

The amount of time, in seconds, after a scaling activity completes before any further trigger-related scaling activities can start.

", + "ScalingPolicy$Cooldown": "

The amount of time, in seconds, after a scaling activity completes before any further dynamic scaling activities can start.

", "UpdateAutoScalingGroupType$DefaultCooldown": "

The amount of time, in seconds, after a scaling activity completes before another scaling activity can start. The default is 300.

For more information, see Auto Scaling Cooldowns in the Auto Scaling User Guide.

" } }, "CreateAutoScalingGroupType": { - "base": "

Contains the parameters for CreateAutoScalingGroup.

", + "base": null, "refs": { } }, "CreateLaunchConfigurationType": { - "base": "

Contains the parameters for CreateLaunchConfiguration.

", + "base": null, "refs": { } }, "CreateOrUpdateTagsType": { - "base": "

Contains the parameters for CreateOrUpdateTags.

", + "base": null, "refs": { } }, "DeleteAutoScalingGroupType": { - "base": "

Contains the parameters for DeleteAutoScalingGroup.

", + "base": null, "refs": { } }, "DeleteLifecycleHookAnswer": { - "base": "

Contains the output of DeleteLifecycleHook.

", + "base": null, "refs": { } }, "DeleteLifecycleHookType": { - "base": "

Contains the parameters for DeleteLifecycleHook.

", + "base": null, "refs": { } }, "DeleteNotificationConfigurationType": { - "base": "

Contains the parameters for DeleteNotificationConfiguration.

", + "base": null, "refs": { } }, "DeletePolicyType": { - "base": "

Contains the parameters for DeletePolicy.

", + "base": null, "refs": { } }, "DeleteScheduledActionType": { - "base": "

Contains the parameters for DeleteScheduledAction.

", + "base": null, "refs": { } }, "DeleteTagsType": { - "base": "

Contains the parameters for DeleteTags.

", + "base": null, "refs": { } }, "DescribeAccountLimitsAnswer": { - "base": "

Contains the parameters for DescribeAccountLimits.

", + "base": null, "refs": { } }, "DescribeAdjustmentTypesAnswer": { - "base": "

Contains the parameters for DescribeAdjustmentTypes.

", + "base": null, "refs": { } }, "DescribeAutoScalingInstancesType": { - "base": "

Contains the parameters for DescribeAutoScalingInstances.

", + "base": null, "refs": { } }, "DescribeAutoScalingNotificationTypesAnswer": { - "base": "

Contains the output of DescribeAutoScalingNotificationTypes.

", + "base": null, "refs": { } }, "DescribeLifecycleHookTypesAnswer": { - "base": "

Contains the output of DescribeLifecycleHookTypes.

", + "base": null, "refs": { } }, "DescribeLifecycleHooksAnswer": { - "base": "

Contains the output of DescribeLifecycleHooks.

", + "base": null, "refs": { } }, "DescribeLifecycleHooksType": { - "base": "

Contains the parameters for DescribeLifecycleHooks.

", + "base": null, "refs": { } }, "DescribeLoadBalancerTargetGroupsRequest": { - "base": "

Contains the parameters for DescribeLoadBalancerTargetGroups.

", + "base": null, "refs": { } }, "DescribeLoadBalancerTargetGroupsResponse": { - "base": "

Contains the output of DescribeLoadBalancerTargetGroups.

", + "base": null, "refs": { } }, "DescribeLoadBalancersRequest": { - "base": "

Contains the parameters for DescribeLoadBalancers.

", + "base": null, "refs": { } }, "DescribeLoadBalancersResponse": { - "base": "

Contains the output of DescribeLoadBalancers.

", + "base": null, "refs": { } }, "DescribeMetricCollectionTypesAnswer": { - "base": "

Contains the output of DescribeMetricsCollectionTypes.

", + "base": null, "refs": { } }, "DescribeNotificationConfigurationsAnswer": { - "base": "

Contains the output from DescribeNotificationConfigurations.

", + "base": null, "refs": { } }, "DescribeNotificationConfigurationsType": { - "base": "

Contains the parameters for DescribeNotificationConfigurations.

", + "base": null, "refs": { } }, "DescribePoliciesType": { - "base": "

Contains the parameters for DescribePolicies.

", + "base": null, "refs": { } }, "DescribeScalingActivitiesType": { - "base": "

Contains the parameters for DescribeScalingActivities.

", + "base": null, "refs": { } }, "DescribeScheduledActionsType": { - "base": "

Contains the parameters for DescribeScheduledActions.

", + "base": null, "refs": { } }, "DescribeTagsType": { - "base": "

Contains the parameters for DescribeTags.

", + "base": null, "refs": { } }, "DescribeTerminationPolicyTypesAnswer": { - "base": "

Contains the output of DescribeTerminationPolicyTypes.

", + "base": null, "refs": { } }, "DetachInstancesAnswer": { - "base": "

Contains the output of DetachInstances.

", + "base": null, "refs": { } }, "DetachInstancesQuery": { - "base": "

Contains the parameters for DetachInstances.

", + "base": null, "refs": { } }, @@ -489,17 +489,17 @@ } }, "DetachLoadBalancersResultType": { - "base": "

Contains the output for DetachLoadBalancers.

", + "base": null, "refs": { } }, "DetachLoadBalancersType": { - "base": "

Contains the parameters for DetachLoadBalancers.

", + "base": null, "refs": { } }, "DisableMetricsCollectionQuery": { - "base": "

Contains the parameters for DisableMetricsCollection.

", + "base": null, "refs": { } }, @@ -517,7 +517,7 @@ } }, "EnableMetricsCollectionQuery": { - "base": "

Contains the parameters for EnableMetricsCollection.

", + "base": null, "refs": { } }, @@ -534,12 +534,12 @@ } }, "EnterStandbyAnswer": { - "base": "

Contains the output of EnterStandby.

", + "base": null, "refs": { } }, "EnterStandbyQuery": { - "base": "

Contains the parameters for EnteStandby.

", + "base": null, "refs": { } }, @@ -551,17 +551,17 @@ } }, "ExecutePolicyType": { - "base": "

Contains the parameters for ExecutePolicy.

", + "base": null, "refs": { } }, "ExitStandbyAnswer": { - "base": "

Contains the parameters for ExitStandby.

", + "base": null, "refs": { } }, "ExitStandbyQuery": { - "base": "

Contains the parameters for ExitStandby.

", + "base": null, "refs": { } }, @@ -629,9 +629,9 @@ } }, "InstanceMonitoring": { - "base": "

Describes whether instance monitoring is enabled.

", + "base": "

Describes whether detailed monitoring is enabled for the Auto Scaling instances.

", "refs": { - "CreateLaunchConfigurationType$InstanceMonitoring": "

Enables detailed monitoring (true) or basic monitoring (false) for the Auto Scaling instances.

", + "CreateLaunchConfigurationType$InstanceMonitoring": "

Enables detailed monitoring (true) or basic monitoring (false) for the Auto Scaling instances. The default is true.

", "LaunchConfiguration$InstanceMonitoring": "

Controls whether instances in this group are launched with detailed (true) or basic (false) monitoring.

" } }, @@ -663,7 +663,7 @@ } }, "LaunchConfigurationNameType": { - "base": "

Contains the parameters for DeleteLaunchConfiguration.

", + "base": null, "refs": { } }, @@ -674,7 +674,7 @@ } }, "LaunchConfigurationNamesType": { - "base": "

Contains the parameters for DescribeLaunchConfigurations.

", + "base": null, "refs": { } }, @@ -685,7 +685,7 @@ } }, "LaunchConfigurationsType": { - "base": "

Contains the output of DescribeLaunchConfigurations.

", + "base": null, "refs": { } }, @@ -745,12 +745,12 @@ "refs": { "AttachLoadBalancersType$LoadBalancerNames": "

One or more load balancer names.

", "AutoScalingGroup$LoadBalancerNames": "

One or more load balancers associated with the group.

", - "CreateAutoScalingGroupType$LoadBalancerNames": "

One or more Classic load balancers. To specify an Application load balancer, use TargetGroupARNs instead.

For more information, see Using a Load Balancer With an Auto Scaling Group in the Auto Scaling User Guide.

", + "CreateAutoScalingGroupType$LoadBalancerNames": "

One or more Classic Load Balancers. To specify an Application Load Balancer, use TargetGroupARNs instead.

For more information, see Using a Load Balancer With an Auto Scaling Group in the Auto Scaling User Guide.

", "DetachLoadBalancersType$LoadBalancerNames": "

One or more load balancer names.

" } }, "LoadBalancerState": { - "base": "

Describes the state of a Classic load balancer.

If you specify a load balancer when creating the Auto Scaling group, the state of the load balancer is InService.

If you attach a load balancer to an existing Auto Scaling group, the initial state is Adding. The state transitions to Added after all instances in the group are registered with the load balancer. If ELB health checks are enabled for the load balancer, the state transitions to InService after at least one instance in the group passes the health check. If EC2 health checks are enabled instead, the load balancer remains in the Added state.

", + "base": "

Describes the state of a Classic Load Balancer.

If you specify a load balancer when creating the Auto Scaling group, the state of the load balancer is InService.

If you attach a load balancer to an existing Auto Scaling group, the initial state is Adding. The state transitions to Added after all instances in the group are registered with the load balancer. If ELB health checks are enabled for the load balancer, the state transitions to InService after at least one instance in the group passes the health check. If EC2 health checks are enabled instead, the load balancer remains in the Added state.

", "refs": { "LoadBalancerStates$member": null } @@ -788,16 +788,16 @@ "MaxRecords": { "base": null, "refs": { - "AutoScalingGroupNamesType$MaxRecords": "

The maximum number of items to return with this call.

", - "DescribeAutoScalingInstancesType$MaxRecords": "

The maximum number of items to return with this call.

", - "DescribeLoadBalancerTargetGroupsRequest$MaxRecords": "

The maximum number of items to return with this call.

", - "DescribeLoadBalancersRequest$MaxRecords": "

The maximum number of items to return with this call.

", - "DescribeNotificationConfigurationsType$MaxRecords": "

The maximum number of items to return with this call.

", - "DescribePoliciesType$MaxRecords": "

The maximum number of items to be returned with each call.

", - "DescribeScalingActivitiesType$MaxRecords": "

The maximum number of items to return with this call.

", - "DescribeScheduledActionsType$MaxRecords": "

The maximum number of items to return with this call.

", - "DescribeTagsType$MaxRecords": "

The maximum number of items to return with this call.

", - "LaunchConfigurationNamesType$MaxRecords": "

The maximum number of items to return with this call. The default is 100.

" + "AutoScalingGroupNamesType$MaxRecords": "

The maximum number of items to return with this call. The default value is 50 and the maximum value is 100.

", + "DescribeAutoScalingInstancesType$MaxRecords": "

The maximum number of items to return with this call. The default value is 50 and the maximum value is 100.

", + "DescribeLoadBalancerTargetGroupsRequest$MaxRecords": "

The maximum number of items to return with this call. The default value is 50 and the maximum value is 100.

", + "DescribeLoadBalancersRequest$MaxRecords": "

The maximum number of items to return with this call. The default value is 50 and the maximum value is 100.

", + "DescribeNotificationConfigurationsType$MaxRecords": "

The maximum number of items to return with this call. The default value is 50 and the maximum value is 100.

", + "DescribePoliciesType$MaxRecords": "

The maximum number of items to be returned with each call. The default value is 50 and the maximum value is 100.

", + "DescribeScalingActivitiesType$MaxRecords": "

The maximum number of items to return with this call. The default value is 100.

", + "DescribeScheduledActionsType$MaxRecords": "

The maximum number of items to return with this call. The default value is 50 and the maximum value is 100.

", + "DescribeTagsType$MaxRecords": "

The maximum number of items to return with this call. The default value is 50 and the maximum value is 100.

", + "LaunchConfigurationNamesType$MaxRecords": "

The maximum number of items to return with this call. The default value is 50 and the maximum value is 100.

" } }, "MetricCollectionType": { @@ -857,7 +857,7 @@ "MonitoringEnabled": { "base": null, "refs": { - "InstanceMonitoring$Enabled": "

If True, instance monitoring is enabled.

" + "InstanceMonitoring$Enabled": "

If true, detailed monitoring is enabled. Otherwise, basic monitoring is enabled.

" } }, "NoDevice": { @@ -897,12 +897,12 @@ } }, "PoliciesType": { - "base": "

Contains the output of DescribePolicies.

", + "base": null, "refs": { } }, "PolicyARNType": { - "base": "

Contains the output of PutScalingPolicy.

", + "base": null, "refs": { } }, @@ -945,7 +945,7 @@ } }, "ProcessesType": { - "base": "

Contains the output of DescribeScalingProcessTypes.

", + "base": null, "refs": { } }, @@ -969,37 +969,37 @@ } }, "PutLifecycleHookAnswer": { - "base": "

Contains the output of PutLifecycleHook.

", + "base": null, "refs": { } }, "PutLifecycleHookType": { - "base": "

Contains the parameters for PutLifecycleHook.

", + "base": null, "refs": { } }, "PutNotificationConfigurationType": { - "base": "

Contains the parameters for PutNotificationConfiguration.

", + "base": null, "refs": { } }, "PutScalingPolicyType": { - "base": "

Contains the parameters for PutScalingPolicy.

", + "base": null, "refs": { } }, "PutScheduledUpdateGroupActionType": { - "base": "

Contains the parameters for PutScheduledUpdateGroupAction.

", + "base": null, "refs": { } }, "RecordLifecycleActionHeartbeatAnswer": { - "base": "

Contains the output of RecordLifecycleActionHeartBeat.

", + "base": null, "refs": { } }, "RecordLifecycleActionHeartbeatType": { - "base": "

Contains the parameters for RecordLifecycleActionHeartbeat.

", + "base": null, "refs": { } }, @@ -1098,7 +1098,7 @@ } }, "ScalingProcessQuery": { - "base": "

Contains the parameters for SuspendProcesses and ResumeProcesses.

", + "base": null, "refs": { } }, @@ -1109,7 +1109,7 @@ } }, "ScheduledActionsType": { - "base": "

Contains the output of DescribeScheduledActions.

", + "base": null, "refs": { } }, @@ -1133,22 +1133,22 @@ } }, "SetDesiredCapacityType": { - "base": "

Contains the parameters for SetDesiredCapacity.

", + "base": null, "refs": { } }, "SetInstanceHealthQuery": { - "base": "

Contains the parameters for SetInstanceHealth.

", + "base": null, "refs": { } }, "SetInstanceProtectionAnswer": { - "base": "

Contains the output of SetInstanceProtection.

", + "base": null, "refs": { } }, "SetInstanceProtectionQuery": { - "base": "

Contains the parameters for SetInstanceProtection.

", + "base": null, "refs": { } }, @@ -1240,7 +1240,7 @@ } }, "TagsType": { - "base": "

Contains the output of DescribeTags.

", + "base": null, "refs": { } }, @@ -1254,7 +1254,7 @@ } }, "TerminateInstanceInAutoScalingGroupType": { - "base": "

Contains the parameters for TerminateInstanceInAutoScalingGroup.

", + "base": null, "refs": { } }, @@ -1285,7 +1285,7 @@ } }, "UpdateAutoScalingGroupType": { - "base": "

Contains the parameters for UpdateAutoScalingGroup.

", + "base": null, "refs": { } }, @@ -1353,7 +1353,7 @@ "AutoScalingInstanceDetails$InstanceId": "

The ID of the instance.

", "CompleteLifecycleActionType$InstanceId": "

The ID of the instance.

", "CreateAutoScalingGroupType$InstanceId": "

The ID of the instance used to create a launch configuration for the group. Alternatively, specify a launch configuration instead of an EC2 instance.

When you specify an ID of an instance, Auto Scaling creates a new launch configuration and associates it with the group. This launch configuration derives its attributes from the specified instance, with the exception of the block device mapping.

For more information, see Create an Auto Scaling Group Using an EC2 Instance in the Auto Scaling User Guide.

", - "CreateLaunchConfigurationType$InstanceId": "

The ID of the instance to use to create the launch configuration.

The new launch configuration derives attributes from the instance, with the exception of the block device mapping.

To create a launch configuration with a block device mapping or override any other instance attributes, specify them as part of the same request.

For more information, see Create a Launch Configuration Using an EC2 Instance in the Auto Scaling User Guide.

", + "CreateLaunchConfigurationType$InstanceId": "

The ID of the instance to use to create the launch configuration. The new launch configuration derives attributes from the instance, with the exception of the block device mapping.

If you do not specify InstanceId, you must specify both ImageId and InstanceType.

To create a launch configuration with a block device mapping or override any other instance attributes, specify them as part of the same request.

For more information, see Create a Launch Configuration Using an EC2 Instance in the Auto Scaling User Guide.

", "Instance$InstanceId": "

The ID of the instance.

", "InstanceIds$member": null, "RecordLifecycleActionHeartbeatType$InstanceId": "

The ID of the instance.

", @@ -1383,7 +1383,7 @@ "AutoScalingGroup$Status": "

The current state of the group when DeleteAutoScalingGroup is in progress.

", "AutoScalingInstanceDetails$AutoScalingGroupName": "

The name of the Auto Scaling group associated with the instance.

", "AutoScalingInstanceDetails$AvailabilityZone": "

The Availability Zone for the instance.

", - "AutoScalingInstanceDetails$LaunchConfigurationName": "

The launch configuration associated with the instance.

", + "AutoScalingInstanceDetails$LaunchConfigurationName": "

The launch configuration used to launch the instance. This value is not available if you attached the instance to the Auto Scaling group.

", "AutoScalingNotificationTypes$member": null, "AvailabilityZones$member": null, "BlockDeviceMapping$VirtualName": "

The name of the virtual device (for example, ephemeral0).

", @@ -1392,10 +1392,10 @@ "CreateAutoScalingGroupType$AutoScalingGroupName": "

The name of the group. This name must be unique within the scope of your AWS account.

", "CreateAutoScalingGroupType$PlacementGroup": "

The name of the placement group into which you'll launch your instances, if any. For more information, see Placement Groups in the Amazon Elastic Compute Cloud User Guide.

", "CreateLaunchConfigurationType$LaunchConfigurationName": "

The name of the launch configuration. This name must be unique within the scope of your AWS account.

", - "CreateLaunchConfigurationType$ImageId": "

The ID of the Amazon Machine Image (AMI) to use to launch your EC2 instances. For more information, see Finding an AMI in the Amazon Elastic Compute Cloud User Guide.

", + "CreateLaunchConfigurationType$ImageId": "

The ID of the Amazon Machine Image (AMI) to use to launch your EC2 instances.

If you do not specify InstanceId, you must specify ImageId.

For more information, see Finding an AMI in the Amazon Elastic Compute Cloud User Guide.

", "CreateLaunchConfigurationType$KeyName": "

The name of the key pair. For more information, see Amazon EC2 Key Pairs in the Amazon Elastic Compute Cloud User Guide.

", "CreateLaunchConfigurationType$ClassicLinkVPCId": "

The ID of a ClassicLink-enabled VPC to link your EC2-Classic instances to. This parameter is supported only if you are launching EC2-Classic instances. For more information, see ClassicLink in the Amazon Elastic Compute Cloud User Guide.

", - "CreateLaunchConfigurationType$InstanceType": "

The instance type of the EC2 instance. For information about available instance types, see Available Instance Types in the Amazon Elastic Compute Cloud User Guide.

", + "CreateLaunchConfigurationType$InstanceType": "

The instance type of the EC2 instance.

If you do not specify InstanceId, you must specify InstanceType.

For information about available instance types, see Available Instance Types in the Amazon Elastic Compute Cloud User Guide.

", "CreateLaunchConfigurationType$KernelId": "

The ID of the kernel associated with the AMI.

", "CreateLaunchConfigurationType$RamdiskId": "

The ID of the RAM disk associated with the AMI.

", "Ebs$SnapshotId": "

The ID of the snapshot.

", diff --git a/vendor/github.com/aws/aws-sdk-go/models/apis/autoscaling/2011-01-01/examples-1.json b/vendor/github.com/aws/aws-sdk-go/models/apis/autoscaling/2011-01-01/examples-1.json index 9dcaf88db..33ffc9c0e 100644 --- a/vendor/github.com/aws/aws-sdk-go/models/apis/autoscaling/2011-01-01/examples-1.json +++ b/vendor/github.com/aws/aws-sdk-go/models/apis/autoscaling/2011-01-01/examples-1.json @@ -410,7 +410,8 @@ "HealthStatus": "Healthy", "InstanceId": "i-4ba0837f", "LaunchConfigurationName": "my-launch-config", - "LifecycleState": "InService" + "LifecycleState": "InService", + "ProtectedFromScaleIn": false } ], "LaunchConfigurationName": "my-launch-config", diff --git a/vendor/github.com/aws/aws-sdk-go/models/apis/autoscaling/2011-01-01/paginators-1.json b/vendor/github.com/aws/aws-sdk-go/models/apis/autoscaling/2011-01-01/paginators-1.json index 31bc09445..1b8385975 100644 --- a/vendor/github.com/aws/aws-sdk-go/models/apis/autoscaling/2011-01-01/paginators-1.json +++ b/vendor/github.com/aws/aws-sdk-go/models/apis/autoscaling/2011-01-01/paginators-1.json @@ -2,51 +2,51 @@ "pagination": { "DescribeAutoScalingGroups": { "input_token": "NextToken", - "output_token": "NextToken", "limit_key": "MaxRecords", + "output_token": "NextToken", "result_key": "AutoScalingGroups" }, "DescribeAutoScalingInstances": { "input_token": "NextToken", - "output_token": "NextToken", "limit_key": "MaxRecords", + "output_token": "NextToken", "result_key": "AutoScalingInstances" }, "DescribeLaunchConfigurations": { "input_token": "NextToken", - "output_token": "NextToken", "limit_key": "MaxRecords", + "output_token": "NextToken", "result_key": "LaunchConfigurations" }, "DescribeNotificationConfigurations": { "input_token": "NextToken", - "output_token": "NextToken", "limit_key": "MaxRecords", + "output_token": "NextToken", "result_key": "NotificationConfigurations" }, "DescribePolicies": { "input_token": "NextToken", - "output_token": "NextToken", "limit_key": "MaxRecords", + "output_token": "NextToken", "result_key": "ScalingPolicies" }, "DescribeScalingActivities": { "input_token": "NextToken", - "output_token": "NextToken", "limit_key": "MaxRecords", + "output_token": "NextToken", "result_key": "Activities" }, "DescribeScheduledActions": { "input_token": "NextToken", - "output_token": "NextToken", "limit_key": "MaxRecords", + "output_token": "NextToken", "result_key": "ScheduledUpdateGroupActions" }, "DescribeTags": { "input_token": "NextToken", - "output_token": "NextToken", "limit_key": "MaxRecords", + "output_token": "NextToken", "result_key": "Tags" } } -} +} \ No newline at end of file diff --git a/vendor/github.com/aws/aws-sdk-go/models/apis/codedeploy/2014-10-06/api-2.json b/vendor/github.com/aws/aws-sdk-go/models/apis/codedeploy/2014-10-06/api-2.json index 9d4d49b21..0812c7968 100644 --- a/vendor/github.com/aws/aws-sdk-go/models/apis/codedeploy/2014-10-06/api-2.json +++ b/vendor/github.com/aws/aws-sdk-go/models/apis/codedeploy/2014-10-06/api-2.json @@ -178,7 +178,8 @@ {"shape":"DeploymentLimitExceededException"}, {"shape":"InvalidTargetInstancesException"}, {"shape":"InvalidAutoRollbackConfigException"}, - {"shape":"InvalidLoadBalancerInfoException"} + {"shape":"InvalidLoadBalancerInfoException"}, + {"shape":"InvalidFileExistsBehaviorException"} ] }, "CreateDeploymentConfig":{ @@ -467,7 +468,8 @@ {"shape":"InvalidNextTokenException"}, {"shape":"InvalidDeploymentIdException"}, {"shape":"InvalidInstanceStatusException"}, - {"shape":"InvalidInstanceTypeException"} + {"shape":"InvalidInstanceTypeException"}, + {"shape":"InvalidDeploymentInstanceTypeException"} ] }, "ListDeployments":{ @@ -966,7 +968,8 @@ "ignoreApplicationStopFailures":{"shape":"Boolean"}, "targetInstances":{"shape":"TargetInstances"}, "autoRollbackConfiguration":{"shape":"AutoRollbackConfiguration"}, - "updateOutdatedInstancesOnly":{"shape":"Boolean"} + "updateOutdatedInstancesOnly":{"shape":"Boolean"}, + "fileExistsBehavior":{"shape":"FileExistsBehavior"} } }, "CreateDeploymentOutput":{ @@ -1147,6 +1150,7 @@ "deploymentGroupName":{"shape":"DeploymentGroupName"}, "deploymentConfigName":{"shape":"DeploymentConfigName"}, "deploymentId":{"shape":"DeploymentId"}, + "previousRevision":{"shape":"RevisionLocation"}, "revision":{"shape":"RevisionLocation"}, "status":{"shape":"DeploymentStatus"}, "errorInformation":{"shape":"ErrorInformation"}, @@ -1165,7 +1169,8 @@ "instanceTerminationWaitTimeStarted":{"shape":"Boolean"}, "blueGreenDeploymentConfiguration":{"shape":"BlueGreenDeploymentConfiguration"}, "loadBalancerInfo":{"shape":"LoadBalancerInfo"}, - "additionalDeploymentStatusInfo":{"shape":"AdditionalDeploymentStatusInfo"} + "additionalDeploymentStatusInfo":{"shape":"AdditionalDeploymentStatusInfo"}, + "fileExistsBehavior":{"shape":"FileExistsBehavior"} } }, "DeploymentIsNotInReadyStateException":{ @@ -1343,6 +1348,14 @@ } }, "ErrorMessage":{"type":"string"}, + "FileExistsBehavior":{ + "type":"string", + "enum":[ + "DISALLOW", + "OVERWRITE", + "RETAIN" + ] + }, "GenericRevisionInfo":{ "type":"structure", "members":{ @@ -1677,6 +1690,12 @@ }, "exception":true }, + "InvalidDeploymentInstanceTypeException":{ + "type":"structure", + "members":{ + }, + "exception":true + }, "InvalidDeploymentStatusException":{ "type":"structure", "members":{ @@ -1695,6 +1714,12 @@ }, "exception":true }, + "InvalidFileExistsBehaviorException":{ + "type":"structure", + "members":{ + }, + "exception":true + }, "InvalidIamSessionArnException":{ "type":"structure", "members":{ diff --git a/vendor/github.com/aws/aws-sdk-go/models/apis/codedeploy/2014-10-06/docs-2.json b/vendor/github.com/aws/aws-sdk-go/models/apis/codedeploy/2014-10-06/docs-2.json index bbf8cd26f..e41e75152 100644 --- a/vendor/github.com/aws/aws-sdk-go/models/apis/codedeploy/2014-10-06/docs-2.json +++ b/vendor/github.com/aws/aws-sdk-go/models/apis/codedeploy/2014-10-06/docs-2.json @@ -1,6 +1,6 @@ { "version": "2.0", - "service": "AWS CodeDeploy

Overview

This reference guide provides descriptions of the AWS CodeDeploy APIs. For more information about AWS CodeDeploy, see the AWS CodeDeploy User Guide.

Using the APIs

You can use the AWS CodeDeploy APIs to work with the following:

  • Applications are unique identifiers used by AWS CodeDeploy to ensure the correct combinations of revisions, deployment configurations, and deployment groups are being referenced during deployments.

    You can use the AWS CodeDeploy APIs to create, delete, get, list, and update applications.

  • Deployment configurations are sets of deployment rules and success and failure conditions used by AWS CodeDeploy during deployments.

    You can use the AWS CodeDeploy APIs to create, delete, get, and list deployment configurations.

  • Deployment groups are groups of instances to which application revisions can be deployed.

    You can use the AWS CodeDeploy APIs to create, delete, get, list, and update deployment groups.

  • Instances represent Amazon EC2 instances to which application revisions are deployed. Instances are identified by their Amazon EC2 tags or Auto Scaling group names. Instances belong to deployment groups.

    You can use the AWS CodeDeploy APIs to get and list instance.

  • Deployments represent the process of deploying revisions to instances.

    You can use the AWS CodeDeploy APIs to create, get, list, and stop deployments.

  • Application revisions are archive files stored in Amazon S3 buckets or GitHub repositories. These revisions contain source content (such as source code, web pages, executable files, and deployment scripts) along with an application specification (AppSpec) file. (The AppSpec file is unique to AWS CodeDeploy; it defines the deployment actions you want AWS CodeDeploy to execute.) For application revisions stored in Amazon S3 buckets, an application revision is uniquely identified by its Amazon S3 object key and its ETag, version, or both. For application revisions stored in GitHub repositories, an application revision is uniquely identified by its repository name and commit ID. Application revisions are deployed through deployment groups.

    You can use the AWS CodeDeploy APIs to get, list, and register application revisions.

", + "service": "AWS CodeDeploy

AWS CodeDeploy is a deployment service that automates application deployments to Amazon EC2 instances or on-premises instances running in your own facility.

You can deploy a nearly unlimited variety of application content, such as code, web and configuration files, executables, packages, scripts, multimedia files, and so on. AWS CodeDeploy can deploy application content stored in Amazon S3 buckets, GitHub repositories, or Bitbucket repositories. You do not need to make changes to your existing code before you can use AWS CodeDeploy.

AWS CodeDeploy makes it easier for you to rapidly release new features, helps you avoid downtime during application deployment, and handles the complexity of updating your applications, without many of the risks associated with error-prone manual deployments.

AWS CodeDeploy Components

Use the information in this guide to help you work with the following AWS CodeDeploy components:

  • Application: A name that uniquely identifies the application you want to deploy. AWS CodeDeploy uses this name, which functions as a container, to ensure the correct combination of revision, deployment configuration, and deployment group are referenced during a deployment.

  • Deployment group: A set of individual instances. A deployment group contains individually tagged instances, Amazon EC2 instances in Auto Scaling groups, or both.

  • Deployment configuration: A set of deployment rules and deployment success and failure conditions used by AWS CodeDeploy during a deployment.

  • Deployment: The process, and the components involved in the process, of installing content on one or more instances.

  • Application revisions: An archive file containing source content—source code, web pages, executable files, and deployment scripts—along with an application specification file (AppSpec file). Revisions are stored in Amazon S3 buckets or GitHub repositories. For Amazon S3, a revision is uniquely identified by its Amazon S3 object key and its ETag, version, or both. For GitHub, a revision is uniquely identified by its commit ID.

This guide also contains information to help you get details about the instances in your deployments and to make on-premises instances available for AWS CodeDeploy deployments.

AWS CodeDeploy Information Resources

", "operations": { "AddTagsToOnPremisesInstances": "

Adds tags to on-premises instances.

", "BatchGetApplicationRevisions": "

Gets information about one or more application revisions.

", @@ -9,7 +9,7 @@ "BatchGetDeploymentInstances": "

Gets information about one or more instance that are part of a deployment group.

", "BatchGetDeployments": "

Gets information about one or more deployments.

", "BatchGetOnPremisesInstances": "

Gets information about one or more on-premises instances.

", - "ContinueDeployment": "

Starts the process of rerouting traffic from instances in the original environment to instances in thereplacement environment without waiting for a specified wait time to elapse. (Traffic rerouting, which is achieved by registering instances in the replacement environment with the load balancer, can start as soon as all instances have a status of Ready.)

", + "ContinueDeployment": "

For a blue/green deployment, starts the process of rerouting traffic from instances in the original environment to instances in the replacement environment without waiting for a specified wait time to elapse. (Traffic rerouting, which is achieved by registering instances in the replacement environment with the load balancer, can start as soon as all instances have a status of Ready.)

", "CreateApplication": "

Creates an application.

", "CreateDeployment": "

Deploys an application revision through the specified deployment group.

", "CreateDeploymentConfig": "

Creates a deployment configuration.

", @@ -61,9 +61,9 @@ "AlarmConfiguration": { "base": "

Information about alarms associated with the deployment group.

", "refs": { - "CreateDeploymentGroupInput$alarmConfiguration": "

Information to add about Amazon CloudWatch alarms when the deployment group is created.

", + "CreateDeploymentGroupInput$alarmConfiguration": "

Information to add about Amazon CloudWatch alarms when the deployment group is created.

", "DeploymentGroupInfo$alarmConfiguration": "

A list of alarms associated with the deployment group.

", - "UpdateDeploymentGroupInput$alarmConfiguration": "

Information to add or change about Amazon CloudWatch alarms when the deployment group is updated.

" + "UpdateDeploymentGroupInput$alarmConfiguration": "

Information to add or change about Amazon CloudWatch alarms when the deployment group is updated.

" } }, "AlarmList": { @@ -440,7 +440,7 @@ "base": null, "refs": { "CreateDeploymentConfigInput$deploymentConfigName": "

The name of the deployment configuration to create.

", - "CreateDeploymentGroupInput$deploymentConfigName": "

If specified, the deployment configuration name can be either one of the predefined configurations provided with AWS CodeDeploy or a custom deployment configuration that you create by calling the create deployment configuration operation.

CodeDeployDefault.OneAtATime is the default deployment configuration. It is used if a configuration isn't specified for the deployment or the deployment group.

For more information about the predefined deployment configurations in AWS CodeDeploy, see see Working with Deployment Groups in AWS CodeDeploy in the AWS CodeDeploy User Guide.

", + "CreateDeploymentGroupInput$deploymentConfigName": "

If specified, the deployment configuration name can be either one of the predefined configurations provided with AWS CodeDeploy or a custom deployment configuration that you create by calling the create deployment configuration operation.

CodeDeployDefault.OneAtATime is the default deployment configuration. It is used if a configuration isn't specified for the deployment or the deployment group.

For more information about the predefined deployment configurations in AWS CodeDeploy, see Working with Deployment Groups in AWS CodeDeploy in the AWS CodeDeploy User Guide.

", "CreateDeploymentInput$deploymentConfigName": "

The name of a deployment configuration associated with the applicable IAM user or AWS account.

If not specified, the value configured in the deployment group will be used as the default. If the deployment group does not have a deployment configuration associated with it, then CodeDeployDefault.OneAtATime will be used by default.

", "DeleteDeploymentConfigInput$deploymentConfigName": "

The name of a deployment configuration associated with the applicable IAM user or AWS account.

", "DeploymentConfigInfo$deploymentConfigName": "

The deployment configuration name.

", @@ -619,18 +619,18 @@ } }, "DeploymentStyle": { - "base": "

Information about the type of deployment, either standard or blue/green, you want to run and whether to route deployment traffic behind a load balancer.

", + "base": "

Information about the type of deployment, either in-place or blue/green, you want to run and whether to route deployment traffic behind a load balancer.

", "refs": { - "CreateDeploymentGroupInput$deploymentStyle": "

Information about the type of deployment, standard or blue/green, that you want to run and whether to route deployment traffic behind a load balancer.

", - "DeploymentGroupInfo$deploymentStyle": "

Information about the type of deployment, either standard or blue/green, you want to run and whether to route deployment traffic behind a load balancer.

", - "DeploymentInfo$deploymentStyle": "

Information about the type of deployment, either standard or blue/green, you want to run and whether to route deployment traffic behind a load balancer.

", - "UpdateDeploymentGroupInput$deploymentStyle": "

Information about the type of deployment, either standard or blue/green, you want to run and whether to route deployment traffic behind a load balancer.

" + "CreateDeploymentGroupInput$deploymentStyle": "

Information about the type of deployment, in-place or blue/green, that you want to run and whether to route deployment traffic behind a load balancer.

", + "DeploymentGroupInfo$deploymentStyle": "

Information about the type of deployment, either in-place or blue/green, you want to run and whether to route deployment traffic behind a load balancer.

", + "DeploymentInfo$deploymentStyle": "

Information about the type of deployment, either in-place or blue/green, you want to run and whether to route deployment traffic behind a load balancer.

", + "UpdateDeploymentGroupInput$deploymentStyle": "

Information about the type of deployment, either in-place or blue/green, you want to run and whether to route deployment traffic behind a load balancer.

" } }, "DeploymentType": { "base": null, "refs": { - "DeploymentStyle$deploymentType": "

Indicates whether to run a standard deployment or a blue/green deployment.

" + "DeploymentStyle$deploymentType": "

Indicates whether to run an in-place deployment or a blue/green deployment.

" } }, "DeploymentsInfoList": { @@ -680,7 +680,7 @@ } }, "EC2TagFilter": { - "base": "

Information about a tag filter.

", + "base": "

Information about an EC2 tag filter.

", "refs": { "EC2TagFilterList$member": null } @@ -688,7 +688,7 @@ "EC2TagFilterList": { "base": null, "refs": { - "CreateDeploymentGroupInput$ec2TagFilters": "

The Amazon EC2 tags on which to filter.

", + "CreateDeploymentGroupInput$ec2TagFilters": "

The Amazon EC2 tags on which to filter. The deployment group will include EC2 instances with any of the specified tags.

", "DeploymentGroupInfo$ec2TagFilters": "

The Amazon EC2 tags on which to filter.

", "TargetInstances$tagFilters": "

The tag filter key, type, and value used to identify Amazon EC2 instances in a replacement environment for a blue/green deployment.

", "UpdateDeploymentGroupInput$ec2TagFilters": "

The replacement set of Amazon EC2 tags on which to filter, if you want to change them. To keep the existing tags, enter their names. To remove tags, do not enter any tag names.

" @@ -701,7 +701,7 @@ } }, "ELBInfo": { - "base": "

Information about a load balancer in Elastic Load Balancing to use in a blue/green deployment.

", + "base": "

Information about a load balancer in Elastic Load Balancing to use in a deployment.

", "refs": { "ELBInfoList$member": null } @@ -709,13 +709,13 @@ "ELBInfoList": { "base": null, "refs": { - "LoadBalancerInfo$elbInfoList": "

An array containing information about the load balancer in Elastic Load Balancing to use in a blue/green deployment.

" + "LoadBalancerInfo$elbInfoList": "

An array containing information about the load balancer in Elastic Load Balancing to use in a deployment.

" } }, "ELBName": { "base": null, "refs": { - "ELBInfo$name": "

The name of the load balancer that will be used to route traffic from original instances to replacement instances in a blue/green deployment.

" + "ELBInfo$name": "

For blue/green deployments, the name of the load balancer that will be used to route traffic from original instances to replacement instances in a blue/green deployment. For in-place deployments, the name of the load balancer that instances are deregistered from so they are not serving traffic during a deployment, and then re-registered with after the deployment completes.

" } }, "ETag": { @@ -745,6 +745,13 @@ "ErrorInformation$message": "

An accompanying error message.

" } }, + "FileExistsBehavior": { + "base": null, + "refs": { + "CreateDeploymentInput$fileExistsBehavior": "

Information about how AWS CodeDeploy handles files that already exist in a deployment target location but weren't part of the previous successful deployment.

The fileExistsBehavior parameter takes any of the following values:

  • DISALLOW: The deployment fails. This is also the default behavior if no option is specified.

  • OVERWRITE: The version of the file from the application revision currently being deployed replaces the version already on the instance.

  • RETAIN: The version of the file already on the instance is kept and used as part of the new deployment.

", + "DeploymentInfo$fileExistsBehavior": "

Information about how AWS CodeDeploy handles files that already exist in a deployment target location but weren't part of the previous successful deployment.

  • DISALLOW: The deployment fails. This is also the default behavior if no option is specified.

  • OVERWRITE: The version of the file from the application revision currently being deployed replaces the version already on the instance.

  • RETAIN: The version of the file already on the instance is kept and used as part of the new deployment.

" + } + }, "GenericRevisionInfo": { "base": "

Information about an application revision.

", "refs": { @@ -1063,13 +1070,18 @@ "refs": { } }, + "InvalidDeploymentInstanceTypeException": { + "base": "

An instance type was specified for an in-place deployment. Instance types are supported for blue/green deployments only.

", + "refs": { + } + }, "InvalidDeploymentStatusException": { "base": "

The specified deployment status doesn't exist or cannot be determined.

", "refs": { } }, "InvalidDeploymentStyleException": { - "base": "

An invalid deployment style was specified. Valid deployment types include \"IN_PLACE\" and \"BLUE_GREEN\". Valid deployment options for blue/green deployments include \"WITH_TRAFFIC_CONTROL\" and \"WITHOUT_TRAFFIC_CONTROL\".

", + "base": "

An invalid deployment style was specified. Valid deployment types include \"IN_PLACE\" and \"BLUE_GREEN\". Valid deployment options include \"WITH_TRAFFIC_CONTROL\" and \"WITHOUT_TRAFFIC_CONTROL\".

", "refs": { } }, @@ -1078,6 +1090,11 @@ "refs": { } }, + "InvalidFileExistsBehaviorException": { + "base": "

An invalid fileExistsBehavior option was specified to determine how AWS CodeDeploy handles files or directories that already exist in a deployment target location but weren't part of the previous successful deployment. Valid values include \"DISALLOW\", \"OVERWRITE\", and \"RETAIN\".

", + "refs": { + } + }, "InvalidIamSessionArnException": { "base": "

The IAM session ARN was specified in an invalid format.

", "refs": { @@ -1304,12 +1321,12 @@ } }, "LoadBalancerInfo": { - "base": "

Information about the load balancer used in a blue/green deployment.

", + "base": "

Information about the load balancer used in a deployment.

", "refs": { - "CreateDeploymentGroupInput$loadBalancerInfo": "

Information about the load balancer used in a blue/green deployment.

", - "DeploymentGroupInfo$loadBalancerInfo": "

Information about the load balancer to use in a blue/green deployment.

", - "DeploymentInfo$loadBalancerInfo": "

Information about the load balancer used in this blue/green deployment.

", - "UpdateDeploymentGroupInput$loadBalancerInfo": "

Information about the load balancer used in a blue/green deployment.

" + "CreateDeploymentGroupInput$loadBalancerInfo": "

Information about the load balancer used in a deployment.

", + "DeploymentGroupInfo$loadBalancerInfo": "

Information about the load balancer to use in a deployment.

", + "DeploymentInfo$loadBalancerInfo": "

Information about the load balancer used in the deployment.

", + "UpdateDeploymentGroupInput$loadBalancerInfo": "

Information about the load balancer used in a deployment.

" } }, "LogTail": { @@ -1334,7 +1351,7 @@ "MinimumHealthyHostsType": { "base": null, "refs": { - "MinimumHealthyHosts$type": "

The minimum healthy instance type:

  • HOST_COUNT: The minimum number of healthy instance as an absolute value.

  • FLEET_PERCENT: The minimum number of healthy instance as a percentage of the total number of instance in the deployment.

In an example of nine instance, if a HOST_COUNT of six is specified, deploy to up to three instances at a time. The deployment will be successful if six or more instances are deployed to successfully; otherwise, the deployment fails. If a FLEET_PERCENT of 40 is specified, deploy to up to five instance at a time. The deployment will be successful if four or more instance are deployed to successfully; otherwise, the deployment fails.

In a call to the get deployment configuration operation, CodeDeployDefault.OneAtATime will return a minimum healthy instance type of MOST_CONCURRENCY and a value of 1. This means a deployment to only one instance at a time. (You cannot set the type to MOST_CONCURRENCY, only to HOST_COUNT or FLEET_PERCENT.) In addition, with CodeDeployDefault.OneAtATime, AWS CodeDeploy will try to ensure that all instances but one are kept in a healthy state during the deployment. Although this allows one instance at a time to be taken offline for a new deployment, it also means that if the deployment to the last instance fails, the overall deployment still succeeds.

" + "MinimumHealthyHosts$type": "

The minimum healthy instance type:

  • HOST_COUNT: The minimum number of healthy instance as an absolute value.

  • FLEET_PERCENT: The minimum number of healthy instance as a percentage of the total number of instance in the deployment.

In an example of nine instance, if a HOST_COUNT of six is specified, deploy to up to three instances at a time. The deployment will be successful if six or more instances are deployed to successfully; otherwise, the deployment fails. If a FLEET_PERCENT of 40 is specified, deploy to up to five instance at a time. The deployment will be successful if four or more instance are deployed to successfully; otherwise, the deployment fails.

In a call to the get deployment configuration operation, CodeDeployDefault.OneAtATime will return a minimum healthy instance type of MOST_CONCURRENCY and a value of 1. This means a deployment to only one instance at a time. (You cannot set the type to MOST_CONCURRENCY, only to HOST_COUNT or FLEET_PERCENT.) In addition, with CodeDeployDefault.OneAtATime, AWS CodeDeploy will try to ensure that all instances but one are kept in a healthy state during the deployment. Although this allows one instance at a time to be taken offline for a new deployment, it also means that if the deployment to the last instance fails, the overall deployment still succeeds.

For more information, see AWS CodeDeploy Instance Health in the AWS CodeDeploy User Guide.

" } }, "MinimumHealthyHostsValue": { @@ -1422,6 +1439,7 @@ "refs": { "CreateDeploymentInput$revision": "

The type and location of the revision to deploy.

", "DeploymentGroupInfo$targetRevision": "

Information about the deployment group's target revision, including type and location.

", + "DeploymentInfo$previousRevision": "

Information about the application revision that was deployed to the deployment group before the most recent successful deployment.

", "DeploymentInfo$revision": "

Information about the location of stored application artifacts and the service from which to retrieve them.

", "GetApplicationRevisionInput$revision": "

Information about the application revision to get, including type and location.

", "GetApplicationRevisionOutput$revision": "

Additional information about the revision, including type and location.

", @@ -1535,7 +1553,7 @@ "TagFilterList": { "base": null, "refs": { - "CreateDeploymentGroupInput$onPremisesInstanceTagFilters": "

The on-premises instance tags on which to filter.

", + "CreateDeploymentGroupInput$onPremisesInstanceTagFilters": "

The on-premises instance tags on which to filter. The deployment group will include on-premises instances with any of the specified tags.

", "DeploymentGroupInfo$onPremisesInstanceTagFilters": "

The on-premises instance tags on which to filter.

", "ListOnPremisesInstancesInput$tagFilters": "

The on-premises instance tags that will be used to restrict the corresponding on-premises instance names returned.

", "UpdateDeploymentGroupInput$onPremisesInstanceTagFilters": "

The replacement set of on-premises instance tags on which to filter, if you want to change them. To keep the existing tags, enter their names. To remove tags, do not enter any tag names.

" diff --git a/vendor/github.com/aws/aws-sdk-go/models/apis/events/2015-10-07/docs-2.json b/vendor/github.com/aws/aws-sdk-go/models/apis/events/2015-10-07/docs-2.json index 1ce70eee0..86c78c792 100644 --- a/vendor/github.com/aws/aws-sdk-go/models/apis/events/2015-10-07/docs-2.json +++ b/vendor/github.com/aws/aws-sdk-go/models/apis/events/2015-10-07/docs-2.json @@ -11,8 +11,8 @@ "ListTargetsByRule": "

Lists the targets assigned to the specified rule.

", "PutEvents": "

Sends custom events to Amazon CloudWatch Events so that they can be matched to rules.

", "PutRule": "

Creates or updates the specified rule. Rules are enabled by default, or based on value of the state. You can disable a rule using DisableRule.

When you create or update a rule, incoming events might not immediately start matching to new or updated rules. Please allow a short period of time for changes to take effect.

A rule must contain at least an EventPattern or ScheduleExpression. Rules with EventPatterns are triggered when a matching event is observed. Rules with ScheduleExpressions self-trigger based on the given schedule. A rule can have both an EventPattern and a ScheduleExpression, in which case the rule triggers on matching events as well as on a schedule.

Most services in AWS treat : or / as the same character in Amazon Resource Names (ARNs). However, CloudWatch Events uses an exact match in event patterns and rules. Be sure to use the correct ARN characters when creating event patterns so that they match the ARN syntax in the event you want to match.

", - "PutTargets": "

Adds the specified targets to the specified rule, or updates the targets if they are already associated with the rule.

Targets are the resources that are invoked when a rule is triggered. Example targets include EC2 instances, AWS Lambda functions, Amazon Kinesis streams, Amazon ECS tasks, AWS Step Functions state machines, and built-in targets. Note that creating rules with built-in targets is supported only in the AWS Management Console.

For some target types, PutTargets provides target-specific parameters. If the target is an Amazon Kinesis stream, you can optionally specify which shard the event goes to by using the KinesisParameters argument. To invoke a command on multiple EC2 instances with one rule, you can use the RunCommandParameters field.

To be able to make API calls against the resources that you own, Amazon CloudWatch Events needs the appropriate permissions. For AWS Lambda and Amazon SNS resources, CloudWatch Events relies on resource-based policies. For EC2 instances, Amazon Kinesis streams, and AWS Step Functions state machines, CloudWatch Events relies on IAM roles that you specify in the RoleARN argument in PutTarget. For more information, see Authentication and Access Control in the Amazon CloudWatch Events User Guide.

Input, InputPath and InputTransformer are mutually exclusive and optional parameters of a target. When a rule is triggered due to a matched event:

  • If none of the following arguments are specified for a target, then the entire event is passed to the target in JSON form (unless the target is Amazon EC2 Run Command or Amazon ECS task, in which case nothing from the event is passed to the target).

  • If Input is specified in the form of valid JSON, then the matched event is overridden with this constant.

  • If InputPath is specified in the form of JSONPath (for example, $.detail), then only the part of the event specified in the path is passed to the target (for example, only the detail part of the event is passed).

  • If InputTransformer is specified, then one or more specified JSONPaths are extracted from the event and used as values in a template that you specify as the input to the target.

When you add targets to a rule and the associated rule triggers soon after, new or updated targets might not be immediately invoked. Please allow a short period of time for changes to take effect.

", - "RemoveTargets": "

Removes the specified targets from the specified rule. When the rule is triggered, those targets are no longer be invoked.

When you remove a target, when the associated rule triggers, removed targets might continue to be invoked. Please allow a short period of time for changes to take effect.

", + "PutTargets": "

Adds the specified targets to the specified rule, or updates the targets if they are already associated with the rule.

Targets are the resources that are invoked when a rule is triggered. Example targets include EC2 instances, AWS Lambda functions, Amazon Kinesis streams, Amazon ECS tasks, AWS Step Functions state machines, and built-in targets. Note that creating rules with built-in targets is supported only in the AWS Management Console.

For some target types, PutTargets provides target-specific parameters. If the target is an Amazon Kinesis stream, you can optionally specify which shard the event goes to by using the KinesisParameters argument. To invoke a command on multiple EC2 instances with one rule, you can use the RunCommandParameters field.

To be able to make API calls against the resources that you own, Amazon CloudWatch Events needs the appropriate permissions. For AWS Lambda and Amazon SNS resources, CloudWatch Events relies on resource-based policies. For EC2 instances, Amazon Kinesis streams, and AWS Step Functions state machines, CloudWatch Events relies on IAM roles that you specify in the RoleARN argument in PutTarget. For more information, see Authentication and Access Control in the Amazon CloudWatch Events User Guide.

Input, InputPath and InputTransformer are mutually exclusive and optional parameters of a target. When a rule is triggered due to a matched event:

  • If none of the following arguments are specified for a target, then the entire event is passed to the target in JSON form (unless the target is Amazon EC2 Run Command or Amazon ECS task, in which case nothing from the event is passed to the target).

  • If Input is specified in the form of valid JSON, then the matched event is overridden with this constant.

  • If InputPath is specified in the form of JSONPath (for example, $.detail), then only the part of the event specified in the path is passed to the target (for example, only the detail part of the event is passed).

  • If InputTransformer is specified, then one or more specified JSONPaths are extracted from the event and used as values in a template that you specify as the input to the target.

When you specify Input, InputPath, or InputTransformer, you must use JSON dot notation, not bracket notation.

When you add targets to a rule and the associated rule triggers soon after, new or updated targets might not be immediately invoked. Please allow a short period of time for changes to take effect.

This action can partially fail if too many requests are made at the same time. If that happens, FailedEntryCount is non-zero in the response and each entry in FailedEntries provides the ID of the failed target and the error code.

", + "RemoveTargets": "

Removes the specified targets from the specified rule. When the rule is triggered, those targets are no longer be invoked.

When you remove a target, when the associated rule triggers, removed targets might continue to be invoked. Please allow a short period of time for changes to take effect.

This action can partially fail if too many requests are made at the same time. If that happens, FailedEntryCount is non-zero in the response and each entry in FailedEntries provides the ID of the failed target and the error code.

", "TestEventPattern": "

Tests whether the specified event pattern matches the provided event.

Most services in AWS treat : or / as the same character in Amazon Resource Names (ARNs). However, CloudWatch Events uses an exact match in event patterns and rules. Be sure to use the correct ARN characters when creating event patterns so that they match the ARN syntax in the event you want to match.

" }, "shapes": { @@ -68,8 +68,8 @@ "base": null, "refs": { "PutEventsResultEntry$ErrorCode": "

The error code that indicates why the event submission failed.

", - "PutTargetsResultEntry$ErrorCode": "

The error code that indicates why the target addition failed.

", - "RemoveTargetsResultEntry$ErrorCode": "

The error code that indicates why the target removal failed.

" + "PutTargetsResultEntry$ErrorCode": "

The error code that indicates why the target addition failed. If the value is ConcurrentModificationException, too many requests were made at the same time.

", + "RemoveTargetsResultEntry$ErrorCode": "

The error code that indicates why the target removal failed. If the value is ConcurrentModificationException, too many requests were made at the same time.

" } }, "ErrorMessage": { @@ -89,10 +89,10 @@ "EventPattern": { "base": null, "refs": { - "DescribeRuleResponse$EventPattern": "

The event pattern.

", - "PutRuleRequest$EventPattern": "

The event pattern.

", - "Rule$EventPattern": "

The event pattern of the rule.

", - "TestEventPatternRequest$EventPattern": "

The event pattern.

" + "DescribeRuleResponse$EventPattern": "

The event pattern. For more information, see Events and Event Patterns in the Amazon CloudWatch Events User Guide.

", + "PutRuleRequest$EventPattern": "

The event pattern. For more information, see Events and Event Patterns in the Amazon CloudWatch Events User Guide.

", + "Rule$EventPattern": "

The event pattern of the rule. For more information, see Events and Event Patterns in the Amazon CloudWatch Events User Guide.

", + "TestEventPatternRequest$EventPattern": "

The event pattern. For more information, see Events and Event Patterns in the Amazon CloudWatch Events User Guide.

" } }, "EventResource": { @@ -454,13 +454,13 @@ "TargetInput": { "base": null, "refs": { - "Target$Input": "

Valid JSON text passed to the target. In this case, nothing from the event itself is passed to the target. For more information, see The JavaScript Object Notation (JSON) Data Interchange Format.

" + "Target$Input": "

Valid JSON text passed to the target. In this case, nothing from the event itself is passed to the target. You must use JSON dot notation, not bracket notation. For more information, see The JavaScript Object Notation (JSON) Data Interchange Format.

" } }, "TargetInputPath": { "base": null, "refs": { - "Target$InputPath": "

The value of the JSONPath that is used for extracting part of the matched event when passing it to the target. For more information about JSON paths, see JSONPath.

", + "Target$InputPath": "

The value of the JSONPath that is used for extracting part of the matched event when passing it to the target. You must use JSON dot notation, not bracket notation. For more information about JSON paths, see JSONPath.

", "TransformerPaths$value": null } }, @@ -496,7 +496,7 @@ "TransformerPaths": { "base": null, "refs": { - "InputTransformer$InputPathsMap": "

Map of JSON paths to be extracted from the event. These are key-value pairs, where each value is a JSON path.

" + "InputTransformer$InputPathsMap": "

Map of JSON paths to be extracted from the event. These are key-value pairs, where each value is a JSON path. You must use JSON dot notation, not bracket notation.

" } } } diff --git a/vendor/github.com/aws/aws-sdk-go/models/apis/gamelift/2015-10-01/api-2.json b/vendor/github.com/aws/aws-sdk-go/models/apis/gamelift/2015-10-01/api-2.json index e0d43925b..0bfd775fb 100644 --- a/vendor/github.com/aws/aws-sdk-go/models/apis/gamelift/2015-10-01/api-2.json +++ b/vendor/github.com/aws/aws-sdk-go/models/apis/gamelift/2015-10-01/api-2.json @@ -91,7 +91,8 @@ "errors":[ {"shape":"InternalServiceException"}, {"shape":"InvalidRequestException"}, - {"shape":"UnauthorizedException"} + {"shape":"UnauthorizedException"}, + {"shape":"LimitExceededException"} ] }, "CreatePlayerSession":{ @@ -874,7 +875,8 @@ "EC2InboundPermissions":{"shape":"IpPermissionsList"}, "NewGameSessionProtectionPolicy":{"shape":"ProtectionPolicy"}, "RuntimeConfiguration":{"shape":"RuntimeConfiguration"}, - "ResourceCreationLimitPolicy":{"shape":"ResourceCreationLimitPolicy"} + "ResourceCreationLimitPolicy":{"shape":"ResourceCreationLimitPolicy"}, + "MetricGroups":{"shape":"MetricGroupList"} } }, "CreateFleetOutput":{ @@ -1372,7 +1374,8 @@ "LogPaths":{"shape":"StringList"}, "NewGameSessionProtectionPolicy":{"shape":"ProtectionPolicy"}, "OperatingSystem":{"shape":"OperatingSystem"}, - "ResourceCreationLimitPolicy":{"shape":"ResourceCreationLimitPolicy"} + "ResourceCreationLimitPolicy":{"shape":"ResourceCreationLimitPolicy"}, + "MetricGroups":{"shape":"MetricGroupList"} } }, "FleetAttributesList":{ @@ -1479,6 +1482,11 @@ "CreatorId":{"shape":"NonZeroAndMaxString"} } }, + "GameSessionActivationTimeoutSeconds":{ + "type":"integer", + "max":600, + "min":1 + }, "GameSessionDetail":{ "type":"structure", "members":{ @@ -1774,15 +1782,33 @@ "NextToken":{"shape":"NonZeroAndMaxString"} } }, + "MaxConcurrentGameSessionActivations":{ + "type":"integer", + "max":2147483647, + "min":1 + }, + "MetricGroup":{ + "type":"string", + "max":255, + "min":1 + }, + "MetricGroupList":{ + "type":"list", + "member":{"shape":"MetricGroup"}, + "max":1 + }, "MetricName":{ "type":"string", "enum":[ "ActivatingGameSessions", "ActiveGameSessions", "ActiveInstances", + "AvailableGameSessions", "AvailablePlayerSessions", "CurrentPlayerSessions", "IdleInstances", + "PercentAvailableGameSessions", + "PercentIdleInstances", "QueueDepth", "WaitTime" ] @@ -2010,7 +2036,9 @@ "RuntimeConfiguration":{ "type":"structure", "members":{ - "ServerProcesses":{"shape":"ServerProcessList"} + "ServerProcesses":{"shape":"ServerProcessList"}, + "MaxConcurrentGameSessionActivations":{"shape":"MaxConcurrentGameSessionActivations"}, + "GameSessionActivationTimeoutSeconds":{"shape":"GameSessionActivationTimeoutSeconds"} } }, "S3Location":{ @@ -2189,7 +2217,8 @@ "Name":{"shape":"NonZeroAndMaxString"}, "Description":{"shape":"NonZeroAndMaxString"}, "NewGameSessionProtectionPolicy":{"shape":"ProtectionPolicy"}, - "ResourceCreationLimitPolicy":{"shape":"ResourceCreationLimitPolicy"} + "ResourceCreationLimitPolicy":{"shape":"ResourceCreationLimitPolicy"}, + "MetricGroups":{"shape":"MetricGroupList"} } }, "UpdateFleetAttributesOutput":{ diff --git a/vendor/github.com/aws/aws-sdk-go/models/apis/gamelift/2015-10-01/docs-2.json b/vendor/github.com/aws/aws-sdk-go/models/apis/gamelift/2015-10-01/docs-2.json index d7ef0607b..5e3aa7e67 100644 --- a/vendor/github.com/aws/aws-sdk-go/models/apis/gamelift/2015-10-01/docs-2.json +++ b/vendor/github.com/aws/aws-sdk-go/models/apis/gamelift/2015-10-01/docs-2.json @@ -4,7 +4,7 @@ "operations": { "CreateAlias": "

Creates an alias and sets a target fleet. A fleet alias can be used in place of a fleet ID, such as when calling CreateGameSession from a game client or game service or adding destinations to a game session queue. By changing an alias's target fleet, you can switch your players to the new fleet without changing any other component. In production, this feature is particularly useful to redirect your player base seamlessly to the latest game server update.

Amazon GameLift supports two types of routing strategies for aliases: simple and terminal. Use a simple alias to point to an active fleet. Use a terminal alias to display a message to incoming traffic instead of routing players to an active fleet. This option is useful when a game server is no longer supported but you want to provide better messaging than a standard 404 error.

To create a fleet alias, specify an alias name, routing strategy, and optional description. If successful, a new alias record is returned, including an alias ID, which you can reference when creating a game session. To reassign the alias to another fleet ID, call UpdateAlias.

", "CreateBuild": "

Creates a new Amazon GameLift build from a set of game server binary files stored in an Amazon Simple Storage Service (Amazon S3) location. When using this API call, you must create a .zip file containing all of the build files and store it in an Amazon S3 bucket under your AWS account. For help on packaging your build files and creating a build, see Uploading Your Game to Amazon GameLift.

Use this API action ONLY if you are storing your game build files in an Amazon S3 bucket in your AWS account. To create a build using files stored in a directory, use the CLI command upload-build , which uploads the build files from a file location you specify and creates a build.

To create a new build using CreateBuild, identify the storage location and operating system of your game build. You also have the option of specifying a build name and version. If successful, this action creates a new build record with an unique build ID and in INITIALIZED status. Use the API call DescribeBuild to check the status of your build. A build must be in READY status before it can be used to create fleets to host your game.

", - "CreateFleet": "

Creates a new fleet to run your game servers. A fleet is a set of Amazon Elastic Compute Cloud (Amazon EC2) instances, each of which can run multiple server processes to host game sessions. You configure a fleet to create instances with certain hardware specifications (see Amazon EC2 Instance Types for more information), and deploy a specified game build to each instance. A newly created fleet passes through several statuses; once it reaches the ACTIVE status, it can begin hosting game sessions.

To create a new fleet, provide a fleet name, an EC2 instance type, and a build ID of the game build to deploy. You can also configure the new fleet with the following settings: (1) a runtime configuration describing what server processes to run on each instance in the fleet (required to create fleet), (2) access permissions for inbound traffic, (3) fleet-wide game session protection, and (4) the location of default log files for Amazon GameLift to upload and store.

If the CreateFleet call is successful, Amazon GameLift performs the following tasks:

  • Creates a fleet record and sets the status to NEW (followed by other statuses as the fleet is activated).

  • Sets the fleet's capacity to 1 \"desired\", which causes Amazon GameLift to start one new EC2 instance.

  • Starts launching server processes on the instance. If the fleet is configured to run multiple server processes per instance, Amazon GameLift staggers each launch by a few seconds.

  • Begins writing events to the fleet event log, which can be accessed in the Amazon GameLift console.

  • Sets the fleet's status to ACTIVE once one server process in the fleet is ready to host a game session.

After a fleet is created, use the following actions to change fleet properties and configuration:

  • UpdateFleetAttributes -- Update fleet metadata, including name and description.

  • UpdateFleetCapacity -- Increase or decrease the number of instances you want the fleet to maintain.

  • UpdateFleetPortSettings -- Change the IP address and port ranges that allow access to incoming traffic.

  • UpdateRuntimeConfiguration -- Change how server processes are launched in the fleet, including launch path, launch parameters, and the number of concurrent processes.

  • PutScalingPolicy -- Create or update rules that are used to set the fleet's capacity (autoscaling).

", + "CreateFleet": "

Creates a new fleet to run your game servers. A fleet is a set of Amazon Elastic Compute Cloud (Amazon EC2) instances, each of which can run multiple server processes to host game sessions. You configure a fleet to create instances with certain hardware specifications (see Amazon EC2 Instance Types for more information), and deploy a specified game build to each instance. A newly created fleet passes through several statuses; once it reaches the ACTIVE status, it can begin hosting game sessions.

To create a new fleet, you must specify the following: (1) fleet name, (2) build ID of an uploaded game build, (3) an EC2 instance type, and (4) a runtime configuration that describes which server processes to run on each instance in the fleet. (Although the runtime configuration is not a required parameter, the fleet cannot be successfully created without it.) You can also configure the new fleet with the following settings: fleet description, access permissions for inbound traffic, fleet-wide game session protection, and resource creation limit. If you use Amazon CloudWatch for metrics, you can add the new fleet to a metric group, which allows you to view aggregated metrics for a set of fleets. Once you specify a metric group, the new fleet's metrics are included in the metric group's data.

If the CreateFleet call is successful, Amazon GameLift performs the following tasks:

  • Creates a fleet record and sets the status to NEW (followed by other statuses as the fleet is activated).

  • Sets the fleet's capacity to 1 \"desired\", which causes Amazon GameLift to start one new EC2 instance.

  • Starts launching server processes on the instance. If the fleet is configured to run multiple server processes per instance, Amazon GameLift staggers each launch by a few seconds.

  • Begins writing events to the fleet event log, which can be accessed in the Amazon GameLift console.

  • Sets the fleet's status to ACTIVE once one server process in the fleet is ready to host a game session.

After a fleet is created, use the following actions to change fleet properties and configuration:

  • UpdateFleetAttributes -- Update fleet metadata, including name and description.

  • UpdateFleetCapacity -- Increase or decrease the number of instances you want the fleet to maintain.

  • UpdateFleetPortSettings -- Change the IP address and port ranges that allow access to incoming traffic.

  • UpdateRuntimeConfiguration -- Change how server processes are launched in the fleet, including launch path, launch parameters, and the number of concurrent processes.

  • PutScalingPolicy -- Create or update rules that are used to set the fleet's capacity (autoscaling).

", "CreateGameSession": "

Creates a multiplayer game session for players. This action creates a game session record and assigns an available server process in the specified fleet to host the game session. A fleet must have an ACTIVE status before a game session can be created in it.

To create a game session, specify either fleet ID or alias ID and indicate a maximum number of players to allow in the game session. You can also provide a name and game-specific properties for this game session. If successful, a GameSession object is returned containing game session properties, including a game session ID with the custom string you provided.

Idempotency tokens. You can add a token that uniquely identifies game session requests. This is useful for ensuring that game session requests are idempotent. Multiple requests with the same idempotency token are processed only once; subsequent requests return the original result. All response values are the same with the exception of game session status, which may change.

Resource creation limits. If you are creating a game session on a fleet with a resource creation limit policy in force, then you must specify a creator ID. Without this ID, Amazon GameLift has no way to evaluate the policy for this new game session request.

By default, newly created game sessions allow new players to join. Use UpdateGameSession to change the game session's player session creation policy.

Available in Amazon GameLift Local.

", "CreateGameSessionQueue": "

Establishes a new queue for processing requests to place new game sessions. A queue identifies where new game sessions can be hosted -- by specifying a list of destinations (fleets or aliases) -- and how long requests can wait in the queue before timing out. You can set up a queue to try to place game sessions on fleets in multiple regions. To add placement requests to a queue, call StartGameSessionPlacement and reference the queue name.

Destination order. When processing a request for a game session, Amazon GameLift tries each destination in order until it finds one with available resources to host the new game session. A queue's default order is determined by how destinations are listed. The default order is overridden when a game session placement request provides player latency information. Player latency information enables Amazon GameLift to prioritize destinations where players report the lowest average latency, as a result placing the new game session where the majority of players will have the best possible gameplay experience.

Player latency policies. For placement requests containing player latency information, use player latency policies to protect individual players from very high latencies. With a latency cap, even when a destination can deliver a low latency for most players, the game is not placed where any individual player is reporting latency higher than a policy's maximum. A queue can have multiple latency policies, which are enforced consecutively starting with the policy with the lowest latency cap. Use multiple policies to gradually relax latency controls; for example, you might set a policy with a low latency cap for the first 60 seconds, a second policy with a higher cap for the next 60 seconds, etc.

To create a new queue, provide a name, timeout value, a list of destinations and, if desired, a set of latency policies. If successful, a new queue object is returned.

", "CreatePlayerSession": "

Adds a player to a game session and creates a player session record. Before a player can be added, a game session must have an ACTIVE status, have a creation policy of ALLOW_ALL, and have an open player slot. To add a group of players to a game session, use CreatePlayerSessions.

To create a player session, specify a game session ID, player ID, and optionally a string of player data. If successful, the player is added to the game session and a new PlayerSession object is returned. Player sessions cannot be updated.

Available in Amazon GameLift Local.

", @@ -39,7 +39,7 @@ "RequestUploadCredentials": "

This API call is not currently in use. Retrieves a fresh set of upload credentials and the assigned Amazon S3 storage location for a specific build. Valid credentials are required to upload your game build files to Amazon S3.

", "ResolveAlias": "

Retrieves the fleet ID that a specified alias is currently pointing to.

", "SearchGameSessions": "

Retrieves a set of game sessions that match a set of search criteria and sorts them in a specified order. Currently a game session search is limited to a single fleet. Search results include only game sessions that are in ACTIVE status. If you need to retrieve game sessions with a status other than active, use DescribeGameSessions. If you need to retrieve the protection policy for each game session, use DescribeGameSessionDetails.

You can search or sort by the following game session attributes:

  • gameSessionId -- Unique identifier for the game session. You can use either a GameSessionId or GameSessionArn value.

  • gameSessionName -- Name assigned to a game session. This value is set when requesting a new game session with CreateGameSession or updating with UpdateGameSession. Game session names do not need to be unique to a game session.

  • creationTimeMillis -- Value indicating when a game session was created. It is expressed in Unix time as milliseconds.

  • playerSessionCount -- Number of players currently connected to a game session. This value changes rapidly as players join the session or drop out.

  • maximumSessions -- Maximum number of player sessions allowed for a game session. This value is set when requesting a new game session with CreateGameSession or updating with UpdateGameSession.

  • hasAvailablePlayerSessions -- Boolean value indicating whether or not a game session has reached its maximum number of players. When searching with this attribute, the search value must be true or false. It is highly recommended that all search requests include this filter attribute to optimize search performance and return only sessions that players can join.

To search or sort, specify either a fleet ID or an alias ID, and provide a search filter expression, a sort expression, or both. Use the pagination parameters to retrieve results as a set of sequential pages. If successful, a collection of GameSession objects matching the request is returned.

Returned values for playerSessionCount and hasAvailablePlayerSessions change quickly as players join sessions and others drop out. Results should be considered a snapshot in time. Be sure to refresh search results often, and handle sessions that fill up before a player can join.

Available in Amazon GameLift Local.

", - "StartGameSessionPlacement": "

Places a request for a new game session in a queue (see CreateGameSessionQueue). When processing a placement request, Amazon GameLift searches for available resources on the queue's destinations, scanning each until it finds resources or the placement request times out. A game session placement request can also request player sessions. When a new game session is successfully created, Amazon GameLift creates a player session for each player included in the request.

When placing a game session, by default Amazon GameLift tries each fleet in the order they are listed in the queue configuration. Ideally, a queue's destinations are listed in preference order. Alternatively, when requesting a game session with players, you can also provide latency data for each player in relevant regions. Latency data indicates the performance lag a player experiences when connected to a fleet in the region. Amazon GameLift uses latency data to reorder the list of destinations to place the game session in a region with minimal lag. If latency data is provided for multiple players, Amazon GameLift calculates each region's average lag for all players and reorders to get the best game play across all players.

To place a new game session request, specify the queue name and a set of game session properties and settings. Also provide a unique ID (such as a UUID) for the placement. You'll use this ID to track the status of the placement request. Optionally, provide a set of IDs and player data for each player you want to join to the new game session. To optimize game play for the players, also provide latency data for all players. If successful, a new game session placement is created. To track the status of a placement request, call DescribeGameSessionPlacement and check the request's status. If the status is Fulfilled, a new game session has been created and a game session ARN and region are referenced. If the placement request times out, you have the option of resubmitting the request or retrying it with a different queue.

", + "StartGameSessionPlacement": "

Places a request for a new game session in a queue (see CreateGameSessionQueue). When processing a placement request, Amazon GameLift searches for available resources on the queue's destinations, scanning each until it finds resources or the placement request times out.

A game session placement request can also request player sessions. When a new game session is successfully created, Amazon GameLift creates a player session for each player included in the request.

When placing a game session, by default Amazon GameLift tries each fleet in the order they are listed in the queue configuration. Ideally, a queue's destinations are listed in preference order.

Alternatively, when requesting a game session with players, you can also provide latency data for each player in relevant regions. Latency data indicates the performance lag a player experiences when connected to a fleet in the region. Amazon GameLift uses latency data to reorder the list of destinations to place the game session in a region with minimal lag. If latency data is provided for multiple players, Amazon GameLift calculates each region's average lag for all players and reorders to get the best game play across all players.

To place a new game session request, specify the following:

  • The queue name and a set of game session properties and settings

  • A unique ID (such as a UUID) for the placement. You use this ID to track the status of the placement request

  • (Optional) A set of IDs and player data for each player you want to join to the new game session

  • Latency data for all players (if you want to optimize game play for the players)

If successful, a new game session placement is created.

To track the status of a placement request, call DescribeGameSessionPlacement and check the request's status. If the status is Fulfilled, a new game session has been created and a game session ARN and region are referenced. If the placement request times out, you can resubmit the request or retry it with a different queue.

", "StopGameSessionPlacement": "

Cancels a game session placement that is in Pending status. To stop a placement, provide the placement ID values. If successful, the placement is moved to Cancelled status.

", "UpdateAlias": "

Updates properties for a fleet alias. To update properties, specify the alias ID to be updated and provide the information to be changed. To reassign an alias to another fleet, provide an updated routing strategy. If successful, the updated alias record is returned.

", "UpdateBuild": "

Updates metadata in a build record, including the build name and version. To update the metadata, specify the build ID to update and provide the new values. If successful, a build object containing the updated metadata is returned.

", @@ -90,7 +90,7 @@ "DescribeGameSessionsInput$GameSessionId": "

Unique identifier for the game session to retrieve. You can use either a GameSessionId or GameSessionArn value.

", "DescribePlayerSessionsInput$GameSessionId": "

Unique identifier for the game session to retrieve player sessions for.

", "FleetAttributes$FleetArn": "

Identifier for a fleet that is unique across all regions.

", - "GameSessionQueue$GameSessionQueueArn": "

Amazon Resource Name (ARN) that is assigned to a game session queue and uniquely identifies it. Format is arn:aws:gamelift:<region>::fleet/fleet-a1234567-b8c9-0d1e-2fa3-b45c6d7e8912.

", + "GameSessionQueue$GameSessionQueueArn": "

Amazon Resource Name (ARN) that is assigned to a game session queue and uniquely identifies it. Format is arn:aws:gamelift:<region>::fleet/fleet-a1234567-b8c9-0d1e-2fa3-b45c6d7e8912.

", "GameSessionQueueDestination$DestinationArn": "

Amazon Resource Name (ARN) assigned to fleet or fleet alias. ARNs, which include a fleet ID or alias ID and a region name, provide a unique identifier across all regions.

", "GetGameSessionLogUrlInput$GameSessionId": "

Unique identifier for the game session to get logs for.

", "UpdateGameSessionInput$GameSessionId": "

Unique identifier for the game session to update.

" @@ -619,6 +619,12 @@ "UpdateGameSessionOutput$GameSession": "

Object that contains the updated game session metadata.

" } }, + "GameSessionActivationTimeoutSeconds": { + "base": null, + "refs": { + "RuntimeConfiguration$GameSessionActivationTimeoutSeconds": "

Maximum amount of time (in seconds) that a game session can remain in status ACTIVATING. If the game session is not active before the timeout, activation is terminated and the game session status is changed to TERMINATED.

" + } + }, "GameSessionDetail": { "base": "

A game session's properties plus the protection policy currently in force.

", "refs": { @@ -877,6 +883,26 @@ "refs": { } }, + "MaxConcurrentGameSessionActivations": { + "base": null, + "refs": { + "RuntimeConfiguration$MaxConcurrentGameSessionActivations": "

Maximum number of game sessions with status ACTIVATING to allow on an instance simultaneously. This setting limits the amount of instance resources that can be used for new game activations at any one time.

" + } + }, + "MetricGroup": { + "base": null, + "refs": { + "MetricGroupList$member": null + } + }, + "MetricGroupList": { + "base": null, + "refs": { + "CreateFleetInput$MetricGroups": "

Names of metric groups to add this fleet to. Use an existing metric group name to add this fleet to the group, or use a new name to create a new metric group. Currently, a fleet can only be included in one metric group at a time.

", + "FleetAttributes$MetricGroups": "

Names of metric groups that this fleet is included in. In Amazon CloudWatch, you can view metrics for an individual fleet or aggregated metrics for a fleets that are in a fleet metric group. Currently, a fleet can be included in only one metric group at a time.

", + "UpdateFleetAttributesInput$MetricGroups": "

Names of metric groups to include this fleet with. A fleet metric group is used in Amazon CloudWatch to aggregate metrics from multiple fleets. Use an existing metric group name to add this fleet to the group, or use a new name to create a new metric group. Currently, a fleet can only be included in one metric group at a time.

" + } + }, "MetricName": { "base": null, "refs": { @@ -1283,7 +1309,7 @@ "ServerProcessList": { "base": null, "refs": { - "RuntimeConfiguration$ServerProcesses": "

Collection of server process configurations describing what server processes to run on each instance in a fleet

" + "RuntimeConfiguration$ServerProcesses": "

Collection of server process configurations that describe which server processes to run on each instance in a fleet.

" } }, "StartGameSessionPlacementInput": { diff --git a/vendor/github.com/aws/aws-sdk-go/models/apis/inspector/2016-02-16/api-2.json b/vendor/github.com/aws/aws-sdk-go/models/apis/inspector/2016-02-16/api-2.json index dc492abe5..425f3a751 100644 --- a/vendor/github.com/aws/aws-sdk-go/models/apis/inspector/2016-02-16/api-2.json +++ b/vendor/github.com/aws/aws-sdk-go/models/apis/inspector/2016-02-16/api-2.json @@ -207,6 +207,23 @@ {"shape":"InvalidInputException"} ] }, + "GetAssessmentReport":{ + "name":"GetAssessmentReport", + "http":{ + "method":"POST", + "requestUri":"/" + }, + "input":{"shape":"GetAssessmentReportRequest"}, + "output":{"shape":"GetAssessmentReportResponse"}, + "errors":[ + {"shape":"InternalException"}, + {"shape":"InvalidInputException"}, + {"shape":"AccessDeniedException"}, + {"shape":"NoSuchEntityException"}, + {"shape":"AssessmentRunInProgressException"}, + {"shape":"UnsupportedFeatureException"} + ] + }, "GetTelemetryMetadata":{ "name":"GetTelemetryMetadata", "http":{ @@ -656,7 +673,8 @@ "stateChangedAt", "dataCollected", "stateChanges", - "notifications" + "notifications", + "findingCounts" ], "members":{ "arn":{"shape":"Arn"}, @@ -672,7 +690,8 @@ "stateChangedAt":{"shape":"Timestamp"}, "dataCollected":{"shape":"Bool"}, "stateChanges":{"shape":"AssessmentRunStateChangeList"}, - "notifications":{"shape":"AssessmentRunNotificationList"} + "notifications":{"shape":"AssessmentRunNotificationList"}, + "findingCounts":{"shape":"AssessmentRunFindingCounts"} } }, "AssessmentRunAgent":{ @@ -717,6 +736,11 @@ "stateChangeTimeRange":{"shape":"TimestampRange"} } }, + "AssessmentRunFindingCounts":{ + "type":"map", + "key":{"shape":"Severity"}, + "value":{"shape":"FindingCount"} + }, "AssessmentRunInProgressArnList":{ "type":"list", "member":{"shape":"Arn"}, @@ -790,8 +814,10 @@ "COLLECTING_DATA", "STOP_DATA_COLLECTION_PENDING", "DATA_COLLECTED", + "START_EVALUATING_RULES_PENDING", "EVALUATING_RULES", "FAILED", + "ERROR", "COMPLETED", "COMPLETED_WITH_ERRORS" ] @@ -1248,6 +1274,7 @@ "updatedAt":{"shape":"Timestamp"} } }, + "FindingCount":{"type":"integer"}, "FindingFilter":{ "type":"structure", "members":{ @@ -1269,9 +1296,30 @@ "FindingList":{ "type":"list", "member":{"shape":"Finding"}, - "max":10, + "max":100, "min":0 }, + "GetAssessmentReportRequest":{ + "type":"structure", + "required":[ + "assessmentRunArn", + "reportFileFormat", + "reportType" + ], + "members":{ + "assessmentRunArn":{"shape":"Arn"}, + "reportFileFormat":{"shape":"ReportFileFormat"}, + "reportType":{"shape":"ReportType"} + } + }, + "GetAssessmentReportResponse":{ + "type":"structure", + "required":["status"], + "members":{ + "status":{"shape":"ReportStatus"}, + "url":{"shape":"Url"} + } + }, "GetTelemetryMetadataRequest":{ "type":"structure", "required":["assessmentRunArn"], @@ -1710,6 +1758,28 @@ "failedItems":{"shape":"FailedItems"} } }, + "ReportFileFormat":{ + "type":"string", + "enum":[ + "HTML", + "PDF" + ] + }, + "ReportStatus":{ + "type":"string", + "enum":[ + "WORK_IN_PROGRESS", + "FAILED", + "COMPLETED" + ] + }, + "ReportType":{ + "type":"string", + "enum":[ + "FINDING", + "FULL" + ] + }, "ResourceGroup":{ "type":"structure", "required":[ @@ -1931,6 +2001,18 @@ "topicArn":{"shape":"Arn"} } }, + "UnsupportedFeatureException":{ + "type":"structure", + "required":[ + "message", + "canRetry" + ], + "members":{ + "message":{"shape":"ErrorMessage"}, + "canRetry":{"shape":"Bool"} + }, + "exception":true + }, "UpdateAssessmentTargetRequest":{ "type":"structure", "required":[ @@ -1944,6 +2026,10 @@ "resourceGroupArn":{"shape":"Arn"} } }, + "Url":{ + "type":"string", + "max":2048 + }, "UserAttributeKeyList":{ "type":"list", "member":{"shape":"AttributeKey"}, diff --git a/vendor/github.com/aws/aws-sdk-go/models/apis/inspector/2016-02-16/docs-2.json b/vendor/github.com/aws/aws-sdk-go/models/apis/inspector/2016-02-16/docs-2.json index 3c66b1de6..718692843 100644 --- a/vendor/github.com/aws/aws-sdk-go/models/apis/inspector/2016-02-16/docs-2.json +++ b/vendor/github.com/aws/aws-sdk-go/models/apis/inspector/2016-02-16/docs-2.json @@ -16,6 +16,7 @@ "DescribeFindings": "

Describes the findings that are specified by the ARNs of the findings.

", "DescribeResourceGroups": "

Describes the resource groups that are specified by the ARNs of the resource groups.

", "DescribeRulesPackages": "

Describes the rules packages that are specified by the ARNs of the rules packages.

", + "GetAssessmentReport": "

Produces an assessment report that includes detailed and comprehensive results of a specified assessment run.

", "GetTelemetryMetadata": "

Information about the data that is collected for the specified assessment run.

", "ListAssessmentRunAgents": "

Lists the agents of the assessment runs that are specified by the ARNs of the assessment runs.

", "ListAssessmentRuns": "

Lists the assessment runs that correspond to the assessment templates that are specified by the ARNs of the assessment templates.

", @@ -176,6 +177,7 @@ "FailedItems$key": null, "FilterRulesPackageArnList$member": null, "Finding$arn": "

The ARN that specifies the finding.

", + "GetAssessmentReportRequest$assessmentRunArn": "

The ARN that specifies the assessment run for which you want to generate a report.

", "GetTelemetryMetadataRequest$assessmentRunArn": "

The ARN that specifies the assessment run that has the telemetry data that you want to obtain.

", "InspectorServiceAttributes$assessmentRunArn": "

The ARN of the assessment run during which the finding is generated.

", "InspectorServiceAttributes$rulesPackageArn": "

The ARN of the rules package that is used to generate the finding.

", @@ -242,6 +244,12 @@ "ListAssessmentRunsRequest$filter": "

You can use this parameter to specify a subset of data to be included in the action's response.

For a record to match a filter, all specified filter attributes must match. When multiple values are specified for a filter attribute, any of the values can match.

" } }, + "AssessmentRunFindingCounts": { + "base": null, + "refs": { + "AssessmentRun$findingCounts": "

Provides a total count of generated findings per severity.

" + } + }, "AssessmentRunInProgressArnList": { "base": null, "refs": { @@ -451,7 +459,8 @@ "InvalidCrossAccountRoleException$canRetry": "

You can immediately retry your request.

", "InvalidInputException$canRetry": "

You can immediately retry your request.

", "LimitExceededException$canRetry": "

You can immediately retry your request.

", - "NoSuchEntityException$canRetry": "

You can immediately retry your request.

" + "NoSuchEntityException$canRetry": "

You can immediately retry your request.

", + "UnsupportedFeatureException$canRetry": null } }, "CreateAssessmentTargetRequest": { @@ -581,7 +590,8 @@ "InvalidCrossAccountRoleException$message": "

Details of the exception error.

", "InvalidInputException$message": "

Details of the exception error.

", "LimitExceededException$message": "

Details of the exception error.

", - "NoSuchEntityException$message": "

Details of the exception error.

" + "NoSuchEntityException$message": "

Details of the exception error.

", + "UnsupportedFeatureException$message": null } }, "EventSubscription": { @@ -635,6 +645,12 @@ "FindingList$member": null } }, + "FindingCount": { + "base": null, + "refs": { + "AssessmentRunFindingCounts$value": null + } + }, "FindingFilter": { "base": "

This data type is used as a request parameter in the ListFindings action.

", "refs": { @@ -653,6 +669,16 @@ "DescribeFindingsResponse$findings": "

Information about the finding.

" } }, + "GetAssessmentReportRequest": { + "base": null, + "refs": { + } + }, + "GetAssessmentReportResponse": { + "base": null, + "refs": { + } + }, "GetTelemetryMetadataRequest": { "base": null, "refs": { @@ -681,7 +707,7 @@ "InspectorServiceAttributes": { "base": "

This data type is used in the Finding data type.

", "refs": { - "Finding$serviceAttributes": null + "Finding$serviceAttributes": "

This data type is used in the Finding data type.

" } }, "InternalException": { @@ -873,7 +899,7 @@ "base": null, "refs": { "AssessmentRunAgent$agentHealthDetails": "

The description for the agent health code.

", - "AssessmentRunNotification$message": null + "AssessmentRunNotification$message": "

The message included in the notification.

" } }, "MessageType": { @@ -973,6 +999,24 @@ "refs": { } }, + "ReportFileFormat": { + "base": null, + "refs": { + "GetAssessmentReportRequest$reportFileFormat": "

Specifies the file format (html or pdf) of the assessment report that you want to generate.

" + } + }, + "ReportStatus": { + "base": null, + "refs": { + "GetAssessmentReportResponse$status": "

Specifies the status of the request to generate an assessment report.

" + } + }, + "ReportType": { + "base": null, + "refs": { + "GetAssessmentReportRequest$reportType": "

Specifies the type of the assessment report that you want to generate. There are two types of assessment reports: a finding report and a full report. For more information, see Assessment Reports.

" + } + }, "ResourceGroup": { "base": "

Contains information about a resource group. The resource group defines a set of tags that, when queried, identify the AWS resources that make up the assessment target. This data type is used as the response element in the DescribeResourceGroups action.

", "refs": { @@ -1042,6 +1086,7 @@ "Severity": { "base": null, "refs": { + "AssessmentRunFindingCounts$key": null, "Finding$severity": "

The finding severity. Values can be set to High, Medium, Low, and Informational.

", "SeverityList$member": null } @@ -1168,11 +1213,22 @@ "refs": { } }, + "UnsupportedFeatureException": { + "base": "

Used by the GetAssessmentReport API. The request was rejected because you tried to generate a report for an assessment run that existed before reporting was supported in Amazon Inspector. You can only generate reports for assessment runs that took place or will take place after generating reports in Amazon Inspector became available.

", + "refs": { + } + }, "UpdateAssessmentTargetRequest": { "base": null, "refs": { } }, + "Url": { + "base": null, + "refs": { + "GetAssessmentReportResponse$url": "

Specifies the URL where you can find the generated assessment report. This parameter is only returned if the report is successfully generated.

" + } + }, "UserAttributeKeyList": { "base": null, "refs": { diff --git a/vendor/github.com/aws/aws-sdk-go/models/apis/inspector/2016-02-16/examples-1.json b/vendor/github.com/aws/aws-sdk-go/models/apis/inspector/2016-02-16/examples-1.json index 24fcb7a9d..d06decc47 100644 --- a/vendor/github.com/aws/aws-sdk-go/models/apis/inspector/2016-02-16/examples-1.json +++ b/vendor/github.com/aws/aws-sdk-go/models/apis/inspector/2016-02-16/examples-1.json @@ -168,6 +168,13 @@ "createdAt": "1458680170.035", "dataCollected": true, "durationInSeconds": 3600, + "findingCounts": { + "High": 14, + "Informational": 0, + "Low": 0, + "Medium": 2, + "Undefined": 0 + }, "notifications": [ ], diff --git a/vendor/github.com/aws/aws-sdk-go/models/apis/inspector/2016-02-16/paginators-1.json b/vendor/github.com/aws/aws-sdk-go/models/apis/inspector/2016-02-16/paginators-1.json new file mode 100644 index 000000000..5677bd8e4 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/models/apis/inspector/2016-02-16/paginators-1.json @@ -0,0 +1,4 @@ +{ + "pagination": { + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/models/apis/kms/2014-11-01/docs-2.json b/vendor/github.com/aws/aws-sdk-go/models/apis/kms/2014-11-01/docs-2.json index 03fb18661..e1fd02215 100644 --- a/vendor/github.com/aws/aws-sdk-go/models/apis/kms/2014-11-01/docs-2.json +++ b/vendor/github.com/aws/aws-sdk-go/models/apis/kms/2014-11-01/docs-2.json @@ -737,7 +737,7 @@ "PrincipalIdType": { "base": null, "refs": { - "CreateGrantRequest$GranteePrincipal": "

The principal that is given permission to perform the operations that the grant permits.

To specify the principal, use the Amazon Resource Name (ARN) of an AWS principal. Valid AWS principals include AWS accounts (root), IAM users, federated users, and assumed role users. For examples of the ARN syntax to use for specifying a principal, see AWS Identity and Access Management (IAM) in the Example ARNs section of the AWS General Reference.

", + "CreateGrantRequest$GranteePrincipal": "

The principal that is given permission to perform the operations that the grant permits.

To specify the principal, use the Amazon Resource Name (ARN) of an AWS principal. Valid AWS principals include AWS accounts (root), IAM users, IAM roles, federated users, and assumed role users. For examples of the ARN syntax to use for specifying a principal, see AWS Identity and Access Management (IAM) in the Example ARNs section of the AWS General Reference.

", "CreateGrantRequest$RetiringPrincipal": "

The principal that is given permission to retire the grant by using RetireGrant operation.

To specify the principal, use the Amazon Resource Name (ARN) of an AWS principal. Valid AWS principals include AWS accounts (root), IAM users, federated users, and assumed role users. For examples of the ARN syntax to use for specifying a principal, see AWS Identity and Access Management (IAM) in the Example ARNs section of the AWS General Reference.

", "GrantListEntry$GranteePrincipal": "

The principal that receives the grant's permissions.

", "GrantListEntry$RetiringPrincipal": "

The principal that can retire the grant.

", diff --git a/vendor/github.com/aws/aws-sdk-go/models/apis/lightsail/2016-11-28/api-2.json b/vendor/github.com/aws/aws-sdk-go/models/apis/lightsail/2016-11-28/api-2.json index b519fb09d..07d9b4a34 100644 --- a/vendor/github.com/aws/aws-sdk-go/models/apis/lightsail/2016-11-28/api-2.json +++ b/vendor/github.com/aws/aws-sdk-go/models/apis/lightsail/2016-11-28/api-2.json @@ -749,6 +749,24 @@ {"shape":"UnauthenticatedException"} ] }, + "PutInstancePublicPorts":{ + "name":"PutInstancePublicPorts", + "http":{ + "method":"POST", + "requestUri":"/" + }, + "input":{"shape":"PutInstancePublicPortsRequest"}, + "output":{"shape":"PutInstancePublicPortsResult"}, + "errors":[ + {"shape":"ServiceException"}, + {"shape":"InvalidInputException"}, + {"shape":"NotFoundException"}, + {"shape":"OperationFailureException"}, + {"shape":"AccessDeniedException"}, + {"shape":"AccountSetupInProgressException"}, + {"shape":"UnauthenticatedException"} + ] + }, "RebootInstance":{ "name":"RebootInstance", "http":{ @@ -1375,7 +1393,7 @@ "GetInstancePortStatesResult":{ "type":"structure", "members":{ - "portStates":{"shape":"PortStateList"} + "portStates":{"shape":"InstancePortStateList"} } }, "GetInstanceRequest":{ @@ -1654,6 +1672,19 @@ "type":"list", "member":{"shape":"InstancePortInfo"} }, + "InstancePortState":{ + "type":"structure", + "members":{ + "fromPort":{"shape":"Port"}, + "toPort":{"shape":"Port"}, + "protocol":{"shape":"NetworkProtocol"}, + "state":{"shape":"PortState"} + } + }, + "InstancePortStateList":{ + "type":"list", + "member":{"shape":"InstancePortState"} + }, "InstanceSnapshot":{ "type":"structure", "members":{ @@ -1898,6 +1929,7 @@ "StartInstance", "RebootInstance", "OpenInstancePublicPorts", + "PutInstancePublicPorts", "CloseInstancePublicPorts", "AllocateStaticIp", "ReleaseStaticIp", @@ -1943,6 +1975,10 @@ "protocol":{"shape":"NetworkProtocol"} } }, + "PortInfoList":{ + "type":"list", + "member":{"shape":"PortInfo"} + }, "PortState":{ "type":"string", "enum":[ @@ -1950,9 +1986,22 @@ "closed" ] }, - "PortStateList":{ - "type":"list", - "member":{"shape":"PortState"} + "PutInstancePublicPortsRequest":{ + "type":"structure", + "required":[ + "portInfos", + "instanceName" + ], + "members":{ + "portInfos":{"shape":"PortInfoList"}, + "instanceName":{"shape":"ResourceName"} + } + }, + "PutInstancePublicPortsResult":{ + "type":"structure", + "members":{ + "operation":{"shape":"Operation"} + } }, "RebootInstanceRequest":{ "type":"structure", @@ -2039,7 +2088,8 @@ "message":{"shape":"string"}, "tip":{"shape":"string"} }, - "exception":true + "exception":true, + "fault":true }, "StartInstanceRequest":{ "type":"structure", diff --git a/vendor/github.com/aws/aws-sdk-go/models/apis/lightsail/2016-11-28/docs-2.json b/vendor/github.com/aws/aws-sdk-go/models/apis/lightsail/2016-11-28/docs-2.json index 97e2ab6f4..70b4e6be0 100644 --- a/vendor/github.com/aws/aws-sdk-go/models/apis/lightsail/2016-11-28/docs-2.json +++ b/vendor/github.com/aws/aws-sdk-go/models/apis/lightsail/2016-11-28/docs-2.json @@ -1,6 +1,6 @@ { "version": "2.0", - "service": "

Amazon Lightsail is the easiest way to get started with AWS for developers who just need virtual private servers. Lightsail includes everything you need to launch your project quickly - a virtual machine, SSD-based storage, data transfer, DNS management, and a static IP - for a low, predictable price. You manage those Lightsail servers through the Lightsail console or by using the API or command-line interface (CLI).

For more information about Lightsail concepts and tasks, see the Lightsail Dev Guide.

To use the Lightsail API or the CLI, you will need to use AWS Identity and Access Management (IAM) to generate access keys. For details about how to set this up, see the Lightsail Dev Guide.

", + "service": "

Amazon Lightsail is the easiest way to get started with AWS for developers who just need virtual private servers. Lightsail includes everything you need to launch your project quickly - a virtual machine, SSD-based storage, data transfer, DNS management, and a static IP - for a low, predictable price. You manage those Lightsail servers through the Lightsail console or by using the API or command-line interface (CLI).

For more information about Lightsail concepts and tasks, see the Lightsail Dev Guide.

To use the Lightsail API or the CLI, you will need to use AWS Identity and Access Management (IAM) to generate access keys. For details about how to set this up, see the Lightsail Dev Guide.

", "operations": { "AllocateStaticIp": "

Allocates a static IP address.

", "AttachStaticIp": "

Attaches a static IP address to a specific Amazon Lightsail instance.

", @@ -36,13 +36,14 @@ "GetOperation": "

Returns information about a specific operation. Operations include events such as when you create an instance, allocate a static IP, attach a static IP, and so on.

", "GetOperations": "

Returns information about all operations.

Results are returned from oldest to newest, up to a maximum of 200. Results can be paged by making each subsequent call to GetOperations use the maximum (last) statusChangedAt value from the previous request.

", "GetOperationsForResource": "

Gets operations for a specific resource (e.g., an instance or a static IP).

", - "GetRegions": "

Returns a list of all valid regions for Amazon Lightsail.

", + "GetRegions": "

Returns a list of all valid regions for Amazon Lightsail. Use the include availability zones parameter to also return the availability zones in a region.

", "GetStaticIp": "

Returns information about a specific static IP.

", "GetStaticIps": "

Returns information about all static IPs in the user's account.

", "ImportKeyPair": "

Imports a public SSH key from a specific key pair.

", "IsVpcPeered": "

Returns a Boolean value indicating whether your Lightsail VPC is peered.

", "OpenInstancePublicPorts": "

Adds public ports to an Amazon Lightsail instance.

", "PeerVpc": "

Tries to peer the Lightsail VPC with the user's default VPC.

", + "PutInstancePublicPorts": "

Sets the specified open ports for an Amazon Lightsail instance, and closes all ports for every protocol not included in the current request.

", "RebootInstance": "

Restarts a specific instance. When your Amazon Lightsail instance is finished rebooting, Lightsail assigns a new public IP address. To use the same IP address after restarting, create a static IP address and attach it to the instance.

", "ReleaseStaticIp": "

Deletes a specific static IP from your account.

", "StartInstance": "

Starts a specific Amazon Lightsail instance from a stopped state. To restart an instance, use the reboot instance operation.

", @@ -96,7 +97,7 @@ "AvailabilityZoneList": { "base": null, "refs": { - "Region$availabilityZones": "

The Availability Zones.

" + "Region$availabilityZones": "

The Availability Zones. Follows the format us-east-1a (case-sensitive).

" } }, "Base64": { @@ -627,6 +628,18 @@ "InstanceNetworking$ports": "

An array of key-value pairs containing information about the ports on the instance.

" } }, + "InstancePortState": { + "base": "

Describes the port state.

", + "refs": { + "InstancePortStateList$member": null + } + }, + "InstancePortStateList": { + "base": null, + "refs": { + "GetInstancePortStatesResult$portStates": "

Information about the port states resulting from your request.

" + } + }, "InstanceSnapshot": { "base": "

Describes the snapshot of the virtual private server, or instance.

", "refs": { @@ -654,7 +667,7 @@ } }, "InvalidInputException": { - "base": "

Lightsail throws this exception when user input does not conform to the validation rules of an input field.

", + "base": "

Lightsail throws this exception when user input does not conform to the validation rules of an input field.

Domain-related APIs are only available in the N. Virginia (us-east-1) Region. Please set your Region configuration to us-east-1 to create, view, or edit these resources.

", "refs": { } }, @@ -757,14 +770,15 @@ "NetworkProtocol": { "base": null, "refs": { - "InstancePortInfo$protocol": "

The protocol.

", + "InstancePortInfo$protocol": "

The protocol being used. Can be one of the following.

  • tcp - Transmission Control Protocol (TCP) provides reliable, ordered, and error-checked delivery of streamed data between applications running on hosts communicating by an IP network. If you have an application that doesn't require reliable data stream service, use UDP instead.

  • all - All transport layer protocol types. For more general information, see Transport layer on Wikipedia.

  • udp - With User Datagram Protocol (UDP), computer applications can send messages (or datagrams) to other hosts on an Internet Protocol (IP) network. Prior communications are not required to set up transmission channels or data paths. Applications that don't require reliable data stream service can use UDP, which provides a connectionless datagram service that emphasizes reduced latency over reliability. If you do require reliable data stream service, use TCP instead.

", + "InstancePortState$protocol": "

The protocol being used. Can be one of the following.

  • tcp - Transmission Control Protocol (TCP) provides reliable, ordered, and error-checked delivery of streamed data between applications running on hosts communicating by an IP network. If you have an application that doesn't require reliable data stream service, use UDP instead.

  • all - All transport layer protocol types. For more general information, see Transport layer on Wikipedia.

  • udp - With User Datagram Protocol (UDP), computer applications can send messages (or datagrams) to other hosts on an Internet Protocol (IP) network. Prior communications are not required to set up transmission channels or data paths. Applications that don't require reliable data stream service can use UDP, which provides a connectionless datagram service that emphasizes reduced latency over reliability. If you do require reliable data stream service, use TCP instead.

", "PortInfo$protocol": "

The protocol.

" } }, "NonEmptyString": { "base": null, "refs": { - "AvailabilityZone$zoneName": "

The name of the Availability Zone.

", + "AvailabilityZone$zoneName": "

The name of the Availability Zone. The format is us-east-1a (case-sensitive).

", "AvailabilityZone$state": "

The state of the Availability Zone.

", "Blueprint$blueprintId": "

The ID for the virtual private server image (e.g., app_wordpress_4_4 or app_lamp_7_0).

", "Blueprint$group": "

The group name of the blueprint (e.g., amazon-linux).

", @@ -818,6 +832,7 @@ "OpenInstancePublicPortsResult$operation": "

An array of key-value pairs containing information about the request operation.

", "OperationList$member": null, "PeerVpcResult$operation": "

An array of key-value pairs containing information about the request operation.

", + "PutInstancePublicPortsResult$operation": "

Describes metadata about the operation you just executed.

", "UnpeerVpcResult$operation": "

An array of key-value pairs containing information about the request operation.

" } }, @@ -873,6 +888,8 @@ "refs": { "InstancePortInfo$fromPort": "

The first port in the range.

", "InstancePortInfo$toPort": "

The last port in the range.

", + "InstancePortState$fromPort": "

The first port in the range.

", + "InstancePortState$toPort": "

The last port in the range.

", "PortInfo$fromPort": "

The first port in the range.

", "PortInfo$toPort": "

The last port in the range.

" } @@ -887,19 +904,30 @@ "base": "

Describes information about the ports on your virtual private server (or instance).

", "refs": { "CloseInstancePublicPortsRequest$portInfo": "

Information about the public port you are trying to close.

", - "OpenInstancePublicPortsRequest$portInfo": "

An array of key-value pairs containing information about the port mappings.

" + "OpenInstancePublicPortsRequest$portInfo": "

An array of key-value pairs containing information about the port mappings.

", + "PortInfoList$member": null + } + }, + "PortInfoList": { + "base": null, + "refs": { + "PutInstancePublicPortsRequest$portInfos": "

Specifies information about the public port(s).

" } }, "PortState": { "base": null, "refs": { - "PortStateList$member": null + "InstancePortState$state": "

Specifies whether the instance port is open or closed.

" } }, - "PortStateList": { + "PutInstancePublicPortsRequest": { + "base": null, + "refs": { + } + }, + "PutInstancePublicPortsResult": { "base": null, "refs": { - "GetInstancePortStatesResult$portStates": "

Information about the port states resulting from your request.

" } }, "RebootInstanceRequest": { @@ -992,6 +1020,7 @@ "KeyPair$name": "

The friendly name of the SSH key pair.

", "OpenInstancePublicPortsRequest$instanceName": "

The name of the instance for which you want to open the public ports.

", "Operation$resourceName": "

The resource name.

", + "PutInstancePublicPortsRequest$instanceName": "

The Lightsail instance name of the public port(s) you are setting.

", "RebootInstanceRequest$instanceName": "

The name of the instance to reboot.

", "ReleaseStaticIpRequest$staticIpName": "

The name of the static IP to delete.

", "StartInstanceRequest$instanceName": "

The name of the instance (a virtual private server) to start.

", @@ -1152,9 +1181,9 @@ "Blueprint$licenseUrl": "

The end-user license agreement URL for the image or blueprint.

", "Bundle$instanceType": "

The Amazon EC2 instance type (e.g., t2.micro).

", "Bundle$name": "

A friendly name for the bundle (e.g., Micro).

", - "CreateInstancesFromSnapshotRequest$availabilityZone": "

The Availability Zone where you want to create your instances. Use the following formatting: us-east-1a (case sensitive).

", + "CreateInstancesFromSnapshotRequest$availabilityZone": "

The Availability Zone where you want to create your instances. Use the following formatting: us-east-1a (case sensitive). You can get a list of availability zones by using the get regions operation. Be sure to add the include availability zones parameter to your request.

", "CreateInstancesFromSnapshotRequest$userData": "

You can create a launch script that configures a server with additional user data. For example, apt-get –y update.

Depending on the machine image you choose, the command to get software on your instance varies. Amazon Linux and CentOS use yum, Debian and Ubuntu use apt-get, and FreeBSD uses pkg. For a complete list, see the Dev Guide.

", - "CreateInstancesRequest$availabilityZone": "

The Availability Zone in which to create your instance. Use the following format: us-east-1a (case sensitive).

", + "CreateInstancesRequest$availabilityZone": "

The Availability Zone in which to create your instance. Use the following format: us-east-1a (case sensitive). You can get a list of availability zones by using the get regions operation. Be sure to add the include availability zones parameter to your request.

", "CreateInstancesRequest$userData": "

A launch script you can create that configures a server with additional user data. For example, you might want to run apt-get –y update.

Depending on the machine image you choose, the command to get software on your instance varies. Amazon Linux and CentOS use yum, Debian and Ubuntu use apt-get, and FreeBSD uses pkg. For a complete list, see the Dev Guide.

", "Disk$supportCode": "

The support code. Include this code in your email to support when you have questions about an instance or another resource in Lightsail. This code enables our support team to look up your Lightsail information more easily.

", "Disk$path": "

The disk path.

", @@ -1214,7 +1243,7 @@ "Region$continentCode": "

The continent code (e.g., NA, meaning North America).

", "Region$description": "

The description of the AWS Region (e.g., This region is recommended to serve users in the eastern United States and eastern Canada).

", "Region$displayName": "

The display name (e.g., Virginia).

", - "ResourceLocation$availabilityZone": "

The Availability Zone.

", + "ResourceLocation$availabilityZone": "

The Availability Zone. Follows the format us-east-1a (case-sensitive).

", "ServiceException$code": null, "ServiceException$docs": null, "ServiceException$message": null, diff --git a/vendor/github.com/aws/aws-sdk-go/models/apis/lightsail/2016-11-28/paginators-1.json b/vendor/github.com/aws/aws-sdk-go/models/apis/lightsail/2016-11-28/paginators-1.json new file mode 100644 index 000000000..5677bd8e4 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/models/apis/lightsail/2016-11-28/paginators-1.json @@ -0,0 +1,4 @@ +{ + "pagination": { + } +} diff --git a/vendor/github.com/aws/aws-sdk-go/models/apis/logs/2014-03-28/docs-2.json b/vendor/github.com/aws/aws-sdk-go/models/apis/logs/2014-03-28/docs-2.json index 2e059518a..4b5fc5670 100644 --- a/vendor/github.com/aws/aws-sdk-go/models/apis/logs/2014-03-28/docs-2.json +++ b/vendor/github.com/aws/aws-sdk-go/models/apis/logs/2014-03-28/docs-2.json @@ -26,7 +26,7 @@ "PutLogEvents": "

Uploads a batch of log events to the specified log stream.

You must include the sequence token obtained from the response of the previous call. An upload in a newly created log stream does not require a sequence token. You can also get the sequence token using DescribeLogStreams.

The batch of events must satisfy the following constraints:

  • The maximum batch size is 1,048,576 bytes, and this size is calculated as the sum of all event messages in UTF-8, plus 26 bytes for each log event.

  • None of the log events in the batch can be more than 2 hours in the future.

  • None of the log events in the batch can be older than 14 days or the retention period of the log group.

  • The log events in the batch must be in chronological ordered by their timestamp (the time the event occurred, expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC).

  • The maximum number of log events in a batch is 10,000.

  • A batch of log events in a single request cannot span more than 24 hours. Otherwise, the operation fails.

", "PutMetricFilter": "

Creates or updates a metric filter and associates it with the specified log group. Metric filters allow you to configure rules to extract metric data from log events ingested through PutLogEvents.

The maximum number of metric filters that can be associated with a log group is 100.

", "PutRetentionPolicy": "

Sets the retention of the specified log group. A retention policy allows you to configure the number of days you want to retain log events in the specified log group.

", - "PutSubscriptionFilter": "

Creates or updates a subscription filter and associates it with the specified log group. Subscription filters allow you to subscribe to a real-time stream of log events ingested through PutLogEvents and have them delivered to a specific destination. Currently, the supported destinations are:

  • An Amazon Kinesis stream belonging to the same account as the subscription filter, for same-account delivery.

  • A logical destination that belongs to a different account, for cross-account delivery.

  • An Amazon Kinesis Firehose stream that belongs to the same account as the subscription filter, for same-account delivery.

  • An AWS Lambda function that belongs to the same account as the subscription filter, for same-account delivery.

There can only be one subscription filter associated with a log group.

", + "PutSubscriptionFilter": "

Creates or updates a subscription filter and associates it with the specified log group. Subscription filters allow you to subscribe to a real-time stream of log events ingested through PutLogEvents and have them delivered to a specific destination. Currently, the supported destinations are:

  • An Amazon Kinesis stream belonging to the same account as the subscription filter, for same-account delivery.

  • A logical destination that belongs to a different account, for cross-account delivery.

  • An Amazon Kinesis Firehose stream that belongs to the same account as the subscription filter, for same-account delivery.

  • An AWS Lambda function that belongs to the same account as the subscription filter, for same-account delivery.

There can only be one subscription filter associated with a log group. If you are updating an existing filter, you must specify the correct name in filterName. Otherwise, the call will fail because you cannot associate a second filter with a log group.

", "TagLogGroup": "

Adds or updates the specified tags for the specified log group.

To list the tags for a log group, use ListTagsLogGroup. To remove tags, use UntagLogGroup.

For more information about tags, see Tag Log Groups in Amazon CloudWatch Logs in the Amazon CloudWatch Logs User Guide.

", "TestMetricFilter": "

Tests the filter pattern of a metric filter against a sample of log event messages. You can use this operation to validate the correctness of a metric filter pattern.

", "UntagLogGroup": "

Removes the specified tags from the specified log group.

To list the tags for a log group, use ListTagsLogGroup. To add tags, use UntagLogGroup.

" @@ -361,7 +361,7 @@ "DescribeSubscriptionFiltersRequest$filterNamePrefix": "

The prefix to match. If you don't specify a value, no prefix filter is applied.

", "MetricFilter$filterName": "

The name of the metric filter.

", "PutMetricFilterRequest$filterName": "

A name for the metric filter.

", - "PutSubscriptionFilterRequest$filterName": "

A name for the subscription filter.

", + "PutSubscriptionFilterRequest$filterName": "

A name for the subscription filter. If you are updating an existing filter, you must specify the correct name in filterName. Otherwise, the call will fail because you cannot associate a second filter with a log group. To find the name of the filter currently associated with a log group, use DescribeSubscriptionFilters.

", "SubscriptionFilter$filterName": "

The name of the subscription filter.

" } }, @@ -622,7 +622,7 @@ "OrderBy": { "base": null, "refs": { - "DescribeLogStreamsRequest$orderBy": "

If the value is LogStreamName, the results are ordered by log stream name. If the value is LastEventTime, the results are ordered by the event time. The default value is LogStreamName.

If you order the results by event time, you cannot specify the logStreamNamePrefix parameter.

" + "DescribeLogStreamsRequest$orderBy": "

If the value is LogStreamName, the results are ordered by log stream name. If the value is LastEventTime, the results are ordered by the event time. The default value is LogStreamName.

If you order the results by event time, you cannot specify the logStreamNamePrefix parameter.

lastEventTimestamp represents the time of the most recent log event in the log stream in CloudWatch Logs. This number is expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC. lastEventTimeStamp updates on an eventual consistency basis. It typically updates in less than an hour from ingestion, but may take longer in some rare situations.

" } }, "OutputLogEvent": { @@ -814,27 +814,27 @@ "refs": { "CreateExportTaskRequest$from": "

The start time of the range for the request, expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC. Events with a timestamp earlier than this time are not exported.

", "CreateExportTaskRequest$to": "

The end time of the range for the request, expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC. Events with a timestamp later than this time are not exported.

", - "Destination$creationTime": "

The creation time of the destination.

", + "Destination$creationTime": "

The creation time of the destination, expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC.

", "ExportTask$from": "

The start time, expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC. Events with a timestamp prior to this time are not exported.

", "ExportTask$to": "

The end time, expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC. Events with a timestamp later than this time are not exported.

", - "ExportTaskExecutionInfo$creationTime": "

The creation time of the export task.

", - "ExportTaskExecutionInfo$completionTime": "

The completion time of the export task.

", + "ExportTaskExecutionInfo$creationTime": "

The creation time of the export task, expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC.

", + "ExportTaskExecutionInfo$completionTime": "

The completion time of the export task, expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC.

", "FilterLogEventsRequest$startTime": "

The start of the time range, expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC. Events with a timestamp prior to this time are not returned.

", "FilterLogEventsRequest$endTime": "

The end of the time range, expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC. Events with a timestamp later than this time are not returned.

", "FilteredLogEvent$timestamp": "

The time the event occurred, expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC.

", - "FilteredLogEvent$ingestionTime": "

The time the event was ingested.

", + "FilteredLogEvent$ingestionTime": "

The time the event was ingested, expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC.

", "GetLogEventsRequest$startTime": "

The start of the time range, expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC. Events with a timestamp earlier than this time are not included.

", "GetLogEventsRequest$endTime": "

The end of the time range, expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC. Events with a timestamp later than this time are not included.

", "InputLogEvent$timestamp": "

The time the event occurred, expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC.

", - "LogGroup$creationTime": "

The creation time of the log group.

", - "LogStream$creationTime": "

The creation time of the stream.

", + "LogGroup$creationTime": "

The creation time of the log group, expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC.

", + "LogStream$creationTime": "

The creation time of the stream, expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC.

", "LogStream$firstEventTimestamp": "

The time of the first event, expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC.

", - "LogStream$lastEventTimestamp": "

The time of the last event, expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC.

", - "LogStream$lastIngestionTime": "

The ingestion time.

", - "MetricFilter$creationTime": "

The creation time of the metric filter.

", + "LogStream$lastEventTimestamp": "

the time of the most recent log event in the log stream in CloudWatch Logs. This number is expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC. lastEventTime updates on an eventual consistency basis. It typically updates in less than an hour from ingestion, but may take longer in some rare situations.

", + "LogStream$lastIngestionTime": "

The ingestion time, expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC.

", + "MetricFilter$creationTime": "

The creation time of the metric filter, expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC.

", "OutputLogEvent$timestamp": "

The time the event occurred, expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC.

", - "OutputLogEvent$ingestionTime": "

The time the event was ingested.

", - "SubscriptionFilter$creationTime": "

The creation time of the subscription filter.

" + "OutputLogEvent$ingestionTime": "

The time the event was ingested, expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC.

", + "SubscriptionFilter$creationTime": "

The creation time of the subscription filter, expressed as the number of milliseconds since Jan 1, 1970 00:00:00 UTC.

" } }, "Token": { diff --git a/vendor/github.com/aws/aws-sdk-go/models/apis/logs/2014-03-28/paginators-1.json b/vendor/github.com/aws/aws-sdk-go/models/apis/logs/2014-03-28/paginators-1.json index f68932415..d70206824 100644 --- a/vendor/github.com/aws/aws-sdk-go/models/apis/logs/2014-03-28/paginators-1.json +++ b/vendor/github.com/aws/aws-sdk-go/models/apis/logs/2014-03-28/paginators-1.json @@ -2,38 +2,38 @@ "pagination": { "DescribeDestinations": { "input_token": "nextToken", - "output_token": "nextToken", "limit_key": "limit", + "output_token": "nextToken", "result_key": "destinations" }, "DescribeLogGroups": { "input_token": "nextToken", - "output_token": "nextToken", "limit_key": "limit", + "output_token": "nextToken", "result_key": "logGroups" }, "DescribeLogStreams": { "input_token": "nextToken", - "output_token": "nextToken", "limit_key": "limit", + "output_token": "nextToken", "result_key": "logStreams" }, "DescribeMetricFilters": { "input_token": "nextToken", - "output_token": "nextToken", "limit_key": "limit", + "output_token": "nextToken", "result_key": "metricFilters" }, "DescribeSubscriptionFilters": { "input_token": "nextToken", - "output_token": "nextToken", "limit_key": "limit", + "output_token": "nextToken", "result_key": "subscriptionFilters" }, "FilterLogEvents": { "input_token": "nextToken", - "output_token": "nextToken", "limit_key": "limit", + "output_token": "nextToken", "result_key": [ "events", "searchedLogStreams" @@ -41,9 +41,9 @@ }, "GetLogEvents": { "input_token": "nextToken", - "output_token": "nextForwardToken", "limit_key": "limit", + "output_token": "nextForwardToken", "result_key": "events" } } -} +} \ No newline at end of file diff --git a/vendor/github.com/aws/aws-sdk-go/models/apis/polly/2016-06-10/api-2.json b/vendor/github.com/aws/aws-sdk-go/models/apis/polly/2016-06-10/api-2.json index 9cde79ae6..5db81e88b 100644 --- a/vendor/github.com/aws/aws-sdk-go/models/apis/polly/2016-06-10/api-2.json +++ b/vendor/github.com/aws/aws-sdk-go/models/apis/polly/2016-06-10/api-2.json @@ -526,7 +526,8 @@ "Maxim", "Tatyana", "Astrid", - "Filiz" + "Filiz", + "Vicki" ] }, "VoiceList":{ diff --git a/vendor/github.com/aws/aws-sdk-go/models/apis/resourcegroupstaggingapi/2017-01-26/api-2.json b/vendor/github.com/aws/aws-sdk-go/models/apis/resourcegroupstaggingapi/2017-01-26/api-2.json index 8ade0d320..34c415c3f 100644 --- a/vendor/github.com/aws/aws-sdk-go/models/apis/resourcegroupstaggingapi/2017-01-26/api-2.json +++ b/vendor/github.com/aws/aws-sdk-go/models/apis/resourcegroupstaggingapi/2017-01-26/api-2.json @@ -119,10 +119,10 @@ }, "GetResourcesInput":{ "type":"structure", - "required":["TagsPerPage"], "members":{ "PaginationToken":{"shape":"PaginationToken"}, "TagFilters":{"shape":"TagFilterList"}, + "ResourcesPerPage":{"shape":"ResourcesPerPage"}, "TagsPerPage":{"shape":"TagsPerPage"}, "ResourceTypeFilters":{"shape":"ResourceTypeFilterList"} } @@ -215,6 +215,7 @@ "type":"list", "member":{"shape":"AmazonResourceType"} }, + "ResourcesPerPage":{"type":"integer"}, "StatusCode":{"type":"integer"}, "Tag":{ "type":"structure", @@ -298,11 +299,7 @@ "type":"list", "member":{"shape":"TagValue"} }, - "TagsPerPage":{ - "type":"integer", - "max":500, - "min":100 - }, + "TagsPerPage":{"type":"integer"}, "ThrottledException":{ "type":"structure", "members":{ diff --git a/vendor/github.com/aws/aws-sdk-go/models/apis/resourcegroupstaggingapi/2017-01-26/docs-2.json b/vendor/github.com/aws/aws-sdk-go/models/apis/resourcegroupstaggingapi/2017-01-26/docs-2.json index 6ab043303..ccbebd92d 100644 --- a/vendor/github.com/aws/aws-sdk-go/models/apis/resourcegroupstaggingapi/2017-01-26/docs-2.json +++ b/vendor/github.com/aws/aws-sdk-go/models/apis/resourcegroupstaggingapi/2017-01-26/docs-2.json @@ -1,6 +1,6 @@ { "version": "2.0", - "service": "Resource Groups Tagging API

This guide describes the API operations for the resource groups tagging.

A tag is a label that you assign to an AWS resource. A tag consists of a key and a value, both of which you define. For example, if you have two Amazon EC2 instances, you might assign both a tag key of \"Stack.\" But the value of \"Stack\" might be \"Testing\" for one and \"Production\" for the other.

Tagging can help you organize your resources and enables you to simplify resource management, access management and cost allocation. For more information about tagging, see Working with Tag Editor and Working with Resource Groups. For more information about permissions you need to use the resource groups tagging APIs, see Obtaining Permissions for Resource Groups and Obtaining Permissions for Tagging .

You can use the resource groups tagging APIs to complete the following tasks:

  • Tag and untag supported resources located in the specified region for the AWS account

  • Use tag-based filters to search for resources located in the specified region for the AWS account

  • List all existing tag keys in the specified region for the AWS account

  • List all existing values for the specified key in the specified region for the AWS account

Not all resources can have tags. For a list of resources that support tagging, see Supported Resources in the AWS Resource Groups and Tag Editor User Guide.

To make full use of the resource groups tagging APIs, you might need additional IAM permissions, including permission to access the resources of individual services as well as permission to view and apply tags to those resources. For more information, see Obtaining Permissions for Tagging in the AWS Resource Groups and Tag Editor User Guide.

", + "service": "Resource Groups Tagging API

This guide describes the API operations for the resource groups tagging.

A tag is a label that you assign to an AWS resource. A tag consists of a key and a value, both of which you define. For example, if you have two Amazon EC2 instances, you might assign both a tag key of \"Stack.\" But the value of \"Stack\" might be \"Testing\" for one and \"Production\" for the other.

Tagging can help you organize your resources and enables you to simplify resource management, access management and cost allocation. For more information about tagging, see Working with Tag Editor and Working with Resource Groups. For more information about permissions you need to use the resource groups tagging APIs, see Obtaining Permissions for Resource Groups and Obtaining Permissions for Tagging .

You can use the resource groups tagging APIs to complete the following tasks:

  • Tag and untag supported resources located in the specified region for the AWS account

  • Use tag-based filters to search for resources located in the specified region for the AWS account

  • List all existing tag keys in the specified region for the AWS account

  • List all existing values for the specified key in the specified region for the AWS account

Not all resources can have tags. For a lists of resources that you can tag, see Supported Resources in the AWS Resource Groups and Tag Editor User Guide.

To make full use of the resource groups tagging APIs, you might need additional IAM permissions, including permission to access the resources of individual services as well as permission to view and apply tags to those resources. For more information, see Obtaining Permissions for Tagging in the AWS Resource Groups and Tag Editor User Guide.

", "operations": { "GetResources": "

Returns all the tagged resources that are associated with the specified tags (keys and values) located in the specified region for the AWS account. The tags and the resource types that you specify in the request are known as filters. The response includes all tags that are associated with the requested resources. If no filter is provided, this action returns a paginated resource list with the associated tags.

", "GetTagKeys": "

Returns all tag keys in the specified region for the AWS account.

", @@ -138,6 +138,12 @@ "GetResourcesInput$ResourceTypeFilters": "

The constraints on the resources that you want returned. The format of each resource type is service[:resourceType]. For example, specifying a resource type of ec2 returns all tagged Amazon EC2 resources (which includes tagged EC2 instances). Specifying a resource type of ec2:instance returns only EC2 instances.

The string for each service name and resource type is the same as that embedded in a resource's Amazon Resource Name (ARN). Consult the AWS General Reference for the following:

" } }, + "ResourcesPerPage": { + "base": null, + "refs": { + "GetResourcesInput$ResourcesPerPage": "

A limit that restricts the number of resources returned by GetResources in paginated output. You can set ResourcesPerPage to a minimum of 1 item and the maximum of 50 items.

" + } + }, "StatusCode": { "base": null, "refs": { diff --git a/vendor/github.com/aws/aws-sdk-go/models/apis/resourcegroupstaggingapi/2017-01-26/paginators-1.json b/vendor/github.com/aws/aws-sdk-go/models/apis/resourcegroupstaggingapi/2017-01-26/paginators-1.json index 5677bd8e4..7bff285bd 100644 --- a/vendor/github.com/aws/aws-sdk-go/models/apis/resourcegroupstaggingapi/2017-01-26/paginators-1.json +++ b/vendor/github.com/aws/aws-sdk-go/models/apis/resourcegroupstaggingapi/2017-01-26/paginators-1.json @@ -1,4 +1,20 @@ { "pagination": { + "GetResources": { + "input_token": "PaginationToken", + "limit_key": "ResourcesPerPage", + "output_token": "PaginationToken", + "result_key": "ResourceTagMappingList" + }, + "GetTagKeys": { + "input_token": "PaginationToken", + "output_token": "PaginationToken", + "result_key": "TagKeys" + }, + "GetTagValues": { + "input_token": "PaginationToken", + "output_token": "PaginationToken", + "result_key": "TagValues" + } } -} +} \ No newline at end of file diff --git a/vendor/github.com/aws/aws-sdk-go/models/apis/ssm/2014-11-06/api-2.json b/vendor/github.com/aws/aws-sdk-go/models/apis/ssm/2014-11-06/api-2.json index 6fb2f615d..61cfee11c 100644 --- a/vendor/github.com/aws/aws-sdk-go/models/apis/ssm/2014-11-06/api-2.json +++ b/vendor/github.com/aws/aws-sdk-go/models/apis/ssm/2014-11-06/api-2.json @@ -1071,7 +1071,9 @@ {"shape":"InvalidDocumentVersion"}, {"shape":"AssociationDoesNotExist"}, {"shape":"InvalidUpdate"}, - {"shape":"TooManyUpdates"} + {"shape":"TooManyUpdates"}, + {"shape":"InvalidDocument"}, + {"shape":"InvalidTarget"} ] }, "UpdateAssociationStatus":{ @@ -2744,6 +2746,14 @@ "locationName":"FailedCreateAssociationEntry" } }, + "FailureDetails":{ + "type":"structure", + "members":{ + "FailureStage":{"shape":"String"}, + "FailureType":{"shape":"String"}, + "Details":{"shape":"AutomationParameterMap"} + } + }, "Fault":{ "type":"string", "enum":[ @@ -5014,7 +5024,8 @@ "Inputs":{"shape":"NormalStringMap"}, "Outputs":{"shape":"AutomationParameterMap"}, "Response":{"shape":"String"}, - "FailureMessage":{"shape":"String"} + "FailureMessage":{"shape":"String"}, + "FailureDetails":{"shape":"FailureDetails"} } }, "StepExecutionList":{ @@ -5152,7 +5163,9 @@ "Parameters":{"shape":"Parameters"}, "DocumentVersion":{"shape":"DocumentVersion"}, "ScheduleExpression":{"shape":"ScheduleExpression"}, - "OutputLocation":{"shape":"InstanceAssociationOutputLocation"} + "OutputLocation":{"shape":"InstanceAssociationOutputLocation"}, + "Name":{"shape":"DocumentName"}, + "Targets":{"shape":"Targets"} } }, "UpdateAssociationResult":{ diff --git a/vendor/github.com/aws/aws-sdk-go/models/apis/ssm/2014-11-06/docs-2.json b/vendor/github.com/aws/aws-sdk-go/models/apis/ssm/2014-11-06/docs-2.json index 642bfc8ad..21f81a29a 100644 --- a/vendor/github.com/aws/aws-sdk-go/models/apis/ssm/2014-11-06/docs-2.json +++ b/vendor/github.com/aws/aws-sdk-go/models/apis/ssm/2014-11-06/docs-2.json @@ -2,7 +2,7 @@ "version": "2.0", "service": "Amazon EC2 Systems Manager

Amazon EC2 Systems Manager is a collection of capabilities that helps you automate management tasks such as collecting system inventory, applying operating system (OS) patches, automating the creation of Amazon Machine Images (AMIs), and configuring operating systems (OSs) and applications at scale. Systems Manager lets you remotely and securely manage the configuration of your managed instances. A managed instance is any Amazon EC2 instance or on-premises machine in your hybrid environment that has been configured for Systems Manager.

This reference is intended to be used with the Amazon EC2 Systems Manager User Guide.

To get started, verify prerequisites and configure managed instances. For more information, see Systems Manager Prerequisites.

", "operations": { - "AddTagsToResource": "

Adds or overwrites one or more tags for the specified resource. Tags are metadata that you assign to your managed instances. Tags enable you to categorize your managed instances in different ways, for example, by purpose, owner, or environment. Each tag consists of a key and an optional value, both of which you define. For example, you could define a set of tags for your account's managed instances that helps you track each instance's owner and stack level. For example: Key=Owner and Value=DbAdmin, SysAdmin, or Dev. Or Key=Stack and Value=Production, Pre-Production, or Test. Each resource can have a maximum of 10 tags.

We recommend that you devise a set of tag keys that meets your needs for each resource type. Using a consistent set of tag keys makes it easier for you to manage your resources. You can search and filter the resources based on the tags you add. Tags don't have any semantic meaning to Amazon EC2 and are interpreted strictly as a string of characters.

For more information about tags, see Tagging Your Amazon EC2 Resources in the Amazon EC2 User Guide.

", + "AddTagsToResource": "

Adds or overwrites one or more tags for the specified resource. Tags are metadata that you assign to your managed instances, Maintenance Windows, or Parameter Store parameters. Tags enable you to categorize your resources in different ways, for example, by purpose, owner, or environment. Each tag consists of a key and an optional value, both of which you define. For example, you could define a set of tags for your account's managed instances that helps you track each instance's owner and stack level. For example: Key=Owner and Value=DbAdmin, SysAdmin, or Dev. Or Key=Stack and Value=Production, Pre-Production, or Test.

Each resource can have a maximum of 10 tags.

We recommend that you devise a set of tag keys that meets your needs for each resource type. Using a consistent set of tag keys makes it easier for you to manage your resources. You can search and filter the resources based on the tags you add. Tags don't have any semantic meaning to Amazon EC2 and are interpreted strictly as a string of characters.

For more information about tags, see Tagging Your Amazon EC2 Resources in the Amazon EC2 User Guide.

", "CancelCommand": "

Attempts to cancel the command specified by the Command ID. There is no guarantee that the command will be terminated and the underlying process stopped.

", "CreateActivation": "

Registers your on-premises server or virtual machine with Amazon EC2 so that you can manage these resources using Run Command. An on-premises server or virtual machine that has been registered with EC2 is called a managed instance. For more information about activations, see Setting Up Systems Manager in Hybrid Environments.

", "CreateAssociation": "

Associates the specified Systems Manager document with the specified instances or targets.

When you associate a document with one or more instances using instance IDs or tags, the SSM Agent running on the instance processes the document and configures the instance as specified.

If you associate a document with an instance that already has an associated document, the system throws the AssociationAlreadyExists exception.

", @@ -16,7 +16,7 @@ "DeleteMaintenanceWindow": "

Deletes a Maintenance Window.

", "DeleteParameter": "

Delete a parameter from the system.

", "DeletePatchBaseline": "

Deletes a patch baseline.

", - "DeregisterManagedInstance": "

Removes the server or virtual machine from the list of registered servers. You can reregister the instance again at any time. If you don’t plan to use Run Command on the server, we suggest uninstalling the SSM Agent first.

", + "DeregisterManagedInstance": "

Removes the server or virtual machine from the list of registered servers. You can reregister the instance again at any time. If you don't plan to use Run Command on the server, we suggest uninstalling the SSM Agent first.

", "DeregisterPatchBaselineForPatchGroup": "

Removes a patch group from a patch baseline.

", "DeregisterTargetFromMaintenanceWindow": "

Removes a target from a Maintenance Window.

", "DeregisterTaskFromMaintenanceWindow": "

Removes a task from a Maintenance Window.

", @@ -25,7 +25,7 @@ "DescribeAutomationExecutions": "

Provides details about all active and terminated Automation executions.

", "DescribeAvailablePatches": "

Lists all patches that could possibly be included in a patch baseline.

", "DescribeDocument": "

Describes the specified SSM document.

", - "DescribeDocumentPermission": "

Describes the permissions for a Systems Manager document. If you created the document, you are the owner. If a document is shared, it can either be shared privately (by specifying a user’s AWS account ID) or publicly (All).

", + "DescribeDocumentPermission": "

Describes the permissions for a Systems Manager document. If you created the document, you are the owner. If a document is shared, it can either be shared privately (by specifying a user's AWS account ID) or publicly (All).

", "DescribeEffectiveInstanceAssociations": "

All associations for the instance(s).

", "DescribeEffectivePatchesForPatchBaseline": "

Retrieves the current effective patches (the patch and the approval state) for the specified patch baseline.

", "DescribeInstanceAssociationsStatus": "

The status of the associations for the instance(s).

", @@ -114,7 +114,7 @@ "base": null, "refs": { "Activation$Description": "

A user defined description of the activation.

", - "CreateActivationRequest$Description": "

A user-defined description of the resource that you want to register with Amazon EC2.

" + "CreateActivationRequest$Description": "

A userdefined description of the resource that you want to register with Amazon EC2.

" } }, "ActivationId": { @@ -338,7 +338,7 @@ "refs": { "AutomationExecution$AutomationExecutionId": "

The execution ID.

", "AutomationExecutionMetadata$AutomationExecutionId": "

The execution ID.

", - "GetAutomationExecutionRequest$AutomationExecutionId": "

The unique identifier for an existing automation execution to examine. The execution ID is returned by StartAutomationExecution when the execution of an Automation document is initiated.

", + "GetAutomationExecutionRequest$AutomationExecutionId": "

The unique identifier for an existing automation execution to examine. The execution ID is returned by StartAutomationExecution when the execution of an Automation document is initiated.

", "StartAutomationExecutionResult$AutomationExecutionId": "

The unique ID of a newly scheduled automation execution.

", "StopAutomationExecutionRequest$AutomationExecutionId": "

The execution ID of the Automation to stop.

" } @@ -370,7 +370,7 @@ "refs": { "AutomationExecution$AutomationExecutionStatus": "

The execution status of the Automation.

", "AutomationExecutionMetadata$AutomationExecutionStatus": "

The status of the execution. Valid values include: Running, Succeeded, Failed, Timed out, or Cancelled.

", - "StepExecution$StepStatus": "

The execution status for this step. Valid values include: Pending, InProgress, Success, Cancelled, Failed, and TimedOut.

" + "StepExecution$StepStatus": "

The execution status for this step. Valid values include: Pending, InProgress, Success, Cancelled, Failed, and TimedOut.

" } }, "AutomationParameterKey": { @@ -382,9 +382,10 @@ "AutomationParameterMap": { "base": null, "refs": { - "AutomationExecution$Parameters": "

The key-value map of execution parameters, which were supplied when calling StartAutomationExecution.

", + "AutomationExecution$Parameters": "

The key-value map of execution parameters, which were supplied when calling StartAutomationExecution.

", "AutomationExecution$Outputs": "

The list of execution outputs as defined in the automation document.

", "AutomationExecutionMetadata$Outputs": "

The list of execution outputs as defined in the Automation document.

", + "FailureDetails$Details": "

Detailed information about the Automation step failure.

", "StartAutomationExecutionRequest$Parameters": "

A key-value map of execution parameters, which match the declared parameters in the Automation document.

", "StepExecution$Outputs": "

Returned values from the execution of the step.

" } @@ -476,7 +477,7 @@ "base": null, "refs": { "CreateMaintenanceWindowRequest$ClientToken": "

User-provided idempotency token.

", - "CreatePatchBaselineRequest$ClientToken": "

Caller-provided idempotency token.

", + "CreatePatchBaselineRequest$ClientToken": "

User-provided idempotency token.

", "RegisterTargetWithMaintenanceWindowRequest$ClientToken": "

User-provided idempotency token.

", "RegisterTaskWithMaintenanceWindowRequest$ClientToken": "

User-provided idempotency token.

" } @@ -541,7 +542,7 @@ "base": null, "refs": { "CommandInvocation$Status": "

Whether or not the invocation succeeded, failed, or is pending.

", - "GetCommandInvocationResult$Status": "

The status of the parent command for this invocation. This status can be different than StatusDetails.

" + "GetCommandInvocationResult$Status": "

The status of the parent command for this invocation. This status can be different than StatusDetails.

" } }, "CommandList": { @@ -607,7 +608,7 @@ "CompletedCount": { "base": null, "refs": { - "Command$CompletedCount": "

The number of targets for which the command invocation reached a terminal state. Terminal states include the following: Success, Failed, Execution Timed Out, Delivery Timed Out, Canceled, Terminated, or Undeliverable.

" + "Command$CompletedCount": "

The number of targets for which the command invocation reached a terminal state. Terminal states include the following: Success, Failed, Execution Timed Out, Delivery Timed Out, Canceled, Terminated, or Undeliverable.

" } }, "ComputerName": { @@ -638,7 +639,7 @@ } }, "CreateAssociationBatchRequestEntry": { - "base": "

Describes the association of a Systems Manager document and an instance.

", + "base": "

Describes the association of a Systems Manager document and an instance.

", "refs": { "CreateAssociationBatchRequestEntries$member": null, "FailedCreateAssociation$Entry": "

The association.

" @@ -718,7 +719,7 @@ "CommandInvocation$RequestedDateTime": "

The time and date the request was sent to this instance.

", "CommandPlugin$ResponseStartDateTime": "

The time the plugin started executing.

", "CommandPlugin$ResponseFinishDateTime": "

The time the plugin stopped executing. Could stop prematurely if, for example, a cancel command was sent.

", - "DocumentDescription$CreatedDate": "

The date when the document was created.

", + "DocumentDescription$CreatedDate": "

The date when the document was created.

", "DocumentVersionInfo$CreatedDate": "

The date the document was created.

", "GetMaintenanceWindowExecutionResult$StartTime": "

The time the Maintenance Window started executing.

", "GetMaintenanceWindowExecutionResult$EndTime": "

The time the Maintenance Window finished executing.

", @@ -743,7 +744,7 @@ "ParameterMetadata$LastModifiedDate": "

Date the parameter was last changed or updated.

", "Patch$ReleaseDate": "

The date the patch was released.

", "PatchStatus$ApprovalDate": "

The date the patch was approved (or will be approved if the status is PENDING_APPROVAL).

", - "StepExecution$ExecutionStartTime": "

If a step has begun execution, this contains the time the step started. If the step is in Pending status, this field is not populated.

", + "StepExecution$ExecutionStartTime": "

If a step has begun execution, this contains the time the step started. If the step is in Pending status, this field is not populated.

", "StepExecution$ExecutionEndTime": "

If a step has finished execution, this contains the time the execution ended. If the step has not yet concluded, this field is not populated.

", "UpdatePatchBaselineResult$CreatedDate": "

The date when the patch baseline was created.

", "UpdatePatchBaselineResult$ModifiedDate": "

The date when the patch baseline was last modified.

" @@ -1113,7 +1114,7 @@ "DescriptionInDocument": { "base": null, "refs": { - "DocumentDescription$Description": "

A description of the document.

" + "DocumentDescription$Description": "

A description of the document.

" } }, "DocumentARN": { @@ -1149,7 +1150,7 @@ } }, "DocumentDescription": { - "base": "

Describes an SSM document.

", + "base": "

Describes an SSM document.

", "refs": { "CreateDocumentResult$DocumentDescription": "

Information about the Systems Manager document.

", "DescribeDocumentResult$Document": "

Information about the SSM document.

", @@ -1220,7 +1221,7 @@ "AutomationExecutionMetadata$DocumentName": "

The name of the Automation document used during execution.

", "Command$DocumentName": "

The name of the document requested for execution.

", "CommandInvocation$DocumentName": "

The document name that was requested for execution.

", - "CreateAssociationBatchRequestEntry$Name": "

The name of the configuration document.

", + "CreateAssociationBatchRequestEntry$Name": "

The name of the configuration document.

", "CreateAssociationRequest$Name": "

The name of the Systems Manager document.

", "CreateDocumentRequest$Name": "

A name for the Systems Manager document.

", "DeleteAssociationRequest$Name": "

The name of the Systems Manager document.

", @@ -1233,6 +1234,7 @@ "InstanceAssociationStatusInfo$Name": "

The name of the association.

", "ListDocumentVersionsRequest$Name": "

The name of the document about which you want version information.

", "ModifyDocumentPermissionRequest$Name": "

The name of the document that you want to share.

", + "UpdateAssociationRequest$Name": "

The name of the association document.

", "UpdateAssociationStatusRequest$Name": "

The name of the SSM document.

", "UpdateDocumentDefaultVersionRequest$Name": "

The name of a custom document that you want to set as the default version.

", "UpdateDocumentRequest$Name": "

The name of the document that you want to update.

" @@ -1278,7 +1280,7 @@ "DocumentParameterType": { "base": null, "refs": { - "DocumentParameter$Type": "

The type of parameter. The type can be either “String” or “StringList”.

" + "DocumentParameter$Type": "

The type of parameter. The type can be either String or StringList.

" } }, "DocumentPermissionLimit": { @@ -1369,7 +1371,7 @@ } }, "DoesNotExistException": { - "base": "

Error returned when the ID specified for a resource (e.g. a Maintenance Window) doesn’t exist.

", + "base": "

Error returned when the ID specified for a resource (e.g. a Maintenance Window) doesn't exist.

", "refs": { } }, @@ -1404,7 +1406,7 @@ "ErrorCount": { "base": null, "refs": { - "Command$ErrorCount": "

The number of targets for which the status is Failed or Execution Timed Out.

" + "Command$ErrorCount": "

The number of targets for which the status is Failed or Execution Timed Out.

" } }, "ExpirationDate": { @@ -1426,6 +1428,12 @@ "CreateAssociationBatchResult$Failed": "

Information about the associations that failed.

" } }, + "FailureDetails": { + "base": "

Information about an Automation failure.

", + "refs": { + "StepExecution$FailureDetails": "

Information about the Automation failure.

" + } + }, "Fault": { "base": null, "refs": { @@ -1594,7 +1602,7 @@ } }, "IdempotentParameterMismatch": { - "base": "

Error returned when an idempotent operation is retried and the parameters don’t match the original call to the API with the same idempotency token.

", + "base": "

Error returned when an idempotent operation is retried and the parameters don't match the original call to the API with the same idempotency token.

", "refs": { } }, @@ -1627,8 +1635,8 @@ "refs": { "AssociationDescription$OutputLocation": "

An Amazon S3 bucket where you want to store the output details of the request.

", "CreateAssociationBatchRequestEntry$OutputLocation": "

An Amazon S3 bucket where you want to store the results of this request.

", - "CreateAssociationRequest$OutputLocation": "

An Amazon S3 bucket where you want to store the output details of the request. For example:

\"{ \\\"S3Location\\\": { \\\"OutputS3Region\\\": \\\"<region>\\\", \\\"OutputS3BucketName\\\": \\\"bucket name\\\", \\\"OutputS3KeyPrefix\\\": \\\"folder name\\\" } }\"

", - "UpdateAssociationRequest$OutputLocation": "

An Amazon S3 bucket where you want to store the results of this request.

\"{ \\\"S3Location\\\": { \\\"OutputS3Region\\\": \\\"<region>\\\", \\\"OutputS3BucketName\\\": \\\"bucket name\\\", \\\"OutputS3KeyPrefix\\\": \\\"folder name\\\" } }\"

" + "CreateAssociationRequest$OutputLocation": "

An Amazon S3 bucket where you want to store the output details of the request.

", + "UpdateAssociationRequest$OutputLocation": "

An Amazon S3 bucket where you want to store the results of this request.

" } }, "InstanceAssociationOutputUrl": { @@ -1668,7 +1676,7 @@ "Association$InstanceId": "

The ID of the instance.

", "AssociationDescription$InstanceId": "

The ID of the instance.

", "CommandInvocation$InstanceId": "

The instance ID in which this invocation was requested.

", - "CreateAssociationBatchRequestEntry$InstanceId": "

The ID of the instance.

", + "CreateAssociationBatchRequestEntry$InstanceId": "

The ID of the instance.

", "CreateAssociationRequest$InstanceId": "

The instance ID.

", "DeleteAssociationRequest$InstanceId": "

The ID of the instance.

", "DescribeAssociationRequest$InstanceId": "

The instance ID.

", @@ -1698,7 +1706,7 @@ "CancelCommandRequest$InstanceIds": "

(Optional) A list of instance IDs on which you want to cancel the command. If not provided, the command is canceled on every instance on which it was requested.

", "Command$InstanceIds": "

The instance IDs against which this command was requested.

", "DescribeInstancePatchStatesRequest$InstanceIds": "

The ID of the instance whose patch state information should be retrieved.

", - "SendCommandRequest$InstanceIds": "

Required. The instance IDs where the command should execute. You can specify a maximum of 50 IDs.

" + "SendCommandRequest$InstanceIds": "

The instance IDs where the command should execute. You can specify a maximum of 50 IDs. If you prefer not to list individual instance IDs, you can instead send commands to a fleet of instances using the Targets parameter, which accepts EC2 tags.

" } }, "InstanceInformation": { @@ -1753,7 +1761,7 @@ "InstanceInformationStringFilterKey": { "base": null, "refs": { - "InstanceInformationStringFilter$Key": "

The filter key name to describe your instances. For example:

\"InstanceIds\"|\"AgentVersion\"|\"PingStatus\"|\"PlatformTypes\"|\"ActivationIds\"|\"IamRole\"|\"ResourceType\"|”AssociationStatus”|”Tag Key”

" + "InstanceInformationStringFilter$Key": "

The filter key name to describe your instances. For example:

\"InstanceIds\"|\"AgentVersion\"|\"PingStatus\"|\"PlatformTypes\"|\"ActivationIds\"|\"IamRole\"|\"ResourceType\"|\"AssociationStatus\"|\"Tag Key\"

" } }, "InstanceInformationStringFilterList": { @@ -1784,7 +1792,7 @@ "InstancePatchStateFilterList": { "base": null, "refs": { - "DescribeInstancePatchStatesForPatchGroupRequest$Filters": "

Each entry in the array is a structure containing:

Key (string 1 ≤ length ≤ 200)

Values (array containing a single string)

Type (string “Equal”, “NotEqual”, “LessThan”, “GreaterThan”)

" + "DescribeInstancePatchStatesForPatchGroupRequest$Filters": "

Each entry in the array is a structure containing:

Key (string between 1 and 200 characters)

Values (array containing a single string)

Type (string \"Equal\", \"NotEqual\", \"LessThan\", \"GreaterThan\")

" } }, "InstancePatchStateFilterValue": { @@ -1820,7 +1828,7 @@ "InstanceTagName": { "base": null, "refs": { - "CommandInvocation$InstanceName": "

The name of the invocation target. For Amazon EC2 instances this is the value for the aws:Name tag. For on-premises instances, this is the name of the instance.

" + "CommandInvocation$InstanceName": "

The name of the invocation target. For Amazon EC2 instances this is the value for the aws:Name tag. For on-premises instances, this is the name of the instance.

" } }, "Integer": { @@ -1828,10 +1836,10 @@ "refs": { "DescribePatchGroupStateResult$Instances": "

The number of instances in the patch group.

", "DescribePatchGroupStateResult$InstancesWithInstalledPatches": "

The number of instances with installed patches.

", - "DescribePatchGroupStateResult$InstancesWithInstalledOtherPatches": "

The number of instances with patches installed that aren’t defined in the patch baseline.

", + "DescribePatchGroupStateResult$InstancesWithInstalledOtherPatches": "

The number of instances with patches installed that aren't defined in the patch baseline.

", "DescribePatchGroupStateResult$InstancesWithMissingPatches": "

The number of instances with missing patches from the patch baseline.

", "DescribePatchGroupStateResult$InstancesWithFailedPatches": "

The number of instances with patches from the patch baseline that failed to install.

", - "DescribePatchGroupStateResult$InstancesWithNotApplicablePatches": "

The number of instances with patches that aren’t applicable.

" + "DescribePatchGroupStateResult$InstancesWithNotApplicablePatches": "

The number of instances with patches that aren't applicable.

" } }, "InternalServerError": { @@ -2066,8 +2074,8 @@ "InventoryItemContentHash": { "base": null, "refs": { - "InventoryItem$ContentHash": "

MD5 hash of the inventory item type contents. The content hash is used to determine whether to update inventory information. The PutInventory API does not update the inventory item type contents if the MD5 hash has not changed since last update.

", - "InventoryResultItem$ContentHash": "

MD5 hash of the inventory item type contents. The content hash is used to determine whether to update inventory information. The PutInventory API does not update the inventory item type contents if the MD5 hash has not changed since last update.

" + "InventoryItem$ContentHash": "

MD5 hash of the inventory item type contents. The content hash is used to determine whether to update inventory information. The PutInventory API does not update the inventory item type contents if the MD5 hash has not changed since last update.

", + "InventoryResultItem$ContentHash": "

MD5 hash of the inventory item type contents. The content hash is used to determine whether to update inventory information. The PutInventory API does not update the inventory item type contents if the MD5 hash has not changed since last update.

" } }, "InventoryItemEntry": { @@ -2115,14 +2123,14 @@ "base": null, "refs": { "InvalidItemContentException$TypeName": null, - "InventoryItem$TypeName": "

The name of the inventory type. Default inventory item type names start with AWS. Custom inventory type names will start with Custom. Default inventory item types include the following: AWS:AWSComponent, AWS:Application, AWS:InstanceInformation, AWS:Network, and AWS:WindowsUpdate.

", - "InventoryItemSchema$TypeName": "

The name of the inventory type. Default inventory item type names start with AWS. Custom inventory type names will start with Custom. Default inventory item types include the following: AWS:AWSComponent, AWS:Application, AWS:InstanceInformation, AWS:Network, and AWS:WindowsUpdate.

", + "InventoryItem$TypeName": "

The name of the inventory type. Default inventory item type names start with AWS. Custom inventory type names will start with Custom. Default inventory item types include the following: AWS:AWSComponent, AWS:Application, AWS:InstanceInformation, AWS:Network, and AWS:WindowsUpdate.

", + "InventoryItemSchema$TypeName": "

The name of the inventory type. Default inventory item type names start with AWS. Custom inventory type names will start with Custom. Default inventory item types include the following: AWS:AWSComponent, AWS:Application, AWS:InstanceInformation, AWS:Network, and AWS:WindowsUpdate.

", "InventoryResultItem$TypeName": "

The name of the inventory result item type.

", "ItemContentMismatchException$TypeName": null, "ItemSizeLimitExceededException$TypeName": null, "ListInventoryEntriesRequest$TypeName": "

The type of inventory item for which you want information.

", "ListInventoryEntriesResult$TypeName": "

The type of inventory item returned by the request.

", - "ResultAttribute$TypeName": "

Name of the inventory item type. Valid value: “AWS:InstanceInformation”. Default Value: “AWS:InstanceInformation”.

" + "ResultAttribute$TypeName": "

Name of the inventory item type. Valid value: AWS:InstanceInformation. Default Value: AWS:InstanceInformation.

" } }, "InventoryItemTypeNameFilter": { @@ -2437,10 +2445,10 @@ "refs": { "DescribeMaintenanceWindowExecutionTaskInvocationsRequest$Filters": "

Optional filters used to scope down the returned task invocations. The supported filter key is STATUS with the corresponding values PENDING, IN_PROGRESS, SUCCESS, FAILED, TIMED_OUT, CANCELLING, and CANCELLED.

", "DescribeMaintenanceWindowExecutionTasksRequest$Filters": "

Optional filters used to scope down the returned tasks. The supported filter key is STATUS with the corresponding values PENDING, IN_PROGRESS, SUCCESS, FAILED, TIMED_OUT, CANCELLING, and CANCELLED.

", - "DescribeMaintenanceWindowExecutionsRequest$Filters": "

Each entry in the array is a structure containing:

Key (string, 1 ≤ length ≤ 128)

Values (array of strings 1 ≤ length ≤ 256)

The supported Keys are ExecutedBefore and ExecutedAfter with the value being a date/time string such as 2016-11-04T05:00:00Z.

", - "DescribeMaintenanceWindowTargetsRequest$Filters": "

Optional filters that can be used to narrow down the scope of the returned window targets. The supported filter keys are Type, WindowTargetId and OwnerInformation.

", - "DescribeMaintenanceWindowTasksRequest$Filters": "

Optional filters used to narrow down the scope of the returned tasks. The supported filter keys are WindowTaskId, TaskArn, Priority, and TaskType.

", - "DescribeMaintenanceWindowsRequest$Filters": "

Optional filters used to narrow down the scope of the returned Maintenance Windows. Supported filter keys are Name and Enabled.

" + "DescribeMaintenanceWindowExecutionsRequest$Filters": "

Each entry in the array is a structure containing:

Key (string, between 1 and 128 characters)

Values (array of strings, each string is between 1 and 256 characters)

The supported Keys are ExecutedBefore and ExecutedAfter with the value being a date/time string such as 2016-11-04T05:00:00Z.

", + "DescribeMaintenanceWindowTargetsRequest$Filters": "

Optional filters that can be used to narrow down the scope of the returned window targets. The supported filter keys are Type, WindowTargetId and OwnerInformation.

", + "DescribeMaintenanceWindowTasksRequest$Filters": "

Optional filters used to narrow down the scope of the returned tasks. The supported filter keys are WindowTaskId, TaskArn, Priority, and TaskType.

", + "DescribeMaintenanceWindowsRequest$Filters": "

Optional filters used to narrow down the scope of the returned Maintenance Windows. Supported filter keys are Name and Enabled.

" } }, "MaintenanceWindowFilterValue": { @@ -2615,7 +2623,7 @@ "MaintenanceWindowTaskParametersList": { "base": null, "refs": { - "GetMaintenanceWindowExecutionTaskResult$TaskParameters": "

The parameters passed to the task when it was executed. The map has the following format:

Key: string, 1 ≤ length ≤ 255

Value: an array of strings where each string 1 ≤ length ≤ 255

" + "GetMaintenanceWindowExecutionTaskResult$TaskParameters": "

The parameters passed to the task when it was executed. The map has the following format:

Key: string, between 1 and 255 characters

Value: an array of strings, each string is between 1 and 255 characters

" } }, "MaintenanceWindowTaskPriority": { @@ -2651,11 +2659,11 @@ "MaxConcurrency": { "base": null, "refs": { - "Command$MaxConcurrency": "

The maximum number of instances that are allowed to execute the command at the same time. You can specify a number of instances, such as 10, or a percentage of instances, such as 10%. The default value is 50. For more information about how to use MaxConcurrency, see Executing a Command Using Systems Manager Run Command.

", + "Command$MaxConcurrency": "

The maximum number of instances that are allowed to execute the command at the same time. You can specify a number of instances, such as 10, or a percentage of instances, such as 10%. The default value is 50. For more information about how to use MaxConcurrency, see Executing a Command Using Systems Manager Run Command.

", "GetMaintenanceWindowExecutionTaskResult$MaxConcurrency": "

The defined maximum number of task executions that could be run in parallel.

", "MaintenanceWindowTask$MaxConcurrency": "

The maximum number of targets this task can be run for in parallel.

", "RegisterTaskWithMaintenanceWindowRequest$MaxConcurrency": "

The maximum number of targets this task can be run for in parallel.

", - "SendCommandRequest$MaxConcurrency": "

(Optional) The maximum number of instances that are allowed to execute the command at the same time. You can specify a number such as “10” or a percentage such as “10%”. The default value is 50. For more information about how to use MaxConcurrency, see Executing a Command Using Systems Manager Run Command.

" + "SendCommandRequest$MaxConcurrency": "

(Optional) The maximum number of instances that are allowed to execute the command at the same time. You can specify a number such as 10 or a percentage such as 10%. The default value is 50. For more information about how to use MaxConcurrency, see Executing a Command Using Systems Manager Run Command.

" } }, "MaxDocumentSizeExceeded": { @@ -2666,11 +2674,11 @@ "MaxErrors": { "base": null, "refs": { - "Command$MaxErrors": "

The maximum number of errors allowed before the system stops sending the command to additional targets. You can specify a number of errors, such as 10, or a percentage or errors, such as 10%. The default value is 50. For more information about how to use MaxErrors, see Executing a Command Using Systems Manager Run Command.

", + "Command$MaxErrors": "

The maximum number of errors allowed before the system stops sending the command to additional targets. You can specify a number of errors, such as 10, or a percentage or errors, such as 10%. The default value is 50. For more information about how to use MaxErrors, see Executing a Command Using Systems Manager Run Command.

", "GetMaintenanceWindowExecutionTaskResult$MaxErrors": "

The defined maximum number of task execution errors allowed before scheduling of the task execution would have been stopped.

", "MaintenanceWindowTask$MaxErrors": "

The maximum number of errors allowed before this task stops being scheduled.

", "RegisterTaskWithMaintenanceWindowRequest$MaxErrors": "

The maximum number of errors allowed before this task stops being scheduled.

", - "SendCommandRequest$MaxErrors": "

The maximum number of errors allowed without the command failing. When the command fails one more time beyond the value of MaxErrors, the systems stops sending the command to additional targets. You can specify a number like “10” or a percentage like “10%”. The default value is 50. For more information about how to use MaxErrors, see Executing a Command Using Systems Manager Run Command.

" + "SendCommandRequest$MaxErrors": "

The maximum number of errors allowed without the command failing. When the command fails one more time beyond the value of MaxErrors, the systems stops sending the command to additional targets. You can specify a number like 10 or a percentage like 10%. The default value is 50. For more information about how to use MaxErrors, see Executing a Command Using Systems Manager Run Command.

" } }, "MaxResults": { @@ -3019,7 +3027,7 @@ "PatchComplianceDataList": { "base": null, "refs": { - "DescribeInstancePatchesResult$Patches": "

Each entry in the array is a structure containing:

Title (string)

KBId (string)

Classification (string)

Severity (string)

State (string – “INSTALLED”, “INSTALLED_OTHER”, “MISSING”, “NOT_APPLICABLE”, “FAILED”)

InstalledTime (DateTime)

InstalledBy (string)

" + "DescribeInstancePatchesResult$Patches": "

Each entry in the array is a structure containing:

Title (string)

KBId (string)

Classification (string)

Severity (string)

State (string: \"INSTALLED\", \"INSTALLED OTHER\", \"MISSING\", \"NOT APPLICABLE\", \"FAILED\")

InstalledTime (DateTime)

InstalledBy (string)

" } }, "PatchComplianceDataState": { @@ -3131,7 +3139,7 @@ "PatchGroupPatchBaselineMappingList": { "base": null, "refs": { - "DescribePatchGroupsResult$Mappings": "

Each entry in the array contains:

PatchGroup: string (1 ≤ length ≤ 256, Regex: ^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-@]*)$)

PatchBaselineIdentity: A PatchBaselineIdentity element.

" + "DescribePatchGroupsResult$Mappings": "

Each entry in the array contains:

PatchGroup: string (between 1 and 256 characters, Regex: ^([\\p{L}\\p{Z}\\p{N}_.:/=+\\-@]*)$)

PatchBaselineIdentity: A PatchBaselineIdentity element.

" } }, "PatchId": { @@ -3182,7 +3190,7 @@ "PatchLanguage": { "base": null, "refs": { - "Patch$Language": "

The language of the patch if it’s language-specific.

" + "Patch$Language": "

The language of the patch if it's language-specific.

" } }, "PatchList": { @@ -3194,7 +3202,7 @@ "PatchMissingCount": { "base": null, "refs": { - "InstancePatchState$MissingCount": "

The number of patches from the patch baseline that are applicable for the instance but aren’t currently installed.

" + "InstancePatchState$MissingCount": "

The number of patches from the patch baseline that are applicable for the instance but aren't currently installed.

" } }, "PatchMsrcNumber": { @@ -3212,7 +3220,7 @@ "PatchNotApplicableCount": { "base": null, "refs": { - "InstancePatchState$NotApplicableCount": "

The number of patches from the patch baseline that aren’t applicable for the instance and hence aren’t installed on the instance.

" + "InstancePatchState$NotApplicableCount": "

The number of patches from the patch baseline that aren't applicable for the instance and hence aren't installed on the instance.

" } }, "PatchOperationEndTime": { @@ -3249,8 +3257,8 @@ "base": null, "refs": { "DescribeAvailablePatchesRequest$Filters": "

Filters used to scope down the returned patches.

", - "DescribeInstancePatchesRequest$Filters": "

Each entry in the array is a structure containing:

Key (string, 1 ≤ length ≤ 128)

Values (array of strings 1 ≤ length ≤ 256)

", - "DescribePatchBaselinesRequest$Filters": "

Each element in the array is a structure containing:

Key: (string, “NAME_PREFIX” or “OWNER”)

Value: (array of strings, exactly 1 entry, 1 ≤ length ≤ 255)

" + "DescribeInstancePatchesRequest$Filters": "

Each entry in the array is a structure containing:

Key (string, between 1 and 128 characters)

Values (array of strings, each string between 1 and 256 characters)

", + "DescribePatchBaselinesRequest$Filters": "

Each element in the array is a structure containing:

Key: (string, \"NAME_PREFIX\" or \"OWNER\")

Value: (array of strings, exactly 1 entry, between 1 and 255 characters)

" } }, "PatchOrchestratorFilterValue": { @@ -3462,7 +3470,7 @@ "base": null, "refs": { "CommandPlugin$ResponseCode": "

A numeric response code generated after executing the plugin.

", - "GetCommandInvocationResult$ResponseCode": "

The error level response code for the plugin script. If the response code is -1, then the command has not started executing on the instance, or it was not received by the instance.

" + "GetCommandInvocationResult$ResponseCode": "

The error level response code for the plugin script. If the response code is -1, then the command has not started executing on the instance, or it was not received by the instance.

" } }, "ResultAttribute": { @@ -3481,7 +3489,7 @@ "base": null, "refs": { "Command$OutputS3BucketName": "

The S3 bucket where the responses to the command executions should be stored. This was requested when issuing the command.

", - "CommandPlugin$OutputS3BucketName": "

The S3 bucket where the responses to the command executions should be stored. This was requested when issuing the command. For example, in the following response:

test_folder/ab19cb99-a030-46dd-9dfc-8eSAMPLEPre-Fix/i-1234567876543/awsrunShellScript

test_folder is the name of the Amazon S3 bucket;

ab19cb99-a030-46dd-9dfc-8eSAMPLEPre-Fix is the name of the S3 prefix;

i-1234567876543 is the instance ID;

awsrunShellScript is the name of the plugin.

", + "CommandPlugin$OutputS3BucketName": "

The S3 bucket where the responses to the command executions should be stored. This was requested when issuing the command. For example, in the following response:

test_folder/ab19cb99-a030-46dd-9dfc-8eSAMPLEPre-Fix/i-1234567876543/awsrunShellScript

test_folder is the name of the Amazon S3 bucket;

ab19cb99-a030-46dd-9dfc-8eSAMPLEPre-Fix is the name of the S3 prefix;

i-1234567876543 is the instance ID;

awsrunShellScript is the name of the plugin.

", "LoggingInfo$S3BucketName": "

The name of an Amazon S3 bucket where execution logs are stored .

", "S3OutputLocation$OutputS3BucketName": "

The name of the Amazon S3 bucket.

", "SendCommandRequest$OutputS3BucketName": "

The name of the S3 bucket where command execution responses should be stored.

" @@ -3491,7 +3499,7 @@ "base": null, "refs": { "Command$OutputS3KeyPrefix": "

The S3 directory path inside the bucket where the responses to the command executions should be stored. This was requested when issuing the command.

", - "CommandPlugin$OutputS3KeyPrefix": "

The S3 directory path inside the bucket where the responses to the command executions should be stored. This was requested when issuing the command. For example, in the following response:

test_folder/ab19cb99-a030-46dd-9dfc-8eSAMPLEPre-Fix/i-1234567876543/awsrunShellScript

test_folder is the name of the Amazon S3 bucket;

ab19cb99-a030-46dd-9dfc-8eSAMPLEPre-Fix is the name of the S3 prefix;

i-1234567876543 is the instance ID;

awsrunShellScript is the name of the plugin.

", + "CommandPlugin$OutputS3KeyPrefix": "

The S3 directory path inside the bucket where the responses to the command executions should be stored. This was requested when issuing the command. For example, in the following response:

test_folder/ab19cb99-a030-46dd-9dfc-8eSAMPLEPre-Fix/i-1234567876543/awsrunShellScript

test_folder is the name of the Amazon S3 bucket;

ab19cb99-a030-46dd-9dfc-8eSAMPLEPre-Fix is the name of the S3 prefix;

i-1234567876543 is the instance ID;

awsrunShellScript is the name of the plugin.

", "LoggingInfo$S3KeyPrefix": "

(Optional) The Amazon S3 bucket subfolder.

", "S3OutputLocation$OutputS3KeyPrefix": "

The Amazon S3 bucket subfolder.

", "SendCommandRequest$OutputS3KeyPrefix": "

The directory structure within the S3 bucket where the responses should be stored.

" @@ -3525,8 +3533,8 @@ "Association$ScheduleExpression": "

A cron expression that specifies a schedule when the association runs.

", "AssociationDescription$ScheduleExpression": "

A cron expression that specifies a schedule when the association runs.

", "CreateAssociationBatchRequestEntry$ScheduleExpression": "

A cron expression that specifies a schedule when the association runs.

", - "CreateAssociationRequest$ScheduleExpression": "

A cron expression when the association will be applied to the target(s). Supported expressions are every half, 1, 2, 4, 8 or 12 hour(s); every specified day and time of the week. For example: cron(0 0/30 * 1/1 * ? *) to run every thirty minutes; cron(0 0 0/4 1/1 * ? *) to run every four hours; and cron(0 0 10 ? * SUN *) to run every Sunday at 10 a.m.

", - "UpdateAssociationRequest$ScheduleExpression": "

The cron expression used to schedule the association that you want to update. Supported expressions are every half, 1, 2, 4, 8 or 12 hour(s); every specified day and time of the week. For example: cron(0 0/30 * 1/1 * ? *) to run every thirty minutes; cron(0 0 0/4 1/1 * ? *) to run every four hours; and cron(0 0 10 ? * SUN *) to run every Sunday at 10 a.m.

" + "CreateAssociationRequest$ScheduleExpression": "

A cron expression when the association will be applied to the target(s).

", + "UpdateAssociationRequest$ScheduleExpression": "

The cron expression used to schedule the association that you want to update.

" } }, "SendCommandRequest": { @@ -3573,7 +3581,7 @@ "StandardOutputContent": { "base": null, "refs": { - "GetCommandInvocationResult$StandardOutputContent": "

The first 24,000 characters written by the plugin to stdout. If the command has not finished executing, if ExecutionStatus is neither Succeeded nor Failed, then this string is empty.

" + "GetCommandInvocationResult$StandardOutputContent": "

The first 24,000 characters written by the plugin to stdout. If the command has not finished executing, if ExecutionStatus is neither Succeeded nor Failed, then this string is empty.

" } }, "StartAutomationExecutionRequest": { @@ -3595,10 +3603,10 @@ "StatusDetails": { "base": null, "refs": { - "Command$StatusDetails": "

A detailed status of the command execution. StatusDetails includes more information than Status because it includes states resulting from error and concurrency control parameters. StatusDetails can show different results than Status. For more information about these statuses, see Run Command Status. StatusDetails can be one of the following values:

  • Pending – The command has not been sent to any instances.

  • In Progress – The command has been sent to at least one instance but has not reached a final state on all instances.

  • Success – The command successfully executed on all invocations. This is a terminal state.

  • Delivery Timed Out – The value of MaxErrors or more command invocations shows a status of Delivery Timed Out. This is a terminal state.

  • Execution Timed Out – The value of MaxErrors or more command invocations shows a status of Execution Timed Out. This is a terminal state.

  • Failed – The value of MaxErrors or more command invocations shows a status of Failed. This is a terminal state.

  • Incomplete – The command was attempted on all instances and one or more invocations does not have a value of Success but not enough invocations failed for the status to be Failed. This is a terminal state.

  • Canceled – The command was terminated before it was completed. This is a terminal state.

  • Rate Exceeded – The number of instances targeted by the command exceeded the account limit for pending invocations. The system has canceled the command before executing it on any instance. This is a terminal state.

", - "CommandInvocation$StatusDetails": "

A detailed status of the command execution for each invocation (each instance targeted by the command). StatusDetails includes more information than Status because it includes states resulting from error and concurrency control parameters. StatusDetails can show different results than Status. For more information about these statuses, see Run Command Status. StatusDetails can be one of the following values:

  • Pending – The command has not been sent to the instance.

  • In Progress – The command has been sent to the instance but has not reached a terminal state.

  • Success – The execution of the command or plugin was successfully completed. This is a terminal state.

  • Delivery Timed Out – The command was not delivered to the instance before the delivery timeout expired. Delivery timeouts do not count against the parent command’s MaxErrors limit, but they do contribute to whether the parent command status is Success or Incomplete. This is a terminal state.

  • Execution Timed Out – Command execution started on the instance, but the execution was not complete before the execution timeout expired. Execution timeouts count against the MaxErrors limit of the parent command. This is a terminal state.

  • Failed – The command was not successful on the instance. For a plugin, this indicates that the result code was not zero. For a command invocation, this indicates that the result code for one or more plugins was not zero. Invocation failures count against the MaxErrors limit of the parent command. This is a terminal state.

  • Canceled – The command was terminated before it was completed. This is a terminal state.

  • Undeliverable – The command can't be delivered to the instance. The instance might not exist or might not be responding. Undeliverable invocations don't count against the parent command’s MaxErrors limit and don't contribute to whether the parent command status is Success or Incomplete. This is a terminal state.

  • Terminated – The parent command exceeded its MaxErrors limit and subsequent command invocations were canceled by the system. This is a terminal state.

", - "CommandPlugin$StatusDetails": "

A detailed status of the plugin execution. StatusDetails includes more information than Status because it includes states resulting from error and concurrency control parameters. StatusDetails can show different results than Status. For more information about these statuses, see Run Command Status. StatusDetails can be one of the following values:

  • Pending – The command has not been sent to the instance.

  • In Progress – The command has been sent to the instance but has not reached a terminal state.

  • Success – The execution of the command or plugin was successfully completed. This is a terminal state.

  • Delivery Timed Out – The command was not delivered to the instance before the delivery timeout expired. Delivery timeouts do not count against the parent command’s MaxErrors limit, but they do contribute to whether the parent command status is Success or Incomplete. This is a terminal state.

  • Execution Timed Out – Command execution started on the instance, but the execution was not complete before the execution timeout expired. Execution timeouts count against the MaxErrors limit of the parent command. This is a terminal state.

  • Failed – The command was not successful on the instance. For a plugin, this indicates that the result code was not zero. For a command invocation, this indicates that the result code for one or more plugins was not zero. Invocation failures count against the MaxErrors limit of the parent command. This is a terminal state.

  • Canceled – The command was terminated before it was completed. This is a terminal state.

  • Undeliverable – The command can't be delivered to the instance. The instance might not exist, or it might not be responding. Undeliverable invocations don't count against the parent command’s MaxErrors limit, and they don't contribute to whether the parent command status is Success or Incomplete. This is a terminal state.

  • Terminated – The parent command exceeded its MaxErrors limit and subsequent command invocations were canceled by the system. This is a terminal state.

", - "GetCommandInvocationResult$StatusDetails": "

A detailed status of the command execution for an invocation. StatusDetails includes more information than Status because it includes states resulting from error and concurrency control parameters. StatusDetails can show different results than Status. For more information about these statuses, see Run Command Status. StatusDetails can be one of the following values:

  • Pending – The command has not been sent to the instance.

  • In Progress – The command has been sent to the instance but has not reached a terminal state.

  • Delayed – The system attempted to send the command to the target, but the target was not available. The instance might not be available because of network issues, the instance was stopped, etc. The system will try to deliver the command again.

  • Success – The command or plugin was executed successfully. This is a terminal state.

  • Delivery Timed Out – The command was not delivered to the instance before the delivery timeout expired. Delivery timeouts do not count against the parent command’s MaxErrors limit, but they do contribute to whether the parent command status is Success or Incomplete. This is a terminal state.

  • Execution Timed Out – The command started to execute on the instance, but the execution was not complete before the timeout expired. Execution timeouts count against the MaxErrors limit of the parent command. This is a terminal state.

  • Failed – The command wasn't executed successfully on the instance. For a plugin, this indicates that the result code was not zero. For a command invocation, this indicates that the result code for one or more plugins was not zero. Invocation failures count against the MaxErrors limit of the parent command. This is a terminal state.

  • Canceled – The command was terminated before it was completed. This is a terminal state.

  • Undeliverable – The command can't be delivered to the instance. The instance might not exist or might not be responding. Undeliverable invocations don't count against the parent command’s MaxErrors limit and don't contribute to whether the parent command status is Success or Incomplete. This is a terminal state.

  • Terminated – The parent command exceeded its MaxErrors limit and subsequent command invocations were canceled by the system. This is a terminal state.

" + "Command$StatusDetails": "

A detailed status of the command execution. StatusDetails includes more information than Status because it includes states resulting from error and concurrency control parameters. StatusDetails can show different results than Status. For more information about these statuses, see Run Command Status. StatusDetails can be one of the following values:

  • Pending: The command has not been sent to any instances.

  • In Progress: The command has been sent to at least one instance but has not reached a final state on all instances.

  • Success: The command successfully executed on all invocations. This is a terminal state.

  • Delivery Timed Out: The value of MaxErrors or more command invocations shows a status of Delivery Timed Out. This is a terminal state.

  • Execution Timed Out: The value of MaxErrors or more command invocations shows a status of Execution Timed Out. This is a terminal state.

  • Failed: The value of MaxErrors or more command invocations shows a status of Failed. This is a terminal state.

  • Incomplete: The command was attempted on all instances and one or more invocations does not have a value of Success but not enough invocations failed for the status to be Failed. This is a terminal state.

  • Canceled: The command was terminated before it was completed. This is a terminal state.

  • Rate Exceeded: The number of instances targeted by the command exceeded the account limit for pending invocations. The system has canceled the command before executing it on any instance. This is a terminal state.

", + "CommandInvocation$StatusDetails": "

A detailed status of the command execution for each invocation (each instance targeted by the command). StatusDetails includes more information than Status because it includes states resulting from error and concurrency control parameters. StatusDetails can show different results than Status. For more information about these statuses, see Run Command Status. StatusDetails can be one of the following values:

  • Pending: The command has not been sent to the instance.

  • In Progress: The command has been sent to the instance but has not reached a terminal state.

  • Success: The execution of the command or plugin was successfully completed. This is a terminal state.

  • Delivery Timed Out: The command was not delivered to the instance before the delivery timeout expired. Delivery timeouts do not count against the parent command's MaxErrors limit, but they do contribute to whether the parent command status is Success or Incomplete. This is a terminal state.

  • Execution Timed Out: Command execution started on the instance, but the execution was not complete before the execution timeout expired. Execution timeouts count against the MaxErrors limit of the parent command. This is a terminal state.

  • Failed: The command was not successful on the instance. For a plugin, this indicates that the result code was not zero. For a command invocation, this indicates that the result code for one or more plugins was not zero. Invocation failures count against the MaxErrors limit of the parent command. This is a terminal state.

  • Canceled: The command was terminated before it was completed. This is a terminal state.

  • Undeliverable: The command can't be delivered to the instance. The instance might not exist or might not be responding. Undeliverable invocations don't count against the parent command's MaxErrors limit and don't contribute to whether the parent command status is Success or Incomplete. This is a terminal state.

  • Terminated: The parent command exceeded its MaxErrors limit and subsequent command invocations were canceled by the system. This is a terminal state.

", + "CommandPlugin$StatusDetails": "

A detailed status of the plugin execution. StatusDetails includes more information than Status because it includes states resulting from error and concurrency control parameters. StatusDetails can show different results than Status. For more information about these statuses, see Run Command Status. StatusDetails can be one of the following values:

  • Pending: The command has not been sent to the instance.

  • In Progress: The command has been sent to the instance but has not reached a terminal state.

  • Success: The execution of the command or plugin was successfully completed. This is a terminal state.

  • Delivery Timed Out: The command was not delivered to the instance before the delivery timeout expired. Delivery timeouts do not count against the parent command's MaxErrors limit, but they do contribute to whether the parent command status is Success or Incomplete. This is a terminal state.

  • Execution Timed Out: Command execution started on the instance, but the execution was not complete before the execution timeout expired. Execution timeouts count against the MaxErrors limit of the parent command. This is a terminal state.

  • Failed: The command was not successful on the instance. For a plugin, this indicates that the result code was not zero. For a command invocation, this indicates that the result code for one or more plugins was not zero. Invocation failures count against the MaxErrors limit of the parent command. This is a terminal state.

  • Canceled: The command was terminated before it was completed. This is a terminal state.

  • Undeliverable: The command can't be delivered to the instance. The instance might not exist, or it might not be responding. Undeliverable invocations don't count against the parent command's MaxErrors limit, and they don't contribute to whether the parent command status is Success or Incomplete. This is a terminal state.

  • Terminated: The parent command exceeded its MaxErrors limit and subsequent command invocations were canceled by the system. This is a terminal state.

", + "GetCommandInvocationResult$StatusDetails": "

A detailed status of the command execution for an invocation. StatusDetails includes more information than Status because it includes states resulting from error and concurrency control parameters. StatusDetails can show different results than Status. For more information about these statuses, see Run Command Status. StatusDetails can be one of the following values:

  • Pending: The command has not been sent to the instance.

  • In Progress: The command has been sent to the instance but has not reached a terminal state.

  • Delayed: The system attempted to send the command to the target, but the target was not available. The instance might not be available because of network issues, the instance was stopped, etc. The system will try to deliver the command again.

  • Success: The command or plugin was executed successfully. This is a terminal state.

  • Delivery Timed Out: The command was not delivered to the instance before the delivery timeout expired. Delivery timeouts do not count against the parent command's MaxErrors limit, but they do contribute to whether the parent command status is Success or Incomplete. This is a terminal state.

  • Execution Timed Out: The command started to execute on the instance, but the execution was not complete before the timeout expired. Execution timeouts count against the MaxErrors limit of the parent command. This is a terminal state.

  • Failed: The command wasn't executed successfully on the instance. For a plugin, this indicates that the result code was not zero. For a command invocation, this indicates that the result code for one or more plugins was not zero. Invocation failures count against the MaxErrors limit of the parent command. This is a terminal state.

  • Canceled: The command was terminated before it was completed. This is a terminal state.

  • Undeliverable: The command can't be delivered to the instance. The instance might not exist or might not be responding. Undeliverable invocations don't count against the parent command's MaxErrors limit and don't contribute to whether the parent command status is Success or Incomplete. This is a terminal state.

  • Terminated: The parent command exceeded its MaxErrors limit and subsequent command invocations were canceled by the system. This is a terminal state.

" } }, "StatusMessage": { @@ -3610,7 +3618,7 @@ "StatusName": { "base": null, "refs": { - "AssociationOverview$Status": "

The status of the association. Status can be: Pending, Success, or Failed.

", + "AssociationOverview$Status": "

The status of the association. Status can be: Pending, Success, or Failed.

", "AssociationOverview$DetailedStatus": "

A detailed status of the association.

", "AssociationStatusAggregatedCount$key": null, "InstanceAggregatedAssociationOverview$DetailedStatus": "

Detailed status information about the aggregated associations.

", @@ -3666,6 +3674,8 @@ "DocumentVersionLimitExceeded$Message": null, "DoesNotExistException$Message": null, "DuplicateDocumentContent$Message": null, + "FailureDetails$FailureStage": "

The stage of the Automation execution when the failure occurred. The stages include the following: InputValidation, PreVerification, Invocation, PostVerification.

", + "FailureDetails$FailureType": "

The type of Automation failure. Failure types include the following: Action, Permission, Throttling, Verification, Internal.

", "IdempotentParameterMismatch$Message": null, "InstanceInformation$PlatformName": "

The name of the operating system platform running on your instance.

", "InstanceInformation$PlatformVersion": "

The version of the OS platform running on your instance.

", @@ -3723,7 +3733,7 @@ "base": null, "refs": { "GetCommandInvocationResult$ExecutionStartDateTime": "

The date and time the plugin started executing. Date and time are written in ISO 8601 format. For example, August 28, 2016 is represented as 2016-08-28. If the plugin has not started to execute, the string is empty.

", - "GetCommandInvocationResult$ExecutionElapsedTime": "

Duration since ExecutionStartDateTime.

", + "GetCommandInvocationResult$ExecutionElapsedTime": "

Duration since ExecutionStartDateTime.

", "GetCommandInvocationResult$ExecutionEndDateTime": "

The date and time the plugin was finished executing. Date and time are written in ISO 8601 format. For example, August 28, 2016 is represented as 2016-08-28. If the plugin has not started to execute, the string is empty.

" } }, @@ -3760,7 +3770,7 @@ } }, "Target": { - "base": "

An array of search criteria that targets instances using a Key,Value combination that you specify. Targets is required if you don't provide one or more instance IDs in the call.

", + "base": "

An array of search criteria that targets instances using a Key,Value combination that you specify. Targets is required if you don't provide one or more instance IDs in the call.

", "refs": { "Targets$member": null } @@ -3774,7 +3784,7 @@ "TargetKey": { "base": null, "refs": { - "Target$Key": "

User-defined criteria for sending commands that target instances that meet the criteria. Key can be tag:<Amazon EC2 tag> or InstanceIds. For more information about how to send commands that target instances using Key,Value parameters, see Executing a Command Using Systems Manager Run Command.

" + "Target$Key": "

User-defined criteria for sending commands that target instances that meet the criteria. Key can be tag:<Amazon EC2 tag> or InstanceIds. For more information about how to send commands that target instances using Key,Value parameters, see Executing a Command Using Systems Manager Run Command.

" } }, "TargetValue": { @@ -3786,7 +3796,7 @@ "TargetValues": { "base": null, "refs": { - "Target$Values": "

User-defined criteria that maps to Key. For example, if you specified tag:ServerRole, you could specify value:WebServer to execute a command on instances that include Amazon EC2 tags of ServerRole,WebServer. For more information about how to send commands that target instances using Key,Value parameters, see Executing a Command Using Systems Manager Run Command.

" + "Target$Values": "

User-defined criteria that maps to Key. For example, if you specified tag:ServerRole, you could specify value:WebServer to execute a command on instances that include Amazon EC2 tags of ServerRole,WebServer. For more information about how to send commands that target instances using Key,Value parameters, see Executing a Command Using Systems Manager Run Command.

" } }, "Targets": { @@ -3794,14 +3804,15 @@ "refs": { "Association$Targets": "

The instances targeted by the request to create an association.

", "AssociationDescription$Targets": "

The instances targeted by the request.

", - "Command$Targets": "

An array of search criteria that targets instances using a Key,Value combination that you specify. Targets is required if you don't provide one or more instance IDs in the call.

", + "Command$Targets": "

An array of search criteria that targets instances using a Key,Value combination that you specify. Targets is required if you don't provide one or more instance IDs in the call.

", "CreateAssociationBatchRequestEntry$Targets": "

The instances targeted by the request.

", - "CreateAssociationRequest$Targets": "

The targets (either instances or tags) for the association. Instances are specified using Key=instanceids,Values=<instanceid1>,<instanceid2>. Tags are specified using Key=<tag name>,Values=<tag value>.

", + "CreateAssociationRequest$Targets": "

The targets (either instances or tags) for the association.

", "MaintenanceWindowTarget$Targets": "

The targets (either instances or tags). Instances are specified using Key=instanceids,Values=<instanceid1>,<instanceid2>. Tags are specified using Key=<tag name>,Values=<tag value>.

", "MaintenanceWindowTask$Targets": "

The targets (either instances or tags). Instances are specified using Key=instanceids,Values=<instanceid1>,<instanceid2>. Tags are specified using Key=<tag name>,Values=<tag value>.

", "RegisterTargetWithMaintenanceWindowRequest$Targets": "

The targets (either instances or tags). Instances are specified using Key=instanceids,Values=<instanceid1>,<instanceid2>. Tags are specified using Key=<tag name>,Values=<tag value>.

", "RegisterTaskWithMaintenanceWindowRequest$Targets": "

The targets (either instances or tags). Instances are specified using Key=instanceids,Values=<instanceid1>,<instanceid2>. Tags are specified using Key=<tag name>,Values=<tag value>.

", - "SendCommandRequest$Targets": "

(Optional) An array of search criteria that targets instances using a Key,Value combination that you specify. Targets is required if you don't provide one or more instance IDs in the call. For more information about how to use Targets, see Executing a Command Using Systems Manager Run Command.

" + "SendCommandRequest$Targets": "

(Optional) An array of search criteria that targets instances using a Key,Value combination that you specify. Targets is required if you don't provide one or more instance IDs in the call. For more information about how to use Targets, see Executing a Command Using Systems Manager Run Command.

", + "UpdateAssociationRequest$Targets": "

The targets of the association.

" } }, "TimeoutSeconds": { @@ -3811,7 +3822,7 @@ } }, "TooManyTagsError": { - "base": "

The Targets parameter includes too many tags. Remove one or more tags and try the command again.

", + "base": "

The Targets parameter includes too many tags. Remove one or more tags and try the command again.

", "refs": { } }, @@ -3826,7 +3837,7 @@ } }, "UnsupportedInventorySchemaVersionException": { - "base": "

Inventory item type schema version has to match supported versions in the service. Check output of GetInventorySchema to see the available schema version for each type.

", + "base": "

Inventory item type schema version has to match supported versions in the service. Check output of GetInventorySchema to see the available schema version for each type.

", "refs": { } }, @@ -3913,8 +3924,8 @@ "Url": { "base": null, "refs": { - "CommandInvocation$StandardOutputUrl": "

The URL to the plugin’s StdOut file in Amazon S3, if the Amazon S3 bucket was defined for the parent command. For an invocation, StandardOutputUrl is populated if there is just one plugin defined for the command, and the Amazon S3 bucket was defined for the command.

", - "CommandInvocation$StandardErrorUrl": "

The URL to the plugin’s StdErr file in Amazon S3, if the Amazon S3 bucket was defined for the parent command. For an invocation, StandardErrorUrl is populated if there is just one plugin defined for the command, and the Amazon S3 bucket was defined for the command.

", + "CommandInvocation$StandardOutputUrl": "

The URL to the plugin's StdOut file in Amazon S3, if the Amazon S3 bucket was defined for the parent command. For an invocation, StandardOutputUrl is populated if there is just one plugin defined for the command, and the Amazon S3 bucket was defined for the command.

", + "CommandInvocation$StandardErrorUrl": "

The URL to the plugin's StdErr file in Amazon S3, if the Amazon S3 bucket was defined for the parent command. For an invocation, StandardErrorUrl is populated if there is just one plugin defined for the command, and the Amazon S3 bucket was defined for the command.

", "CommandPlugin$StandardOutputUrl": "

The URL for the complete text written by the plugin to stdout in Amazon S3. If the Amazon S3 bucket for the command was not specified, then this string is empty.

", "CommandPlugin$StandardErrorUrl": "

The URL for the complete text written by the plugin to stderr. If execution is not yet complete, then this string is empty.

", "GetCommandInvocationResult$StandardOutputUrl": "

The URL for the complete text written by the plugin to stdout in Amazon S3. If an Amazon S3 bucket was not specified, then this string is empty.

", diff --git a/vendor/github.com/aws/aws-sdk-go/models/endpoints/endpoints.json b/vendor/github.com/aws/aws-sdk-go/models/endpoints/endpoints.json index 78d29d0a4..dd4b532eb 100644 --- a/vendor/github.com/aws/aws-sdk-go/models/endpoints/endpoints.json +++ b/vendor/github.com/aws/aws-sdk-go/models/endpoints/endpoints.json @@ -1,2006 +1,1886 @@ { - "partitions": [ - { - "defaults": { - "hostname": "{service}.{region}.{dnsSuffix}", - "protocols": [ - "https" - ], - "signatureVersions": [ - "v4" - ] + "partitions" : [ { + "defaults" : { + "hostname" : "{service}.{region}.{dnsSuffix}", + "protocols" : [ "https" ], + "signatureVersions" : [ "v4" ] + }, + "dnsSuffix" : "amazonaws.com", + "partition" : "aws", + "partitionName" : "AWS Standard", + "regionRegex" : "^(us|eu|ap|sa|ca)\\-\\w+\\-\\d+$", + "regions" : { + "ap-northeast-1" : { + "description" : "Asia Pacific (Tokyo)" }, - "dnsSuffix": "amazonaws.com", - "partition": "aws", - "partitionName": "AWS Standard", - "regionRegex": "^(us|eu|ap|sa|ca)\\-\\w+\\-\\d+$", - "regions": { - "ap-northeast-1": { - "description": "Asia Pacific (Tokyo)" - }, - "ap-northeast-2": { - "description": "Asia Pacific (Seoul)" - }, - "ap-south-1": { - "description": "Asia Pacific (Mumbai)" - }, - "ap-southeast-1": { - "description": "Asia Pacific (Singapore)" - }, - "ap-southeast-2": { - "description": "Asia Pacific (Sydney)" - }, - "ca-central-1": { - "description": "Canada (Central)" - }, - "eu-central-1": { - "description": "EU (Frankfurt)" - }, - "eu-west-1": { - "description": "EU (Ireland)" - }, - "eu-west-2": { - "description": "EU (London)" - }, - "sa-east-1": { - "description": "South America (Sao Paulo)" - }, - "us-east-1": { - "description": "US East (N. Virginia)" - }, - "us-east-2": { - "description": "US East (Ohio)" - }, - "us-west-1": { - "description": "US West (N. California)" - }, - "us-west-2": { - "description": "US West (Oregon)" - } + "ap-northeast-2" : { + "description" : "Asia Pacific (Seoul)" }, - "services": { - "acm": { - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "apigateway": { - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "application-autoscaling": { - "defaults": { - "credentialScope": { - "service": "application-autoscaling" - }, - "hostname": "autoscaling.{region}.amazonaws.com", - "protocols": [ - "http", - "https" - ] - }, - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "appstream2": { - "defaults": { - "credentialScope": { - "service": "appstream" - }, - "protocols": [ - "https" - ] - }, - "endpoints": { - "ap-northeast-1": {}, - "eu-west-1": {}, - "us-east-1": {}, - "us-west-2": {} - } - }, - "autoscaling": { - "defaults": { - "protocols": [ - "http", - "https" - ] - }, - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "batch": { - "endpoints": { - "us-east-1": {} - } - }, - "budgets": { - "endpoints": { - "aws-global": { - "credentialScope": { - "region": "us-east-1" - }, - "hostname": "budgets.amazonaws.com" - } - }, - "isRegionalized": false, - "partitionEndpoint": "aws-global" - }, - "clouddirectory": { - "endpoints": { - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-2": {} - } - }, - "cloudformation": { - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "cloudfront": { - "endpoints": { - "aws-global": { - "credentialScope": { - "region": "us-east-1" - }, - "hostname": "cloudfront.amazonaws.com", - "protocols": [ - "http", - "https" - ] - } - }, - "isRegionalized": false, - "partitionEndpoint": "aws-global" - }, - "cloudhsm": { - "endpoints": { - "ap-northeast-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "cloudsearch": { - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "cloudtrail": { - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "codebuild": { - "endpoints": { - "ap-northeast-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-2": {} - } - }, - "codecommit": { - "endpoints": { - "eu-west-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-2": {} - } - }, - "codedeploy": { - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "codepipeline": { - "endpoints": { - "ap-northeast-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-2": {} - } - }, - "codestar": { - "endpoints": { - "eu-west-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-2": {} - } - }, - "cognito-identity": { - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-2": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-2": {} - } - }, - "cognito-idp": { - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-2": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-2": {} - } - }, - "cognito-sync": { - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-2": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-2": {} - } - }, - "config": { - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "cur": { - "endpoints": { - "us-east-1": {} - } - }, - "data.iot": { - "defaults": { - "credentialScope": { - "service": "iotdata" - }, - "protocols": [ - "https" - ] - }, - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "us-east-1": {}, - "us-west-2": {} - } - }, - "datapipeline": { - "endpoints": { - "ap-northeast-1": {}, - "ap-southeast-2": {}, - "eu-west-1": {}, - "us-east-1": {}, - "us-west-2": {} - } - }, - "devicefarm": { - "endpoints": { - "us-west-2": {} - } - }, - "directconnect": { - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "discovery": { - "endpoints": { - "us-west-2": {} - } - }, - "dms": { - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "ds": { - "endpoints": { - "ap-northeast-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "us-east-1": {}, - "us-west-2": {} - } - }, - "dynamodb": { - "defaults": { - "protocols": [ - "http", - "https" - ] - }, - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "local": { - "credentialScope": { - "region": "us-east-1" - }, - "hostname": "localhost:8000", - "protocols": [ - "http" - ] - }, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "ec2": { - "defaults": { - "protocols": [ - "http", - "https" - ] - }, - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "ecr": { - "endpoints": { - "ap-northeast-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "ecs": { - "endpoints": { - "ap-northeast-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "elasticache": { - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "elasticbeanstalk": { - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "elasticfilesystem": { - "endpoints": { - "ap-southeast-2": {}, - "eu-west-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-2": {} - } - }, - "elasticloadbalancing": { - "defaults": { - "protocols": [ - "http", - "https" - ] - }, - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "elasticmapreduce": { - "defaults": { - "protocols": [ - "http", - "https" - ], - "sslCommonName": "{region}.{service}.{dnsSuffix}" - }, - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": { - "sslCommonName": "{service}.{region}.{dnsSuffix}" - }, - "eu-west-1": {}, - "eu-west-2": {}, - "sa-east-1": {}, - "us-east-1": { - "sslCommonName": "{service}.{region}.{dnsSuffix}" - }, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "elastictranscoder": { - "endpoints": { - "ap-northeast-1": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "eu-west-1": {}, - "us-east-1": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "email": { - "endpoints": { - "eu-west-1": {}, - "us-east-1": {}, - "us-west-2": {} - } - }, - "entitlement.marketplace": { - "defaults": { - "credentialScope": { - "service": "aws-marketplace" - } - }, - "endpoints": { - "us-east-1": {} - } - }, - "es": { - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "events": { - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "firehose": { - "endpoints": { - "eu-west-1": {}, - "us-east-1": {}, - "us-west-2": {} - } - }, - "gamelift": { - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-west-2": {} - } - }, - "glacier": { - "defaults": { - "protocols": [ - "http", - "https" - ] - }, - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "health": { - "endpoints": { - "us-east-1": {} - } - }, - "iam": { - "endpoints": { - "aws-global": { - "credentialScope": { - "region": "us-east-1" - }, - "hostname": "iam.amazonaws.com" - } - }, - "isRegionalized": false, - "partitionEndpoint": "aws-global" - }, - "importexport": { - "endpoints": { - "aws-global": { - "credentialScope": { - "region": "us-east-1", - "service": "IngestionService" - }, - "hostname": "importexport.amazonaws.com", - "signatureVersions": [ - "v2", - "v4" - ] - } - }, - "isRegionalized": false, - "partitionEndpoint": "aws-global" - }, - "inspector": { - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-2": {}, - "eu-west-1": {}, - "us-east-1": {}, - "us-west-2": {} - } - }, - "iot": { - "defaults": { - "credentialScope": { - "service": "execute-api" - } - }, - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-2": {} - } - }, - "kinesis": { - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "kinesisanalytics": { - "endpoints": { - "eu-west-1": {}, - "us-east-1": {}, - "us-west-2": {} - } - }, - "kms": { - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "lambda": { - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "lightsail": { - "endpoints": { - "us-east-1": {} - } - }, - "logs": { - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "machinelearning": { - "endpoints": { - "eu-west-1": {}, - "us-east-1": {} - } - }, - "marketplacecommerceanalytics": { - "endpoints": { - "us-east-1": {} - } - }, - "metering.marketplace": { - "defaults": { - "credentialScope": { - "service": "aws-marketplace" - } - }, - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "mobileanalytics": { - "endpoints": { - "us-east-1": {} - } - }, - "models.lex": { - "defaults": { - "credentialScope": { - "service": "lex" - } - }, - "endpoints": { - "us-east-1": {} - } - }, - "monitoring": { - "defaults": { - "protocols": [ - "http", - "https" - ] - }, - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "mturk-requester": { - "endpoints": { - "sandbox": { - "hostname": "mturk-requester-sandbox.us-east-1.amazonaws.com" - }, - "us-east-1": {} - }, - "isRegionalized": false - }, - "opsworks": { - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "opsworks-cm": { - "endpoints": { - "eu-west-1": {}, - "us-east-1": {}, - "us-west-2": {} - } - }, - "organizations": { - "endpoints": { - "aws-global": { - "credentialScope": { - "region": "us-east-1" - }, - "hostname": "organizations.us-east-1.amazonaws.com" - } - }, - "isRegionalized": false, - "partitionEndpoint": "aws-global" - }, - "pinpoint": { - "defaults": { - "credentialScope": { - "service": "mobiletargeting" - } - }, - "endpoints": { - "us-east-1": {} - } - }, - "polly": { - "endpoints": { - "eu-west-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-2": {} - } - }, - "rds": { - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "sa-east-1": {}, - "us-east-1": { - "sslCommonName": "{service}.{dnsSuffix}" - }, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "redshift": { - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "rekognition": { - "endpoints": { - "eu-west-1": {}, - "us-east-1": {}, - "us-west-2": {} - } - }, - "route53": { - "endpoints": { - "aws-global": { - "credentialScope": { - "region": "us-east-1" - }, - "hostname": "route53.amazonaws.com" - } - }, - "isRegionalized": false, - "partitionEndpoint": "aws-global" - }, - "route53domains": { - "endpoints": { - "us-east-1": {} - } - }, - "runtime.lex": { - "defaults": { - "credentialScope": { - "service": "lex" - } - }, - "endpoints": { - "us-east-1": {} - } - }, - "s3": { - "defaults": { - "protocols": [ - "http", - "https" - ], - "signatureVersions": [ - "s3v4" - ] - }, - "endpoints": { - "ap-northeast-1": { - "hostname": "s3-ap-northeast-1.amazonaws.com", - "signatureVersions": [ - "s3", - "s3v4" - ] - }, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": { - "hostname": "s3-ap-southeast-1.amazonaws.com", - "signatureVersions": [ - "s3", - "s3v4" - ] - }, - "ap-southeast-2": { - "hostname": "s3-ap-southeast-2.amazonaws.com", - "signatureVersions": [ - "s3", - "s3v4" - ] - }, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": { - "hostname": "s3-eu-west-1.amazonaws.com", - "signatureVersions": [ - "s3", - "s3v4" - ] - }, - "eu-west-2": {}, - "s3-external-1": { - "credentialScope": { - "region": "us-east-1" - }, - "hostname": "s3-external-1.amazonaws.com", - "signatureVersions": [ - "s3", - "s3v4" - ] - }, - "sa-east-1": { - "hostname": "s3-sa-east-1.amazonaws.com", - "signatureVersions": [ - "s3", - "s3v4" - ] - }, - "us-east-1": { - "hostname": "s3.amazonaws.com", - "signatureVersions": [ - "s3", - "s3v4" - ] - }, - "us-east-2": {}, - "us-west-1": { - "hostname": "s3-us-west-1.amazonaws.com", - "signatureVersions": [ - "s3", - "s3v4" - ] - }, - "us-west-2": { - "hostname": "s3-us-west-2.amazonaws.com", - "signatureVersions": [ - "s3", - "s3v4" - ] - } - }, - "isRegionalized": true, - "partitionEndpoint": "us-east-1" - }, - "sdb": { - "defaults": { - "protocols": [ - "http", - "https" - ], - "signatureVersions": [ - "v2" - ] - }, - "endpoints": { - "ap-northeast-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "eu-west-1": {}, - "sa-east-1": {}, - "us-east-1": { - "hostname": "sdb.amazonaws.com" - }, - "us-west-1": {}, - "us-west-2": {} - } - }, - "servicecatalog": { - "endpoints": { - "ap-northeast-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-2": {} - } - }, - "shield": { - "defaults": { - "protocols": [ - "https" - ], - "sslCommonName": "Shield.us-east-1.amazonaws.com" - }, - "endpoints": { - "us-east-1": {} - }, - "isRegionalized": false - }, - "sms": { - "endpoints": { - "ap-southeast-2": {}, - "eu-west-1": {}, - "us-east-1": {} - } - }, - "snowball": { - "endpoints": { - "ap-south-1": {}, - "ap-southeast-2": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "sns": { - "defaults": { - "protocols": [ - "http", - "https" - ] - }, - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "sqs": { - "defaults": { - "protocols": [ - "http", - "https" - ], - "sslCommonName": "{region}.queue.{dnsSuffix}" - }, - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "sa-east-1": {}, - "us-east-1": { - "sslCommonName": "queue.{dnsSuffix}" - }, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "ssm": { - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "states": { - "endpoints": { - "ap-northeast-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-2": {} - } - }, - "storagegateway": { - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "streams.dynamodb": { - "defaults": { - "credentialScope": { - "service": "dynamodb" - }, - "protocols": [ - "http", - "http", - "https", - "https" - ] - }, - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "local": { - "credentialScope": { - "region": "us-east-1" - }, - "hostname": "localhost:8000", - "protocols": [ - "http" - ] - }, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "sts": { - "defaults": { - "credentialScope": { - "region": "us-east-1" - }, - "hostname": "sts.amazonaws.com" - }, - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": { - "credentialScope": { - "region": "ap-northeast-2" - }, - "hostname": "sts.ap-northeast-2.amazonaws.com" - }, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "aws-global": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - }, - "partitionEndpoint": "aws-global" - }, - "support": { - "endpoints": { - "us-east-1": {} - } - }, - "swf": { - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "tagging": { - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "ca-central-1": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "eu-west-2": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - }, - "waf": { - "endpoints": { - "aws-global": { - "credentialScope": { - "region": "us-east-1" - }, - "hostname": "waf.amazonaws.com" - } - }, - "isRegionalized": false, - "partitionEndpoint": "aws-global" - }, - "waf-regional": { - "endpoints": { - "ap-northeast-1": {}, - "eu-west-1": {}, - "us-east-1": {}, - "us-west-2": {} - } - }, - "workdocs": { - "endpoints": { - "ap-northeast-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "eu-west-1": {}, - "us-east-1": {}, - "us-west-2": {} - } - }, - "workspaces": { - "endpoints": { - "ap-northeast-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "us-east-1": {}, - "us-west-2": {} - } - }, - "xray": { - "endpoints": { - "ap-northeast-1": {}, - "ap-northeast-2": {}, - "ap-south-1": {}, - "ap-southeast-1": {}, - "ap-southeast-2": {}, - "eu-central-1": {}, - "eu-west-1": {}, - "sa-east-1": {}, - "us-east-1": {}, - "us-east-2": {}, - "us-west-1": {}, - "us-west-2": {} - } - } + "ap-south-1" : { + "description" : "Asia Pacific (Mumbai)" + }, + "ap-southeast-1" : { + "description" : "Asia Pacific (Singapore)" + }, + "ap-southeast-2" : { + "description" : "Asia Pacific (Sydney)" + }, + "ca-central-1" : { + "description" : "Canada (Central)" + }, + "eu-central-1" : { + "description" : "EU (Frankfurt)" + }, + "eu-west-1" : { + "description" : "EU (Ireland)" + }, + "eu-west-2" : { + "description" : "EU (London)" + }, + "sa-east-1" : { + "description" : "South America (Sao Paulo)" + }, + "us-east-1" : { + "description" : "US East (N. Virginia)" + }, + "us-east-2" : { + "description" : "US East (Ohio)" + }, + "us-west-1" : { + "description" : "US West (N. California)" + }, + "us-west-2" : { + "description" : "US West (Oregon)" } }, - { - "defaults": { - "hostname": "{service}.{region}.{dnsSuffix}", - "protocols": [ - "https" - ], - "signatureVersions": [ - "v4" - ] - }, - "dnsSuffix": "amazonaws.com.cn", - "partition": "aws-cn", - "partitionName": "AWS China", - "regionRegex": "^cn\\-\\w+\\-\\d+$", - "regions": { - "cn-north-1": { - "description": "China (Beijing)" + "services" : { + "acm" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } } }, - "services": { - "autoscaling": { - "defaults": { - "protocols": [ - "http", - "https" - ] + "apigateway" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "application-autoscaling" : { + "defaults" : { + "credentialScope" : { + "service" : "application-autoscaling" }, - "endpoints": { - "cn-north-1": {} - } + "hostname" : "autoscaling.{region}.amazonaws.com", + "protocols" : [ "http", "https" ] }, - "cloudformation": { - "endpoints": { - "cn-north-1": {} - } - }, - "cloudtrail": { - "endpoints": { - "cn-north-1": {} - } - }, - "codedeploy": { - "endpoints": { - "cn-north-1": {} - } - }, - "config": { - "endpoints": { - "cn-north-1": {} - } - }, - "directconnect": { - "endpoints": { - "cn-north-1": {} - } - }, - "dynamodb": { - "defaults": { - "protocols": [ - "http", - "https" - ] + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "appstream2" : { + "defaults" : { + "credentialScope" : { + "service" : "appstream" }, - "endpoints": { - "cn-north-1": {} - } + "protocols" : [ "https" ] }, - "ec2": { - "defaults": { - "protocols": [ - "http", - "https" - ] - }, - "endpoints": { - "cn-north-1": {} - } + "endpoints" : { + "ap-northeast-1" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-west-2" : { } + } + }, + "autoscaling" : { + "defaults" : { + "protocols" : [ "http", "https" ] }, - "elasticache": { - "endpoints": { - "cn-north-1": {} - } - }, - "elasticbeanstalk": { - "endpoints": { - "cn-north-1": {} - } - }, - "elasticloadbalancing": { - "defaults": { - "protocols": [ - "http", - "https" - ] - }, - "endpoints": { - "cn-north-1": {} - } - }, - "elasticmapreduce": { - "defaults": { - "protocols": [ - "http", - "https" - ] - }, - "endpoints": { - "cn-north-1": {} - } - }, - "events": { - "endpoints": { - "cn-north-1": {} - } - }, - "glacier": { - "defaults": { - "protocols": [ - "http", - "https" - ] - }, - "endpoints": { - "cn-north-1": {} - } - }, - "iam": { - "endpoints": { - "aws-cn-global": { - "credentialScope": { - "region": "cn-north-1" - }, - "hostname": "iam.cn-north-1.amazonaws.com.cn" - } - }, - "isRegionalized": false, - "partitionEndpoint": "aws-cn-global" - }, - "kinesis": { - "endpoints": { - "cn-north-1": {} - } - }, - "logs": { - "endpoints": { - "cn-north-1": {} - } - }, - "monitoring": { - "defaults": { - "protocols": [ - "http", - "https" - ] - }, - "endpoints": { - "cn-north-1": {} - } - }, - "rds": { - "endpoints": { - "cn-north-1": {} - } - }, - "redshift": { - "endpoints": { - "cn-north-1": {} - } - }, - "s3": { - "defaults": { - "protocols": [ - "http", - "https" - ], - "signatureVersions": [ - "s3v4" - ] - }, - "endpoints": { - "cn-north-1": {} - } - }, - "sns": { - "defaults": { - "protocols": [ - "http", - "https" - ] - }, - "endpoints": { - "cn-north-1": {} - } - }, - "sqs": { - "defaults": { - "protocols": [ - "http", - "https" - ], - "sslCommonName": "{region}.queue.{dnsSuffix}" - }, - "endpoints": { - "cn-north-1": {} - } - }, - "storagegateway": { - "endpoints": { - "cn-north-1": {} - } - }, - "streams.dynamodb": { - "defaults": { - "credentialScope": { - "service": "dynamodb" + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "batch" : { + "endpoints" : { + "us-east-1" : { } + } + }, + "budgets" : { + "endpoints" : { + "aws-global" : { + "credentialScope" : { + "region" : "us-east-1" }, - "protocols": [ - "http", - "http", - "https", - "https" - ] - }, - "endpoints": { - "cn-north-1": {} + "hostname" : "budgets.amazonaws.com" } }, - "sts": { - "endpoints": { - "cn-north-1": {} - } - }, - "swf": { - "endpoints": { - "cn-north-1": {} - } - }, - "tagging": { - "endpoints": { - "cn-north-1": {} - } - } - } - }, - { - "defaults": { - "hostname": "{service}.{region}.{dnsSuffix}", - "protocols": [ - "https" - ], - "signatureVersions": [ - "v4" - ] + "isRegionalized" : false, + "partitionEndpoint" : "aws-global" }, - "dnsSuffix": "amazonaws.com", - "partition": "aws-us-gov", - "partitionName": "AWS GovCloud (US)", - "regionRegex": "^us\\-gov\\-\\w+\\-\\d+$", - "regions": { - "us-gov-west-1": { - "description": "AWS GovCloud (US)" + "clouddirectory" : { + "endpoints" : { + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } } }, - "services": { - "autoscaling": { - "endpoints": { - "us-gov-west-1": { - "protocols": [ - "http", - "https" - ] - } - } - }, - "cloudformation": { - "endpoints": { - "us-gov-west-1": {} - } - }, - "cloudhsm": { - "endpoints": { - "us-gov-west-1": {} - } - }, - "cloudtrail": { - "endpoints": { - "us-gov-west-1": {} - } - }, - "config": { - "endpoints": { - "us-gov-west-1": {} - } - }, - "directconnect": { - "endpoints": { - "us-gov-west-1": {} - } - }, - "dynamodb": { - "endpoints": { - "us-gov-west-1": {} - } - }, - "ec2": { - "endpoints": { - "us-gov-west-1": {} - } - }, - "elasticache": { - "endpoints": { - "us-gov-west-1": {} - } - }, - "elasticloadbalancing": { - "endpoints": { - "us-gov-west-1": { - "protocols": [ - "http", - "https" - ] - } - } - }, - "elasticmapreduce": { - "endpoints": { - "us-gov-west-1": { - "protocols": [ - "http", - "https" - ] - } - } - }, - "glacier": { - "endpoints": { - "us-gov-west-1": { - "protocols": [ - "http", - "https" - ] - } - } - }, - "iam": { - "endpoints": { - "aws-us-gov-global": { - "credentialScope": { - "region": "us-gov-west-1" - }, - "hostname": "iam.us-gov.amazonaws.com" - } - }, - "isRegionalized": false, - "partitionEndpoint": "aws-us-gov-global" - }, - "kinesis": { - "endpoints": { - "us-gov-west-1": {} - } - }, - "kms": { - "endpoints": { - "us-gov-west-1": {} - } - }, - "logs": { - "endpoints": { - "us-gov-west-1": {} - } - }, - "monitoring": { - "endpoints": { - "us-gov-west-1": {} - } - }, - "rds": { - "endpoints": { - "us-gov-west-1": {} - } - }, - "redshift": { - "endpoints": { - "us-gov-west-1": {} - } - }, - "s3": { - "defaults": { - "signatureVersions": [ - "s3", - "s3v4" - ] - }, - "endpoints": { - "fips-us-gov-west-1": { - "credentialScope": { - "region": "us-gov-west-1" - }, - "hostname": "s3-fips-us-gov-west-1.amazonaws.com" + "cloudformation" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "cloudfront" : { + "endpoints" : { + "aws-global" : { + "credentialScope" : { + "region" : "us-east-1" }, - "us-gov-west-1": { - "hostname": "s3-us-gov-west-1.amazonaws.com", - "protocols": [ - "http", - "https" - ] - } + "hostname" : "cloudfront.amazonaws.com", + "protocols" : [ "http", "https" ] } }, - "snowball": { - "endpoints": { - "us-gov-west-1": {} - } - }, - "sns": { - "endpoints": { - "us-gov-west-1": { - "protocols": [ - "http", - "https" - ] - } - } - }, - "sqs": { - "endpoints": { - "us-gov-west-1": { - "protocols": [ - "http", - "https" - ], - "sslCommonName": "{region}.queue.{dnsSuffix}" - } - } - }, - "streams.dynamodb": { - "defaults": { - "credentialScope": { - "service": "dynamodb" - } + "isRegionalized" : false, + "partitionEndpoint" : "aws-global" + }, + "cloudhsm" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "cloudsearch" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "cloudtrail" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "codebuild" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } + } + }, + "codecommit" : { + "endpoints" : { + "eu-west-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } + } + }, + "codedeploy" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "codepipeline" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } + } + }, + "codestar" : { + "endpoints" : { + "eu-west-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } + } + }, + "cognito-identity" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } + } + }, + "cognito-idp" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } + } + }, + "cognito-sync" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } + } + }, + "config" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "cur" : { + "endpoints" : { + "us-east-1" : { } + } + }, + "data.iot" : { + "defaults" : { + "credentialScope" : { + "service" : "iotdata" }, - "endpoints": { - "us-gov-west-1": {} + "protocols" : [ "https" ] + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-west-2" : { } + } + }, + "datapipeline" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-southeast-2" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-west-2" : { } + } + }, + "devicefarm" : { + "endpoints" : { + "us-west-2" : { } + } + }, + "directconnect" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "discovery" : { + "endpoints" : { + "us-west-2" : { } + } + }, + "dms" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "ds" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } + } + }, + "dynamodb" : { + "defaults" : { + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "local" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "localhost:8000", + "protocols" : [ "http" ] + }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "ec2" : { + "defaults" : { + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "ecr" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "ecs" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "elasticache" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "elasticbeanstalk" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "elasticfilesystem" : { + "endpoints" : { + "ap-southeast-2" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } + } + }, + "elasticloadbalancing" : { + "defaults" : { + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "elasticmapreduce" : { + "defaults" : { + "protocols" : [ "http", "https" ], + "sslCommonName" : "{region}.{service}.{dnsSuffix}" + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { + "sslCommonName" : "{service}.{region}.{dnsSuffix}" + }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { + "sslCommonName" : "{service}.{region}.{dnsSuffix}" + }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "elastictranscoder" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "email" : { + "endpoints" : { + "eu-west-1" : { }, + "us-east-1" : { }, + "us-west-2" : { } + } + }, + "entitlement.marketplace" : { + "defaults" : { + "credentialScope" : { + "service" : "aws-marketplace" } }, - "sts": { - "endpoints": { - "us-gov-west-1": {} + "endpoints" : { + "us-east-1" : { } + } + }, + "es" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "events" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "firehose" : { + "endpoints" : { + "eu-west-1" : { }, + "us-east-1" : { }, + "us-west-2" : { } + } + }, + "gamelift" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-west-2" : { } + } + }, + "glacier" : { + "defaults" : { + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "health" : { + "endpoints" : { + "us-east-1" : { } + } + }, + "iam" : { + "endpoints" : { + "aws-global" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "iam.amazonaws.com" } }, - "swf": { - "endpoints": { - "us-gov-west-1": {} + "isRegionalized" : false, + "partitionEndpoint" : "aws-global" + }, + "importexport" : { + "endpoints" : { + "aws-global" : { + "credentialScope" : { + "region" : "us-east-1", + "service" : "IngestionService" + }, + "hostname" : "importexport.amazonaws.com", + "signatureVersions" : [ "v2", "v4" ] } + }, + "isRegionalized" : false, + "partitionEndpoint" : "aws-global" + }, + "inspector" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-2" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-west-2" : { } + } + }, + "iot" : { + "defaults" : { + "credentialScope" : { + "service" : "execute-api" + } + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } + } + }, + "kinesis" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "kinesisanalytics" : { + "endpoints" : { + "eu-west-1" : { }, + "us-east-1" : { }, + "us-west-2" : { } + } + }, + "kms" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "lambda" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "lightsail" : { + "endpoints" : { + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } + } + }, + "logs" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "machinelearning" : { + "endpoints" : { + "eu-west-1" : { }, + "us-east-1" : { } + } + }, + "marketplacecommerceanalytics" : { + "endpoints" : { + "us-east-1" : { } + } + }, + "metering.marketplace" : { + "defaults" : { + "credentialScope" : { + "service" : "aws-marketplace" + } + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "mobileanalytics" : { + "endpoints" : { + "us-east-1" : { } + } + }, + "models.lex" : { + "defaults" : { + "credentialScope" : { + "service" : "lex" + } + }, + "endpoints" : { + "us-east-1" : { } + } + }, + "monitoring" : { + "defaults" : { + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "mturk-requester" : { + "endpoints" : { + "sandbox" : { + "hostname" : "mturk-requester-sandbox.us-east-1.amazonaws.com" + }, + "us-east-1" : { } + }, + "isRegionalized" : false + }, + "opsworks" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "opsworks-cm" : { + "endpoints" : { + "eu-west-1" : { }, + "us-east-1" : { }, + "us-west-2" : { } + } + }, + "organizations" : { + "endpoints" : { + "aws-global" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "organizations.us-east-1.amazonaws.com" + } + }, + "isRegionalized" : false, + "partitionEndpoint" : "aws-global" + }, + "pinpoint" : { + "defaults" : { + "credentialScope" : { + "service" : "mobiletargeting" + } + }, + "endpoints" : { + "us-east-1" : { } + } + }, + "polly" : { + "endpoints" : { + "eu-west-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } + } + }, + "rds" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { + "sslCommonName" : "{service}.{dnsSuffix}" + }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "redshift" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "rekognition" : { + "endpoints" : { + "eu-west-1" : { }, + "us-east-1" : { }, + "us-west-2" : { } + } + }, + "route53" : { + "endpoints" : { + "aws-global" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "route53.amazonaws.com" + } + }, + "isRegionalized" : false, + "partitionEndpoint" : "aws-global" + }, + "route53domains" : { + "endpoints" : { + "us-east-1" : { } + } + }, + "runtime.lex" : { + "defaults" : { + "credentialScope" : { + "service" : "lex" + } + }, + "endpoints" : { + "us-east-1" : { } + } + }, + "s3" : { + "defaults" : { + "protocols" : [ "http", "https" ], + "signatureVersions" : [ "s3v4" ] + }, + "endpoints" : { + "ap-northeast-1" : { + "hostname" : "s3-ap-northeast-1.amazonaws.com", + "signatureVersions" : [ "s3", "s3v4" ] + }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { + "hostname" : "s3-ap-southeast-1.amazonaws.com", + "signatureVersions" : [ "s3", "s3v4" ] + }, + "ap-southeast-2" : { + "hostname" : "s3-ap-southeast-2.amazonaws.com", + "signatureVersions" : [ "s3", "s3v4" ] + }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { + "hostname" : "s3-eu-west-1.amazonaws.com", + "signatureVersions" : [ "s3", "s3v4" ] + }, + "eu-west-2" : { }, + "s3-external-1" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "s3-external-1.amazonaws.com", + "signatureVersions" : [ "s3", "s3v4" ] + }, + "sa-east-1" : { + "hostname" : "s3-sa-east-1.amazonaws.com", + "signatureVersions" : [ "s3", "s3v4" ] + }, + "us-east-1" : { + "hostname" : "s3.amazonaws.com", + "signatureVersions" : [ "s3", "s3v4" ] + }, + "us-east-2" : { }, + "us-west-1" : { + "hostname" : "s3-us-west-1.amazonaws.com", + "signatureVersions" : [ "s3", "s3v4" ] + }, + "us-west-2" : { + "hostname" : "s3-us-west-2.amazonaws.com", + "signatureVersions" : [ "s3", "s3v4" ] + } + }, + "isRegionalized" : true, + "partitionEndpoint" : "us-east-1" + }, + "sdb" : { + "defaults" : { + "protocols" : [ "http", "https" ], + "signatureVersions" : [ "v2" ] + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-west-1" : { }, + "sa-east-1" : { }, + "us-east-1" : { + "hostname" : "sdb.amazonaws.com" + }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "servicecatalog" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } + } + }, + "shield" : { + "defaults" : { + "protocols" : [ "https" ], + "sslCommonName" : "Shield.us-east-1.amazonaws.com" + }, + "endpoints" : { + "us-east-1" : { } + }, + "isRegionalized" : false + }, + "sms" : { + "endpoints" : { + "ap-southeast-2" : { }, + "eu-west-1" : { }, + "us-east-1" : { } + } + }, + "snowball" : { + "endpoints" : { + "ap-south-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "sns" : { + "defaults" : { + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "sqs" : { + "defaults" : { + "protocols" : [ "http", "https" ], + "sslCommonName" : "{region}.queue.{dnsSuffix}" + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { + "sslCommonName" : "queue.{dnsSuffix}" + }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "ssm" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "states" : { + "endpoints" : { + "ap-northeast-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-2" : { } + } + }, + "storagegateway" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "streams.dynamodb" : { + "defaults" : { + "credentialScope" : { + "service" : "dynamodb" + }, + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "local" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "localhost:8000", + "protocols" : [ "http" ] + }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "sts" : { + "defaults" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "sts.amazonaws.com" + }, + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { + "credentialScope" : { + "region" : "ap-northeast-2" + }, + "hostname" : "sts.ap-northeast-2.amazonaws.com" + }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "aws-global" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-1-fips" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "sts-fips.us-east-1.amazonaws.com" + }, + "us-east-2" : { }, + "us-east-2-fips" : { + "credentialScope" : { + "region" : "us-east-2" + }, + "hostname" : "sts-fips.us-east-2.amazonaws.com" + }, + "us-west-1" : { }, + "us-west-1-fips" : { + "credentialScope" : { + "region" : "us-west-1" + }, + "hostname" : "sts-fips.us-west-1.amazonaws.com" + }, + "us-west-2" : { }, + "us-west-2-fips" : { + "credentialScope" : { + "region" : "us-west-2" + }, + "hostname" : "sts-fips.us-west-2.amazonaws.com" + } + }, + "partitionEndpoint" : "aws-global" + }, + "support" : { + "endpoints" : { + "us-east-1" : { } + } + }, + "swf" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "tagging" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } + } + }, + "waf" : { + "endpoints" : { + "aws-global" : { + "credentialScope" : { + "region" : "us-east-1" + }, + "hostname" : "waf.amazonaws.com" + } + }, + "isRegionalized" : false, + "partitionEndpoint" : "aws-global" + }, + "waf-regional" : { + "endpoints" : { + "ap-northeast-1" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-west-2" : { } + } + }, + "workdocs" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-west-2" : { } + } + }, + "workspaces" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "us-east-1" : { }, + "us-west-2" : { } + } + }, + "xray" : { + "endpoints" : { + "ap-northeast-1" : { }, + "ap-northeast-2" : { }, + "ap-south-1" : { }, + "ap-southeast-1" : { }, + "ap-southeast-2" : { }, + "ca-central-1" : { }, + "eu-central-1" : { }, + "eu-west-1" : { }, + "eu-west-2" : { }, + "sa-east-1" : { }, + "us-east-1" : { }, + "us-east-2" : { }, + "us-west-1" : { }, + "us-west-2" : { } } } } - ], - "version": 3 -} + }, { + "defaults" : { + "hostname" : "{service}.{region}.{dnsSuffix}", + "protocols" : [ "https" ], + "signatureVersions" : [ "v4" ] + }, + "dnsSuffix" : "amazonaws.com.cn", + "partition" : "aws-cn", + "partitionName" : "AWS China", + "regionRegex" : "^cn\\-\\w+\\-\\d+$", + "regions" : { + "cn-north-1" : { + "description" : "China (Beijing)" + } + }, + "services" : { + "autoscaling" : { + "defaults" : { + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "cn-north-1" : { } + } + }, + "cloudformation" : { + "endpoints" : { + "cn-north-1" : { } + } + }, + "cloudtrail" : { + "endpoints" : { + "cn-north-1" : { } + } + }, + "codedeploy" : { + "endpoints" : { + "cn-north-1" : { } + } + }, + "config" : { + "endpoints" : { + "cn-north-1" : { } + } + }, + "directconnect" : { + "endpoints" : { + "cn-north-1" : { } + } + }, + "dynamodb" : { + "defaults" : { + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "cn-north-1" : { } + } + }, + "ec2" : { + "defaults" : { + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "cn-north-1" : { } + } + }, + "elasticache" : { + "endpoints" : { + "cn-north-1" : { } + } + }, + "elasticbeanstalk" : { + "endpoints" : { + "cn-north-1" : { } + } + }, + "elasticloadbalancing" : { + "defaults" : { + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "cn-north-1" : { } + } + }, + "elasticmapreduce" : { + "defaults" : { + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "cn-north-1" : { } + } + }, + "events" : { + "endpoints" : { + "cn-north-1" : { } + } + }, + "glacier" : { + "defaults" : { + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "cn-north-1" : { } + } + }, + "iam" : { + "endpoints" : { + "aws-cn-global" : { + "credentialScope" : { + "region" : "cn-north-1" + }, + "hostname" : "iam.cn-north-1.amazonaws.com.cn" + } + }, + "isRegionalized" : false, + "partitionEndpoint" : "aws-cn-global" + }, + "kinesis" : { + "endpoints" : { + "cn-north-1" : { } + } + }, + "logs" : { + "endpoints" : { + "cn-north-1" : { } + } + }, + "monitoring" : { + "defaults" : { + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "cn-north-1" : { } + } + }, + "rds" : { + "endpoints" : { + "cn-north-1" : { } + } + }, + "redshift" : { + "endpoints" : { + "cn-north-1" : { } + } + }, + "s3" : { + "defaults" : { + "protocols" : [ "http", "https" ], + "signatureVersions" : [ "s3v4" ] + }, + "endpoints" : { + "cn-north-1" : { } + } + }, + "sns" : { + "defaults" : { + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "cn-north-1" : { } + } + }, + "sqs" : { + "defaults" : { + "protocols" : [ "http", "https" ], + "sslCommonName" : "{region}.queue.{dnsSuffix}" + }, + "endpoints" : { + "cn-north-1" : { } + } + }, + "storagegateway" : { + "endpoints" : { + "cn-north-1" : { } + } + }, + "streams.dynamodb" : { + "defaults" : { + "credentialScope" : { + "service" : "dynamodb" + }, + "protocols" : [ "http", "https" ] + }, + "endpoints" : { + "cn-north-1" : { } + } + }, + "sts" : { + "endpoints" : { + "cn-north-1" : { } + } + }, + "swf" : { + "endpoints" : { + "cn-north-1" : { } + } + }, + "tagging" : { + "endpoints" : { + "cn-north-1" : { } + } + } + } + }, { + "defaults" : { + "hostname" : "{service}.{region}.{dnsSuffix}", + "protocols" : [ "https" ], + "signatureVersions" : [ "v4" ] + }, + "dnsSuffix" : "amazonaws.com", + "partition" : "aws-us-gov", + "partitionName" : "AWS GovCloud (US)", + "regionRegex" : "^us\\-gov\\-\\w+\\-\\d+$", + "regions" : { + "us-gov-west-1" : { + "description" : "AWS GovCloud (US)" + } + }, + "services" : { + "autoscaling" : { + "endpoints" : { + "us-gov-west-1" : { + "protocols" : [ "http", "https" ] + } + } + }, + "cloudformation" : { + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "cloudhsm" : { + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "cloudtrail" : { + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "config" : { + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "directconnect" : { + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "dynamodb" : { + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "ec2" : { + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "elasticache" : { + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "elasticloadbalancing" : { + "endpoints" : { + "us-gov-west-1" : { + "protocols" : [ "http", "https" ] + } + } + }, + "elasticmapreduce" : { + "endpoints" : { + "us-gov-west-1" : { + "protocols" : [ "http", "https" ] + } + } + }, + "events" : { + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "glacier" : { + "endpoints" : { + "us-gov-west-1" : { + "protocols" : [ "http", "https" ] + } + } + }, + "iam" : { + "endpoints" : { + "aws-us-gov-global" : { + "credentialScope" : { + "region" : "us-gov-west-1" + }, + "hostname" : "iam.us-gov.amazonaws.com" + } + }, + "isRegionalized" : false, + "partitionEndpoint" : "aws-us-gov-global" + }, + "kinesis" : { + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "kms" : { + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "lambda" : { + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "logs" : { + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "monitoring" : { + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "rds" : { + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "redshift" : { + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "s3" : { + "defaults" : { + "signatureVersions" : [ "s3", "s3v4" ] + }, + "endpoints" : { + "fips-us-gov-west-1" : { + "credentialScope" : { + "region" : "us-gov-west-1" + }, + "hostname" : "s3-fips-us-gov-west-1.amazonaws.com" + }, + "us-gov-west-1" : { + "hostname" : "s3-us-gov-west-1.amazonaws.com", + "protocols" : [ "http", "https" ] + } + } + }, + "snowball" : { + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "sns" : { + "endpoints" : { + "us-gov-west-1" : { + "protocols" : [ "http", "https" ] + } + } + }, + "sqs" : { + "endpoints" : { + "us-gov-west-1" : { + "protocols" : [ "http", "https" ], + "sslCommonName" : "{region}.queue.{dnsSuffix}" + } + } + }, + "streams.dynamodb" : { + "defaults" : { + "credentialScope" : { + "service" : "dynamodb" + } + }, + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "sts" : { + "endpoints" : { + "us-gov-west-1" : { } + } + }, + "swf" : { + "endpoints" : { + "us-gov-west-1" : { } + } + } + } + } ], + "version" : 3 +} \ No newline at end of file diff --git a/vendor/github.com/aws/aws-sdk-go/service/athena/api.go b/vendor/github.com/aws/aws-sdk-go/service/athena/api.go new file mode 100644 index 000000000..33141fc72 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/athena/api.go @@ -0,0 +1,2749 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package athena + +import ( + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/awsutil" + "github.com/aws/aws-sdk-go/aws/request" +) + +const opBatchGetNamedQuery = "BatchGetNamedQuery" + +// BatchGetNamedQueryRequest generates a "aws/request.Request" representing the +// client's request for the BatchGetNamedQuery operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See BatchGetNamedQuery for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the BatchGetNamedQuery method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the BatchGetNamedQueryRequest method. +// req, resp := client.BatchGetNamedQueryRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/BatchGetNamedQuery +func (c *Athena) BatchGetNamedQueryRequest(input *BatchGetNamedQueryInput) (req *request.Request, output *BatchGetNamedQueryOutput) { + op := &request.Operation{ + Name: opBatchGetNamedQuery, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &BatchGetNamedQueryInput{} + } + + output = &BatchGetNamedQueryOutput{} + req = c.newRequest(op, input, output) + return +} + +// BatchGetNamedQuery API operation for Amazon Athena. +// +// Returns the details of a single named query or a list of up to 50 queries, +// which you provide as an array of query ID strings. Use ListNamedQueries to +// get the list of named query IDs. If information could not be retrieved for +// a submitted query ID, information about the query ID submitted is listed +// under UnprocessedNamedQueryId. Named queries are different from executed +// queries. Use BatchGetQueryExecution to get details about each unique query +// execution, and ListQueryExecutions to get a list of query execution IDs. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Athena's +// API operation BatchGetNamedQuery for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInternalServerException "InternalServerException" +// Indicates a platform issue, which may be due to a transient condition or +// outage. +// +// * ErrCodeInvalidRequestException "InvalidRequestException" +// Indicates that something is wrong with the input to the request. For example, +// a required parameter may be missing or out of range. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/BatchGetNamedQuery +func (c *Athena) BatchGetNamedQuery(input *BatchGetNamedQueryInput) (*BatchGetNamedQueryOutput, error) { + req, out := c.BatchGetNamedQueryRequest(input) + return out, req.Send() +} + +// BatchGetNamedQueryWithContext is the same as BatchGetNamedQuery with the addition of +// the ability to pass a context and additional request options. +// +// See BatchGetNamedQuery for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Athena) BatchGetNamedQueryWithContext(ctx aws.Context, input *BatchGetNamedQueryInput, opts ...request.Option) (*BatchGetNamedQueryOutput, error) { + req, out := c.BatchGetNamedQueryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opBatchGetQueryExecution = "BatchGetQueryExecution" + +// BatchGetQueryExecutionRequest generates a "aws/request.Request" representing the +// client's request for the BatchGetQueryExecution operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See BatchGetQueryExecution for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the BatchGetQueryExecution method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the BatchGetQueryExecutionRequest method. +// req, resp := client.BatchGetQueryExecutionRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/BatchGetQueryExecution +func (c *Athena) BatchGetQueryExecutionRequest(input *BatchGetQueryExecutionInput) (req *request.Request, output *BatchGetQueryExecutionOutput) { + op := &request.Operation{ + Name: opBatchGetQueryExecution, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &BatchGetQueryExecutionInput{} + } + + output = &BatchGetQueryExecutionOutput{} + req = c.newRequest(op, input, output) + return +} + +// BatchGetQueryExecution API operation for Amazon Athena. +// +// Returns the details of a single query execution or a list of up to 50 query +// executions, which you provide as an array of query execution ID strings. +// To get a list of query execution IDs, use ListQueryExecutions. Query executions +// are different from named (saved) queries. Use BatchGetNamedQuery to get details +// about named queries. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Athena's +// API operation BatchGetQueryExecution for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInternalServerException "InternalServerException" +// Indicates a platform issue, which may be due to a transient condition or +// outage. +// +// * ErrCodeInvalidRequestException "InvalidRequestException" +// Indicates that something is wrong with the input to the request. For example, +// a required parameter may be missing or out of range. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/BatchGetQueryExecution +func (c *Athena) BatchGetQueryExecution(input *BatchGetQueryExecutionInput) (*BatchGetQueryExecutionOutput, error) { + req, out := c.BatchGetQueryExecutionRequest(input) + return out, req.Send() +} + +// BatchGetQueryExecutionWithContext is the same as BatchGetQueryExecution with the addition of +// the ability to pass a context and additional request options. +// +// See BatchGetQueryExecution for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Athena) BatchGetQueryExecutionWithContext(ctx aws.Context, input *BatchGetQueryExecutionInput, opts ...request.Option) (*BatchGetQueryExecutionOutput, error) { + req, out := c.BatchGetQueryExecutionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opCreateNamedQuery = "CreateNamedQuery" + +// CreateNamedQueryRequest generates a "aws/request.Request" representing the +// client's request for the CreateNamedQuery operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See CreateNamedQuery for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the CreateNamedQuery method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the CreateNamedQueryRequest method. +// req, resp := client.CreateNamedQueryRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/CreateNamedQuery +func (c *Athena) CreateNamedQueryRequest(input *CreateNamedQueryInput) (req *request.Request, output *CreateNamedQueryOutput) { + op := &request.Operation{ + Name: opCreateNamedQuery, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &CreateNamedQueryInput{} + } + + output = &CreateNamedQueryOutput{} + req = c.newRequest(op, input, output) + return +} + +// CreateNamedQuery API operation for Amazon Athena. +// +// Creates a named query. +// +// For code samples using the AWS SDK for Java, see Examples and Code Samples +// (http://docs.aws.amazon.com/athena/latest/ug/code-samples.html) in the Amazon +// Athena User Guide. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Athena's +// API operation CreateNamedQuery for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInternalServerException "InternalServerException" +// Indicates a platform issue, which may be due to a transient condition or +// outage. +// +// * ErrCodeInvalidRequestException "InvalidRequestException" +// Indicates that something is wrong with the input to the request. For example, +// a required parameter may be missing or out of range. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/CreateNamedQuery +func (c *Athena) CreateNamedQuery(input *CreateNamedQueryInput) (*CreateNamedQueryOutput, error) { + req, out := c.CreateNamedQueryRequest(input) + return out, req.Send() +} + +// CreateNamedQueryWithContext is the same as CreateNamedQuery with the addition of +// the ability to pass a context and additional request options. +// +// See CreateNamedQuery for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Athena) CreateNamedQueryWithContext(ctx aws.Context, input *CreateNamedQueryInput, opts ...request.Option) (*CreateNamedQueryOutput, error) { + req, out := c.CreateNamedQueryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opDeleteNamedQuery = "DeleteNamedQuery" + +// DeleteNamedQueryRequest generates a "aws/request.Request" representing the +// client's request for the DeleteNamedQuery operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See DeleteNamedQuery for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the DeleteNamedQuery method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the DeleteNamedQueryRequest method. +// req, resp := client.DeleteNamedQueryRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/DeleteNamedQuery +func (c *Athena) DeleteNamedQueryRequest(input *DeleteNamedQueryInput) (req *request.Request, output *DeleteNamedQueryOutput) { + op := &request.Operation{ + Name: opDeleteNamedQuery, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &DeleteNamedQueryInput{} + } + + output = &DeleteNamedQueryOutput{} + req = c.newRequest(op, input, output) + return +} + +// DeleteNamedQuery API operation for Amazon Athena. +// +// Deletes a named query. +// +// For code samples using the AWS SDK for Java, see Examples and Code Samples +// (http://docs.aws.amazon.com/athena/latest/ug/code-samples.html) in the Amazon +// Athena User Guide. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Athena's +// API operation DeleteNamedQuery for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInternalServerException "InternalServerException" +// Indicates a platform issue, which may be due to a transient condition or +// outage. +// +// * ErrCodeInvalidRequestException "InvalidRequestException" +// Indicates that something is wrong with the input to the request. For example, +// a required parameter may be missing or out of range. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/DeleteNamedQuery +func (c *Athena) DeleteNamedQuery(input *DeleteNamedQueryInput) (*DeleteNamedQueryOutput, error) { + req, out := c.DeleteNamedQueryRequest(input) + return out, req.Send() +} + +// DeleteNamedQueryWithContext is the same as DeleteNamedQuery with the addition of +// the ability to pass a context and additional request options. +// +// See DeleteNamedQuery for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Athena) DeleteNamedQueryWithContext(ctx aws.Context, input *DeleteNamedQueryInput, opts ...request.Option) (*DeleteNamedQueryOutput, error) { + req, out := c.DeleteNamedQueryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetNamedQuery = "GetNamedQuery" + +// GetNamedQueryRequest generates a "aws/request.Request" representing the +// client's request for the GetNamedQuery operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See GetNamedQuery for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetNamedQuery method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetNamedQueryRequest method. +// req, resp := client.GetNamedQueryRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/GetNamedQuery +func (c *Athena) GetNamedQueryRequest(input *GetNamedQueryInput) (req *request.Request, output *GetNamedQueryOutput) { + op := &request.Operation{ + Name: opGetNamedQuery, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetNamedQueryInput{} + } + + output = &GetNamedQueryOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetNamedQuery API operation for Amazon Athena. +// +// Returns information about a single query. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Athena's +// API operation GetNamedQuery for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInternalServerException "InternalServerException" +// Indicates a platform issue, which may be due to a transient condition or +// outage. +// +// * ErrCodeInvalidRequestException "InvalidRequestException" +// Indicates that something is wrong with the input to the request. For example, +// a required parameter may be missing or out of range. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/GetNamedQuery +func (c *Athena) GetNamedQuery(input *GetNamedQueryInput) (*GetNamedQueryOutput, error) { + req, out := c.GetNamedQueryRequest(input) + return out, req.Send() +} + +// GetNamedQueryWithContext is the same as GetNamedQuery with the addition of +// the ability to pass a context and additional request options. +// +// See GetNamedQuery for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Athena) GetNamedQueryWithContext(ctx aws.Context, input *GetNamedQueryInput, opts ...request.Option) (*GetNamedQueryOutput, error) { + req, out := c.GetNamedQueryRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetQueryExecution = "GetQueryExecution" + +// GetQueryExecutionRequest generates a "aws/request.Request" representing the +// client's request for the GetQueryExecution operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See GetQueryExecution for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetQueryExecution method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetQueryExecutionRequest method. +// req, resp := client.GetQueryExecutionRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/GetQueryExecution +func (c *Athena) GetQueryExecutionRequest(input *GetQueryExecutionInput) (req *request.Request, output *GetQueryExecutionOutput) { + op := &request.Operation{ + Name: opGetQueryExecution, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetQueryExecutionInput{} + } + + output = &GetQueryExecutionOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetQueryExecution API operation for Amazon Athena. +// +// Returns information about a single execution of a query. Each time a query +// executes, information about the query execution is saved with a unique ID. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Athena's +// API operation GetQueryExecution for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInternalServerException "InternalServerException" +// Indicates a platform issue, which may be due to a transient condition or +// outage. +// +// * ErrCodeInvalidRequestException "InvalidRequestException" +// Indicates that something is wrong with the input to the request. For example, +// a required parameter may be missing or out of range. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/GetQueryExecution +func (c *Athena) GetQueryExecution(input *GetQueryExecutionInput) (*GetQueryExecutionOutput, error) { + req, out := c.GetQueryExecutionRequest(input) + return out, req.Send() +} + +// GetQueryExecutionWithContext is the same as GetQueryExecution with the addition of +// the ability to pass a context and additional request options. +// +// See GetQueryExecution for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Athena) GetQueryExecutionWithContext(ctx aws.Context, input *GetQueryExecutionInput, opts ...request.Option) (*GetQueryExecutionOutput, error) { + req, out := c.GetQueryExecutionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opGetQueryResults = "GetQueryResults" + +// GetQueryResultsRequest generates a "aws/request.Request" representing the +// client's request for the GetQueryResults operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See GetQueryResults for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetQueryResults method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetQueryResultsRequest method. +// req, resp := client.GetQueryResultsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/GetQueryResults +func (c *Athena) GetQueryResultsRequest(input *GetQueryResultsInput) (req *request.Request, output *GetQueryResultsOutput) { + op := &request.Operation{ + Name: opGetQueryResults, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, + } + + if input == nil { + input = &GetQueryResultsInput{} + } + + output = &GetQueryResultsOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetQueryResults API operation for Amazon Athena. +// +// Returns the results of a single query execution specified by QueryExecutionId. +// This request does not execute the query but returns results. Use StartQueryExecution +// to run a query. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Athena's +// API operation GetQueryResults for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInternalServerException "InternalServerException" +// Indicates a platform issue, which may be due to a transient condition or +// outage. +// +// * ErrCodeInvalidRequestException "InvalidRequestException" +// Indicates that something is wrong with the input to the request. For example, +// a required parameter may be missing or out of range. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/GetQueryResults +func (c *Athena) GetQueryResults(input *GetQueryResultsInput) (*GetQueryResultsOutput, error) { + req, out := c.GetQueryResultsRequest(input) + return out, req.Send() +} + +// GetQueryResultsWithContext is the same as GetQueryResults with the addition of +// the ability to pass a context and additional request options. +// +// See GetQueryResults for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Athena) GetQueryResultsWithContext(ctx aws.Context, input *GetQueryResultsInput, opts ...request.Option) (*GetQueryResultsOutput, error) { + req, out := c.GetQueryResultsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// GetQueryResultsPages iterates over the pages of a GetQueryResults operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See GetQueryResults method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a GetQueryResults operation. +// pageNum := 0 +// err := client.GetQueryResultsPages(params, +// func(page *GetQueryResultsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *Athena) GetQueryResultsPages(input *GetQueryResultsInput, fn func(*GetQueryResultsOutput, bool) bool) error { + return c.GetQueryResultsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// GetQueryResultsPagesWithContext same as GetQueryResultsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Athena) GetQueryResultsPagesWithContext(ctx aws.Context, input *GetQueryResultsInput, fn func(*GetQueryResultsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *GetQueryResultsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetQueryResultsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*GetQueryResultsOutput), !p.HasNextPage()) + } + return p.Err() +} + +const opListNamedQueries = "ListNamedQueries" + +// ListNamedQueriesRequest generates a "aws/request.Request" representing the +// client's request for the ListNamedQueries operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See ListNamedQueries for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ListNamedQueries method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ListNamedQueriesRequest method. +// req, resp := client.ListNamedQueriesRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/ListNamedQueries +func (c *Athena) ListNamedQueriesRequest(input *ListNamedQueriesInput) (req *request.Request, output *ListNamedQueriesOutput) { + op := &request.Operation{ + Name: opListNamedQueries, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, + } + + if input == nil { + input = &ListNamedQueriesInput{} + } + + output = &ListNamedQueriesOutput{} + req = c.newRequest(op, input, output) + return +} + +// ListNamedQueries API operation for Amazon Athena. +// +// Provides a list of all available query IDs. +// +// For code samples using the AWS SDK for Java, see Examples and Code Samples +// (http://docs.aws.amazon.com/athena/latest/ug/code-samples.html) in the Amazon +// Athena User Guide. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Athena's +// API operation ListNamedQueries for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInternalServerException "InternalServerException" +// Indicates a platform issue, which may be due to a transient condition or +// outage. +// +// * ErrCodeInvalidRequestException "InvalidRequestException" +// Indicates that something is wrong with the input to the request. For example, +// a required parameter may be missing or out of range. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/ListNamedQueries +func (c *Athena) ListNamedQueries(input *ListNamedQueriesInput) (*ListNamedQueriesOutput, error) { + req, out := c.ListNamedQueriesRequest(input) + return out, req.Send() +} + +// ListNamedQueriesWithContext is the same as ListNamedQueries with the addition of +// the ability to pass a context and additional request options. +// +// See ListNamedQueries for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Athena) ListNamedQueriesWithContext(ctx aws.Context, input *ListNamedQueriesInput, opts ...request.Option) (*ListNamedQueriesOutput, error) { + req, out := c.ListNamedQueriesRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// ListNamedQueriesPages iterates over the pages of a ListNamedQueries operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See ListNamedQueries method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a ListNamedQueries operation. +// pageNum := 0 +// err := client.ListNamedQueriesPages(params, +// func(page *ListNamedQueriesOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *Athena) ListNamedQueriesPages(input *ListNamedQueriesInput, fn func(*ListNamedQueriesOutput, bool) bool) error { + return c.ListNamedQueriesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListNamedQueriesPagesWithContext same as ListNamedQueriesPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Athena) ListNamedQueriesPagesWithContext(ctx aws.Context, input *ListNamedQueriesInput, fn func(*ListNamedQueriesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListNamedQueriesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListNamedQueriesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListNamedQueriesOutput), !p.HasNextPage()) + } + return p.Err() +} + +const opListQueryExecutions = "ListQueryExecutions" + +// ListQueryExecutionsRequest generates a "aws/request.Request" representing the +// client's request for the ListQueryExecutions operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See ListQueryExecutions for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the ListQueryExecutions method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the ListQueryExecutionsRequest method. +// req, resp := client.ListQueryExecutionsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/ListQueryExecutions +func (c *Athena) ListQueryExecutionsRequest(input *ListQueryExecutionsInput) (req *request.Request, output *ListQueryExecutionsOutput) { + op := &request.Operation{ + Name: opListQueryExecutions, + HTTPMethod: "POST", + HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"NextToken"}, + OutputTokens: []string{"NextToken"}, + LimitToken: "MaxResults", + TruncationToken: "", + }, + } + + if input == nil { + input = &ListQueryExecutionsInput{} + } + + output = &ListQueryExecutionsOutput{} + req = c.newRequest(op, input, output) + return +} + +// ListQueryExecutions API operation for Amazon Athena. +// +// Provides a list of all available query execution IDs. +// +// For code samples using the AWS SDK for Java, see Examples and Code Samples +// (http://docs.aws.amazon.com/athena/latest/ug/code-samples.html) in the Amazon +// Athena User Guide. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Athena's +// API operation ListQueryExecutions for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInternalServerException "InternalServerException" +// Indicates a platform issue, which may be due to a transient condition or +// outage. +// +// * ErrCodeInvalidRequestException "InvalidRequestException" +// Indicates that something is wrong with the input to the request. For example, +// a required parameter may be missing or out of range. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/ListQueryExecutions +func (c *Athena) ListQueryExecutions(input *ListQueryExecutionsInput) (*ListQueryExecutionsOutput, error) { + req, out := c.ListQueryExecutionsRequest(input) + return out, req.Send() +} + +// ListQueryExecutionsWithContext is the same as ListQueryExecutions with the addition of +// the ability to pass a context and additional request options. +// +// See ListQueryExecutions for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Athena) ListQueryExecutionsWithContext(ctx aws.Context, input *ListQueryExecutionsInput, opts ...request.Option) (*ListQueryExecutionsOutput, error) { + req, out := c.ListQueryExecutionsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// ListQueryExecutionsPages iterates over the pages of a ListQueryExecutions operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See ListQueryExecutions method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a ListQueryExecutions operation. +// pageNum := 0 +// err := client.ListQueryExecutionsPages(params, +// func(page *ListQueryExecutionsOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *Athena) ListQueryExecutionsPages(input *ListQueryExecutionsInput, fn func(*ListQueryExecutionsOutput, bool) bool) error { + return c.ListQueryExecutionsPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// ListQueryExecutionsPagesWithContext same as ListQueryExecutionsPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Athena) ListQueryExecutionsPagesWithContext(ctx aws.Context, input *ListQueryExecutionsInput, fn func(*ListQueryExecutionsOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *ListQueryExecutionsInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.ListQueryExecutionsRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*ListQueryExecutionsOutput), !p.HasNextPage()) + } + return p.Err() +} + +const opStartQueryExecution = "StartQueryExecution" + +// StartQueryExecutionRequest generates a "aws/request.Request" representing the +// client's request for the StartQueryExecution operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See StartQueryExecution for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the StartQueryExecution method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the StartQueryExecutionRequest method. +// req, resp := client.StartQueryExecutionRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/StartQueryExecution +func (c *Athena) StartQueryExecutionRequest(input *StartQueryExecutionInput) (req *request.Request, output *StartQueryExecutionOutput) { + op := &request.Operation{ + Name: opStartQueryExecution, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &StartQueryExecutionInput{} + } + + output = &StartQueryExecutionOutput{} + req = c.newRequest(op, input, output) + return +} + +// StartQueryExecution API operation for Amazon Athena. +// +// Runs (executes) the SQL query statements contained in the Query string. +// +// For code samples using the AWS SDK for Java, see Examples and Code Samples +// (http://docs.aws.amazon.com/athena/latest/ug/code-samples.html) in the Amazon +// Athena User Guide. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Athena's +// API operation StartQueryExecution for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInternalServerException "InternalServerException" +// Indicates a platform issue, which may be due to a transient condition or +// outage. +// +// * ErrCodeInvalidRequestException "InvalidRequestException" +// Indicates that something is wrong with the input to the request. For example, +// a required parameter may be missing or out of range. +// +// * ErrCodeTooManyRequestsException "TooManyRequestsException" +// Indicates that the request was throttled. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/StartQueryExecution +func (c *Athena) StartQueryExecution(input *StartQueryExecutionInput) (*StartQueryExecutionOutput, error) { + req, out := c.StartQueryExecutionRequest(input) + return out, req.Send() +} + +// StartQueryExecutionWithContext is the same as StartQueryExecution with the addition of +// the ability to pass a context and additional request options. +// +// See StartQueryExecution for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Athena) StartQueryExecutionWithContext(ctx aws.Context, input *StartQueryExecutionInput, opts ...request.Option) (*StartQueryExecutionOutput, error) { + req, out := c.StartQueryExecutionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +const opStopQueryExecution = "StopQueryExecution" + +// StopQueryExecutionRequest generates a "aws/request.Request" representing the +// client's request for the StopQueryExecution operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See StopQueryExecution for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the StopQueryExecution method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the StopQueryExecutionRequest method. +// req, resp := client.StopQueryExecutionRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/StopQueryExecution +func (c *Athena) StopQueryExecutionRequest(input *StopQueryExecutionInput) (req *request.Request, output *StopQueryExecutionOutput) { + op := &request.Operation{ + Name: opStopQueryExecution, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &StopQueryExecutionInput{} + } + + output = &StopQueryExecutionOutput{} + req = c.newRequest(op, input, output) + return +} + +// StopQueryExecution API operation for Amazon Athena. +// +// Stops a query execution. +// +// For code samples using the AWS SDK for Java, see Examples and Code Samples +// (http://docs.aws.amazon.com/athena/latest/ug/code-samples.html) in the Amazon +// Athena User Guide. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Athena's +// API operation StopQueryExecution for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInternalServerException "InternalServerException" +// Indicates a platform issue, which may be due to a transient condition or +// outage. +// +// * ErrCodeInvalidRequestException "InvalidRequestException" +// Indicates that something is wrong with the input to the request. For example, +// a required parameter may be missing or out of range. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/StopQueryExecution +func (c *Athena) StopQueryExecution(input *StopQueryExecutionInput) (*StopQueryExecutionOutput, error) { + req, out := c.StopQueryExecutionRequest(input) + return out, req.Send() +} + +// StopQueryExecutionWithContext is the same as StopQueryExecution with the addition of +// the ability to pass a context and additional request options. +// +// See StopQueryExecution for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Athena) StopQueryExecutionWithContext(ctx aws.Context, input *StopQueryExecutionInput, opts ...request.Option) (*StopQueryExecutionOutput, error) { + req, out := c.StopQueryExecutionRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/BatchGetNamedQueryInput +type BatchGetNamedQueryInput struct { + _ struct{} `type:"structure"` + + // An array of query IDs. + // + // NamedQueryIds is a required field + NamedQueryIds []*string `min:"1" type:"list" required:"true"` +} + +// String returns the string representation +func (s BatchGetNamedQueryInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s BatchGetNamedQueryInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *BatchGetNamedQueryInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "BatchGetNamedQueryInput"} + if s.NamedQueryIds == nil { + invalidParams.Add(request.NewErrParamRequired("NamedQueryIds")) + } + if s.NamedQueryIds != nil && len(s.NamedQueryIds) < 1 { + invalidParams.Add(request.NewErrParamMinLen("NamedQueryIds", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetNamedQueryIds sets the NamedQueryIds field's value. +func (s *BatchGetNamedQueryInput) SetNamedQueryIds(v []*string) *BatchGetNamedQueryInput { + s.NamedQueryIds = v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/BatchGetNamedQueryOutput +type BatchGetNamedQueryOutput struct { + _ struct{} `type:"structure"` + + // Information about the named query IDs submitted. + NamedQueries []*NamedQuery `type:"list"` + + // Information about provided query IDs. + UnprocessedNamedQueryIds []*UnprocessedNamedQueryId `type:"list"` +} + +// String returns the string representation +func (s BatchGetNamedQueryOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s BatchGetNamedQueryOutput) GoString() string { + return s.String() +} + +// SetNamedQueries sets the NamedQueries field's value. +func (s *BatchGetNamedQueryOutput) SetNamedQueries(v []*NamedQuery) *BatchGetNamedQueryOutput { + s.NamedQueries = v + return s +} + +// SetUnprocessedNamedQueryIds sets the UnprocessedNamedQueryIds field's value. +func (s *BatchGetNamedQueryOutput) SetUnprocessedNamedQueryIds(v []*UnprocessedNamedQueryId) *BatchGetNamedQueryOutput { + s.UnprocessedNamedQueryIds = v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/BatchGetQueryExecutionInput +type BatchGetQueryExecutionInput struct { + _ struct{} `type:"structure"` + + // An array of query execution IDs. + // + // QueryExecutionIds is a required field + QueryExecutionIds []*string `min:"1" type:"list" required:"true"` +} + +// String returns the string representation +func (s BatchGetQueryExecutionInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s BatchGetQueryExecutionInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *BatchGetQueryExecutionInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "BatchGetQueryExecutionInput"} + if s.QueryExecutionIds == nil { + invalidParams.Add(request.NewErrParamRequired("QueryExecutionIds")) + } + if s.QueryExecutionIds != nil && len(s.QueryExecutionIds) < 1 { + invalidParams.Add(request.NewErrParamMinLen("QueryExecutionIds", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetQueryExecutionIds sets the QueryExecutionIds field's value. +func (s *BatchGetQueryExecutionInput) SetQueryExecutionIds(v []*string) *BatchGetQueryExecutionInput { + s.QueryExecutionIds = v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/BatchGetQueryExecutionOutput +type BatchGetQueryExecutionOutput struct { + _ struct{} `type:"structure"` + + // Information about a query execution. + QueryExecutions []*QueryExecution `type:"list"` + + // Information about the query executions that failed to run. + UnprocessedQueryExecutionIds []*UnprocessedQueryExecutionId `type:"list"` +} + +// String returns the string representation +func (s BatchGetQueryExecutionOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s BatchGetQueryExecutionOutput) GoString() string { + return s.String() +} + +// SetQueryExecutions sets the QueryExecutions field's value. +func (s *BatchGetQueryExecutionOutput) SetQueryExecutions(v []*QueryExecution) *BatchGetQueryExecutionOutput { + s.QueryExecutions = v + return s +} + +// SetUnprocessedQueryExecutionIds sets the UnprocessedQueryExecutionIds field's value. +func (s *BatchGetQueryExecutionOutput) SetUnprocessedQueryExecutionIds(v []*UnprocessedQueryExecutionId) *BatchGetQueryExecutionOutput { + s.UnprocessedQueryExecutionIds = v + return s +} + +// Information about the columns in a query execution result. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/ColumnInfo +type ColumnInfo struct { + _ struct{} `type:"structure"` + + // Indicates whether values in the column are case-sensitive. + CaseSensitive *bool `type:"boolean"` + + // The catalog to which the query results belong. + CatalogName *string `type:"string"` + + // A column label. + Label *string `type:"string"` + + // The name of the column. + // + // Name is a required field + Name *string `type:"string" required:"true"` + + // Indicates the column's nullable status. + Nullable *string `type:"string" enum:"ColumnNullable"` + + // For DECIMAL data types, specifies the total number of digits, up to 38. For + // performance reasons, we recommend up to 18 digits. + Precision *int64 `type:"integer"` + + // For DECIMAL data types, specifies the total number of digits in the fractional + // part of the value. Defaults to 0. + Scale *int64 `type:"integer"` + + // The schema name (database name) to which the query results belong. + SchemaName *string `type:"string"` + + // The table name for the query results. + TableName *string `type:"string"` + + // The data type of the column. + // + // Type is a required field + Type *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s ColumnInfo) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ColumnInfo) GoString() string { + return s.String() +} + +// SetCaseSensitive sets the CaseSensitive field's value. +func (s *ColumnInfo) SetCaseSensitive(v bool) *ColumnInfo { + s.CaseSensitive = &v + return s +} + +// SetCatalogName sets the CatalogName field's value. +func (s *ColumnInfo) SetCatalogName(v string) *ColumnInfo { + s.CatalogName = &v + return s +} + +// SetLabel sets the Label field's value. +func (s *ColumnInfo) SetLabel(v string) *ColumnInfo { + s.Label = &v + return s +} + +// SetName sets the Name field's value. +func (s *ColumnInfo) SetName(v string) *ColumnInfo { + s.Name = &v + return s +} + +// SetNullable sets the Nullable field's value. +func (s *ColumnInfo) SetNullable(v string) *ColumnInfo { + s.Nullable = &v + return s +} + +// SetPrecision sets the Precision field's value. +func (s *ColumnInfo) SetPrecision(v int64) *ColumnInfo { + s.Precision = &v + return s +} + +// SetScale sets the Scale field's value. +func (s *ColumnInfo) SetScale(v int64) *ColumnInfo { + s.Scale = &v + return s +} + +// SetSchemaName sets the SchemaName field's value. +func (s *ColumnInfo) SetSchemaName(v string) *ColumnInfo { + s.SchemaName = &v + return s +} + +// SetTableName sets the TableName field's value. +func (s *ColumnInfo) SetTableName(v string) *ColumnInfo { + s.TableName = &v + return s +} + +// SetType sets the Type field's value. +func (s *ColumnInfo) SetType(v string) *ColumnInfo { + s.Type = &v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/CreateNamedQueryInput +type CreateNamedQueryInput struct { + _ struct{} `type:"structure"` + + // A unique case-sensitive string used to ensure the request to create the query + // is idempotent (executes only once). If another CreateNamedQuery request is + // received, the same response is returned and another query is not created. + // If a parameter has changed, for example, the QueryString, an error is returned. + // + // This token is listed as not required because AWS SDKs (for example the AWS + // SDK for Java) auto-generate the token for users. If you are not using the + // AWS SDK or the AWS CLI, you must provide this token or the action will fail. + ClientRequestToken *string `min:"32" type:"string" idempotencyToken:"true"` + + // The database to which the query belongs. + // + // Database is a required field + Database *string `min:"1" type:"string" required:"true"` + + // A brief explanation of the query. + Description *string `min:"1" type:"string"` + + // The plain language name for the query. + // + // Name is a required field + Name *string `min:"1" type:"string" required:"true"` + + // The text of the query itself. In other words, all query statements. + // + // QueryString is a required field + QueryString *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s CreateNamedQueryInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateNamedQueryInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *CreateNamedQueryInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "CreateNamedQueryInput"} + if s.ClientRequestToken != nil && len(*s.ClientRequestToken) < 32 { + invalidParams.Add(request.NewErrParamMinLen("ClientRequestToken", 32)) + } + if s.Database == nil { + invalidParams.Add(request.NewErrParamRequired("Database")) + } + if s.Database != nil && len(*s.Database) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Database", 1)) + } + if s.Description != nil && len(*s.Description) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Description", 1)) + } + if s.Name == nil { + invalidParams.Add(request.NewErrParamRequired("Name")) + } + if s.Name != nil && len(*s.Name) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Name", 1)) + } + if s.QueryString == nil { + invalidParams.Add(request.NewErrParamRequired("QueryString")) + } + if s.QueryString != nil && len(*s.QueryString) < 1 { + invalidParams.Add(request.NewErrParamMinLen("QueryString", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetClientRequestToken sets the ClientRequestToken field's value. +func (s *CreateNamedQueryInput) SetClientRequestToken(v string) *CreateNamedQueryInput { + s.ClientRequestToken = &v + return s +} + +// SetDatabase sets the Database field's value. +func (s *CreateNamedQueryInput) SetDatabase(v string) *CreateNamedQueryInput { + s.Database = &v + return s +} + +// SetDescription sets the Description field's value. +func (s *CreateNamedQueryInput) SetDescription(v string) *CreateNamedQueryInput { + s.Description = &v + return s +} + +// SetName sets the Name field's value. +func (s *CreateNamedQueryInput) SetName(v string) *CreateNamedQueryInput { + s.Name = &v + return s +} + +// SetQueryString sets the QueryString field's value. +func (s *CreateNamedQueryInput) SetQueryString(v string) *CreateNamedQueryInput { + s.QueryString = &v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/CreateNamedQueryOutput +type CreateNamedQueryOutput struct { + _ struct{} `type:"structure"` + + // The unique ID of the query. + NamedQueryId *string `type:"string"` +} + +// String returns the string representation +func (s CreateNamedQueryOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s CreateNamedQueryOutput) GoString() string { + return s.String() +} + +// SetNamedQueryId sets the NamedQueryId field's value. +func (s *CreateNamedQueryOutput) SetNamedQueryId(v string) *CreateNamedQueryOutput { + s.NamedQueryId = &v + return s +} + +// A piece of data (a field in the table). +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/Datum +type Datum struct { + _ struct{} `type:"structure"` + + // The value of the datum. + VarCharValue *string `type:"string"` +} + +// String returns the string representation +func (s Datum) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Datum) GoString() string { + return s.String() +} + +// SetVarCharValue sets the VarCharValue field's value. +func (s *Datum) SetVarCharValue(v string) *Datum { + s.VarCharValue = &v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/DeleteNamedQueryInput +type DeleteNamedQueryInput struct { + _ struct{} `type:"structure"` + + // The unique ID of the query to delete. + // + // NamedQueryId is a required field + NamedQueryId *string `type:"string" required:"true" idempotencyToken:"true"` +} + +// String returns the string representation +func (s DeleteNamedQueryInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteNamedQueryInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *DeleteNamedQueryInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "DeleteNamedQueryInput"} + if s.NamedQueryId == nil { + invalidParams.Add(request.NewErrParamRequired("NamedQueryId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetNamedQueryId sets the NamedQueryId field's value. +func (s *DeleteNamedQueryInput) SetNamedQueryId(v string) *DeleteNamedQueryInput { + s.NamedQueryId = &v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/DeleteNamedQueryOutput +type DeleteNamedQueryOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s DeleteNamedQueryOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s DeleteNamedQueryOutput) GoString() string { + return s.String() +} + +// If query results are encrypted in Amazon S3, indicates the Amazon S3 encryption +// option used. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/EncryptionConfiguration +type EncryptionConfiguration struct { + _ struct{} `type:"structure"` + + // Indicates whether Amazon S3 server-side encryption with Amazon S3-managed + // keys (SSE-S3), server-side encryption with KMS-managed keys (SSE-KMS), or + // client-side encryption with KMS-managed keys (CSE-KMS) is used. + // + // EncryptionOption is a required field + EncryptionOption *string `type:"string" required:"true" enum:"EncryptionOption"` + + // For SSE-KMS and CSE-KMS, this is the KMS key ARN or ID. + KmsKey *string `type:"string"` +} + +// String returns the string representation +func (s EncryptionConfiguration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s EncryptionConfiguration) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *EncryptionConfiguration) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "EncryptionConfiguration"} + if s.EncryptionOption == nil { + invalidParams.Add(request.NewErrParamRequired("EncryptionOption")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetEncryptionOption sets the EncryptionOption field's value. +func (s *EncryptionConfiguration) SetEncryptionOption(v string) *EncryptionConfiguration { + s.EncryptionOption = &v + return s +} + +// SetKmsKey sets the KmsKey field's value. +func (s *EncryptionConfiguration) SetKmsKey(v string) *EncryptionConfiguration { + s.KmsKey = &v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/GetNamedQueryInput +type GetNamedQueryInput struct { + _ struct{} `type:"structure"` + + // The unique ID of the query. Use ListNamedQueries to get query IDs. + // + // NamedQueryId is a required field + NamedQueryId *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s GetNamedQueryInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetNamedQueryInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetNamedQueryInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetNamedQueryInput"} + if s.NamedQueryId == nil { + invalidParams.Add(request.NewErrParamRequired("NamedQueryId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetNamedQueryId sets the NamedQueryId field's value. +func (s *GetNamedQueryInput) SetNamedQueryId(v string) *GetNamedQueryInput { + s.NamedQueryId = &v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/GetNamedQueryOutput +type GetNamedQueryOutput struct { + _ struct{} `type:"structure"` + + // Information about the query. + NamedQuery *NamedQuery `type:"structure"` +} + +// String returns the string representation +func (s GetNamedQueryOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetNamedQueryOutput) GoString() string { + return s.String() +} + +// SetNamedQuery sets the NamedQuery field's value. +func (s *GetNamedQueryOutput) SetNamedQuery(v *NamedQuery) *GetNamedQueryOutput { + s.NamedQuery = v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/GetQueryExecutionInput +type GetQueryExecutionInput struct { + _ struct{} `type:"structure"` + + // The unique ID of the query execution. + // + // QueryExecutionId is a required field + QueryExecutionId *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s GetQueryExecutionInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetQueryExecutionInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetQueryExecutionInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetQueryExecutionInput"} + if s.QueryExecutionId == nil { + invalidParams.Add(request.NewErrParamRequired("QueryExecutionId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetQueryExecutionId sets the QueryExecutionId field's value. +func (s *GetQueryExecutionInput) SetQueryExecutionId(v string) *GetQueryExecutionInput { + s.QueryExecutionId = &v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/GetQueryExecutionOutput +type GetQueryExecutionOutput struct { + _ struct{} `type:"structure"` + + // Information about the query execution. + QueryExecution *QueryExecution `type:"structure"` +} + +// String returns the string representation +func (s GetQueryExecutionOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetQueryExecutionOutput) GoString() string { + return s.String() +} + +// SetQueryExecution sets the QueryExecution field's value. +func (s *GetQueryExecutionOutput) SetQueryExecution(v *QueryExecution) *GetQueryExecutionOutput { + s.QueryExecution = v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/GetQueryResultsInput +type GetQueryResultsInput struct { + _ struct{} `type:"structure"` + + // The maximum number of results (rows) to return in this request. + MaxResults *int64 `type:"integer"` + + // The token that specifies where to start pagination if a previous request + // was truncated. + NextToken *string `type:"string"` + + // The unique ID of the query execution. + // + // QueryExecutionId is a required field + QueryExecutionId *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s GetQueryResultsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetQueryResultsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetQueryResultsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetQueryResultsInput"} + if s.QueryExecutionId == nil { + invalidParams.Add(request.NewErrParamRequired("QueryExecutionId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetMaxResults sets the MaxResults field's value. +func (s *GetQueryResultsInput) SetMaxResults(v int64) *GetQueryResultsInput { + s.MaxResults = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *GetQueryResultsInput) SetNextToken(v string) *GetQueryResultsInput { + s.NextToken = &v + return s +} + +// SetQueryExecutionId sets the QueryExecutionId field's value. +func (s *GetQueryResultsInput) SetQueryExecutionId(v string) *GetQueryResultsInput { + s.QueryExecutionId = &v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/GetQueryResultsOutput +type GetQueryResultsOutput struct { + _ struct{} `type:"structure"` + + // A token to be used by the next request if this request is truncated. + NextToken *string `type:"string"` + + // The results of the query execution. + ResultSet *ResultSet `type:"structure"` +} + +// String returns the string representation +func (s GetQueryResultsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetQueryResultsOutput) GoString() string { + return s.String() +} + +// SetNextToken sets the NextToken field's value. +func (s *GetQueryResultsOutput) SetNextToken(v string) *GetQueryResultsOutput { + s.NextToken = &v + return s +} + +// SetResultSet sets the ResultSet field's value. +func (s *GetQueryResultsOutput) SetResultSet(v *ResultSet) *GetQueryResultsOutput { + s.ResultSet = v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/ListNamedQueriesInput +type ListNamedQueriesInput struct { + _ struct{} `type:"structure"` + + // The maximum number of queries to return in this request. + MaxResults *int64 `type:"integer"` + + // The token that specifies where to start pagination if a previous request + // was truncated. + NextToken *string `type:"string"` +} + +// String returns the string representation +func (s ListNamedQueriesInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListNamedQueriesInput) GoString() string { + return s.String() +} + +// SetMaxResults sets the MaxResults field's value. +func (s *ListNamedQueriesInput) SetMaxResults(v int64) *ListNamedQueriesInput { + s.MaxResults = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListNamedQueriesInput) SetNextToken(v string) *ListNamedQueriesInput { + s.NextToken = &v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/ListNamedQueriesOutput +type ListNamedQueriesOutput struct { + _ struct{} `type:"structure"` + + // The list of unique query IDs. + NamedQueryIds []*string `min:"1" type:"list"` + + // A token to be used by the next request if this request is truncated. + NextToken *string `type:"string"` +} + +// String returns the string representation +func (s ListNamedQueriesOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListNamedQueriesOutput) GoString() string { + return s.String() +} + +// SetNamedQueryIds sets the NamedQueryIds field's value. +func (s *ListNamedQueriesOutput) SetNamedQueryIds(v []*string) *ListNamedQueriesOutput { + s.NamedQueryIds = v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListNamedQueriesOutput) SetNextToken(v string) *ListNamedQueriesOutput { + s.NextToken = &v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/ListQueryExecutionsInput +type ListQueryExecutionsInput struct { + _ struct{} `type:"structure"` + + // The maximum number of query executions to return in this request. + MaxResults *int64 `type:"integer"` + + // The token that specifies where to start pagination if a previous request + // was truncated. + NextToken *string `type:"string"` +} + +// String returns the string representation +func (s ListQueryExecutionsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListQueryExecutionsInput) GoString() string { + return s.String() +} + +// SetMaxResults sets the MaxResults field's value. +func (s *ListQueryExecutionsInput) SetMaxResults(v int64) *ListQueryExecutionsInput { + s.MaxResults = &v + return s +} + +// SetNextToken sets the NextToken field's value. +func (s *ListQueryExecutionsInput) SetNextToken(v string) *ListQueryExecutionsInput { + s.NextToken = &v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/ListQueryExecutionsOutput +type ListQueryExecutionsOutput struct { + _ struct{} `type:"structure"` + + // A token to be used by the next request if this request is truncated. + NextToken *string `type:"string"` + + // The unique IDs of each query execution as an array of strings. + QueryExecutionIds []*string `min:"1" type:"list"` +} + +// String returns the string representation +func (s ListQueryExecutionsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ListQueryExecutionsOutput) GoString() string { + return s.String() +} + +// SetNextToken sets the NextToken field's value. +func (s *ListQueryExecutionsOutput) SetNextToken(v string) *ListQueryExecutionsOutput { + s.NextToken = &v + return s +} + +// SetQueryExecutionIds sets the QueryExecutionIds field's value. +func (s *ListQueryExecutionsOutput) SetQueryExecutionIds(v []*string) *ListQueryExecutionsOutput { + s.QueryExecutionIds = v + return s +} + +// A query, where QueryString is the SQL query statements that comprise the +// query. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/NamedQuery +type NamedQuery struct { + _ struct{} `type:"structure"` + + // The database to which the query belongs. + // + // Database is a required field + Database *string `min:"1" type:"string" required:"true"` + + // A brief description of the query. + Description *string `min:"1" type:"string"` + + // The plain-language name of the query. + // + // Name is a required field + Name *string `min:"1" type:"string" required:"true"` + + // The unique identifier of the query. + NamedQueryId *string `type:"string"` + + // The SQL query statements that comprise the query. + // + // QueryString is a required field + QueryString *string `min:"1" type:"string" required:"true"` +} + +// String returns the string representation +func (s NamedQuery) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s NamedQuery) GoString() string { + return s.String() +} + +// SetDatabase sets the Database field's value. +func (s *NamedQuery) SetDatabase(v string) *NamedQuery { + s.Database = &v + return s +} + +// SetDescription sets the Description field's value. +func (s *NamedQuery) SetDescription(v string) *NamedQuery { + s.Description = &v + return s +} + +// SetName sets the Name field's value. +func (s *NamedQuery) SetName(v string) *NamedQuery { + s.Name = &v + return s +} + +// SetNamedQueryId sets the NamedQueryId field's value. +func (s *NamedQuery) SetNamedQueryId(v string) *NamedQuery { + s.NamedQueryId = &v + return s +} + +// SetQueryString sets the QueryString field's value. +func (s *NamedQuery) SetQueryString(v string) *NamedQuery { + s.QueryString = &v + return s +} + +// Information about a single instance of a query execution. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/QueryExecution +type QueryExecution struct { + _ struct{} `type:"structure"` + + // The SQL query statements which the query execution ran. + Query *string `min:"1" type:"string"` + + // The database in which the query execution occurred. + QueryExecutionContext *QueryExecutionContext `type:"structure"` + + // The unique identifier for each query execution. + QueryExecutionId *string `type:"string"` + + // The location in Amazon S3 where query results were stored and the encryption + // option, if any, used for query results. + ResultConfiguration *ResultConfiguration `type:"structure"` + + // The amount of data scanned during the query execution and the amount of time + // that it took to execute. + Statistics *QueryExecutionStatistics `type:"structure"` + + // The completion date, current state, submission time, and state change reason + // (if applicable) for the query execution. + Status *QueryExecutionStatus `type:"structure"` +} + +// String returns the string representation +func (s QueryExecution) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s QueryExecution) GoString() string { + return s.String() +} + +// SetQuery sets the Query field's value. +func (s *QueryExecution) SetQuery(v string) *QueryExecution { + s.Query = &v + return s +} + +// SetQueryExecutionContext sets the QueryExecutionContext field's value. +func (s *QueryExecution) SetQueryExecutionContext(v *QueryExecutionContext) *QueryExecution { + s.QueryExecutionContext = v + return s +} + +// SetQueryExecutionId sets the QueryExecutionId field's value. +func (s *QueryExecution) SetQueryExecutionId(v string) *QueryExecution { + s.QueryExecutionId = &v + return s +} + +// SetResultConfiguration sets the ResultConfiguration field's value. +func (s *QueryExecution) SetResultConfiguration(v *ResultConfiguration) *QueryExecution { + s.ResultConfiguration = v + return s +} + +// SetStatistics sets the Statistics field's value. +func (s *QueryExecution) SetStatistics(v *QueryExecutionStatistics) *QueryExecution { + s.Statistics = v + return s +} + +// SetStatus sets the Status field's value. +func (s *QueryExecution) SetStatus(v *QueryExecutionStatus) *QueryExecution { + s.Status = v + return s +} + +// The database in which the query execution occurs. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/QueryExecutionContext +type QueryExecutionContext struct { + _ struct{} `type:"structure"` + + // The name of the database. + Database *string `min:"1" type:"string"` +} + +// String returns the string representation +func (s QueryExecutionContext) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s QueryExecutionContext) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *QueryExecutionContext) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "QueryExecutionContext"} + if s.Database != nil && len(*s.Database) < 1 { + invalidParams.Add(request.NewErrParamMinLen("Database", 1)) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetDatabase sets the Database field's value. +func (s *QueryExecutionContext) SetDatabase(v string) *QueryExecutionContext { + s.Database = &v + return s +} + +// The amount of data scanned during the query execution and the amount of time +// that it took to execute. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/QueryExecutionStatistics +type QueryExecutionStatistics struct { + _ struct{} `type:"structure"` + + // The number of bytes in the data that was queried. + DataScannedInBytes *int64 `type:"long"` + + // The number of milliseconds that the query took to execute. + EngineExecutionTimeInMillis *int64 `type:"long"` +} + +// String returns the string representation +func (s QueryExecutionStatistics) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s QueryExecutionStatistics) GoString() string { + return s.String() +} + +// SetDataScannedInBytes sets the DataScannedInBytes field's value. +func (s *QueryExecutionStatistics) SetDataScannedInBytes(v int64) *QueryExecutionStatistics { + s.DataScannedInBytes = &v + return s +} + +// SetEngineExecutionTimeInMillis sets the EngineExecutionTimeInMillis field's value. +func (s *QueryExecutionStatistics) SetEngineExecutionTimeInMillis(v int64) *QueryExecutionStatistics { + s.EngineExecutionTimeInMillis = &v + return s +} + +// The completion date, current state, submission time, and state change reason +// (if applicable) for the query execution. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/QueryExecutionStatus +type QueryExecutionStatus struct { + _ struct{} `type:"structure"` + + // The date and time that the query completed. + CompletionDateTime *time.Time `type:"timestamp" timestampFormat:"unix"` + + // The state of query execution. SUBMITTED indicates that the query is queued + // for execution. RUNNING indicates that the query is scanning data and returning + // results. SUCCEEDED indicates that the query completed without error. FAILED + // indicates that the query experienced an error and did not complete processing. + // CANCELLED indicates that user input interrupted query execution. + State *string `type:"string" enum:"QueryExecutionState"` + + // Further detail about the status of the query. + StateChangeReason *string `type:"string"` + + // The date and time that the query was submitted. + SubmissionDateTime *time.Time `type:"timestamp" timestampFormat:"unix"` +} + +// String returns the string representation +func (s QueryExecutionStatus) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s QueryExecutionStatus) GoString() string { + return s.String() +} + +// SetCompletionDateTime sets the CompletionDateTime field's value. +func (s *QueryExecutionStatus) SetCompletionDateTime(v time.Time) *QueryExecutionStatus { + s.CompletionDateTime = &v + return s +} + +// SetState sets the State field's value. +func (s *QueryExecutionStatus) SetState(v string) *QueryExecutionStatus { + s.State = &v + return s +} + +// SetStateChangeReason sets the StateChangeReason field's value. +func (s *QueryExecutionStatus) SetStateChangeReason(v string) *QueryExecutionStatus { + s.StateChangeReason = &v + return s +} + +// SetSubmissionDateTime sets the SubmissionDateTime field's value. +func (s *QueryExecutionStatus) SetSubmissionDateTime(v time.Time) *QueryExecutionStatus { + s.SubmissionDateTime = &v + return s +} + +// The location in Amazon S3 where query results are stored and the encryption +// option, if any, used for query results. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/ResultConfiguration +type ResultConfiguration struct { + _ struct{} `type:"structure"` + + // If query results are encrypted in S3, indicates the S3 encryption option + // used (for example, SSE-KMS or CSE-KMS and key information. + EncryptionConfiguration *EncryptionConfiguration `type:"structure"` + + // The location in S3 where query results are stored. + // + // OutputLocation is a required field + OutputLocation *string `type:"string" required:"true"` +} + +// String returns the string representation +func (s ResultConfiguration) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ResultConfiguration) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *ResultConfiguration) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "ResultConfiguration"} + if s.OutputLocation == nil { + invalidParams.Add(request.NewErrParamRequired("OutputLocation")) + } + if s.EncryptionConfiguration != nil { + if err := s.EncryptionConfiguration.Validate(); err != nil { + invalidParams.AddNested("EncryptionConfiguration", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetEncryptionConfiguration sets the EncryptionConfiguration field's value. +func (s *ResultConfiguration) SetEncryptionConfiguration(v *EncryptionConfiguration) *ResultConfiguration { + s.EncryptionConfiguration = v + return s +} + +// SetOutputLocation sets the OutputLocation field's value. +func (s *ResultConfiguration) SetOutputLocation(v string) *ResultConfiguration { + s.OutputLocation = &v + return s +} + +// The metadata and rows that comprise a query result set. The metadata describes +// the column structure and data types. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/ResultSet +type ResultSet struct { + _ struct{} `type:"structure"` + + // The metadata that describes the column structure and data types of a table + // of query results. + ResultSetMetadata *ResultSetMetadata `type:"structure"` + + // The rows in the table. + Rows []*Row `type:"list"` +} + +// String returns the string representation +func (s ResultSet) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ResultSet) GoString() string { + return s.String() +} + +// SetResultSetMetadata sets the ResultSetMetadata field's value. +func (s *ResultSet) SetResultSetMetadata(v *ResultSetMetadata) *ResultSet { + s.ResultSetMetadata = v + return s +} + +// SetRows sets the Rows field's value. +func (s *ResultSet) SetRows(v []*Row) *ResultSet { + s.Rows = v + return s +} + +// The metadata that describes the column structure and data types of a table +// of query results. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/ResultSetMetadata +type ResultSetMetadata struct { + _ struct{} `type:"structure"` + + // Information about the columns in a query execution result. + ColumnInfo []*ColumnInfo `type:"list"` +} + +// String returns the string representation +func (s ResultSetMetadata) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s ResultSetMetadata) GoString() string { + return s.String() +} + +// SetColumnInfo sets the ColumnInfo field's value. +func (s *ResultSetMetadata) SetColumnInfo(v []*ColumnInfo) *ResultSetMetadata { + s.ColumnInfo = v + return s +} + +// The rows that comprise a query result table. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/Row +type Row struct { + _ struct{} `type:"structure"` + + // The data that populates a row in a query result table. + Data []*Datum `type:"list"` +} + +// String returns the string representation +func (s Row) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s Row) GoString() string { + return s.String() +} + +// SetData sets the Data field's value. +func (s *Row) SetData(v []*Datum) *Row { + s.Data = v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/StartQueryExecutionInput +type StartQueryExecutionInput struct { + _ struct{} `type:"structure"` + + // A unique case-sensitive string used to ensure the request to create the query + // is idempotent (executes only once). If another StartQueryExecution request + // is received, the same response is returned and another query is not created. + // If a parameter has changed, for example, the QueryString, an error is returned. + // + // This token is listed as not required because AWS SDKs (for example the AWS + // SDK for Java) auto-generate the token for users. If you are not using the + // AWS SDK or the AWS CLI, you must provide this token or the action will fail. + ClientRequestToken *string `min:"32" type:"string" idempotencyToken:"true"` + + // The database within which the query executes. + QueryExecutionContext *QueryExecutionContext `type:"structure"` + + // The SQL query statements to be executed. + // + // QueryString is a required field + QueryString *string `min:"1" type:"string" required:"true"` + + // Specifies information about where and how to save the results of the query + // execution. + // + // ResultConfiguration is a required field + ResultConfiguration *ResultConfiguration `type:"structure" required:"true"` +} + +// String returns the string representation +func (s StartQueryExecutionInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StartQueryExecutionInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *StartQueryExecutionInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "StartQueryExecutionInput"} + if s.ClientRequestToken != nil && len(*s.ClientRequestToken) < 32 { + invalidParams.Add(request.NewErrParamMinLen("ClientRequestToken", 32)) + } + if s.QueryString == nil { + invalidParams.Add(request.NewErrParamRequired("QueryString")) + } + if s.QueryString != nil && len(*s.QueryString) < 1 { + invalidParams.Add(request.NewErrParamMinLen("QueryString", 1)) + } + if s.ResultConfiguration == nil { + invalidParams.Add(request.NewErrParamRequired("ResultConfiguration")) + } + if s.QueryExecutionContext != nil { + if err := s.QueryExecutionContext.Validate(); err != nil { + invalidParams.AddNested("QueryExecutionContext", err.(request.ErrInvalidParams)) + } + } + if s.ResultConfiguration != nil { + if err := s.ResultConfiguration.Validate(); err != nil { + invalidParams.AddNested("ResultConfiguration", err.(request.ErrInvalidParams)) + } + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetClientRequestToken sets the ClientRequestToken field's value. +func (s *StartQueryExecutionInput) SetClientRequestToken(v string) *StartQueryExecutionInput { + s.ClientRequestToken = &v + return s +} + +// SetQueryExecutionContext sets the QueryExecutionContext field's value. +func (s *StartQueryExecutionInput) SetQueryExecutionContext(v *QueryExecutionContext) *StartQueryExecutionInput { + s.QueryExecutionContext = v + return s +} + +// SetQueryString sets the QueryString field's value. +func (s *StartQueryExecutionInput) SetQueryString(v string) *StartQueryExecutionInput { + s.QueryString = &v + return s +} + +// SetResultConfiguration sets the ResultConfiguration field's value. +func (s *StartQueryExecutionInput) SetResultConfiguration(v *ResultConfiguration) *StartQueryExecutionInput { + s.ResultConfiguration = v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/StartQueryExecutionOutput +type StartQueryExecutionOutput struct { + _ struct{} `type:"structure"` + + // The unique ID of the query that ran as a result of this request. + QueryExecutionId *string `type:"string"` +} + +// String returns the string representation +func (s StartQueryExecutionOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StartQueryExecutionOutput) GoString() string { + return s.String() +} + +// SetQueryExecutionId sets the QueryExecutionId field's value. +func (s *StartQueryExecutionOutput) SetQueryExecutionId(v string) *StartQueryExecutionOutput { + s.QueryExecutionId = &v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/StopQueryExecutionInput +type StopQueryExecutionInput struct { + _ struct{} `type:"structure"` + + // The unique ID of the query execution to stop. + // + // QueryExecutionId is a required field + QueryExecutionId *string `type:"string" required:"true" idempotencyToken:"true"` +} + +// String returns the string representation +func (s StopQueryExecutionInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StopQueryExecutionInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *StopQueryExecutionInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "StopQueryExecutionInput"} + if s.QueryExecutionId == nil { + invalidParams.Add(request.NewErrParamRequired("QueryExecutionId")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetQueryExecutionId sets the QueryExecutionId field's value. +func (s *StopQueryExecutionInput) SetQueryExecutionId(v string) *StopQueryExecutionInput { + s.QueryExecutionId = &v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/StopQueryExecutionOutput +type StopQueryExecutionOutput struct { + _ struct{} `type:"structure"` +} + +// String returns the string representation +func (s StopQueryExecutionOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s StopQueryExecutionOutput) GoString() string { + return s.String() +} + +// Information about a named query ID that could not be processed. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/UnprocessedNamedQueryId +type UnprocessedNamedQueryId struct { + _ struct{} `type:"structure"` + + // The error code returned when the processing request for the named query failed, + // if applicable. + ErrorCode *string `min:"1" type:"string"` + + // The error message returned when the processing request for the named query + // failed, if applicable. + ErrorMessage *string `type:"string"` + + // The unique identifier of the named query. + NamedQueryId *string `type:"string"` +} + +// String returns the string representation +func (s UnprocessedNamedQueryId) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UnprocessedNamedQueryId) GoString() string { + return s.String() +} + +// SetErrorCode sets the ErrorCode field's value. +func (s *UnprocessedNamedQueryId) SetErrorCode(v string) *UnprocessedNamedQueryId { + s.ErrorCode = &v + return s +} + +// SetErrorMessage sets the ErrorMessage field's value. +func (s *UnprocessedNamedQueryId) SetErrorMessage(v string) *UnprocessedNamedQueryId { + s.ErrorMessage = &v + return s +} + +// SetNamedQueryId sets the NamedQueryId field's value. +func (s *UnprocessedNamedQueryId) SetNamedQueryId(v string) *UnprocessedNamedQueryId { + s.NamedQueryId = &v + return s +} + +// Describes a query execution that failed to process. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18/UnprocessedQueryExecutionId +type UnprocessedQueryExecutionId struct { + _ struct{} `type:"structure"` + + // The error code returned when the query execution failed to process, if applicable. + ErrorCode *string `min:"1" type:"string"` + + // The error message returned when the query execution failed to process, if + // applicable. + ErrorMessage *string `type:"string"` + + // The unique identifier of the query execution. + QueryExecutionId *string `type:"string"` +} + +// String returns the string representation +func (s UnprocessedQueryExecutionId) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s UnprocessedQueryExecutionId) GoString() string { + return s.String() +} + +// SetErrorCode sets the ErrorCode field's value. +func (s *UnprocessedQueryExecutionId) SetErrorCode(v string) *UnprocessedQueryExecutionId { + s.ErrorCode = &v + return s +} + +// SetErrorMessage sets the ErrorMessage field's value. +func (s *UnprocessedQueryExecutionId) SetErrorMessage(v string) *UnprocessedQueryExecutionId { + s.ErrorMessage = &v + return s +} + +// SetQueryExecutionId sets the QueryExecutionId field's value. +func (s *UnprocessedQueryExecutionId) SetQueryExecutionId(v string) *UnprocessedQueryExecutionId { + s.QueryExecutionId = &v + return s +} + +const ( + // ColumnNullableNotNull is a ColumnNullable enum value + ColumnNullableNotNull = "NOT_NULL" + + // ColumnNullableNullable is a ColumnNullable enum value + ColumnNullableNullable = "NULLABLE" + + // ColumnNullableUnknown is a ColumnNullable enum value + ColumnNullableUnknown = "UNKNOWN" +) + +const ( + // EncryptionOptionSseS3 is a EncryptionOption enum value + EncryptionOptionSseS3 = "SSE_S3" + + // EncryptionOptionSseKms is a EncryptionOption enum value + EncryptionOptionSseKms = "SSE_KMS" + + // EncryptionOptionCseKms is a EncryptionOption enum value + EncryptionOptionCseKms = "CSE_KMS" +) + +const ( + // QueryExecutionStateQueued is a QueryExecutionState enum value + QueryExecutionStateQueued = "QUEUED" + + // QueryExecutionStateRunning is a QueryExecutionState enum value + QueryExecutionStateRunning = "RUNNING" + + // QueryExecutionStateSucceeded is a QueryExecutionState enum value + QueryExecutionStateSucceeded = "SUCCEEDED" + + // QueryExecutionStateFailed is a QueryExecutionState enum value + QueryExecutionStateFailed = "FAILED" + + // QueryExecutionStateCancelled is a QueryExecutionState enum value + QueryExecutionStateCancelled = "CANCELLED" +) + +const ( + // ThrottleReasonConcurrentQueryLimitExceeded is a ThrottleReason enum value + ThrottleReasonConcurrentQueryLimitExceeded = "CONCURRENT_QUERY_LIMIT_EXCEEDED" +) diff --git a/vendor/github.com/aws/aws-sdk-go/service/athena/athenaiface/interface.go b/vendor/github.com/aws/aws-sdk-go/service/athena/athenaiface/interface.go new file mode 100644 index 000000000..fbf459874 --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/athena/athenaiface/interface.go @@ -0,0 +1,117 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +// Package athenaiface provides an interface to enable mocking the Amazon Athena service client +// for testing your code. +// +// It is important to note that this interface will have breaking changes +// when the service model is updated and adds new API operations, paginators, +// and waiters. +package athenaiface + +import ( + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/request" + "github.com/aws/aws-sdk-go/service/athena" +) + +// AthenaAPI provides an interface to enable mocking the +// athena.Athena service client's API operation, +// paginators, and waiters. This make unit testing your code that calls out +// to the SDK's service client's calls easier. +// +// The best way to use this interface is so the SDK's service client's calls +// can be stubbed out for unit testing your code with the SDK without needing +// to inject custom request handlers into the the SDK's request pipeline. +// +// // myFunc uses an SDK service client to make a request to +// // Amazon Athena. +// func myFunc(svc athenaiface.AthenaAPI) bool { +// // Make svc.BatchGetNamedQuery request +// } +// +// func main() { +// sess := session.New() +// svc := athena.New(sess) +// +// myFunc(svc) +// } +// +// In your _test.go file: +// +// // Define a mock struct to be used in your unit tests of myFunc. +// type mockAthenaClient struct { +// athenaiface.AthenaAPI +// } +// func (m *mockAthenaClient) BatchGetNamedQuery(input *athena.BatchGetNamedQueryInput) (*athena.BatchGetNamedQueryOutput, error) { +// // mock response/functionality +// } +// +// func TestMyFunc(t *testing.T) { +// // Setup Test +// mockSvc := &mockAthenaClient{} +// +// myfunc(mockSvc) +// +// // Verify myFunc's functionality +// } +// +// It is important to note that this interface will have breaking changes +// when the service model is updated and adds new API operations, paginators, +// and waiters. Its suggested to use the pattern above for testing, or using +// tooling to generate mocks to satisfy the interfaces. +type AthenaAPI interface { + BatchGetNamedQuery(*athena.BatchGetNamedQueryInput) (*athena.BatchGetNamedQueryOutput, error) + BatchGetNamedQueryWithContext(aws.Context, *athena.BatchGetNamedQueryInput, ...request.Option) (*athena.BatchGetNamedQueryOutput, error) + BatchGetNamedQueryRequest(*athena.BatchGetNamedQueryInput) (*request.Request, *athena.BatchGetNamedQueryOutput) + + BatchGetQueryExecution(*athena.BatchGetQueryExecutionInput) (*athena.BatchGetQueryExecutionOutput, error) + BatchGetQueryExecutionWithContext(aws.Context, *athena.BatchGetQueryExecutionInput, ...request.Option) (*athena.BatchGetQueryExecutionOutput, error) + BatchGetQueryExecutionRequest(*athena.BatchGetQueryExecutionInput) (*request.Request, *athena.BatchGetQueryExecutionOutput) + + CreateNamedQuery(*athena.CreateNamedQueryInput) (*athena.CreateNamedQueryOutput, error) + CreateNamedQueryWithContext(aws.Context, *athena.CreateNamedQueryInput, ...request.Option) (*athena.CreateNamedQueryOutput, error) + CreateNamedQueryRequest(*athena.CreateNamedQueryInput) (*request.Request, *athena.CreateNamedQueryOutput) + + DeleteNamedQuery(*athena.DeleteNamedQueryInput) (*athena.DeleteNamedQueryOutput, error) + DeleteNamedQueryWithContext(aws.Context, *athena.DeleteNamedQueryInput, ...request.Option) (*athena.DeleteNamedQueryOutput, error) + DeleteNamedQueryRequest(*athena.DeleteNamedQueryInput) (*request.Request, *athena.DeleteNamedQueryOutput) + + GetNamedQuery(*athena.GetNamedQueryInput) (*athena.GetNamedQueryOutput, error) + GetNamedQueryWithContext(aws.Context, *athena.GetNamedQueryInput, ...request.Option) (*athena.GetNamedQueryOutput, error) + GetNamedQueryRequest(*athena.GetNamedQueryInput) (*request.Request, *athena.GetNamedQueryOutput) + + GetQueryExecution(*athena.GetQueryExecutionInput) (*athena.GetQueryExecutionOutput, error) + GetQueryExecutionWithContext(aws.Context, *athena.GetQueryExecutionInput, ...request.Option) (*athena.GetQueryExecutionOutput, error) + GetQueryExecutionRequest(*athena.GetQueryExecutionInput) (*request.Request, *athena.GetQueryExecutionOutput) + + GetQueryResults(*athena.GetQueryResultsInput) (*athena.GetQueryResultsOutput, error) + GetQueryResultsWithContext(aws.Context, *athena.GetQueryResultsInput, ...request.Option) (*athena.GetQueryResultsOutput, error) + GetQueryResultsRequest(*athena.GetQueryResultsInput) (*request.Request, *athena.GetQueryResultsOutput) + + GetQueryResultsPages(*athena.GetQueryResultsInput, func(*athena.GetQueryResultsOutput, bool) bool) error + GetQueryResultsPagesWithContext(aws.Context, *athena.GetQueryResultsInput, func(*athena.GetQueryResultsOutput, bool) bool, ...request.Option) error + + ListNamedQueries(*athena.ListNamedQueriesInput) (*athena.ListNamedQueriesOutput, error) + ListNamedQueriesWithContext(aws.Context, *athena.ListNamedQueriesInput, ...request.Option) (*athena.ListNamedQueriesOutput, error) + ListNamedQueriesRequest(*athena.ListNamedQueriesInput) (*request.Request, *athena.ListNamedQueriesOutput) + + ListNamedQueriesPages(*athena.ListNamedQueriesInput, func(*athena.ListNamedQueriesOutput, bool) bool) error + ListNamedQueriesPagesWithContext(aws.Context, *athena.ListNamedQueriesInput, func(*athena.ListNamedQueriesOutput, bool) bool, ...request.Option) error + + ListQueryExecutions(*athena.ListQueryExecutionsInput) (*athena.ListQueryExecutionsOutput, error) + ListQueryExecutionsWithContext(aws.Context, *athena.ListQueryExecutionsInput, ...request.Option) (*athena.ListQueryExecutionsOutput, error) + ListQueryExecutionsRequest(*athena.ListQueryExecutionsInput) (*request.Request, *athena.ListQueryExecutionsOutput) + + ListQueryExecutionsPages(*athena.ListQueryExecutionsInput, func(*athena.ListQueryExecutionsOutput, bool) bool) error + ListQueryExecutionsPagesWithContext(aws.Context, *athena.ListQueryExecutionsInput, func(*athena.ListQueryExecutionsOutput, bool) bool, ...request.Option) error + + StartQueryExecution(*athena.StartQueryExecutionInput) (*athena.StartQueryExecutionOutput, error) + StartQueryExecutionWithContext(aws.Context, *athena.StartQueryExecutionInput, ...request.Option) (*athena.StartQueryExecutionOutput, error) + StartQueryExecutionRequest(*athena.StartQueryExecutionInput) (*request.Request, *athena.StartQueryExecutionOutput) + + StopQueryExecution(*athena.StopQueryExecutionInput) (*athena.StopQueryExecutionOutput, error) + StopQueryExecutionWithContext(aws.Context, *athena.StopQueryExecutionInput, ...request.Option) (*athena.StopQueryExecutionOutput, error) + StopQueryExecutionRequest(*athena.StopQueryExecutionInput) (*request.Request, *athena.StopQueryExecutionOutput) +} + +var _ AthenaAPI = (*athena.Athena)(nil) diff --git a/vendor/github.com/aws/aws-sdk-go/service/athena/doc.go b/vendor/github.com/aws/aws-sdk-go/service/athena/doc.go new file mode 100644 index 000000000..d4a51b74f --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/athena/doc.go @@ -0,0 +1,91 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +// Package athena provides the client and types for making API +// requests to Amazon Athena. +// +// Amazon Athena is an interactive query service that lets you use standard +// SQL to analyze data directly in Amazon S3. You can point Athena at your data +// in Amazon S3 and run ad-hoc queries and get results in seconds. Athena is +// serverless, so there is no infrastructure to set up or manage. You pay only +// for the queries you run. Athena scales automatically—executing queries in +// parallel—so results are fast, even with large datasets and complex queries. +// For more information, see What is Amazon Athena (http://docs.aws.amazon.com/athena/latest/ug/what-is.html) +// in the Amazon Athena User Guide. +// +// For code samples using the AWS SDK for Java, see Examples and Code Samples +// (http://docs.aws.amazon.com/athena/latest/ug/code-samples.html) in the Amazon +// Athena User Guide. +// +// See https://docs.aws.amazon.com/goto/WebAPI/athena-2017-05-18 for more information on this service. +// +// See athena package documentation for more information. +// https://docs.aws.amazon.com/sdk-for-go/api/service/athena/ +// +// Using the Client +// +// To use the client for Amazon Athena you will first need +// to create a new instance of it. +// +// When creating a client for an AWS service you'll first need to have a Session +// already created. The Session provides configuration that can be shared +// between multiple service clients. Additional configuration can be applied to +// the Session and service's client when they are constructed. The aws package's +// Config type contains several fields such as Region for the AWS Region the +// client should make API requests too. The optional Config value can be provided +// as the variadic argument for Sessions and client creation. +// +// Once the service's client is created you can use it to make API requests the +// AWS service. These clients are safe to use concurrently. +// +// // Create a session to share configuration, and load external configuration. +// sess := session.Must(session.NewSession()) +// +// // Create the service's client with the session. +// svc := athena.New(sess) +// +// See the SDK's documentation for more information on how to use service clients. +// https://docs.aws.amazon.com/sdk-for-go/api/ +// +// See aws package's Config type for more information on configuration options. +// https://docs.aws.amazon.com/sdk-for-go/api/aws/#Config +// +// See the Amazon Athena client Athena for more +// information on creating the service's client. +// https://docs.aws.amazon.com/sdk-for-go/api/service/athena/#New +// +// Once the client is created you can make an API request to the service. +// Each API method takes a input parameter, and returns the service response +// and an error. +// +// The API method will document which error codes the service can be returned +// by the operation if the service models the API operation's errors. These +// errors will also be available as const strings prefixed with "ErrCode". +// +// result, err := svc.BatchGetNamedQuery(params) +// if err != nil { +// // Cast err to awserr.Error to handle specific error codes. +// aerr, ok := err.(awserr.Error) +// if ok && aerr.Code() == { +// // Specific error code handling +// } +// return err +// } +// +// fmt.Println("BatchGetNamedQuery result:") +// fmt.Println(result) +// +// Using the Client with Context +// +// The service's client also provides methods to make API requests with a Context +// value. This allows you to control the timeout, and cancellation of pending +// requests. These methods also take request Option as variadic parameter to apply +// additional configuration to the API request. +// +// ctx := context.Background() +// +// result, err := svc.BatchGetNamedQueryWithContext(ctx, params) +// +// See the request package documentation for more information on using Context pattern +// with the SDK. +// https://docs.aws.amazon.com/sdk-for-go/api/aws/request/ +package athena diff --git a/vendor/github.com/aws/aws-sdk-go/service/athena/errors.go b/vendor/github.com/aws/aws-sdk-go/service/athena/errors.go new file mode 100644 index 000000000..4060e744e --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/athena/errors.go @@ -0,0 +1,26 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package athena + +const ( + + // ErrCodeInternalServerException for service response error code + // "InternalServerException". + // + // Indicates a platform issue, which may be due to a transient condition or + // outage. + ErrCodeInternalServerException = "InternalServerException" + + // ErrCodeInvalidRequestException for service response error code + // "InvalidRequestException". + // + // Indicates that something is wrong with the input to the request. For example, + // a required parameter may be missing or out of range. + ErrCodeInvalidRequestException = "InvalidRequestException" + + // ErrCodeTooManyRequestsException for service response error code + // "TooManyRequestsException". + // + // Indicates that the request was throttled. + ErrCodeTooManyRequestsException = "TooManyRequestsException" +) diff --git a/vendor/github.com/aws/aws-sdk-go/service/athena/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/athena/examples_test.go new file mode 100644 index 000000000..8ec43cdcb --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/athena/examples_test.go @@ -0,0 +1,272 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package athena_test + +import ( + "bytes" + "fmt" + "time" + + "github.com/aws/aws-sdk-go/aws" + "github.com/aws/aws-sdk-go/aws/session" + "github.com/aws/aws-sdk-go/service/athena" +) + +var _ time.Duration +var _ bytes.Buffer + +func ExampleAthena_BatchGetNamedQuery() { + sess := session.Must(session.NewSession()) + + svc := athena.New(sess) + + params := &athena.BatchGetNamedQueryInput{ + NamedQueryIds: []*string{ // Required + aws.String("NamedQueryId"), // Required + // More values... + }, + } + resp, err := svc.BatchGetNamedQuery(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} + +func ExampleAthena_BatchGetQueryExecution() { + sess := session.Must(session.NewSession()) + + svc := athena.New(sess) + + params := &athena.BatchGetQueryExecutionInput{ + QueryExecutionIds: []*string{ // Required + aws.String("QueryExecutionId"), // Required + // More values... + }, + } + resp, err := svc.BatchGetQueryExecution(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} + +func ExampleAthena_CreateNamedQuery() { + sess := session.Must(session.NewSession()) + + svc := athena.New(sess) + + params := &athena.CreateNamedQueryInput{ + Database: aws.String("DatabaseString"), // Required + Name: aws.String("NameString"), // Required + QueryString: aws.String("QueryString"), // Required + ClientRequestToken: aws.String("IdempotencyToken"), + Description: aws.String("DescriptionString"), + } + resp, err := svc.CreateNamedQuery(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} + +func ExampleAthena_DeleteNamedQuery() { + sess := session.Must(session.NewSession()) + + svc := athena.New(sess) + + params := &athena.DeleteNamedQueryInput{ + NamedQueryId: aws.String("NamedQueryId"), // Required + } + resp, err := svc.DeleteNamedQuery(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} + +func ExampleAthena_GetNamedQuery() { + sess := session.Must(session.NewSession()) + + svc := athena.New(sess) + + params := &athena.GetNamedQueryInput{ + NamedQueryId: aws.String("NamedQueryId"), // Required + } + resp, err := svc.GetNamedQuery(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} + +func ExampleAthena_GetQueryExecution() { + sess := session.Must(session.NewSession()) + + svc := athena.New(sess) + + params := &athena.GetQueryExecutionInput{ + QueryExecutionId: aws.String("QueryExecutionId"), // Required + } + resp, err := svc.GetQueryExecution(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} + +func ExampleAthena_GetQueryResults() { + sess := session.Must(session.NewSession()) + + svc := athena.New(sess) + + params := &athena.GetQueryResultsInput{ + QueryExecutionId: aws.String("QueryExecutionId"), // Required + MaxResults: aws.Int64(1), + NextToken: aws.String("Token"), + } + resp, err := svc.GetQueryResults(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} + +func ExampleAthena_ListNamedQueries() { + sess := session.Must(session.NewSession()) + + svc := athena.New(sess) + + params := &athena.ListNamedQueriesInput{ + MaxResults: aws.Int64(1), + NextToken: aws.String("Token"), + } + resp, err := svc.ListNamedQueries(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} + +func ExampleAthena_ListQueryExecutions() { + sess := session.Must(session.NewSession()) + + svc := athena.New(sess) + + params := &athena.ListQueryExecutionsInput{ + MaxResults: aws.Int64(1), + NextToken: aws.String("Token"), + } + resp, err := svc.ListQueryExecutions(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} + +func ExampleAthena_StartQueryExecution() { + sess := session.Must(session.NewSession()) + + svc := athena.New(sess) + + params := &athena.StartQueryExecutionInput{ + QueryString: aws.String("QueryString"), // Required + ResultConfiguration: &athena.ResultConfiguration{ // Required + OutputLocation: aws.String("String"), // Required + EncryptionConfiguration: &athena.EncryptionConfiguration{ + EncryptionOption: aws.String("EncryptionOption"), // Required + KmsKey: aws.String("String"), + }, + }, + ClientRequestToken: aws.String("IdempotencyToken"), + QueryExecutionContext: &athena.QueryExecutionContext{ + Database: aws.String("DatabaseString"), + }, + } + resp, err := svc.StartQueryExecution(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} + +func ExampleAthena_StopQueryExecution() { + sess := session.Must(session.NewSession()) + + svc := athena.New(sess) + + params := &athena.StopQueryExecutionInput{ + QueryExecutionId: aws.String("QueryExecutionId"), // Required + } + resp, err := svc.StopQueryExecution(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} diff --git a/vendor/github.com/aws/aws-sdk-go/service/athena/service.go b/vendor/github.com/aws/aws-sdk-go/service/athena/service.go new file mode 100644 index 000000000..c1fd29b0f --- /dev/null +++ b/vendor/github.com/aws/aws-sdk-go/service/athena/service.go @@ -0,0 +1,95 @@ +// Code generated by private/model/cli/gen-api/main.go. DO NOT EDIT. + +package athena + +import ( + "github.com/aws/aws-sdk-go/aws" + "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/signer/v4" + "github.com/aws/aws-sdk-go/private/protocol/jsonrpc" +) + +// Athena provides the API operation methods for making requests to +// Amazon Athena. See this package's package overview docs +// for details on the service. +// +// Athena methods are safe to use concurrently. It is not safe to +// modify mutate any of the struct's properties though. +type Athena struct { + *client.Client +} + +// Used for custom client initialization logic +var initClient func(*client.Client) + +// Used for custom request initialization logic +var initRequest func(*request.Request) + +// Service information constants +const ( + ServiceName = "athena" // Service endpoint prefix API calls made to. + EndpointsID = ServiceName // Service ID for Regions and Endpoints metadata. +) + +// New creates a new instance of the Athena client with a session. +// If additional configuration is needed for the client instance use the optional +// aws.Config parameter to add your extra config. +// +// Example: +// // Create a Athena client from just a session. +// svc := athena.New(mySession) +// +// // Create a Athena client with additional configuration +// svc := athena.New(mySession, aws.NewConfig().WithRegion("us-west-2")) +func New(p client.ConfigProvider, cfgs ...*aws.Config) *Athena { + c := p.ClientConfig(EndpointsID, cfgs...) + return newClient(*c.Config, c.Handlers, c.Endpoint, c.SigningRegion, c.SigningName) +} + +// newClient creates, initializes and returns a new service client instance. +func newClient(cfg aws.Config, handlers request.Handlers, endpoint, signingRegion, signingName string) *Athena { + svc := &Athena{ + Client: client.New( + cfg, + metadata.ClientInfo{ + ServiceName: ServiceName, + SigningName: signingName, + SigningRegion: signingRegion, + Endpoint: endpoint, + APIVersion: "2017-05-18", + JSONVersion: "1.1", + TargetPrefix: "AmazonAthena", + }, + handlers, + ), + } + + // Handlers + svc.Handlers.Sign.PushBackNamed(v4.SignRequestHandler) + svc.Handlers.Build.PushBackNamed(jsonrpc.BuildHandler) + svc.Handlers.Unmarshal.PushBackNamed(jsonrpc.UnmarshalHandler) + svc.Handlers.UnmarshalMeta.PushBackNamed(jsonrpc.UnmarshalMetaHandler) + svc.Handlers.UnmarshalError.PushBackNamed(jsonrpc.UnmarshalErrorHandler) + + // Run custom client initialization if present + if initClient != nil { + initClient(svc.Client) + } + + return svc +} + +// newRequest creates a new request for a Athena operation and runs any +// custom request initialization. +func (c *Athena) newRequest(op *request.Operation, params, data interface{}) *request.Request { + req := c.NewRequest(op, params, data) + + // Run custom request initialization if present + if initRequest != nil { + initRequest(req) + } + + return req +} diff --git a/vendor/github.com/aws/aws-sdk-go/service/autoscaling/api.go b/vendor/github.com/aws/aws-sdk-go/service/autoscaling/api.go index 49dd0bf2e..d20cf3c04 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/autoscaling/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/autoscaling/api.go @@ -67,7 +67,7 @@ func (c *AutoScaling) AttachInstancesRequest(input *AttachInstancesInput) (req * // being attached plus the desired capacity of the group exceeds the maximum // size of the group, the operation fails. // -// If there is a Classic load balancer attached to your Auto Scaling group, +// If there is a Classic Load Balancer attached to your Auto Scaling group, // the instances are also registered with the load balancer. If there are target // groups attached to your Auto Scaling group, the instances are also registered // with the target groups. @@ -243,10 +243,10 @@ func (c *AutoScaling) AttachLoadBalancersRequest(input *AttachLoadBalancersInput // AttachLoadBalancers API operation for Auto Scaling. // -// Attaches one or more Classic load balancers to the specified Auto Scaling +// Attaches one or more Classic Load Balancers to the specified Auto Scaling // group. // -// To attach an Application load balancer instead, see AttachLoadBalancerTargetGroups. +// To attach an Application Load Balancer instead, see AttachLoadBalancerTargetGroups. // // To describe the load balancers for an Auto Scaling group, use DescribeLoadBalancers. // To detach the load balancer from the Auto Scaling group, use DetachLoadBalancers. @@ -2258,8 +2258,8 @@ func (c *AutoScaling) DescribeLoadBalancersRequest(input *DescribeLoadBalancersI // // Describes the load balancers for the specified Auto Scaling group. // -// Note that this operation describes only Classic load balancers. If you have -// Application load balancers, use DescribeLoadBalancerTargetGroups instead. +// Note that this operation describes only Classic Load Balancers. If you have +// Application Load Balancers, use DescribeLoadBalancerTargetGroups instead. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -3299,13 +3299,13 @@ func (c *AutoScaling) DetachInstancesRequest(input *DetachInstancesInput) (req * // // Removes one or more instances from the specified Auto Scaling group. // -// After the instances are detached, you can manage them independently from -// the rest of the Auto Scaling group. +// After the instances are detached, you can manage them independent of the +// Auto Scaling group. // // If you do not specify the option to decrement the desired capacity, Auto // Scaling launches instances to replace the ones that are detached. // -// If there is a Classic load balancer attached to the Auto Scaling group, the +// If there is a Classic Load Balancer attached to the Auto Scaling group, the // instances are deregistered from the load balancer. If there are target groups // attached to the Auto Scaling group, the instances are deregistered from the // target groups. @@ -3474,11 +3474,11 @@ func (c *AutoScaling) DetachLoadBalancersRequest(input *DetachLoadBalancersInput // DetachLoadBalancers API operation for Auto Scaling. // -// Detaches one or more Classic load balancers from the specified Auto Scaling +// Detaches one or more Classic Load Balancers from the specified Auto Scaling // group. // -// Note that this operation detaches only Classic load balancers. If you have -// Application load balancers, use DetachLoadBalancerTargetGroups instead. +// Note that this operation detaches only Classic Load Balancers. If you have +// Application Load Balancers, use DetachLoadBalancerTargetGroups instead. // // When you detach a load balancer, it enters the Removing state while deregistering // the instances in the group. When all instances are deregistered, then you @@ -3732,9 +3732,10 @@ func (c *AutoScaling) EnterStandbyRequest(input *EnterStandbyInput) (req *reques // EnterStandby API operation for Auto Scaling. // -// Moves the specified instances into Standby mode. +// Moves the specified instances into the standby state. // -// For more information, see Auto Scaling Lifecycle (http://docs.aws.amazon.com/autoscaling/latest/userguide/AutoScalingGroupLifecycle.html) +// For more information, see Temporarily Removing Instances from Your Auto Scaling +// Group (http://docs.aws.amazon.com/autoscaling/latest/userguide/as-enter-exit-standby.html) // in the Auto Scaling User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -3903,9 +3904,10 @@ func (c *AutoScaling) ExitStandbyRequest(input *ExitStandbyInput) (req *request. // ExitStandby API operation for Auto Scaling. // -// Moves the specified instances out of Standby mode. +// Moves the specified instances out of the standby state. // -// For more information, see Auto Scaling Lifecycle (http://docs.aws.amazon.com/autoscaling/latest/userguide/AutoScalingGroupLifecycle.html) +// For more information, see Temporarily Removing Instances from Your Auto Scaling +// Group (http://docs.aws.amazon.com/autoscaling/latest/userguide/as-enter-exit-standby.html) // in the Auto Scaling User Guide. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -5039,15 +5041,14 @@ func (c *AutoScaling) UpdateAutoScalingGroupRequest(input *UpdateAutoScalingGrou // // Updates the configuration for the specified Auto Scaling group. // +// The new settings take effect on any scaling activities after this call returns. +// Scaling activities that are currently in progress aren't affected. +// // To update an Auto Scaling group with a launch configuration with InstanceMonitoring -// set to False, you must first disable the collection of group metrics. Otherwise, +// set to false, you must first disable the collection of group metrics. Otherwise, // you will get an error. If you have previously enabled the collection of group // metrics, you can disable it using DisableMetricsCollection. // -// The new settings are registered upon the completion of this call. Any launch -// configuration settings take effect on any triggers after this call returns. -// Scaling activities that are currently in progress aren't affected. -// // Note the following: // // * If you specify a new value for MinSize without specifying a value for @@ -5281,7 +5282,6 @@ func (s *Alarm) SetAlarmName(v string) *Alarm { return s } -// Contains the parameters for AttachInstances. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/AttachInstancesQuery type AttachInstancesInput struct { _ struct{} `type:"structure"` @@ -5348,7 +5348,6 @@ func (s AttachInstancesOutput) GoString() string { return s.String() } -// Contains the parameters for AttachLoadBalancerTargetGroups. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/AttachLoadBalancerTargetGroupsType type AttachLoadBalancerTargetGroupsInput struct { _ struct{} `type:"structure"` @@ -5420,7 +5419,6 @@ func (s AttachLoadBalancerTargetGroupsOutput) GoString() string { return s.String() } -// Contains the parameters for AttachLoadBalancers. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/AttachLoadBalancersType type AttachLoadBalancersInput struct { _ struct{} `type:"structure"` @@ -5477,7 +5475,6 @@ func (s *AttachLoadBalancersInput) SetLoadBalancerNames(v []*string) *AttachLoad return s } -// Contains the output of AttachLoadBalancers. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/AttachLoadBalancersResultType type AttachLoadBalancersOutput struct { _ struct{} `type:"structure"` @@ -5575,7 +5572,6 @@ func (s *BlockDeviceMapping) SetVirtualName(v string) *BlockDeviceMapping { return s } -// Contains the parameters for CompleteLifecycleAction. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CompleteLifecycleActionType type CompleteLifecycleActionInput struct { _ struct{} `type:"structure"` @@ -5676,7 +5672,6 @@ func (s *CompleteLifecycleActionInput) SetLifecycleHookName(v string) *CompleteL return s } -// Contains the output of CompleteLifecycleAction. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CompleteLifecycleActionAnswer type CompleteLifecycleActionOutput struct { _ struct{} `type:"structure"` @@ -5692,7 +5687,6 @@ func (s CompleteLifecycleActionOutput) GoString() string { return s.String() } -// Contains the parameters for CreateAutoScalingGroup. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CreateAutoScalingGroupType type CreateAutoScalingGroupInput struct { _ struct{} `type:"structure"` @@ -5716,7 +5710,8 @@ type CreateAutoScalingGroupInput struct { // The number of EC2 instances that should be running in the group. This number // must be greater than or equal to the minimum size of the group and less than - // or equal to the maximum size of the group. + // or equal to the maximum size of the group. If you do not specify a desired + // capacity, the default is the minimum size of the group. DesiredCapacity *int64 `type:"integer"` // The amount of time, in seconds, that Auto Scaling waits before checking the @@ -5754,7 +5749,7 @@ type CreateAutoScalingGroupInput struct { // instead of a launch configuration. LaunchConfigurationName *string `min:"1" type:"string"` - // One or more Classic load balancers. To specify an Application load balancer, + // One or more Classic Load Balancers. To specify an Application Load Balancer, // use TargetGroupARNs instead. // // For more information, see Using a Load Balancer With an Auto Scaling Group @@ -5986,7 +5981,6 @@ func (s CreateAutoScalingGroupOutput) GoString() string { return s.String() } -// Contains the parameters for CreateLaunchConfiguration. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CreateLaunchConfigurationType type CreateLaunchConfigurationInput struct { _ struct{} `type:"structure"` @@ -6043,14 +6037,18 @@ type CreateLaunchConfigurationInput struct { IamInstanceProfile *string `min:"1" type:"string"` // The ID of the Amazon Machine Image (AMI) to use to launch your EC2 instances. + // + // If you do not specify InstanceId, you must specify ImageId. + // // For more information, see Finding an AMI (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/finding-an-ami.html) // in the Amazon Elastic Compute Cloud User Guide. ImageId *string `min:"1" type:"string"` - // The ID of the instance to use to create the launch configuration. + // The ID of the instance to use to create the launch configuration. The new + // launch configuration derives attributes from the instance, with the exception + // of the block device mapping. // - // The new launch configuration derives attributes from the instance, with the - // exception of the block device mapping. + // If you do not specify InstanceId, you must specify both ImageId and InstanceType. // // To create a launch configuration with a block device mapping or override // any other instance attributes, specify them as part of the same request. @@ -6061,11 +6059,15 @@ type CreateLaunchConfigurationInput struct { InstanceId *string `min:"1" type:"string"` // Enables detailed monitoring (true) or basic monitoring (false) for the Auto - // Scaling instances. + // Scaling instances. The default is true. InstanceMonitoring *InstanceMonitoring `type:"structure"` - // The instance type of the EC2 instance. For information about available instance - // types, see Available Instance Types (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#AvailableInstanceTypes) + // The instance type of the EC2 instance. + // + // If you do not specify InstanceId, you must specify InstanceType. + // + // For information about available instance types, see Available Instance Types + // (http://docs.aws.amazon.com/AWSEC2/latest/UserGuide/instance-types.html#AvailableInstanceTypes) // in the Amazon Elastic Compute Cloud User Guide. InstanceType *string `min:"1" type:"string"` @@ -6316,7 +6318,6 @@ func (s CreateLaunchConfigurationOutput) GoString() string { return s.String() } -// Contains the parameters for CreateOrUpdateTags. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/CreateOrUpdateTagsType type CreateOrUpdateTagsInput struct { _ struct{} `type:"structure"` @@ -6381,7 +6382,6 @@ func (s CreateOrUpdateTagsOutput) GoString() string { return s.String() } -// Contains the parameters for DeleteAutoScalingGroup. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DeleteAutoScalingGroupType type DeleteAutoScalingGroupInput struct { _ struct{} `type:"structure"` @@ -6450,7 +6450,6 @@ func (s DeleteAutoScalingGroupOutput) GoString() string { return s.String() } -// Contains the parameters for DeleteLaunchConfiguration. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/LaunchConfigurationNameType type DeleteLaunchConfigurationInput struct { _ struct{} `type:"structure"` @@ -6508,7 +6507,6 @@ func (s DeleteLaunchConfigurationOutput) GoString() string { return s.String() } -// Contains the parameters for DeleteLifecycleHook. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DeleteLifecycleHookType type DeleteLifecycleHookInput struct { _ struct{} `type:"structure"` @@ -6568,7 +6566,6 @@ func (s *DeleteLifecycleHookInput) SetLifecycleHookName(v string) *DeleteLifecyc return s } -// Contains the output of DeleteLifecycleHook. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DeleteLifecycleHookAnswer type DeleteLifecycleHookOutput struct { _ struct{} `type:"structure"` @@ -6584,7 +6581,6 @@ func (s DeleteLifecycleHookOutput) GoString() string { return s.String() } -// Contains the parameters for DeleteNotificationConfiguration. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DeleteNotificationConfigurationType type DeleteNotificationConfigurationInput struct { _ struct{} `type:"structure"` @@ -6660,7 +6656,6 @@ func (s DeleteNotificationConfigurationOutput) GoString() string { return s.String() } -// Contains the parameters for DeletePolicy. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DeletePolicyType type DeletePolicyInput struct { _ struct{} `type:"structure"` @@ -6730,7 +6725,6 @@ func (s DeletePolicyOutput) GoString() string { return s.String() } -// Contains the parameters for DeleteScheduledAction. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DeleteScheduledActionType type DeleteScheduledActionInput struct { _ struct{} `type:"structure"` @@ -6805,7 +6799,6 @@ func (s DeleteScheduledActionOutput) GoString() string { return s.String() } -// Contains the parameters for DeleteTags. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DeleteTagsType type DeleteTagsInput struct { _ struct{} `type:"structure"` @@ -6885,7 +6878,6 @@ func (s DescribeAccountLimitsInput) GoString() string { return s.String() } -// Contains the parameters for DescribeAccountLimits. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeAccountLimitsAnswer type DescribeAccountLimitsOutput struct { _ struct{} `type:"structure"` @@ -6954,7 +6946,6 @@ func (s DescribeAdjustmentTypesInput) GoString() string { return s.String() } -// Contains the parameters for DescribeAdjustmentTypes. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeAdjustmentTypesAnswer type DescribeAdjustmentTypesOutput struct { _ struct{} `type:"structure"` @@ -6979,7 +6970,6 @@ func (s *DescribeAdjustmentTypesOutput) SetAdjustmentTypes(v []*AdjustmentType) return s } -// Contains the parameters for DescribeAutoScalingGroups. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/GroupNamesType type DescribeAutoScalingGroupsInput struct { _ struct{} `type:"structure"` @@ -6988,7 +6978,8 @@ type DescribeAutoScalingGroupsInput struct { // described. AutoScalingGroupNames []*string `type:"list"` - // The maximum number of items to return with this call. + // The maximum number of items to return with this call. The default value is + // 50 and the maximum value is 100. MaxRecords *int64 `type:"integer"` // The token for the next set of items to return. (You received this token from @@ -7024,7 +7015,6 @@ func (s *DescribeAutoScalingGroupsInput) SetNextToken(v string) *DescribeAutoSca return s } -// Contains the output for DescribeAutoScalingGroups. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/GroupsType type DescribeAutoScalingGroupsOutput struct { _ struct{} `type:"structure"` @@ -7061,7 +7051,6 @@ func (s *DescribeAutoScalingGroupsOutput) SetNextToken(v string) *DescribeAutoSc return s } -// Contains the parameters for DescribeAutoScalingInstances. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeAutoScalingInstancesType type DescribeAutoScalingInstancesInput struct { _ struct{} `type:"structure"` @@ -7071,7 +7060,8 @@ type DescribeAutoScalingInstancesInput struct { // not exist, it is ignored with no error. InstanceIds []*string `type:"list"` - // The maximum number of items to return with this call. + // The maximum number of items to return with this call. The default value is + // 50 and the maximum value is 100. MaxRecords *int64 `type:"integer"` // The token for the next set of items to return. (You received this token from @@ -7107,7 +7097,6 @@ func (s *DescribeAutoScalingInstancesInput) SetNextToken(v string) *DescribeAuto return s } -// Contains the output of DescribeAutoScalingInstances. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/InstancesType type DescribeAutoScalingInstancesOutput struct { _ struct{} `type:"structure"` @@ -7157,7 +7146,6 @@ func (s DescribeAutoScalingNotificationTypesInput) GoString() string { return s.String() } -// Contains the output of DescribeAutoScalingNotificationTypes. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeAutoScalingNotificationTypesAnswer type DescribeAutoScalingNotificationTypesOutput struct { _ struct{} `type:"structure"` @@ -7182,7 +7170,6 @@ func (s *DescribeAutoScalingNotificationTypesOutput) SetAutoScalingNotificationT return s } -// Contains the parameters for DescribeLaunchConfigurations. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/LaunchConfigurationNamesType type DescribeLaunchConfigurationsInput struct { _ struct{} `type:"structure"` @@ -7191,7 +7178,8 @@ type DescribeLaunchConfigurationsInput struct { // are described. LaunchConfigurationNames []*string `type:"list"` - // The maximum number of items to return with this call. The default is 100. + // The maximum number of items to return with this call. The default value is + // 50 and the maximum value is 100. MaxRecords *int64 `type:"integer"` // The token for the next set of items to return. (You received this token from @@ -7227,7 +7215,6 @@ func (s *DescribeLaunchConfigurationsInput) SetNextToken(v string) *DescribeLaun return s } -// Contains the output of DescribeLaunchConfigurations. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/LaunchConfigurationsType type DescribeLaunchConfigurationsOutput struct { _ struct{} `type:"structure"` @@ -7279,7 +7266,6 @@ func (s DescribeLifecycleHookTypesInput) GoString() string { return s.String() } -// Contains the output of DescribeLifecycleHookTypes. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeLifecycleHookTypesAnswer type DescribeLifecycleHookTypesOutput struct { _ struct{} `type:"structure"` @@ -7304,7 +7290,6 @@ func (s *DescribeLifecycleHookTypesOutput) SetLifecycleHookTypes(v []*string) *D return s } -// Contains the parameters for DescribeLifecycleHooks. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeLifecycleHooksType type DescribeLifecycleHooksInput struct { _ struct{} `type:"structure"` @@ -7357,7 +7342,6 @@ func (s *DescribeLifecycleHooksInput) SetLifecycleHookNames(v []*string) *Descri return s } -// Contains the output of DescribeLifecycleHooks. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeLifecycleHooksAnswer type DescribeLifecycleHooksOutput struct { _ struct{} `type:"structure"` @@ -7382,7 +7366,6 @@ func (s *DescribeLifecycleHooksOutput) SetLifecycleHooks(v []*LifecycleHook) *De return s } -// Contains the parameters for DescribeLoadBalancerTargetGroups. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeLoadBalancerTargetGroupsRequest type DescribeLoadBalancerTargetGroupsInput struct { _ struct{} `type:"structure"` @@ -7392,7 +7375,8 @@ type DescribeLoadBalancerTargetGroupsInput struct { // AutoScalingGroupName is a required field AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - // The maximum number of items to return with this call. + // The maximum number of items to return with this call. The default value is + // 50 and the maximum value is 100. MaxRecords *int64 `type:"integer"` // The token for the next set of items to return. (You received this token from @@ -7444,7 +7428,6 @@ func (s *DescribeLoadBalancerTargetGroupsInput) SetNextToken(v string) *Describe return s } -// Contains the output of DescribeLoadBalancerTargetGroups. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeLoadBalancerTargetGroupsResponse type DescribeLoadBalancerTargetGroupsOutput struct { _ struct{} `type:"structure"` @@ -7479,7 +7462,6 @@ func (s *DescribeLoadBalancerTargetGroupsOutput) SetNextToken(v string) *Describ return s } -// Contains the parameters for DescribeLoadBalancers. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeLoadBalancersRequest type DescribeLoadBalancersInput struct { _ struct{} `type:"structure"` @@ -7489,7 +7471,8 @@ type DescribeLoadBalancersInput struct { // AutoScalingGroupName is a required field AutoScalingGroupName *string `min:"1" type:"string" required:"true"` - // The maximum number of items to return with this call. + // The maximum number of items to return with this call. The default value is + // 50 and the maximum value is 100. MaxRecords *int64 `type:"integer"` // The token for the next set of items to return. (You received this token from @@ -7541,7 +7524,6 @@ func (s *DescribeLoadBalancersInput) SetNextToken(v string) *DescribeLoadBalance return s } -// Contains the output of DescribeLoadBalancers. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeLoadBalancersResponse type DescribeLoadBalancersOutput struct { _ struct{} `type:"structure"` @@ -7591,7 +7573,6 @@ func (s DescribeMetricCollectionTypesInput) GoString() string { return s.String() } -// Contains the output of DescribeMetricsCollectionTypes. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeMetricCollectionTypesAnswer type DescribeMetricCollectionTypesOutput struct { _ struct{} `type:"structure"` @@ -7625,7 +7606,6 @@ func (s *DescribeMetricCollectionTypesOutput) SetMetrics(v []*MetricCollectionTy return s } -// Contains the parameters for DescribeNotificationConfigurations. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeNotificationConfigurationsType type DescribeNotificationConfigurationsInput struct { _ struct{} `type:"structure"` @@ -7633,7 +7613,8 @@ type DescribeNotificationConfigurationsInput struct { // The name of the group. AutoScalingGroupNames []*string `type:"list"` - // The maximum number of items to return with this call. + // The maximum number of items to return with this call. The default value is + // 50 and the maximum value is 100. MaxRecords *int64 `type:"integer"` // The token for the next set of items to return. (You received this token from @@ -7669,7 +7650,6 @@ func (s *DescribeNotificationConfigurationsInput) SetNextToken(v string) *Descri return s } -// Contains the output from DescribeNotificationConfigurations. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeNotificationConfigurationsAnswer type DescribeNotificationConfigurationsOutput struct { _ struct{} `type:"structure"` @@ -7706,7 +7686,6 @@ func (s *DescribeNotificationConfigurationsOutput) SetNotificationConfigurations return s } -// Contains the parameters for DescribePolicies. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribePoliciesType type DescribePoliciesInput struct { _ struct{} `type:"structure"` @@ -7714,7 +7693,8 @@ type DescribePoliciesInput struct { // The name of the group. AutoScalingGroupName *string `min:"1" type:"string"` - // The maximum number of items to be returned with each call. + // The maximum number of items to be returned with each call. The default value + // is 50 and the maximum value is 100. MaxRecords *int64 `type:"integer"` // The token for the next set of items to return. (You received this token from @@ -7784,7 +7764,6 @@ func (s *DescribePoliciesInput) SetPolicyTypes(v []*string) *DescribePoliciesInp return s } -// Contains the output of DescribePolicies. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/PoliciesType type DescribePoliciesOutput struct { _ struct{} `type:"structure"` @@ -7819,7 +7798,6 @@ func (s *DescribePoliciesOutput) SetScalingPolicies(v []*ScalingPolicy) *Describ return s } -// Contains the parameters for DescribeScalingActivities. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeScalingActivitiesType type DescribeScalingActivitiesInput struct { _ struct{} `type:"structure"` @@ -7834,7 +7812,8 @@ type DescribeScalingActivitiesInput struct { // The name of the group. AutoScalingGroupName *string `min:"1" type:"string"` - // The maximum number of items to return with this call. + // The maximum number of items to return with this call. The default value is + // 100. MaxRecords *int64 `type:"integer"` // The token for the next set of items to return. (You received this token from @@ -7889,7 +7868,6 @@ func (s *DescribeScalingActivitiesInput) SetNextToken(v string) *DescribeScaling return s } -// Contains the output of DescribeScalingActivities. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/ActivitiesType type DescribeScalingActivitiesOutput struct { _ struct{} `type:"structure"` @@ -7942,7 +7920,6 @@ func (s DescribeScalingProcessTypesInput) GoString() string { return s.String() } -// Contains the output of DescribeScalingProcessTypes. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/ProcessesType type DescribeScalingProcessTypesOutput struct { _ struct{} `type:"structure"` @@ -7967,7 +7944,6 @@ func (s *DescribeScalingProcessTypesOutput) SetProcesses(v []*ProcessType) *Desc return s } -// Contains the parameters for DescribeScheduledActions. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeScheduledActionsType type DescribeScheduledActionsInput struct { _ struct{} `type:"structure"` @@ -7979,7 +7955,8 @@ type DescribeScheduledActionsInput struct { // provided, this parameter is ignored. EndTime *time.Time `type:"timestamp" timestampFormat:"iso8601"` - // The maximum number of items to return with this call. + // The maximum number of items to return with this call. The default value is + // 50 and the maximum value is 100. MaxRecords *int64 `type:"integer"` // The token for the next set of items to return. (You received this token from @@ -8059,7 +8036,6 @@ func (s *DescribeScheduledActionsInput) SetStartTime(v time.Time) *DescribeSched return s } -// Contains the output of DescribeScheduledActions. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/ScheduledActionsType type DescribeScheduledActionsOutput struct { _ struct{} `type:"structure"` @@ -8094,7 +8070,6 @@ func (s *DescribeScheduledActionsOutput) SetScheduledUpdateGroupActions(v []*Sch return s } -// Contains the parameters for DescribeTags. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeTagsType type DescribeTagsInput struct { _ struct{} `type:"structure"` @@ -8102,7 +8077,8 @@ type DescribeTagsInput struct { // A filter used to scope the tags to return. Filters []*Filter `type:"list"` - // The maximum number of items to return with this call. + // The maximum number of items to return with this call. The default value is + // 50 and the maximum value is 100. MaxRecords *int64 `type:"integer"` // The token for the next set of items to return. (You received this token from @@ -8138,7 +8114,6 @@ func (s *DescribeTagsInput) SetNextToken(v string) *DescribeTagsInput { return s } -// Contains the output of DescribeTags. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/TagsType type DescribeTagsOutput struct { _ struct{} `type:"structure"` @@ -8188,7 +8163,6 @@ func (s DescribeTerminationPolicyTypesInput) GoString() string { return s.String() } -// Contains the output of DescribeTerminationPolicyTypes. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DescribeTerminationPolicyTypesAnswer type DescribeTerminationPolicyTypesOutput struct { _ struct{} `type:"structure"` @@ -8214,7 +8188,6 @@ func (s *DescribeTerminationPolicyTypesOutput) SetTerminationPolicyTypes(v []*st return s } -// Contains the parameters for DetachInstances. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DetachInstancesQuery type DetachInstancesInput struct { _ struct{} `type:"structure"` @@ -8281,7 +8254,6 @@ func (s *DetachInstancesInput) SetShouldDecrementDesiredCapacity(v bool) *Detach return s } -// Contains the output of DetachInstances. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DetachInstancesAnswer type DetachInstancesOutput struct { _ struct{} `type:"structure"` @@ -8377,7 +8349,6 @@ func (s DetachLoadBalancerTargetGroupsOutput) GoString() string { return s.String() } -// Contains the parameters for DetachLoadBalancers. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DetachLoadBalancersType type DetachLoadBalancersInput struct { _ struct{} `type:"structure"` @@ -8434,7 +8405,6 @@ func (s *DetachLoadBalancersInput) SetLoadBalancerNames(v []*string) *DetachLoad return s } -// Contains the output for DetachLoadBalancers. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DetachLoadBalancersResultType type DetachLoadBalancersOutput struct { _ struct{} `type:"structure"` @@ -8450,7 +8420,6 @@ func (s DetachLoadBalancersOutput) GoString() string { return s.String() } -// Contains the parameters for DisableMetricsCollection. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/DisableMetricsCollectionQuery type DisableMetricsCollectionInput struct { _ struct{} `type:"structure"` @@ -8647,7 +8616,6 @@ func (s *Ebs) SetVolumeType(v string) *Ebs { return s } -// Contains the parameters for EnableMetricsCollection. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/EnableMetricsCollectionQuery type EnableMetricsCollectionInput struct { _ struct{} `type:"structure"` @@ -8799,7 +8767,6 @@ func (s *EnabledMetric) SetMetric(v string) *EnabledMetric { return s } -// Contains the parameters for EnteStandby. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/EnterStandbyQuery type EnterStandbyInput struct { _ struct{} `type:"structure"` @@ -8869,7 +8836,6 @@ func (s *EnterStandbyInput) SetShouldDecrementDesiredCapacity(v bool) *EnterStan return s } -// Contains the output of EnterStandby. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/EnterStandbyAnswer type EnterStandbyOutput struct { _ struct{} `type:"structure"` @@ -8894,7 +8860,6 @@ func (s *EnterStandbyOutput) SetActivities(v []*Activity) *EnterStandbyOutput { return s } -// Contains the parameters for ExecutePolicy. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/ExecutePolicyType type ExecutePolicyInput struct { _ struct{} `type:"structure"` @@ -9011,7 +8976,6 @@ func (s ExecutePolicyOutput) GoString() string { return s.String() } -// Contains the parameters for ExitStandby. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/ExitStandbyQuery type ExitStandbyInput struct { _ struct{} `type:"structure"` @@ -9063,7 +9027,6 @@ func (s *ExitStandbyInput) SetInstanceIds(v []*string) *ExitStandbyInput { return s } -// Contains the parameters for ExitStandby. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/ExitStandbyAnswer type ExitStandbyOutput struct { _ struct{} `type:"structure"` @@ -9474,7 +9437,8 @@ type InstanceDetails struct { // InstanceId is a required field InstanceId *string `min:"1" type:"string" required:"true"` - // The launch configuration associated with the instance. + // The launch configuration used to launch the instance. This value is not available + // if you attached the instance to the Auto Scaling group. // // LaunchConfigurationName is a required field LaunchConfigurationName *string `min:"1" type:"string" required:"true"` @@ -9545,12 +9509,12 @@ func (s *InstanceDetails) SetProtectedFromScaleIn(v bool) *InstanceDetails { return s } -// Describes whether instance monitoring is enabled. +// Describes whether detailed monitoring is enabled for the Auto Scaling instances. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/InstanceMonitoring type InstanceMonitoring struct { _ struct{} `type:"structure"` - // If True, instance monitoring is enabled. + // If true, detailed monitoring is enabled. Otherwise, basic monitoring is enabled. Enabled *bool `type:"boolean"` } @@ -9908,7 +9872,7 @@ func (s *LifecycleHook) SetRoleARN(v string) *LifecycleHook { return s } -// Describes the state of a Classic load balancer. +// Describes the state of a Classic Load Balancer. // // If you specify a load balancer when creating the Auto Scaling group, the // state of the load balancer is InService. @@ -10189,7 +10153,6 @@ func (s *ProcessType) SetProcessName(v string) *ProcessType { return s } -// Contains the parameters for PutLifecycleHook. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/PutLifecycleHookType type PutLifecycleHookInput struct { _ struct{} `type:"structure"` @@ -10335,7 +10298,6 @@ func (s *PutLifecycleHookInput) SetRoleARN(v string) *PutLifecycleHookInput { return s } -// Contains the output of PutLifecycleHook. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/PutLifecycleHookAnswer type PutLifecycleHookOutput struct { _ struct{} `type:"structure"` @@ -10351,7 +10313,6 @@ func (s PutLifecycleHookOutput) GoString() string { return s.String() } -// Contains the parameters for PutNotificationConfiguration. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/PutNotificationConfigurationType type PutNotificationConfigurationInput struct { _ struct{} `type:"structure"` @@ -10442,7 +10403,6 @@ func (s PutNotificationConfigurationOutput) GoString() string { return s.String() } -// Contains the parameters for PutScalingPolicy. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/PutScalingPolicyType type PutScalingPolicyInput struct { _ struct{} `type:"structure"` @@ -10639,7 +10599,6 @@ func (s *PutScalingPolicyInput) SetStepAdjustments(v []*StepAdjustment) *PutScal return s } -// Contains the output of PutScalingPolicy. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/PolicyARNType type PutScalingPolicyOutput struct { _ struct{} `type:"structure"` @@ -10664,7 +10623,6 @@ func (s *PutScalingPolicyOutput) SetPolicyARN(v string) *PutScalingPolicyOutput return s } -// Contains the parameters for PutScheduledUpdateGroupAction. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/PutScheduledUpdateGroupActionType type PutScheduledUpdateGroupActionInput struct { _ struct{} `type:"structure"` @@ -10814,7 +10772,6 @@ func (s PutScheduledUpdateGroupActionOutput) GoString() string { return s.String() } -// Contains the parameters for RecordLifecycleActionHeartbeat. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/RecordLifecycleActionHeartbeatType type RecordLifecycleActionHeartbeatInput struct { _ struct{} `type:"structure"` @@ -10900,7 +10857,6 @@ func (s *RecordLifecycleActionHeartbeatInput) SetLifecycleHookName(v string) *Re return s } -// Contains the output of RecordLifecycleActionHeartBeat. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/RecordLifecycleActionHeartbeatAnswer type RecordLifecycleActionHeartbeatOutput struct { _ struct{} `type:"structure"` @@ -10947,7 +10903,7 @@ type ScalingPolicy struct { AutoScalingGroupName *string `min:"1" type:"string"` // The amount of time, in seconds, after a scaling activity completes before - // any further trigger-related scaling activities can start. + // any further dynamic scaling activities can start. Cooldown *int64 `type:"integer"` // The estimated time, in seconds, until a newly launched instance can contribute @@ -11074,7 +11030,6 @@ func (s *ScalingPolicy) SetStepAdjustments(v []*StepAdjustment) *ScalingPolicy { return s } -// Contains the parameters for SuspendProcesses and ResumeProcesses. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/ScalingProcessQuery type ScalingProcessQuery struct { _ struct{} `type:"structure"` @@ -11254,7 +11209,6 @@ func (s *ScheduledUpdateGroupAction) SetTime(v time.Time) *ScheduledUpdateGroupA return s } -// Contains the parameters for SetDesiredCapacity. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/SetDesiredCapacityType type SetDesiredCapacityInput struct { _ struct{} `type:"structure"` @@ -11338,7 +11292,6 @@ func (s SetDesiredCapacityOutput) GoString() string { return s.String() } -// Contains the parameters for SetInstanceHealth. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/SetInstanceHealthQuery type SetInstanceHealthInput struct { _ struct{} `type:"structure"` @@ -11430,7 +11383,6 @@ func (s SetInstanceHealthOutput) GoString() string { return s.String() } -// Contains the parameters for SetInstanceProtection. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/SetInstanceProtectionQuery type SetInstanceProtectionInput struct { _ struct{} `type:"structure"` @@ -11502,7 +11454,6 @@ func (s *SetInstanceProtectionInput) SetProtectedFromScaleIn(v bool) *SetInstanc return s } -// Contains the output of SetInstanceProtection. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/SetInstanceProtectionAnswer type SetInstanceProtectionOutput struct { _ struct{} `type:"structure"` @@ -11808,7 +11759,6 @@ func (s *TagDescription) SetValue(v string) *TagDescription { return s } -// Contains the parameters for TerminateInstanceInAutoScalingGroup. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/TerminateInstanceInAutoScalingGroupType type TerminateInstanceInAutoScalingGroupInput struct { _ struct{} `type:"structure"` @@ -11866,7 +11816,6 @@ func (s *TerminateInstanceInAutoScalingGroupInput) SetShouldDecrementDesiredCapa return s } -// Contains the output of TerminateInstancesInAutoScalingGroup. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/ActivityType type TerminateInstanceInAutoScalingGroupOutput struct { _ struct{} `type:"structure"` @@ -11891,7 +11840,6 @@ func (s *TerminateInstanceInAutoScalingGroupOutput) SetActivity(v *Activity) *Te return s } -// Contains the parameters for UpdateAutoScalingGroup. // Please also see https://docs.aws.amazon.com/goto/WebAPI/autoscaling-2011-01-01/UpdateAutoScalingGroupType type UpdateAutoScalingGroupInput struct { _ struct{} `type:"structure"` diff --git a/vendor/github.com/aws/aws-sdk-go/service/cloudwatchevents/api.go b/vendor/github.com/aws/aws-sdk-go/service/cloudwatchevents/api.go index 5d64f7704..1ee818747 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/cloudwatchevents/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/cloudwatchevents/api.go @@ -889,10 +889,18 @@ func (c *CloudWatchEvents) PutTargetsRequest(input *PutTargetsInput) (req *reque // are extracted from the event and used as values in a template that you // specify as the input to the target. // +// When you specify Input, InputPath, or InputTransformer, you must use JSON +// dot notation, not bracket notation. +// // When you add targets to a rule and the associated rule triggers soon after, // new or updated targets might not be immediately invoked. Please allow a short // period of time for changes to take effect. // +// This action can partially fail if too many requests are made at the same +// time. If that happens, FailedEntryCount is non-zero in the response and each +// entry in FailedEntries provides the ID of the failed target and the error +// code. +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -987,6 +995,11 @@ func (c *CloudWatchEvents) RemoveTargetsRequest(input *RemoveTargetsInput) (req // might continue to be invoked. Please allow a short period of time for changes // to take effect. // +// This action can partially fail if too many requests are made at the same +// time. If that happens, FailedEntryCount is non-zero in the response and each +// entry in FailedEntries provides the ID of the failed target and the error +// code. +// // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about // the error. @@ -1223,7 +1236,8 @@ type DescribeRuleOutput struct { // The description of the rule. Description *string `type:"string"` - // The event pattern. + // The event pattern. For more information, see Events and Event Patterns (http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/CloudWatchEventsandEventPatterns.html) + // in the Amazon CloudWatch Events User Guide. EventPattern *string `type:"string"` // The name of the rule. @@ -1469,7 +1483,8 @@ type InputTransformer struct { _ struct{} `type:"structure"` // Map of JSON paths to be extracted from the event. These are key-value pairs, - // where each value is a JSON path. + // where each value is a JSON path. You must use JSON dot notation, not bracket + // notation. InputPathsMap map[string]*string `type:"map"` // Input template where you can use the values of the keys from InputPathsMap @@ -2050,7 +2065,8 @@ type PutRuleInput struct { // A description of the rule. Description *string `type:"string"` - // The event pattern. + // The event pattern. For more information, see Events and Event Patterns (http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/CloudWatchEventsandEventPatterns.html) + // in the Amazon CloudWatch Events User Guide. EventPattern *string `type:"string"` // The name of the rule that you are creating or updating. @@ -2264,7 +2280,9 @@ func (s *PutTargetsOutput) SetFailedEntryCount(v int64) *PutTargetsOutput { type PutTargetsResultEntry struct { _ struct{} `type:"structure"` - // The error code that indicates why the target addition failed. + // The error code that indicates why the target addition failed. If the value + // is ConcurrentModificationException, too many requests were made at the same + // time. ErrorCode *string `type:"string"` // The error message that explains why the target addition failed. @@ -2399,7 +2417,9 @@ func (s *RemoveTargetsOutput) SetFailedEntryCount(v int64) *RemoveTargetsOutput type RemoveTargetsResultEntry struct { _ struct{} `type:"structure"` - // The error code that indicates why the target removal failed. + // The error code that indicates why the target removal failed. If the value + // is ConcurrentModificationException, too many requests were made at the same + // time. ErrorCode *string `type:"string"` // The error message that explains why the target removal failed. @@ -2448,7 +2468,9 @@ type Rule struct { // The description of the rule. Description *string `type:"string"` - // The event pattern of the rule. + // The event pattern of the rule. For more information, see Events and Event + // Patterns (http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/CloudWatchEventsandEventPatterns.html) + // in the Amazon CloudWatch Events User Guide. EventPattern *string `type:"string"` // The name of the rule. @@ -2659,13 +2681,14 @@ type Target struct { Id *string `min:"1" type:"string" required:"true"` // Valid JSON text passed to the target. In this case, nothing from the event - // itself is passed to the target. For more information, see The JavaScript - // Object Notation (JSON) Data Interchange Format (http://www.rfc-editor.org/rfc/rfc7159.txt). + // itself is passed to the target. You must use JSON dot notation, not bracket + // notation. For more information, see The JavaScript Object Notation (JSON) + // Data Interchange Format (http://www.rfc-editor.org/rfc/rfc7159.txt). Input *string `type:"string"` // The value of the JSONPath that is used for extracting part of the matched - // event when passing it to the target. For more information about JSON paths, - // see JSONPath (http://goessner.net/articles/JsonPath/). + // event when passing it to the target. You must use JSON dot notation, not + // bracket notation. For more information about JSON paths, see JSONPath (http://goessner.net/articles/JsonPath/). InputPath *string `type:"string"` // Settings to enable you to provide custom input to a target based on certain @@ -2805,7 +2828,8 @@ type TestEventPatternInput struct { // Event is a required field Event *string `type:"string" required:"true"` - // The event pattern. + // The event pattern. For more information, see Events and Event Patterns (http://docs.aws.amazon.com/AmazonCloudWatch/latest/events/CloudWatchEventsandEventPatterns.html) + // in the Amazon CloudWatch Events User Guide. // // EventPattern is a required field EventPattern *string `type:"string" required:"true"` diff --git a/vendor/github.com/aws/aws-sdk-go/service/cloudwatchlogs/api.go b/vendor/github.com/aws/aws-sdk-go/service/cloudwatchlogs/api.go index aa55e434e..1c0b9734b 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/cloudwatchlogs/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/cloudwatchlogs/api.go @@ -2713,7 +2713,10 @@ func (c *CloudWatchLogs) PutSubscriptionFilterRequest(input *PutSubscriptionFilt // * An AWS Lambda function that belongs to the same account as the subscription // filter, for same-account delivery. // -// There can only be one subscription filter associated with a log group. +// There can only be one subscription filter associated with a log group. If +// you are updating an existing filter, you must specify the correct name in +// filterName. Otherwise, the call will fail because you cannot associate a +// second filter with a log group. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -4101,6 +4104,12 @@ type DescribeLogStreamsInput struct { // // If you order the results by event time, you cannot specify the logStreamNamePrefix // parameter. + // + // lastEventTimestamp represents the time of the most recent log event in the + // log stream in CloudWatch Logs. This number is expressed as the number of + // milliseconds since Jan 1, 1970 00:00:00 UTC. lastEventTimeStamp updates on + // an eventual consistency basis. It typically updates in less than an hour + // from ingestion, but may take longer in some rare situations. OrderBy *string `locationName:"orderBy" type:"string" enum:"OrderBy"` } @@ -4462,7 +4471,8 @@ type Destination struct { // The ARN of this destination. Arn *string `locationName:"arn" type:"string"` - // The creation time of the destination. + // The creation time of the destination, expressed as the number of milliseconds + // since Jan 1, 1970 00:00:00 UTC. CreationTime *int64 `locationName:"creationTime" type:"long"` // The name of the destination. @@ -4626,10 +4636,12 @@ func (s *ExportTask) SetTo(v int64) *ExportTask { type ExportTaskExecutionInfo struct { _ struct{} `type:"structure"` - // The completion time of the export task. + // The completion time of the export task, expressed as the number of milliseconds + // since Jan 1, 1970 00:00:00 UTC. CompletionTime *int64 `locationName:"completionTime" type:"long"` - // The creation time of the export task. + // The creation time of the export task, expressed as the number of milliseconds + // since Jan 1, 1970 00:00:00 UTC. CreationTime *int64 `locationName:"creationTime" type:"long"` } @@ -4864,7 +4876,8 @@ type FilteredLogEvent struct { // The ID of the event. EventId *string `locationName:"eventId" type:"string"` - // The time the event was ingested. + // The time the event was ingested, expressed as the number of milliseconds + // since Jan 1, 1970 00:00:00 UTC. IngestionTime *int64 `locationName:"ingestionTime" type:"long"` // The name of the log stream this event belongs to. @@ -5214,7 +5227,8 @@ type LogGroup struct { // The Amazon Resource Name (ARN) of the log group. Arn *string `locationName:"arn" type:"string"` - // The creation time of the log group. + // The creation time of the log group, expressed as the number of milliseconds + // since Jan 1, 1970 00:00:00 UTC. CreationTime *int64 `locationName:"creationTime" type:"long"` // The name of the log group. @@ -5287,18 +5301,23 @@ type LogStream struct { // The Amazon Resource Name (ARN) of the log stream. Arn *string `locationName:"arn" type:"string"` - // The creation time of the stream. + // The creation time of the stream, expressed as the number of milliseconds + // since Jan 1, 1970 00:00:00 UTC. CreationTime *int64 `locationName:"creationTime" type:"long"` // The time of the first event, expressed as the number of milliseconds since // Jan 1, 1970 00:00:00 UTC. FirstEventTimestamp *int64 `locationName:"firstEventTimestamp" type:"long"` - // The time of the last event, expressed as the number of milliseconds since - // Jan 1, 1970 00:00:00 UTC. + // the time of the most recent log event in the log stream in CloudWatch Logs. + // This number is expressed as the number of milliseconds since Jan 1, 1970 + // 00:00:00 UTC. lastEventTime updates on an eventual consistency basis. It + // typically updates in less than an hour from ingestion, but may take longer + // in some rare situations. LastEventTimestamp *int64 `locationName:"lastEventTimestamp" type:"long"` - // The ingestion time. + // The ingestion time, expressed as the number of milliseconds since Jan 1, + // 1970 00:00:00 UTC. LastIngestionTime *int64 `locationName:"lastIngestionTime" type:"long"` // The name of the log stream. @@ -5376,7 +5395,8 @@ func (s *LogStream) SetUploadSequenceToken(v string) *LogStream { type MetricFilter struct { _ struct{} `type:"structure"` - // The creation time of the metric filter. + // The creation time of the metric filter, expressed as the number of milliseconds + // since Jan 1, 1970 00:00:00 UTC. CreationTime *int64 `locationName:"creationTime" type:"long"` // The name of the metric filter. @@ -5563,7 +5583,8 @@ func (s *MetricTransformation) SetMetricValue(v string) *MetricTransformation { type OutputLogEvent struct { _ struct{} `type:"structure"` - // The time the event was ingested. + // The time the event was ingested, expressed as the number of milliseconds + // since Jan 1, 1970 00:00:00 UTC. IngestionTime *int64 `locationName:"ingestionTime" type:"long"` // The data contained in the log event. @@ -6124,7 +6145,10 @@ type PutSubscriptionFilterInput struct { // For a more even distribution, you can group log data randomly. Distribution *string `locationName:"distribution" type:"string" enum:"Distribution"` - // A name for the subscription filter. + // A name for the subscription filter. If you are updating an existing filter, + // you must specify the correct name in filterName. Otherwise, the call will + // fail because you cannot associate a second filter with a log group. To find + // the name of the filter currently associated with a log group, use DescribeSubscriptionFilters. // // FilterName is a required field FilterName *string `locationName:"filterName" min:"1" type:"string" required:"true"` @@ -6323,7 +6347,8 @@ func (s *SearchedLogStream) SetSearchedCompletely(v bool) *SearchedLogStream { type SubscriptionFilter struct { _ struct{} `type:"structure"` - // The creation time of the subscription filter. + // The creation time of the subscription filter, expressed as the number of + // milliseconds since Jan 1, 1970 00:00:00 UTC. CreationTime *int64 `locationName:"creationTime" type:"long"` // The Amazon Resource Name (ARN) of the destination. diff --git a/vendor/github.com/aws/aws-sdk-go/service/codedeploy/api.go b/vendor/github.com/aws/aws-sdk-go/service/codedeploy/api.go index 61da57561..673707b32 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/codedeploy/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/codedeploy/api.go @@ -704,11 +704,12 @@ func (c *CodeDeploy) ContinueDeploymentRequest(input *ContinueDeploymentInput) ( // ContinueDeployment API operation for AWS CodeDeploy. // -// Starts the process of rerouting traffic from instances in the original environment -// to instances in thereplacement environment without waiting for a specified -// wait time to elapse. (Traffic rerouting, which is achieved by registering -// instances in the replacement environment with the load balancer, can start -// as soon as all instances have a status of Ready.) +// For a blue/green deployment, starts the process of rerouting traffic from +// instances in the original environment to instances in the replacement environment +// without waiting for a specified wait time to elapse. (Traffic rerouting, +// which is achieved by registering instances in the replacement environment +// with the load balancer, can start as soon as all instances have a status +// of Ready.) // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -964,6 +965,12 @@ func (c *CodeDeploy) CreateDeploymentRequest(input *CreateDeploymentInput) (req // * ErrCodeInvalidLoadBalancerInfoException "InvalidLoadBalancerInfoException" // An invalid load balancer name, or no load balancer name, was specified. // +// * ErrCodeInvalidFileExistsBehaviorException "InvalidFileExistsBehaviorException" +// An invalid fileExistsBehavior option was specified to determine how AWS CodeDeploy +// handles files or directories that already exist in a deployment target location +// but weren't part of the previous successful deployment. Valid values include +// "DISALLOW", "OVERWRITE", and "RETAIN". +// // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/CreateDeployment func (c *CodeDeploy) CreateDeployment(input *CreateDeploymentInput) (*CreateDeploymentOutput, error) { req, out := c.CreateDeploymentRequest(input) @@ -1215,8 +1222,8 @@ func (c *CodeDeploy) CreateDeploymentGroupRequest(input *CreateDeploymentGroupIn // // * ErrCodeInvalidDeploymentStyleException "InvalidDeploymentStyleException" // An invalid deployment style was specified. Valid deployment types include -// "IN_PLACE" and "BLUE_GREEN". Valid deployment options for blue/green deployments -// include "WITH_TRAFFIC_CONTROL" and "WITHOUT_TRAFFIC_CONTROL". +// "IN_PLACE" and "BLUE_GREEN". Valid deployment options include "WITH_TRAFFIC_CONTROL" +// and "WITHOUT_TRAFFIC_CONTROL". // // * ErrCodeInvalidBlueGreenDeploymentConfigurationException "InvalidBlueGreenDeploymentConfigurationException" // The configuration for the blue/green deployment group was provided in an @@ -2901,6 +2908,10 @@ func (c *CodeDeploy) ListDeploymentInstancesRequest(input *ListDeploymentInstanc // Valid values include "Blue" for an original environment and "Green" for a // replacement environment. // +// * ErrCodeInvalidDeploymentInstanceTypeException "InvalidDeploymentInstanceTypeException" +// An instance type was specified for an in-place deployment. Instance types +// are supported for blue/green deployments only. +// // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/ListDeploymentInstances func (c *CodeDeploy) ListDeploymentInstances(input *ListDeploymentInstancesInput) (*ListDeploymentInstancesOutput, error) { req, out := c.ListDeploymentInstancesRequest(input) @@ -3948,8 +3959,8 @@ func (c *CodeDeploy) UpdateDeploymentGroupRequest(input *UpdateDeploymentGroupIn // // * ErrCodeInvalidDeploymentStyleException "InvalidDeploymentStyleException" // An invalid deployment style was specified. Valid deployment types include -// "IN_PLACE" and "BLUE_GREEN". Valid deployment options for blue/green deployments -// include "WITH_TRAFFIC_CONTROL" and "WITHOUT_TRAFFIC_CONTROL". +// "IN_PLACE" and "BLUE_GREEN". Valid deployment options include "WITH_TRAFFIC_CONTROL" +// and "WITHOUT_TRAFFIC_CONTROL". // // * ErrCodeInvalidBlueGreenDeploymentConfigurationException "InvalidBlueGreenDeploymentConfigurationException" // The configuration for the blue/green deployment group was provided in an @@ -5008,7 +5019,7 @@ type CreateDeploymentGroupInput struct { // group. // // For more information about the predefined deployment configurations in AWS - // CodeDeploy, see see Working with Deployment Groups in AWS CodeDeploy (http://docs.aws.amazon.com/codedeploy/latest/userguide/deployment-configurations.html) + // CodeDeploy, see Working with Deployment Groups in AWS CodeDeploy (http://docs.aws.amazon.com/codedeploy/latest/userguide/deployment-configurations.html) // in the AWS CodeDeploy User Guide. DeploymentConfigName *string `locationName:"deploymentConfigName" min:"1" type:"string"` @@ -5017,17 +5028,19 @@ type CreateDeploymentGroupInput struct { // DeploymentGroupName is a required field DeploymentGroupName *string `locationName:"deploymentGroupName" min:"1" type:"string" required:"true"` - // Information about the type of deployment, standard or blue/green, that you + // Information about the type of deployment, in-place or blue/green, that you // want to run and whether to route deployment traffic behind a load balancer. DeploymentStyle *DeploymentStyle `locationName:"deploymentStyle" type:"structure"` - // The Amazon EC2 tags on which to filter. + // The Amazon EC2 tags on which to filter. The deployment group will include + // EC2 instances with any of the specified tags. Ec2TagFilters []*EC2TagFilter `locationName:"ec2TagFilters" type:"list"` - // Information about the load balancer used in a blue/green deployment. + // Information about the load balancer used in a deployment. LoadBalancerInfo *LoadBalancerInfo `locationName:"loadBalancerInfo" type:"structure"` - // The on-premises instance tags on which to filter. + // The on-premises instance tags on which to filter. The deployment group will + // include on-premises instances with any of the specified tags. OnPremisesInstanceTagFilters []*TagFilter `locationName:"onPremisesInstanceTagFilters" type:"list"` // A service role ARN that allows AWS CodeDeploy to act on the user's behalf @@ -5212,6 +5225,22 @@ type CreateDeploymentInput struct { // A comment about the deployment. Description *string `locationName:"description" type:"string"` + // Information about how AWS CodeDeploy handles files that already exist in + // a deployment target location but weren't part of the previous successful + // deployment. + // + // The fileExistsBehavior parameter takes any of the following values: + // + // * DISALLOW: The deployment fails. This is also the default behavior if + // no option is specified. + // + // * OVERWRITE: The version of the file from the application revision currently + // being deployed replaces the version already on the instance. + // + // * RETAIN: The version of the file already on the instance is kept and + // used as part of the new deployment. + FileExistsBehavior *string `locationName:"fileExistsBehavior" type:"string" enum:"FileExistsBehavior"` + // If set to true, then if the deployment causes the ApplicationStop deployment // lifecycle event to an instance to fail, the deployment to that instance will // not be considered to have failed at that point and will continue on to the @@ -5297,6 +5326,12 @@ func (s *CreateDeploymentInput) SetDescription(v string) *CreateDeploymentInput return s } +// SetFileExistsBehavior sets the FileExistsBehavior field's value. +func (s *CreateDeploymentInput) SetFileExistsBehavior(v string) *CreateDeploymentInput { + s.FileExistsBehavior = &v + return s +} + // SetIgnoreApplicationStopFailures sets the IgnoreApplicationStopFailures field's value. func (s *CreateDeploymentInput) SetIgnoreApplicationStopFailures(v bool) *CreateDeploymentInput { s.IgnoreApplicationStopFailures = &v @@ -5637,14 +5672,14 @@ type DeploymentGroupInfo struct { // The deployment group name. DeploymentGroupName *string `locationName:"deploymentGroupName" min:"1" type:"string"` - // Information about the type of deployment, either standard or blue/green, + // Information about the type of deployment, either in-place or blue/green, // you want to run and whether to route deployment traffic behind a load balancer. DeploymentStyle *DeploymentStyle `locationName:"deploymentStyle" type:"structure"` // The Amazon EC2 tags on which to filter. Ec2TagFilters []*EC2TagFilter `locationName:"ec2TagFilters" type:"list"` - // Information about the load balancer to use in a blue/green deployment. + // Information about the load balancer to use in a deployment. LoadBalancerInfo *LoadBalancerInfo `locationName:"loadBalancerInfo" type:"structure"` // The on-premises instance tags on which to filter. @@ -5807,7 +5842,7 @@ type DeploymentInfo struct { // A summary of the deployment status of the instances in the deployment. DeploymentOverview *DeploymentOverview `locationName:"deploymentOverview" type:"structure"` - // Information about the type of deployment, either standard or blue/green, + // Information about the type of deployment, either in-place or blue/green, // you want to run and whether to route deployment traffic behind a load balancer. DeploymentStyle *DeploymentStyle `locationName:"deploymentStyle" type:"structure"` @@ -5817,6 +5852,20 @@ type DeploymentInfo struct { // Information about any error associated with this deployment. ErrorInformation *ErrorInformation `locationName:"errorInformation" type:"structure"` + // Information about how AWS CodeDeploy handles files that already exist in + // a deployment target location but weren't part of the previous successful + // deployment. + // + // * DISALLOW: The deployment fails. This is also the default behavior if + // no option is specified. + // + // * OVERWRITE: The version of the file from the application revision currently + // being deployed replaces the version already on the instance. + // + // * RETAIN: The version of the file already on the instance is kept and + // used as part of the new deployment. + FileExistsBehavior *string `locationName:"fileExistsBehavior" type:"string" enum:"FileExistsBehavior"` + // If true, then if the deployment causes the ApplicationStop deployment lifecycle // event to an instance to fail, the deployment to that instance will not be // considered to have failed at that point and will continue on to the BeforeInstall @@ -5834,9 +5883,13 @@ type DeploymentInfo struct { // starts. InstanceTerminationWaitTimeStarted *bool `locationName:"instanceTerminationWaitTimeStarted" type:"boolean"` - // Information about the load balancer used in this blue/green deployment. + // Information about the load balancer used in the deployment. LoadBalancerInfo *LoadBalancerInfo `locationName:"loadBalancerInfo" type:"structure"` + // Information about the application revision that was deployed to the deployment + // group before the most recent successful deployment. + PreviousRevision *RevisionLocation `locationName:"previousRevision" type:"structure"` + // Information about the location of stored application artifacts and the service // from which to retrieve them. Revision *RevisionLocation `locationName:"revision" type:"structure"` @@ -5958,6 +6011,12 @@ func (s *DeploymentInfo) SetErrorInformation(v *ErrorInformation) *DeploymentInf return s } +// SetFileExistsBehavior sets the FileExistsBehavior field's value. +func (s *DeploymentInfo) SetFileExistsBehavior(v string) *DeploymentInfo { + s.FileExistsBehavior = &v + return s +} + // SetIgnoreApplicationStopFailures sets the IgnoreApplicationStopFailures field's value. func (s *DeploymentInfo) SetIgnoreApplicationStopFailures(v bool) *DeploymentInfo { s.IgnoreApplicationStopFailures = &v @@ -5976,6 +6035,12 @@ func (s *DeploymentInfo) SetLoadBalancerInfo(v *LoadBalancerInfo) *DeploymentInf return s } +// SetPreviousRevision sets the PreviousRevision field's value. +func (s *DeploymentInfo) SetPreviousRevision(v *RevisionLocation) *DeploymentInfo { + s.PreviousRevision = v + return s +} + // SetRevision sets the Revision field's value. func (s *DeploymentInfo) SetRevision(v *RevisionLocation) *DeploymentInfo { s.Revision = v @@ -6131,7 +6196,7 @@ func (s *DeploymentReadyOption) SetWaitTimeInMinutes(v int64) *DeploymentReadyOp return s } -// Information about the type of deployment, either standard or blue/green, +// Information about the type of deployment, either in-place or blue/green, // you want to run and whether to route deployment traffic behind a load balancer. // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/DeploymentStyle type DeploymentStyle struct { @@ -6140,7 +6205,7 @@ type DeploymentStyle struct { // Indicates whether to route deployment traffic behind a load balancer. DeploymentOption *string `locationName:"deploymentOption" type:"string" enum:"DeploymentOption"` - // Indicates whether to run a standard deployment or a blue/green deployment. + // Indicates whether to run an in-place deployment or a blue/green deployment. DeploymentType *string `locationName:"deploymentType" type:"string" enum:"DeploymentType"` } @@ -6290,7 +6355,7 @@ func (s *Diagnostics) SetScriptName(v string) *Diagnostics { return s } -// Information about a tag filter. +// Information about an EC2 tag filter. // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/EC2TagFilter type EC2TagFilter struct { _ struct{} `type:"structure"` @@ -6339,14 +6404,16 @@ func (s *EC2TagFilter) SetValue(v string) *EC2TagFilter { return s } -// Information about a load balancer in Elastic Load Balancing to use in a blue/green -// deployment. +// Information about a load balancer in Elastic Load Balancing to use in a deployment. // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/ELBInfo type ELBInfo struct { _ struct{} `type:"structure"` - // The name of the load balancer that will be used to route traffic from original - // instances to replacement instances in a blue/green deployment. + // For blue/green deployments, the name of the load balancer that will be used + // to route traffic from original instances to replacement instances in a blue/green + // deployment. For in-place deployments, the name of the load balancer that + // instances are deregistered from so they are not serving traffic during a + // deployment, and then re-registered with after the deployment completes. Name *string `locationName:"name" type:"string"` } @@ -8065,13 +8132,13 @@ func (s *ListOnPremisesInstancesOutput) SetNextToken(v string) *ListOnPremisesIn return s } -// Information about the load balancer used in a blue/green deployment. +// Information about the load balancer used in a deployment. // Please also see https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06/LoadBalancerInfo type LoadBalancerInfo struct { _ struct{} `type:"structure"` // An array containing information about the load balancer in Elastic Load Balancing - // to use in a blue/green deployment. + // to use in a deployment. ElbInfoList []*ELBInfo `locationName:"elbInfoList" type:"list"` } @@ -8119,6 +8186,9 @@ type MinimumHealthyHosts struct { // Although this allows one instance at a time to be taken offline for a new // deployment, it also means that if the deployment to the last instance fails, // the overall deployment still succeeds. + // + // For more information, see AWS CodeDeploy Instance Health (http://docs.aws.amazon.com/codedeploy/latest/userguide/instances-health.html) + // in the AWS CodeDeploy User Guide. Type *string `locationName:"type" type:"string" enum:"MinimumHealthyHostsType"` // The minimum healthy instance value. @@ -9009,7 +9079,7 @@ type UpdateDeploymentGroupInput struct { // it. DeploymentConfigName *string `locationName:"deploymentConfigName" min:"1" type:"string"` - // Information about the type of deployment, either standard or blue/green, + // Information about the type of deployment, either in-place or blue/green, // you want to run and whether to route deployment traffic behind a load balancer. DeploymentStyle *DeploymentStyle `locationName:"deploymentStyle" type:"structure"` @@ -9018,7 +9088,7 @@ type UpdateDeploymentGroupInput struct { // do not enter any tag names. Ec2TagFilters []*EC2TagFilter `locationName:"ec2TagFilters" type:"list"` - // Information about the load balancer used in a blue/green deployment. + // Information about the load balancer used in a deployment. LoadBalancerInfo *LoadBalancerInfo `locationName:"loadBalancerInfo" type:"structure"` // The new name of the deployment group, if you want to change it. @@ -9347,6 +9417,17 @@ const ( ErrorCodeManualStop = "MANUAL_STOP" ) +const ( + // FileExistsBehaviorDisallow is a FileExistsBehavior enum value + FileExistsBehaviorDisallow = "DISALLOW" + + // FileExistsBehaviorOverwrite is a FileExistsBehavior enum value + FileExistsBehaviorOverwrite = "OVERWRITE" + + // FileExistsBehaviorRetain is a FileExistsBehavior enum value + FileExistsBehaviorRetain = "RETAIN" +) + const ( // GreenFleetProvisioningActionDiscoverExisting is a GreenFleetProvisioningAction enum value GreenFleetProvisioningActionDiscoverExisting = "DISCOVER_EXISTING" diff --git a/vendor/github.com/aws/aws-sdk-go/service/codedeploy/doc.go b/vendor/github.com/aws/aws-sdk-go/service/codedeploy/doc.go index 7e46df547..f9a43b80c 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/codedeploy/doc.go +++ b/vendor/github.com/aws/aws-sdk-go/service/codedeploy/doc.go @@ -3,59 +3,60 @@ // Package codedeploy provides the client and types for making API // requests to AWS CodeDeploy. // -// Overview +// AWS CodeDeploy is a deployment service that automates application deployments +// to Amazon EC2 instances or on-premises instances running in your own facility. // -// This reference guide provides descriptions of the AWS CodeDeploy APIs. For -// more information about AWS CodeDeploy, see the AWS CodeDeploy User Guide -// (http://docs.aws.amazon.com/codedeploy/latest/userguide). +// You can deploy a nearly unlimited variety of application content, such as +// code, web and configuration files, executables, packages, scripts, multimedia +// files, and so on. AWS CodeDeploy can deploy application content stored in +// Amazon S3 buckets, GitHub repositories, or Bitbucket repositories. You do +// not need to make changes to your existing code before you can use AWS CodeDeploy. // -// Using the APIs +// AWS CodeDeploy makes it easier for you to rapidly release new features, helps +// you avoid downtime during application deployment, and handles the complexity +// of updating your applications, without many of the risks associated with +// error-prone manual deployments. // -// You can use the AWS CodeDeploy APIs to work with the following: +// AWS CodeDeploy Components // -// * Applications are unique identifiers used by AWS CodeDeploy to ensure -// the correct combinations of revisions, deployment configurations, and -// deployment groups are being referenced during deployments. +// Use the information in this guide to help you work with the following AWS +// CodeDeploy components: // -// You can use the AWS CodeDeploy APIs to create, delete, get, list, and update -// applications. +// * Application: A name that uniquely identifies the application you want +// to deploy. AWS CodeDeploy uses this name, which functions as a container, +// to ensure the correct combination of revision, deployment configuration, +// and deployment group are referenced during a deployment. // -// * Deployment configurations are sets of deployment rules and success and -// failure conditions used by AWS CodeDeploy during deployments. +// * Deployment group: A set of individual instances. A deployment group +// contains individually tagged instances, Amazon EC2 instances in Auto Scaling +// groups, or both. // -// You can use the AWS CodeDeploy APIs to create, delete, get, and list deployment -// configurations. +// * Deployment configuration: A set of deployment rules and deployment success +// and failure conditions used by AWS CodeDeploy during a deployment. // -// * Deployment groups are groups of instances to which application revisions -// can be deployed. +// * Deployment: The process, and the components involved in the process, +// of installing content on one or more instances. // -// You can use the AWS CodeDeploy APIs to create, delete, get, list, and update -// deployment groups. +// * Application revisions: An archive file containing source content—source +// code, web pages, executable files, and deployment scripts—along with an +// application specification file (AppSpec file). Revisions are stored in +// Amazon S3 buckets or GitHub repositories. For Amazon S3, a revision is +// uniquely identified by its Amazon S3 object key and its ETag, version, +// or both. For GitHub, a revision is uniquely identified by its commit ID. // -// * Instances represent Amazon EC2 instances to which application revisions -// are deployed. Instances are identified by their Amazon EC2 tags or Auto -// Scaling group names. Instances belong to deployment groups. +// This guide also contains information to help you get details about the instances +// in your deployments and to make on-premises instances available for AWS CodeDeploy +// deployments. // -// You can use the AWS CodeDeploy APIs to get and list instance. +// AWS CodeDeploy Information Resources // -// * Deployments represent the process of deploying revisions to instances. +// * AWS CodeDeploy User Guide (http://docs.aws.amazon.com/codedeploy/latest/userguide) // -// You can use the AWS CodeDeploy APIs to create, get, list, and stop deployments. +// * AWS CodeDeploy API Reference Guide (http://docs.aws.amazon.com/codedeploy/latest/APIReference/) // -// * Application revisions are archive files stored in Amazon S3 buckets -// or GitHub repositories. These revisions contain source content (such as -// source code, web pages, executable files, and deployment scripts) along -// with an application specification (AppSpec) file. (The AppSpec file is -// unique to AWS CodeDeploy; it defines the deployment actions you want AWS -// CodeDeploy to execute.) For application revisions stored in Amazon S3 -// buckets, an application revision is uniquely identified by its Amazon -// S3 object key and its ETag, version, or both. For application revisions -// stored in GitHub repositories, an application revision is uniquely identified -// by its repository name and commit ID. Application revisions are deployed -// through deployment groups. +// * AWS CLI Reference for AWS CodeDeploy (http://docs.aws.amazon.com/cli/latest/reference/deploy/index.html) // -// You can use the AWS CodeDeploy APIs to get, list, and register application -// revisions. +// * AWS CodeDeploy Developer Forum (https://forums.aws.amazon.com/forum.jspa?forumID=179) // // See https://docs.aws.amazon.com/goto/WebAPI/codedeploy-2014-10-06 for more information on this service. // diff --git a/vendor/github.com/aws/aws-sdk-go/service/codedeploy/errors.go b/vendor/github.com/aws/aws-sdk-go/service/codedeploy/errors.go index 1f8c6a96d..1e1e41c65 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/codedeploy/errors.go +++ b/vendor/github.com/aws/aws-sdk-go/service/codedeploy/errors.go @@ -284,6 +284,13 @@ const ( // At least one of the deployment IDs was specified in an invalid format. ErrCodeInvalidDeploymentIdException = "InvalidDeploymentIdException" + // ErrCodeInvalidDeploymentInstanceTypeException for service response error code + // "InvalidDeploymentInstanceTypeException". + // + // An instance type was specified for an in-place deployment. Instance types + // are supported for blue/green deployments only. + ErrCodeInvalidDeploymentInstanceTypeException = "InvalidDeploymentInstanceTypeException" + // ErrCodeInvalidDeploymentStatusException for service response error code // "InvalidDeploymentStatusException". // @@ -294,8 +301,8 @@ const ( // "InvalidDeploymentStyleException". // // An invalid deployment style was specified. Valid deployment types include - // "IN_PLACE" and "BLUE_GREEN". Valid deployment options for blue/green deployments - // include "WITH_TRAFFIC_CONTROL" and "WITHOUT_TRAFFIC_CONTROL". + // "IN_PLACE" and "BLUE_GREEN". Valid deployment options include "WITH_TRAFFIC_CONTROL" + // and "WITHOUT_TRAFFIC_CONTROL". ErrCodeInvalidDeploymentStyleException = "InvalidDeploymentStyleException" // ErrCodeInvalidEC2TagException for service response error code @@ -304,6 +311,15 @@ const ( // The tag was specified in an invalid format. ErrCodeInvalidEC2TagException = "InvalidEC2TagException" + // ErrCodeInvalidFileExistsBehaviorException for service response error code + // "InvalidFileExistsBehaviorException". + // + // An invalid fileExistsBehavior option was specified to determine how AWS CodeDeploy + // handles files or directories that already exist in a deployment target location + // but weren't part of the previous successful deployment. Valid values include + // "DISALLOW", "OVERWRITE", and "RETAIN". + ErrCodeInvalidFileExistsBehaviorException = "InvalidFileExistsBehaviorException" + // ErrCodeInvalidIamSessionArnException for service response error code // "InvalidIamSessionArnException". // diff --git a/vendor/github.com/aws/aws-sdk-go/service/codedeploy/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/codedeploy/examples_test.go index d341d14b3..8c5fcdbe2 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/codedeploy/examples_test.go +++ b/vendor/github.com/aws/aws-sdk-go/service/codedeploy/examples_test.go @@ -265,6 +265,7 @@ func ExampleCodeDeploy_CreateDeployment() { DeploymentConfigName: aws.String("DeploymentConfigName"), DeploymentGroupName: aws.String("DeploymentGroupName"), Description: aws.String("Description"), + FileExistsBehavior: aws.String("FileExistsBehavior"), IgnoreApplicationStopFailures: aws.Bool(true), Revision: &codedeploy.RevisionLocation{ GitHubLocation: &codedeploy.GitHubLocation{ diff --git a/vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/encode.go b/vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/encode.go index 22c46a0a3..76680868e 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/encode.go +++ b/vendor/github.com/aws/aws-sdk-go/service/dynamodb/dynamodbattribute/encode.go @@ -14,7 +14,7 @@ import ( // and unmarshaled with DynamoDB AttributeValues it will be done so as number // instead of string in seconds since January 1, 1970 UTC. // -// This type is useful as an alterntitive to the struct tag `unixtime` when you +// This type is useful as an alternative to the struct tag `unixtime` when you // want to have your time value marshaled as Unix time in seconds intead of // the default time.RFC3339. // diff --git a/vendor/github.com/aws/aws-sdk-go/service/gamelift/api.go b/vendor/github.com/aws/aws-sdk-go/service/gamelift/api.go index 2c091353e..f1ffffec2 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/gamelift/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/gamelift/api.go @@ -293,13 +293,17 @@ func (c *GameLift) CreateFleetRequest(input *CreateFleetInput) (req *request.Req // A newly created fleet passes through several statuses; once it reaches the // ACTIVE status, it can begin hosting game sessions. // -// To create a new fleet, provide a fleet name, an EC2 instance type, and a -// build ID of the game build to deploy. You can also configure the new fleet -// with the following settings: (1) a runtime configuration describing what -// server processes to run on each instance in the fleet (required to create -// fleet), (2) access permissions for inbound traffic, (3) fleet-wide game session -// protection, and (4) the location of default log files for Amazon GameLift -// to upload and store. +// To create a new fleet, you must specify the following: (1) fleet name, (2) +// build ID of an uploaded game build, (3) an EC2 instance type, and (4) a runtime +// configuration that describes which server processes to run on each instance +// in the fleet. (Although the runtime configuration is not a required parameter, +// the fleet cannot be successfully created without it.) You can also configure +// the new fleet with the following settings: fleet description, access permissions +// for inbound traffic, fleet-wide game session protection, and resource creation +// limit. If you use Amazon CloudWatch for metrics, you can add the new fleet +// to a metric group, which allows you to view aggregated metrics for a set +// of fleets. Once you specify a metric group, the new fleet's metrics are included +// in the metric group's data. // // If the CreateFleet call is successful, Amazon GameLift performs the following // tasks: @@ -636,6 +640,10 @@ func (c *GameLift) CreateGameSessionQueueRequest(input *CreateGameSessionQueueIn // * ErrCodeUnauthorizedException "UnauthorizedException" // The client failed authentication. Clients should not retry such requests. // +// * ErrCodeLimitExceededException "LimitExceededException" +// The requested operation would cause the resource to exceed the allowed service +// limit. Resolve the issue before retrying. +// // Please also see https://docs.aws.amazon.com/goto/WebAPI/gamelift-2015-10-01/CreateGameSessionQueue func (c *GameLift) CreateGameSessionQueue(input *CreateGameSessionQueueInput) (*CreateGameSessionQueueOutput, error) { req, out := c.CreateGameSessionQueueRequest(input) @@ -3984,33 +3992,44 @@ func (c *GameLift) StartGameSessionPlacementRequest(input *StartGameSessionPlace // Places a request for a new game session in a queue (see CreateGameSessionQueue). // When processing a placement request, Amazon GameLift searches for available // resources on the queue's destinations, scanning each until it finds resources -// or the placement request times out. A game session placement request can -// also request player sessions. When a new game session is successfully created, -// Amazon GameLift creates a player session for each player included in the -// request. +// or the placement request times out. +// +// A game session placement request can also request player sessions. When a +// new game session is successfully created, Amazon GameLift creates a player +// session for each player included in the request. // // When placing a game session, by default Amazon GameLift tries each fleet // in the order they are listed in the queue configuration. Ideally, a queue's -// destinations are listed in preference order. Alternatively, when requesting -// a game session with players, you can also provide latency data for each player -// in relevant regions. Latency data indicates the performance lag a player -// experiences when connected to a fleet in the region. Amazon GameLift uses -// latency data to reorder the list of destinations to place the game session -// in a region with minimal lag. If latency data is provided for multiple players, -// Amazon GameLift calculates each region's average lag for all players and -// reorders to get the best game play across all players. +// destinations are listed in preference order. // -// To place a new game session request, specify the queue name and a set of -// game session properties and settings. Also provide a unique ID (such as a -// UUID) for the placement. You'll use this ID to track the status of the placement -// request. Optionally, provide a set of IDs and player data for each player -// you want to join to the new game session. To optimize game play for the players, -// also provide latency data for all players. If successful, a new game session -// placement is created. To track the status of a placement request, call DescribeGameSessionPlacement +// Alternatively, when requesting a game session with players, you can also +// provide latency data for each player in relevant regions. Latency data indicates +// the performance lag a player experiences when connected to a fleet in the +// region. Amazon GameLift uses latency data to reorder the list of destinations +// to place the game session in a region with minimal lag. If latency data is +// provided for multiple players, Amazon GameLift calculates each region's average +// lag for all players and reorders to get the best game play across all players. +// +// To place a new game session request, specify the following: +// +// * The queue name and a set of game session properties and settings +// +// * A unique ID (such as a UUID) for the placement. You use this ID to track +// the status of the placement request +// +// * (Optional) A set of IDs and player data for each player you want to +// join to the new game session +// +// * Latency data for all players (if you want to optimize game play for +// the players) +// +// If successful, a new game session placement is created. +// +// To track the status of a placement request, call DescribeGameSessionPlacement // and check the request's status. If the status is Fulfilled, a new game session // has been created and a game session ARN and region are referenced. If the -// placement request times out, you have the option of resubmitting the request -// or retrying it with a different queue. +// placement request times out, you can resubmit the request or retry it with +// a different queue. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -5510,6 +5529,11 @@ type CreateFleetInput struct { // See more information in the Server API Reference (http://docs.aws.amazon.com/gamelift/latest/developerguide/gamelift-sdk-server-api-ref.html#gamelift-sdk-server-api-ref-dataypes-process). LogPaths []*string `type:"list"` + // Names of metric groups to add this fleet to. Use an existing metric group + // name to add this fleet to the group, or use a new name to create a new metric + // group. Currently, a fleet can only be included in one metric group at a time. + MetricGroups []*string `type:"list"` + // Descriptive label that is associated with a fleet. Fleet names do not need // to be unique. // @@ -5645,6 +5669,12 @@ func (s *CreateFleetInput) SetLogPaths(v []*string) *CreateFleetInput { return s } +// SetMetricGroups sets the MetricGroups field's value. +func (s *CreateFleetInput) SetMetricGroups(v []*string) *CreateFleetInput { + s.MetricGroups = v + return s +} + // SetName sets the Name field's value. func (s *CreateFleetInput) SetName(v string) *CreateFleetInput { s.Name = &v @@ -8354,6 +8384,12 @@ type FleetAttributes struct { // stored logs. LogPaths []*string `type:"list"` + // Names of metric groups that this fleet is included in. In Amazon CloudWatch, + // you can view metrics for an individual fleet or aggregated metrics for a + // fleets that are in a fleet metric group. Currently, a fleet can be included + // in only one metric group at a time. + MetricGroups []*string `type:"list"` + // Descriptive label that is associated with a fleet. Fleet names do not need // to be unique. Name *string `min:"1" type:"string"` @@ -8459,6 +8495,12 @@ func (s *FleetAttributes) SetLogPaths(v []*string) *FleetAttributes { return s } +// SetMetricGroups sets the MetricGroups field's value. +func (s *FleetAttributes) SetMetricGroups(v []*string) *FleetAttributes { + s.MetricGroups = v + return s +} + // SetName sets the Name field's value. func (s *FleetAttributes) SetName(v string) *FleetAttributes { s.Name = &v @@ -9095,7 +9137,7 @@ type GameSessionQueue struct { // ARN. Destinations are listed in default preference order. Destinations []*GameSessionQueueDestination `type:"list"` - // Amazon Resource Name (ARN (http://docs.aws.amazon.com/docs.aws.amazon.com/AmazonS3/latest/dev/s3-arn-format.html)) + // Amazon Resource Name (ARN (http://docs.aws.amazon.com/AmazonS3/latest/dev/s3-arn-format.html)) // that is assigned to a game session queue and uniquely identifies it. Format // is arn:aws:gamelift:::fleet/fleet-a1234567-b8c9-0d1e-2fa3-b45c6d7e8912. GameSessionQueueArn *string `min:"1" type:"string"` @@ -10729,8 +10771,18 @@ func (s *RoutingStrategy) SetType(v string) *RoutingStrategy { type RuntimeConfiguration struct { _ struct{} `type:"structure"` - // Collection of server process configurations describing what server processes - // to run on each instance in a fleet + // Maximum amount of time (in seconds) that a game session can remain in status + // ACTIVATING. If the game session is not active before the timeout, activation + // is terminated and the game session status is changed to TERMINATED. + GameSessionActivationTimeoutSeconds *int64 `min:"1" type:"integer"` + + // Maximum number of game sessions with status ACTIVATING to allow on an instance + // simultaneously. This setting limits the amount of instance resources that + // can be used for new game activations at any one time. + MaxConcurrentGameSessionActivations *int64 `min:"1" type:"integer"` + + // Collection of server process configurations that describe which server processes + // to run on each instance in a fleet. ServerProcesses []*ServerProcess `min:"1" type:"list"` } @@ -10747,6 +10799,12 @@ func (s RuntimeConfiguration) GoString() string { // Validate inspects the fields of the type to determine if they are valid. func (s *RuntimeConfiguration) Validate() error { invalidParams := request.ErrInvalidParams{Context: "RuntimeConfiguration"} + if s.GameSessionActivationTimeoutSeconds != nil && *s.GameSessionActivationTimeoutSeconds < 1 { + invalidParams.Add(request.NewErrParamMinValue("GameSessionActivationTimeoutSeconds", 1)) + } + if s.MaxConcurrentGameSessionActivations != nil && *s.MaxConcurrentGameSessionActivations < 1 { + invalidParams.Add(request.NewErrParamMinValue("MaxConcurrentGameSessionActivations", 1)) + } if s.ServerProcesses != nil && len(s.ServerProcesses) < 1 { invalidParams.Add(request.NewErrParamMinLen("ServerProcesses", 1)) } @@ -10767,6 +10825,18 @@ func (s *RuntimeConfiguration) Validate() error { return nil } +// SetGameSessionActivationTimeoutSeconds sets the GameSessionActivationTimeoutSeconds field's value. +func (s *RuntimeConfiguration) SetGameSessionActivationTimeoutSeconds(v int64) *RuntimeConfiguration { + s.GameSessionActivationTimeoutSeconds = &v + return s +} + +// SetMaxConcurrentGameSessionActivations sets the MaxConcurrentGameSessionActivations field's value. +func (s *RuntimeConfiguration) SetMaxConcurrentGameSessionActivations(v int64) *RuntimeConfiguration { + s.MaxConcurrentGameSessionActivations = &v + return s +} + // SetServerProcesses sets the ServerProcesses field's value. func (s *RuntimeConfiguration) SetServerProcesses(v []*ServerProcess) *RuntimeConfiguration { s.ServerProcesses = v @@ -11703,6 +11773,13 @@ type UpdateFleetAttributesInput struct { // FleetId is a required field FleetId *string `type:"string" required:"true"` + // Names of metric groups to include this fleet with. A fleet metric group is + // used in Amazon CloudWatch to aggregate metrics from multiple fleets. Use + // an existing metric group name to add this fleet to the group, or use a new + // name to create a new metric group. Currently, a fleet can only be included + // in one metric group at a time. + MetricGroups []*string `type:"list"` + // Descriptive label that is associated with a fleet. Fleet names do not need // to be unique. Name *string `min:"1" type:"string"` @@ -11764,6 +11841,12 @@ func (s *UpdateFleetAttributesInput) SetFleetId(v string) *UpdateFleetAttributes return s } +// SetMetricGroups sets the MetricGroups field's value. +func (s *UpdateFleetAttributesInput) SetMetricGroups(v []*string) *UpdateFleetAttributesInput { + s.MetricGroups = v + return s +} + // SetName sets the Name field's value. func (s *UpdateFleetAttributesInput) SetName(v string) *UpdateFleetAttributesInput { s.Name = &v @@ -12608,6 +12691,9 @@ const ( // MetricNameActiveInstances is a MetricName enum value MetricNameActiveInstances = "ActiveInstances" + // MetricNameAvailableGameSessions is a MetricName enum value + MetricNameAvailableGameSessions = "AvailableGameSessions" + // MetricNameAvailablePlayerSessions is a MetricName enum value MetricNameAvailablePlayerSessions = "AvailablePlayerSessions" @@ -12617,6 +12703,12 @@ const ( // MetricNameIdleInstances is a MetricName enum value MetricNameIdleInstances = "IdleInstances" + // MetricNamePercentAvailableGameSessions is a MetricName enum value + MetricNamePercentAvailableGameSessions = "PercentAvailableGameSessions" + + // MetricNamePercentIdleInstances is a MetricName enum value + MetricNamePercentIdleInstances = "PercentIdleInstances" + // MetricNameQueueDepth is a MetricName enum value MetricNameQueueDepth = "QueueDepth" diff --git a/vendor/github.com/aws/aws-sdk-go/service/gamelift/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/gamelift/examples_test.go index 4c596e86a..c871a86d7 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/gamelift/examples_test.go +++ b/vendor/github.com/aws/aws-sdk-go/service/gamelift/examples_test.go @@ -93,12 +93,18 @@ func ExampleGameLift_CreateFleet() { aws.String("NonZeroAndMaxString"), // Required // More values... }, + MetricGroups: []*string{ + aws.String("MetricGroup"), // Required + // More values... + }, NewGameSessionProtectionPolicy: aws.String("ProtectionPolicy"), ResourceCreationLimitPolicy: &gamelift.ResourceCreationLimitPolicy{ NewGameSessionsPerCreator: aws.Int64(1), PolicyPeriodInMinutes: aws.Int64(1), }, RuntimeConfiguration: &gamelift.RuntimeConfiguration{ + GameSessionActivationTimeoutSeconds: aws.Int64(1), + MaxConcurrentGameSessionActivations: aws.Int64(1), ServerProcesses: []*gamelift.ServerProcess{ { // Required ConcurrentExecutions: aws.Int64(1), // Required @@ -1067,7 +1073,11 @@ func ExampleGameLift_UpdateFleetAttributes() { params := &gamelift.UpdateFleetAttributesInput{ FleetId: aws.String("FleetId"), // Required Description: aws.String("NonZeroAndMaxString"), - Name: aws.String("NonZeroAndMaxString"), + MetricGroups: []*string{ + aws.String("MetricGroup"), // Required + // More values... + }, + Name: aws.String("NonZeroAndMaxString"), NewGameSessionProtectionPolicy: aws.String("ProtectionPolicy"), ResourceCreationLimitPolicy: &gamelift.ResourceCreationLimitPolicy{ NewGameSessionsPerCreator: aws.Int64(1), @@ -1218,6 +1228,8 @@ func ExampleGameLift_UpdateRuntimeConfiguration() { params := &gamelift.UpdateRuntimeConfigurationInput{ FleetId: aws.String("FleetId"), // Required RuntimeConfiguration: &gamelift.RuntimeConfiguration{ // Required + GameSessionActivationTimeoutSeconds: aws.Int64(1), + MaxConcurrentGameSessionActivations: aws.Int64(1), ServerProcesses: []*gamelift.ServerProcess{ { // Required ConcurrentExecutions: aws.Int64(1), // Required diff --git a/vendor/github.com/aws/aws-sdk-go/service/inspector/api.go b/vendor/github.com/aws/aws-sdk-go/service/inspector/api.go index 212961fb8..277aa2964 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/inspector/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/inspector/api.go @@ -1276,6 +1276,109 @@ func (c *Inspector) DescribeRulesPackagesWithContext(ctx aws.Context, input *Des return out, req.Send() } +const opGetAssessmentReport = "GetAssessmentReport" + +// GetAssessmentReportRequest generates a "aws/request.Request" representing the +// client's request for the GetAssessmentReport operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See GetAssessmentReport for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the GetAssessmentReport method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the GetAssessmentReportRequest method. +// req, resp := client.GetAssessmentReportRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/GetAssessmentReport +func (c *Inspector) GetAssessmentReportRequest(input *GetAssessmentReportInput) (req *request.Request, output *GetAssessmentReportOutput) { + op := &request.Operation{ + Name: opGetAssessmentReport, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &GetAssessmentReportInput{} + } + + output = &GetAssessmentReportOutput{} + req = c.newRequest(op, input, output) + return +} + +// GetAssessmentReport API operation for Amazon Inspector. +// +// Produces an assessment report that includes detailed and comprehensive results +// of a specified assessment run. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Inspector's +// API operation GetAssessmentReport for usage and error information. +// +// Returned Error Codes: +// * ErrCodeInternalException "InternalException" +// Internal server error. +// +// * ErrCodeInvalidInputException "InvalidInputException" +// The request was rejected because an invalid or out-of-range value was supplied +// for an input parameter. +// +// * ErrCodeAccessDeniedException "AccessDeniedException" +// You do not have required permissions to access the requested resource. +// +// * ErrCodeNoSuchEntityException "NoSuchEntityException" +// The request was rejected because it referenced an entity that does not exist. +// The error code describes the entity. +// +// * ErrCodeAssessmentRunInProgressException "AssessmentRunInProgressException" +// You cannot perform a specified action if an assessment run is currently in +// progress. +// +// * ErrCodeUnsupportedFeatureException "UnsupportedFeatureException" +// Used by the GetAssessmentReport API. The request was rejected because you +// tried to generate a report for an assessment run that existed before reporting +// was supported in Amazon Inspector. You can only generate reports for assessment +// runs that took place or will take place after generating reports in Amazon +// Inspector became available. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/GetAssessmentReport +func (c *Inspector) GetAssessmentReport(input *GetAssessmentReportInput) (*GetAssessmentReportOutput, error) { + req, out := c.GetAssessmentReportRequest(input) + return out, req.Send() +} + +// GetAssessmentReportWithContext is the same as GetAssessmentReport with the addition of +// the ability to pass a context and additional request options. +// +// See GetAssessmentReport for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Inspector) GetAssessmentReportWithContext(ctx aws.Context, input *GetAssessmentReportInput, opts ...request.Option) (*GetAssessmentReportOutput, error) { + req, out := c.GetAssessmentReportRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opGetTelemetryMetadata = "GetTelemetryMetadata" // GetTelemetryMetadataRequest generates a "aws/request.Request" representing the @@ -3222,6 +3325,11 @@ type AssessmentRun struct { // DurationInSeconds is a required field DurationInSeconds *int64 `locationName:"durationInSeconds" min:"180" type:"integer" required:"true"` + // Provides a total count of generated findings per severity. + // + // FindingCounts is a required field + FindingCounts map[string]*int64 `locationName:"findingCounts" type:"map" required:"true"` + // The auto-generated name for the assessment run. // // Name is a required field @@ -3308,6 +3416,12 @@ func (s *AssessmentRun) SetDurationInSeconds(v int64) *AssessmentRun { return s } +// SetFindingCounts sets the FindingCounts field's value. +func (s *AssessmentRun) SetFindingCounts(v map[string]*int64) *AssessmentRun { + s.FindingCounts = v + return s +} + // SetName sets the Name field's value. func (s *AssessmentRun) SetName(v string) *AssessmentRun { s.Name = &v @@ -3580,6 +3694,7 @@ type AssessmentRunNotification struct { // Event is a required field Event *string `locationName:"event" type:"string" required:"true" enum:"Event"` + // The message included in the notification. Message *string `locationName:"message" type:"string"` // The status code of the SNS notification. @@ -5573,6 +5688,116 @@ func (s *FindingFilter) SetUserAttributes(v []*Attribute) *FindingFilter { return s } +// Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/GetAssessmentReportRequest +type GetAssessmentReportInput struct { + _ struct{} `type:"structure"` + + // The ARN that specifies the assessment run for which you want to generate + // a report. + // + // AssessmentRunArn is a required field + AssessmentRunArn *string `locationName:"assessmentRunArn" min:"1" type:"string" required:"true"` + + // Specifies the file format (html or pdf) of the assessment report that you + // want to generate. + // + // ReportFileFormat is a required field + ReportFileFormat *string `locationName:"reportFileFormat" type:"string" required:"true" enum:"ReportFileFormat"` + + // Specifies the type of the assessment report that you want to generate. There + // are two types of assessment reports: a finding report and a full report. + // For more information, see Assessment Reports (http://docs.aws.amazon.com/inspector/latest/userguide/inspector_reports.html). + // + // ReportType is a required field + ReportType *string `locationName:"reportType" type:"string" required:"true" enum:"ReportType"` +} + +// String returns the string representation +func (s GetAssessmentReportInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetAssessmentReportInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *GetAssessmentReportInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "GetAssessmentReportInput"} + if s.AssessmentRunArn == nil { + invalidParams.Add(request.NewErrParamRequired("AssessmentRunArn")) + } + if s.AssessmentRunArn != nil && len(*s.AssessmentRunArn) < 1 { + invalidParams.Add(request.NewErrParamMinLen("AssessmentRunArn", 1)) + } + if s.ReportFileFormat == nil { + invalidParams.Add(request.NewErrParamRequired("ReportFileFormat")) + } + if s.ReportType == nil { + invalidParams.Add(request.NewErrParamRequired("ReportType")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetAssessmentRunArn sets the AssessmentRunArn field's value. +func (s *GetAssessmentReportInput) SetAssessmentRunArn(v string) *GetAssessmentReportInput { + s.AssessmentRunArn = &v + return s +} + +// SetReportFileFormat sets the ReportFileFormat field's value. +func (s *GetAssessmentReportInput) SetReportFileFormat(v string) *GetAssessmentReportInput { + s.ReportFileFormat = &v + return s +} + +// SetReportType sets the ReportType field's value. +func (s *GetAssessmentReportInput) SetReportType(v string) *GetAssessmentReportInput { + s.ReportType = &v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/GetAssessmentReportResponse +type GetAssessmentReportOutput struct { + _ struct{} `type:"structure"` + + // Specifies the status of the request to generate an assessment report. + // + // Status is a required field + Status *string `locationName:"status" type:"string" required:"true" enum:"ReportStatus"` + + // Specifies the URL where you can find the generated assessment report. This + // parameter is only returned if the report is successfully generated. + Url *string `locationName:"url" type:"string"` +} + +// String returns the string representation +func (s GetAssessmentReportOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s GetAssessmentReportOutput) GoString() string { + return s.String() +} + +// SetStatus sets the Status field's value. +func (s *GetAssessmentReportOutput) SetStatus(v string) *GetAssessmentReportOutput { + s.Status = &v + return s +} + +// SetUrl sets the Url field's value. +func (s *GetAssessmentReportOutput) SetUrl(v string) *GetAssessmentReportOutput { + s.Url = &v + return s +} + // Please also see https://docs.aws.amazon.com/goto/WebAPI/inspector-2016-02-16/GetTelemetryMetadataRequest type GetTelemetryMetadataInput struct { _ struct{} `type:"structure"` @@ -7717,12 +7942,18 @@ const ( // AssessmentRunStateDataCollected is a AssessmentRunState enum value AssessmentRunStateDataCollected = "DATA_COLLECTED" + // AssessmentRunStateStartEvaluatingRulesPending is a AssessmentRunState enum value + AssessmentRunStateStartEvaluatingRulesPending = "START_EVALUATING_RULES_PENDING" + // AssessmentRunStateEvaluatingRules is a AssessmentRunState enum value AssessmentRunStateEvaluatingRules = "EVALUATING_RULES" // AssessmentRunStateFailed is a AssessmentRunState enum value AssessmentRunStateFailed = "FAILED" + // AssessmentRunStateError is a AssessmentRunState enum value + AssessmentRunStateError = "ERROR" + // AssessmentRunStateCompleted is a AssessmentRunState enum value AssessmentRunStateCompleted = "COMPLETED" @@ -7992,6 +8223,33 @@ const ( NoSuchEntityErrorCodeIamRoleDoesNotExist = "IAM_ROLE_DOES_NOT_EXIST" ) +const ( + // ReportFileFormatHtml is a ReportFileFormat enum value + ReportFileFormatHtml = "HTML" + + // ReportFileFormatPdf is a ReportFileFormat enum value + ReportFileFormatPdf = "PDF" +) + +const ( + // ReportStatusWorkInProgress is a ReportStatus enum value + ReportStatusWorkInProgress = "WORK_IN_PROGRESS" + + // ReportStatusFailed is a ReportStatus enum value + ReportStatusFailed = "FAILED" + + // ReportStatusCompleted is a ReportStatus enum value + ReportStatusCompleted = "COMPLETED" +) + +const ( + // ReportTypeFinding is a ReportType enum value + ReportTypeFinding = "FINDING" + + // ReportTypeFull is a ReportType enum value + ReportTypeFull = "FULL" +) + const ( // SeverityLow is a Severity enum value SeverityLow = "Low" diff --git a/vendor/github.com/aws/aws-sdk-go/service/inspector/errors.go b/vendor/github.com/aws/aws-sdk-go/service/inspector/errors.go index 2178a76b2..abdadcccb 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/inspector/errors.go +++ b/vendor/github.com/aws/aws-sdk-go/service/inspector/errors.go @@ -57,4 +57,14 @@ const ( // The request was rejected because it referenced an entity that does not exist. // The error code describes the entity. ErrCodeNoSuchEntityException = "NoSuchEntityException" + + // ErrCodeUnsupportedFeatureException for service response error code + // "UnsupportedFeatureException". + // + // Used by the GetAssessmentReport API. The request was rejected because you + // tried to generate a report for an assessment run that existed before reporting + // was supported in Amazon Inspector. You can only generate reports for assessment + // runs that took place or will take place after generating reports in Amazon + // Inspector became available. + ErrCodeUnsupportedFeatureException = "UnsupportedFeatureException" ) diff --git a/vendor/github.com/aws/aws-sdk-go/service/inspector/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/inspector/examples_test.go index 08d4f3f04..3f4b2a6bc 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/inspector/examples_test.go +++ b/vendor/github.com/aws/aws-sdk-go/service/inspector/examples_test.go @@ -357,6 +357,29 @@ func ExampleInspector_DescribeRulesPackages() { fmt.Println(resp) } +func ExampleInspector_GetAssessmentReport() { + sess := session.Must(session.NewSession()) + + svc := inspector.New(sess) + + params := &inspector.GetAssessmentReportInput{ + AssessmentRunArn: aws.String("Arn"), // Required + ReportFileFormat: aws.String("ReportFileFormat"), // Required + ReportType: aws.String("ReportType"), // Required + } + resp, err := svc.GetAssessmentReport(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} + func ExampleInspector_GetTelemetryMetadata() { sess := session.Must(session.NewSession()) diff --git a/vendor/github.com/aws/aws-sdk-go/service/inspector/inspectoriface/interface.go b/vendor/github.com/aws/aws-sdk-go/service/inspector/inspectoriface/interface.go index 280aac6ad..3e4742c34 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/inspector/inspectoriface/interface.go +++ b/vendor/github.com/aws/aws-sdk-go/service/inspector/inspectoriface/interface.go @@ -116,6 +116,10 @@ type InspectorAPI interface { DescribeRulesPackagesWithContext(aws.Context, *inspector.DescribeRulesPackagesInput, ...request.Option) (*inspector.DescribeRulesPackagesOutput, error) DescribeRulesPackagesRequest(*inspector.DescribeRulesPackagesInput) (*request.Request, *inspector.DescribeRulesPackagesOutput) + GetAssessmentReport(*inspector.GetAssessmentReportInput) (*inspector.GetAssessmentReportOutput, error) + GetAssessmentReportWithContext(aws.Context, *inspector.GetAssessmentReportInput, ...request.Option) (*inspector.GetAssessmentReportOutput, error) + GetAssessmentReportRequest(*inspector.GetAssessmentReportInput) (*request.Request, *inspector.GetAssessmentReportOutput) + GetTelemetryMetadata(*inspector.GetTelemetryMetadataInput) (*inspector.GetTelemetryMetadataOutput, error) GetTelemetryMetadataWithContext(aws.Context, *inspector.GetTelemetryMetadataInput, ...request.Option) (*inspector.GetTelemetryMetadataOutput, error) GetTelemetryMetadataRequest(*inspector.GetTelemetryMetadataInput) (*request.Request, *inspector.GetTelemetryMetadataOutput) diff --git a/vendor/github.com/aws/aws-sdk-go/service/kms/api.go b/vendor/github.com/aws/aws-sdk-go/service/kms/api.go index 318cb6af1..fa60d0247 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/kms/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/kms/api.go @@ -4336,9 +4336,9 @@ type CreateGrantInput struct { // // To specify the principal, use the Amazon Resource Name (ARN) (http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html) // of an AWS principal. Valid AWS principals include AWS accounts (root), IAM - // users, federated users, and assumed role users. For examples of the ARN syntax - // to use for specifying a principal, see AWS Identity and Access Management - // (IAM) (http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-iam) + // users, IAM roles, federated users, and assumed role users. For examples of + // the ARN syntax to use for specifying a principal, see AWS Identity and Access + // Management (IAM) (http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html#arn-syntax-iam) // in the Example ARNs section of the AWS General Reference. // // GranteePrincipal is a required field diff --git a/vendor/github.com/aws/aws-sdk-go/service/lightsail/api.go b/vendor/github.com/aws/aws-sdk-go/service/lightsail/api.go index 13bfbb577..f8313b0e7 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/lightsail/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/lightsail/api.go @@ -72,6 +72,10 @@ func (c *Lightsail) AllocateStaticIpRequest(input *AllocateStaticIpInput) (req * // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -173,6 +177,10 @@ func (c *Lightsail) AttachStaticIpRequest(input *AttachStaticIpInput) (req *requ // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -274,6 +282,10 @@ func (c *Lightsail) CloseInstancePublicPortsRequest(input *CloseInstancePublicPo // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -375,6 +387,10 @@ func (c *Lightsail) CreateDomainRequest(input *CreateDomainInput) (req *request. // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -477,6 +493,10 @@ func (c *Lightsail) CreateDomainEntryRequest(input *CreateDomainEntryInput) (req // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -579,6 +599,10 @@ func (c *Lightsail) CreateInstanceSnapshotRequest(input *CreateInstanceSnapshotI // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -680,6 +704,10 @@ func (c *Lightsail) CreateInstancesRequest(input *CreateInstancesInput) (req *re // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -782,6 +810,10 @@ func (c *Lightsail) CreateInstancesFromSnapshotRequest(input *CreateInstancesFro // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -883,6 +915,10 @@ func (c *Lightsail) CreateKeyPairRequest(input *CreateKeyPairInput) (req *reques // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -984,6 +1020,10 @@ func (c *Lightsail) DeleteDomainRequest(input *DeleteDomainInput) (req *request. // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -1085,6 +1125,10 @@ func (c *Lightsail) DeleteDomainEntryRequest(input *DeleteDomainEntryInput) (req // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -1186,6 +1230,10 @@ func (c *Lightsail) DeleteInstanceRequest(input *DeleteInstanceInput) (req *requ // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -1287,6 +1335,10 @@ func (c *Lightsail) DeleteInstanceSnapshotRequest(input *DeleteInstanceSnapshotI // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -1388,6 +1440,10 @@ func (c *Lightsail) DeleteKeyPairRequest(input *DeleteKeyPairInput) (req *reques // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -1489,6 +1545,10 @@ func (c *Lightsail) DetachStaticIpRequest(input *DetachStaticIpInput) (req *requ // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -1590,6 +1650,10 @@ func (c *Lightsail) DownloadDefaultKeyPairRequest(input *DownloadDefaultKeyPairI // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -1691,6 +1755,10 @@ func (c *Lightsail) GetActiveNamesRequest(input *GetActiveNamesInput) (req *requ // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -1795,6 +1863,10 @@ func (c *Lightsail) GetBlueprintsRequest(input *GetBlueprintsInput) (req *reques // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -1897,6 +1969,10 @@ func (c *Lightsail) GetBundlesRequest(input *GetBundlesInput) (req *request.Requ // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -1998,6 +2074,10 @@ func (c *Lightsail) GetDomainRequest(input *GetDomainInput) (req *request.Reques // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -2099,6 +2179,10 @@ func (c *Lightsail) GetDomainsRequest(input *GetDomainsInput) (req *request.Requ // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -2201,6 +2285,10 @@ func (c *Lightsail) GetInstanceRequest(input *GetInstanceInput) (req *request.Re // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -2303,6 +2391,10 @@ func (c *Lightsail) GetInstanceAccessDetailsRequest(input *GetInstanceAccessDeta // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -2405,6 +2497,10 @@ func (c *Lightsail) GetInstanceMetricDataRequest(input *GetInstanceMetricDataInp // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -2506,6 +2602,10 @@ func (c *Lightsail) GetInstancePortStatesRequest(input *GetInstancePortStatesInp // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -2607,6 +2707,10 @@ func (c *Lightsail) GetInstanceSnapshotRequest(input *GetInstanceSnapshotInput) // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -2708,6 +2812,10 @@ func (c *Lightsail) GetInstanceSnapshotsRequest(input *GetInstanceSnapshotsInput // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -2809,6 +2917,10 @@ func (c *Lightsail) GetInstanceStateRequest(input *GetInstanceStateInput) (req * // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -2911,6 +3023,10 @@ func (c *Lightsail) GetInstancesRequest(input *GetInstancesInput) (req *request. // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -3012,6 +3128,10 @@ func (c *Lightsail) GetKeyPairRequest(input *GetKeyPairInput) (req *request.Requ // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -3113,6 +3233,10 @@ func (c *Lightsail) GetKeyPairsRequest(input *GetKeyPairsInput) (req *request.Re // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -3216,6 +3340,10 @@ func (c *Lightsail) GetOperationRequest(input *GetOperationInput) (req *request. // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -3321,6 +3449,10 @@ func (c *Lightsail) GetOperationsRequest(input *GetOperationsInput) (req *reques // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -3422,6 +3554,10 @@ func (c *Lightsail) GetOperationsForResourceRequest(input *GetOperationsForResou // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -3506,7 +3642,8 @@ func (c *Lightsail) GetRegionsRequest(input *GetRegionsInput) (req *request.Requ // GetRegions API operation for Amazon Lightsail. // -// Returns a list of all valid regions for Amazon Lightsail. +// Returns a list of all valid regions for Amazon Lightsail. Use the include +// availability zones parameter to also return the availability zones in a region. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -3523,6 +3660,10 @@ func (c *Lightsail) GetRegionsRequest(input *GetRegionsInput) (req *request.Requ // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -3624,6 +3765,10 @@ func (c *Lightsail) GetStaticIpRequest(input *GetStaticIpInput) (req *request.Re // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -3725,6 +3870,10 @@ func (c *Lightsail) GetStaticIpsRequest(input *GetStaticIpsInput) (req *request. // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -3826,6 +3975,10 @@ func (c *Lightsail) ImportKeyPairRequest(input *ImportKeyPairInput) (req *reques // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -3927,6 +4080,10 @@ func (c *Lightsail) IsVpcPeeredRequest(input *IsVpcPeeredInput) (req *request.Re // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -4028,6 +4185,10 @@ func (c *Lightsail) OpenInstancePublicPortsRequest(input *OpenInstancePublicPort // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -4129,6 +4290,10 @@ func (c *Lightsail) PeerVpcRequest(input *PeerVpcInput) (req *request.Request, o // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -4168,6 +4333,112 @@ func (c *Lightsail) PeerVpcWithContext(ctx aws.Context, input *PeerVpcInput, opt return out, req.Send() } +const opPutInstancePublicPorts = "PutInstancePublicPorts" + +// PutInstancePublicPortsRequest generates a "aws/request.Request" representing the +// client's request for the PutInstancePublicPorts operation. The "output" return +// value can be used to capture response data after the request's "Send" method +// is called. +// +// See PutInstancePublicPorts for usage and error information. +// +// Creating a request object using this method should be used when you want to inject +// custom logic into the request's lifecycle using a custom handler, or if you want to +// access properties on the request object before or after sending the request. If +// you just want the service response, call the PutInstancePublicPorts method directly +// instead. +// +// Note: You must call the "Send" method on the returned request object in order +// to execute the request. +// +// // Example sending a request using the PutInstancePublicPortsRequest method. +// req, resp := client.PutInstancePublicPortsRequest(params) +// +// err := req.Send() +// if err == nil { // resp is now filled +// fmt.Println(resp) +// } +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/PutInstancePublicPorts +func (c *Lightsail) PutInstancePublicPortsRequest(input *PutInstancePublicPortsInput) (req *request.Request, output *PutInstancePublicPortsOutput) { + op := &request.Operation{ + Name: opPutInstancePublicPorts, + HTTPMethod: "POST", + HTTPPath: "/", + } + + if input == nil { + input = &PutInstancePublicPortsInput{} + } + + output = &PutInstancePublicPortsOutput{} + req = c.newRequest(op, input, output) + return +} + +// PutInstancePublicPorts API operation for Amazon Lightsail. +// +// Sets the specified open ports for an Amazon Lightsail instance, and closes +// all ports for every protocol not included in the current request. +// +// Returns awserr.Error for service API and SDK errors. Use runtime type assertions +// with awserr.Error's Code and Message methods to get detailed information about +// the error. +// +// See the AWS API reference guide for Amazon Lightsail's +// API operation PutInstancePublicPorts for usage and error information. +// +// Returned Error Codes: +// * ErrCodeServiceException "ServiceException" +// A general service exception. +// +// * ErrCodeInvalidInputException "InvalidInputException" +// Lightsail throws this exception when user input does not conform to the validation +// rules of an input field. +// +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// +// * ErrCodeNotFoundException "NotFoundException" +// Lightsail throws this exception when it cannot find a resource. +// +// * ErrCodeOperationFailureException "OperationFailureException" +// Lightsail throws this exception when an operation fails to execute. +// +// * ErrCodeAccessDeniedException "AccessDeniedException" +// Lightsail throws this exception when the user cannot be authenticated or +// uses invalid credentials to access a resource. +// +// * ErrCodeAccountSetupInProgressException "AccountSetupInProgressException" +// Lightsail throws this exception when an account is still in the setup in +// progress state. +// +// * ErrCodeUnauthenticatedException "UnauthenticatedException" +// Lightsail throws this exception when the user has not been authenticated. +// +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/PutInstancePublicPorts +func (c *Lightsail) PutInstancePublicPorts(input *PutInstancePublicPortsInput) (*PutInstancePublicPortsOutput, error) { + req, out := c.PutInstancePublicPortsRequest(input) + return out, req.Send() +} + +// PutInstancePublicPortsWithContext is the same as PutInstancePublicPorts with the addition of +// the ability to pass a context and additional request options. +// +// See PutInstancePublicPorts for details on how to use this API operation. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *Lightsail) PutInstancePublicPortsWithContext(ctx aws.Context, input *PutInstancePublicPortsInput, opts ...request.Option) (*PutInstancePublicPortsOutput, error) { + req, out := c.PutInstancePublicPortsRequest(input) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return out, req.Send() +} + const opRebootInstance = "RebootInstance" // RebootInstanceRequest generates a "aws/request.Request" representing the @@ -4233,6 +4504,10 @@ func (c *Lightsail) RebootInstanceRequest(input *RebootInstanceInput) (req *requ // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -4334,6 +4609,10 @@ func (c *Lightsail) ReleaseStaticIpRequest(input *ReleaseStaticIpInput) (req *re // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -4436,6 +4715,10 @@ func (c *Lightsail) StartInstanceRequest(input *StartInstanceInput) (req *reques // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -4537,6 +4820,10 @@ func (c *Lightsail) StopInstanceRequest(input *StopInstanceInput) (req *request. // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -4638,6 +4925,10 @@ func (c *Lightsail) UnpeerVpcRequest(input *UnpeerVpcInput) (req *request.Reques // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -4739,6 +5030,10 @@ func (c *Lightsail) UpdateDomainEntryRequest(input *UpdateDomainEntryInput) (req // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. // +// Domain-related APIs are only available in the N. Virginia (us-east-1) Region. +// Please set your Region configuration to us-east-1 to create, view, or edit +// these resources. +// // * ErrCodeNotFoundException "NotFoundException" // Lightsail throws this exception when it cannot find a resource. // @@ -4927,7 +5222,7 @@ type AvailabilityZone struct { // The state of the Availability Zone. State *string `locationName:"state" type:"string"` - // The name of the Availability Zone. + // The name of the Availability Zone. The format is us-east-1a (case-sensitive). ZoneName *string `locationName:"zoneName" type:"string"` } @@ -5487,7 +5782,10 @@ type CreateInstancesFromSnapshotInput struct { _ struct{} `type:"structure"` // The Availability Zone where you want to create your instances. Use the following - // formatting: us-east-1a (case sensitive). + // formatting: us-east-1a (case sensitive). You can get a list of availability + // zones by using the get regions (http://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_GetRegions.html) + // operation. Be sure to add the include availability zones parameter to your + // request. // // AvailabilityZone is a required field AvailabilityZone *string `locationName:"availabilityZone" type:"string" required:"true"` @@ -5621,7 +5919,10 @@ type CreateInstancesInput struct { _ struct{} `type:"structure"` // The Availability Zone in which to create your instance. Use the following - // format: us-east-1a (case sensitive). + // format: us-east-1a (case sensitive). You can get a list of availability zones + // by using the get regions (http://docs.aws.amazon.com/lightsail/2016-11-28/api-reference/API_GetRegions.html) + // operation. Be sure to add the include availability zones parameter to your + // request. // // AvailabilityZone is a required field AvailabilityZone *string `locationName:"availabilityZone" type:"string" required:"true"` @@ -7246,7 +7547,7 @@ type GetInstancePortStatesOutput struct { _ struct{} `type:"structure"` // Information about the port states resulting from your request. - PortStates []*string `locationName:"portStates" type:"list"` + PortStates []*InstancePortState `locationName:"portStates" type:"list"` } // String returns the string representation @@ -7260,7 +7561,7 @@ func (s GetInstancePortStatesOutput) GoString() string { } // SetPortStates sets the PortStates field's value. -func (s *GetInstancePortStatesOutput) SetPortStates(v []*string) *GetInstancePortStatesOutput { +func (s *GetInstancePortStatesOutput) SetPortStates(v []*InstancePortState) *GetInstancePortStatesOutput { s.PortStates = v return s } @@ -8463,7 +8764,24 @@ type InstancePortInfo struct { // The first port in the range. FromPort *int64 `locationName:"fromPort" type:"integer"` - // The protocol. + // The protocol being used. Can be one of the following. + // + // * tcp - Transmission Control Protocol (TCP) provides reliable, ordered, + // and error-checked delivery of streamed data between applications running + // on hosts communicating by an IP network. If you have an application that + // doesn't require reliable data stream service, use UDP instead. + // + // * all - All transport layer protocol types. For more general information, + // see Transport layer (https://en.wikipedia.org/wiki/Transport_layer) on + // Wikipedia. + // + // * udp - With User Datagram Protocol (UDP), computer applications can send + // messages (or datagrams) to other hosts on an Internet Protocol (IP) network. + // Prior communications are not required to set up transmission channels + // or data paths. Applications that don't require reliable data stream service + // can use UDP, which provides a connectionless datagram service that emphasizes + // reduced latency over reliability. If you do require reliable data stream + // service, use TCP instead. Protocol *string `locationName:"protocol" type:"string" enum:"NetworkProtocol"` // The last port in the range. @@ -8522,6 +8840,75 @@ func (s *InstancePortInfo) SetToPort(v int64) *InstancePortInfo { return s } +// Describes the port state. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/InstancePortState +type InstancePortState struct { + _ struct{} `type:"structure"` + + // The first port in the range. + FromPort *int64 `locationName:"fromPort" type:"integer"` + + // The protocol being used. Can be one of the following. + // + // * tcp - Transmission Control Protocol (TCP) provides reliable, ordered, + // and error-checked delivery of streamed data between applications running + // on hosts communicating by an IP network. If you have an application that + // doesn't require reliable data stream service, use UDP instead. + // + // * all - All transport layer protocol types. For more general information, + // see Transport layer (https://en.wikipedia.org/wiki/Transport_layer) on + // Wikipedia. + // + // * udp - With User Datagram Protocol (UDP), computer applications can send + // messages (or datagrams) to other hosts on an Internet Protocol (IP) network. + // Prior communications are not required to set up transmission channels + // or data paths. Applications that don't require reliable data stream service + // can use UDP, which provides a connectionless datagram service that emphasizes + // reduced latency over reliability. If you do require reliable data stream + // service, use TCP instead. + Protocol *string `locationName:"protocol" type:"string" enum:"NetworkProtocol"` + + // Specifies whether the instance port is open or closed. + State *string `locationName:"state" type:"string" enum:"PortState"` + + // The last port in the range. + ToPort *int64 `locationName:"toPort" type:"integer"` +} + +// String returns the string representation +func (s InstancePortState) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s InstancePortState) GoString() string { + return s.String() +} + +// SetFromPort sets the FromPort field's value. +func (s *InstancePortState) SetFromPort(v int64) *InstancePortState { + s.FromPort = &v + return s +} + +// SetProtocol sets the Protocol field's value. +func (s *InstancePortState) SetProtocol(v string) *InstancePortState { + s.Protocol = &v + return s +} + +// SetState sets the State field's value. +func (s *InstancePortState) SetState(v string) *InstancePortState { + s.State = &v + return s +} + +// SetToPort sets the ToPort field's value. +func (s *InstancePortState) SetToPort(v int64) *InstancePortState { + s.ToPort = &v + return s +} + // Describes the snapshot of the virtual private server, or instance. // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/InstanceSnapshot type InstanceSnapshot struct { @@ -9203,6 +9590,83 @@ func (s *PortInfo) SetToPort(v int64) *PortInfo { return s } +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/PutInstancePublicPortsRequest +type PutInstancePublicPortsInput struct { + _ struct{} `type:"structure"` + + // The Lightsail instance name of the public port(s) you are setting. + // + // InstanceName is a required field + InstanceName *string `locationName:"instanceName" type:"string" required:"true"` + + // Specifies information about the public port(s). + // + // PortInfos is a required field + PortInfos []*PortInfo `locationName:"portInfos" type:"list" required:"true"` +} + +// String returns the string representation +func (s PutInstancePublicPortsInput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutInstancePublicPortsInput) GoString() string { + return s.String() +} + +// Validate inspects the fields of the type to determine if they are valid. +func (s *PutInstancePublicPortsInput) Validate() error { + invalidParams := request.ErrInvalidParams{Context: "PutInstancePublicPortsInput"} + if s.InstanceName == nil { + invalidParams.Add(request.NewErrParamRequired("InstanceName")) + } + if s.PortInfos == nil { + invalidParams.Add(request.NewErrParamRequired("PortInfos")) + } + + if invalidParams.Len() > 0 { + return invalidParams + } + return nil +} + +// SetInstanceName sets the InstanceName field's value. +func (s *PutInstancePublicPortsInput) SetInstanceName(v string) *PutInstancePublicPortsInput { + s.InstanceName = &v + return s +} + +// SetPortInfos sets the PortInfos field's value. +func (s *PutInstancePublicPortsInput) SetPortInfos(v []*PortInfo) *PutInstancePublicPortsInput { + s.PortInfos = v + return s +} + +// Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/PutInstancePublicPortsResult +type PutInstancePublicPortsOutput struct { + _ struct{} `type:"structure"` + + // Describes metadata about the operation you just executed. + Operation *Operation `locationName:"operation" type:"structure"` +} + +// String returns the string representation +func (s PutInstancePublicPortsOutput) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s PutInstancePublicPortsOutput) GoString() string { + return s.String() +} + +// SetOperation sets the Operation field's value. +func (s *PutInstancePublicPortsOutput) SetOperation(v *Operation) *PutInstancePublicPortsOutput { + s.Operation = v + return s +} + // Please also see https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28/RebootInstanceRequest type RebootInstanceInput struct { _ struct{} `type:"structure"` @@ -9271,7 +9735,7 @@ func (s *RebootInstanceOutput) SetOperations(v []*Operation) *RebootInstanceOutp type Region struct { _ struct{} `type:"structure"` - // The Availability Zones. + // The Availability Zones. Follows the format us-east-1a (case-sensitive). AvailabilityZones []*AvailabilityZone `locationName:"availabilityZones" type:"list"` // The continent code (e.g., NA, meaning North America). @@ -9396,7 +9860,7 @@ func (s *ReleaseStaticIpOutput) SetOperations(v []*Operation) *ReleaseStaticIpOu type ResourceLocation struct { _ struct{} `type:"structure"` - // The Availability Zone. + // The Availability Zone. Follows the format us-east-1a (case-sensitive). AvailabilityZone *string `locationName:"availabilityZone" type:"string"` // The AWS Region name. @@ -9965,6 +10429,9 @@ const ( // OperationTypeOpenInstancePublicPorts is a OperationType enum value OperationTypeOpenInstancePublicPorts = "OpenInstancePublicPorts" + // OperationTypePutInstancePublicPorts is a OperationType enum value + OperationTypePutInstancePublicPorts = "PutInstancePublicPorts" + // OperationTypeCloseInstancePublicPorts is a OperationType enum value OperationTypeCloseInstancePublicPorts = "CloseInstancePublicPorts" diff --git a/vendor/github.com/aws/aws-sdk-go/service/lightsail/doc.go b/vendor/github.com/aws/aws-sdk-go/service/lightsail/doc.go index 171892107..0e2e9ee62 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/lightsail/doc.go +++ b/vendor/github.com/aws/aws-sdk-go/service/lightsail/doc.go @@ -11,11 +11,11 @@ // the API or command-line interface (CLI). // // For more information about Lightsail concepts and tasks, see the Lightsail -// Dev Guide (http://lightsail.aws.amazon.com/ls/docs). +// Dev Guide (https://lightsail.aws.amazon.com/ls/docs/all). // // To use the Lightsail API or the CLI, you will need to use AWS Identity and // Access Management (IAM) to generate access keys. For details about how to -// set this up, see the Lightsail Dev Guide (http://lightsail.aws.amazon.com/ls/docs/how-to/articles/lightsail-how-to-set-up-access-keys-to-use-sdk-api-cli). +// set this up, see the Lightsail Dev Guide (http://lightsail.aws.amazon.com/ls/docs/how-to/article/lightsail-how-to-set-up-access-keys-to-use-sdk-api-cli). // // See https://docs.aws.amazon.com/goto/WebAPI/lightsail-2016-11-28 for more information on this service. // diff --git a/vendor/github.com/aws/aws-sdk-go/service/lightsail/errors.go b/vendor/github.com/aws/aws-sdk-go/service/lightsail/errors.go index a42a1393b..d1ef481f2 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/lightsail/errors.go +++ b/vendor/github.com/aws/aws-sdk-go/service/lightsail/errors.go @@ -23,6 +23,10 @@ const ( // // Lightsail throws this exception when user input does not conform to the validation // rules of an input field. + // + // Domain-related APIs are only available in the N. Virginia (us-east-1) Region. + // Please set your Region configuration to us-east-1 to create, view, or edit + // these resources. ErrCodeInvalidInputException = "InvalidInputException" // ErrCodeNotFoundException for service response error code diff --git a/vendor/github.com/aws/aws-sdk-go/service/lightsail/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/lightsail/examples_test.go index d1198da8b..f648047e3 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/lightsail/examples_test.go +++ b/vendor/github.com/aws/aws-sdk-go/service/lightsail/examples_test.go @@ -933,6 +933,35 @@ func ExampleLightsail_PeerVpc() { fmt.Println(resp) } +func ExampleLightsail_PutInstancePublicPorts() { + sess := session.Must(session.NewSession()) + + svc := lightsail.New(sess) + + params := &lightsail.PutInstancePublicPortsInput{ + InstanceName: aws.String("ResourceName"), // Required + PortInfos: []*lightsail.PortInfo{ // Required + { // Required + FromPort: aws.Int64(1), + Protocol: aws.String("NetworkProtocol"), + ToPort: aws.Int64(1), + }, + // More values... + }, + } + resp, err := svc.PutInstancePublicPorts(params) + + if err != nil { + // Print the error, cast err to awserr.Error to get the Code and + // Message from an error. + fmt.Println(err.Error()) + return + } + + // Pretty-print the response data. + fmt.Println(resp) +} + func ExampleLightsail_RebootInstance() { sess := session.Must(session.NewSession()) diff --git a/vendor/github.com/aws/aws-sdk-go/service/lightsail/lightsailiface/interface.go b/vendor/github.com/aws/aws-sdk-go/service/lightsail/lightsailiface/interface.go index 7c96e9c2d..40a449bd4 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/lightsail/lightsailiface/interface.go +++ b/vendor/github.com/aws/aws-sdk-go/service/lightsail/lightsailiface/interface.go @@ -224,6 +224,10 @@ type LightsailAPI interface { PeerVpcWithContext(aws.Context, *lightsail.PeerVpcInput, ...request.Option) (*lightsail.PeerVpcOutput, error) PeerVpcRequest(*lightsail.PeerVpcInput) (*request.Request, *lightsail.PeerVpcOutput) + PutInstancePublicPorts(*lightsail.PutInstancePublicPortsInput) (*lightsail.PutInstancePublicPortsOutput, error) + PutInstancePublicPortsWithContext(aws.Context, *lightsail.PutInstancePublicPortsInput, ...request.Option) (*lightsail.PutInstancePublicPortsOutput, error) + PutInstancePublicPortsRequest(*lightsail.PutInstancePublicPortsInput) (*request.Request, *lightsail.PutInstancePublicPortsOutput) + RebootInstance(*lightsail.RebootInstanceInput) (*lightsail.RebootInstanceOutput, error) RebootInstanceWithContext(aws.Context, *lightsail.RebootInstanceInput, ...request.Option) (*lightsail.RebootInstanceOutput, error) RebootInstanceRequest(*lightsail.RebootInstanceInput) (*request.Request, *lightsail.RebootInstanceOutput) diff --git a/vendor/github.com/aws/aws-sdk-go/service/polly/api.go b/vendor/github.com/aws/aws-sdk-go/service/polly/api.go index 20d72151b..cd9713b4d 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/polly/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/polly/api.go @@ -1558,4 +1558,7 @@ const ( // VoiceIdFiliz is a VoiceId enum value VoiceIdFiliz = "Filiz" + + // VoiceIdVicki is a VoiceId enum value + VoiceIdVicki = "Vicki" ) diff --git a/vendor/github.com/aws/aws-sdk-go/service/rds/rdsutils/connect.go b/vendor/github.com/aws/aws-sdk-go/service/rds/rdsutils/connect.go index 4937d2b03..cfa923188 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/rds/rdsutils/connect.go +++ b/vendor/github.com/aws/aws-sdk-go/service/rds/rdsutils/connect.go @@ -12,11 +12,10 @@ import ( // BuildAuthToken will return a authentication token for the database's connect // based on the RDS database endpoint, AWS region, IAM user or role, and AWS credentials. // -// Endpoint consists of the scheme, hostname, and port. IE scheme://{hostname}[:port] -// of the RDS database. Region is the AWS region the RDS database is in and where -// the authentication token will be generated for. DbUser is the IAM user or role -// the request will be authenticated for. The creds is the AWS credentials -// the authentication token is signed with. +// Endpoint consists of the hostname and port, IE hostname:port, of the RDS database. +// Region is the AWS region the RDS database is in and where the authentication token +// will be generated for. DbUser is the IAM user or role the request will be authenticated +// for. The creds is the AWS credentials the authentication token is signed with. // // An error is returned if the authentication token is unable to be signed with // the credentials, or the endpoint is not a valid URL. @@ -38,6 +37,11 @@ import ( // See http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/UsingWithRDS.IAMDBAuth.html // for more information on using IAM database authentication with RDS. func BuildAuthToken(endpoint, region, dbUser string, creds *credentials.Credentials) (string, error) { + // the scheme is arbitrary and is only needed because validation of the URL requires one. + if !(strings.HasPrefix(endpoint, "http://") || strings.HasPrefix(endpoint, "https://")) { + endpoint = "https://" + endpoint + } + req, err := http.NewRequest("GET", endpoint, nil) if err != nil { return "", err diff --git a/vendor/github.com/aws/aws-sdk-go/service/rds/rdsutils/connect_test.go b/vendor/github.com/aws/aws-sdk-go/service/rds/rdsutils/connect_test.go index af42bf180..2d65700ad 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/rds/rdsutils/connect_test.go +++ b/vendor/github.com/aws/aws-sdk-go/service/rds/rdsutils/connect_test.go @@ -10,12 +10,30 @@ import ( ) func TestBuildAuthToken(t *testing.T) { - endpoint := "https://prod-instance.us-east-1.rds.amazonaws.com:3306" - region := "us-west-2" - creds := credentials.NewStaticCredentials("AKID", "SECRET", "SESSION") - user := "mysqlUser" + cases := []struct { + endpoint string + region string + user string + expectedRegex string + }{ + { + "https://prod-instance.us-east-1.rds.amazonaws.com:3306", + "us-west-2", + "mysqlUser", + `^prod-instance\.us-east-1\.rds\.amazonaws\.com:3306\?Action=connect.*?DBUser=mysqlUser.*`, + }, + { + "prod-instance.us-east-1.rds.amazonaws.com:3306", + "us-west-2", + "mysqlUser", + `^prod-instance\.us-east-1\.rds\.amazonaws\.com:3306\?Action=connect.*?DBUser=mysqlUser.*`, + }, + } - url, err := rdsutils.BuildAuthToken(endpoint, region, user, creds) - assert.NoError(t, err) - assert.Regexp(t, `^prod-instance\.us-east-1\.rds\.amazonaws\.com:3306\?Action=connect.*?DBUser=mysqlUser.*`, url) + for _, c := range cases { + creds := credentials.NewStaticCredentials("AKID", "SECRET", "SESSION") + url, err := rdsutils.BuildAuthToken(c.endpoint, c.region, c.user, creds) + assert.NoError(t, err) + assert.Regexp(t, c.expectedRegex, url) + } } diff --git a/vendor/github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi/api.go b/vendor/github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi/api.go index 03f7677f6..76d5f8648 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi/api.go @@ -42,6 +42,12 @@ func (c *ResourceGroupsTaggingAPI) GetResourcesRequest(input *GetResourcesInput) Name: opGetResources, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"PaginationToken"}, + OutputTokens: []string{"PaginationToken"}, + LimitToken: "ResourcesPerPage", + TruncationToken: "", + }, } if input == nil { @@ -107,6 +113,56 @@ func (c *ResourceGroupsTaggingAPI) GetResourcesWithContext(ctx aws.Context, inpu return out, req.Send() } +// GetResourcesPages iterates over the pages of a GetResources operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See GetResources method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a GetResources operation. +// pageNum := 0 +// err := client.GetResourcesPages(params, +// func(page *GetResourcesOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *ResourceGroupsTaggingAPI) GetResourcesPages(input *GetResourcesInput, fn func(*GetResourcesOutput, bool) bool) error { + return c.GetResourcesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// GetResourcesPagesWithContext same as GetResourcesPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *ResourceGroupsTaggingAPI) GetResourcesPagesWithContext(ctx aws.Context, input *GetResourcesInput, fn func(*GetResourcesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *GetResourcesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetResourcesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*GetResourcesOutput), !p.HasNextPage()) + } + return p.Err() +} + const opGetTagKeys = "GetTagKeys" // GetTagKeysRequest generates a "aws/request.Request" representing the @@ -139,6 +195,12 @@ func (c *ResourceGroupsTaggingAPI) GetTagKeysRequest(input *GetTagKeysInput) (re Name: opGetTagKeys, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"PaginationToken"}, + OutputTokens: []string{"PaginationToken"}, + LimitToken: "", + TruncationToken: "", + }, } if input == nil { @@ -199,6 +261,56 @@ func (c *ResourceGroupsTaggingAPI) GetTagKeysWithContext(ctx aws.Context, input return out, req.Send() } +// GetTagKeysPages iterates over the pages of a GetTagKeys operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See GetTagKeys method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a GetTagKeys operation. +// pageNum := 0 +// err := client.GetTagKeysPages(params, +// func(page *GetTagKeysOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *ResourceGroupsTaggingAPI) GetTagKeysPages(input *GetTagKeysInput, fn func(*GetTagKeysOutput, bool) bool) error { + return c.GetTagKeysPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// GetTagKeysPagesWithContext same as GetTagKeysPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *ResourceGroupsTaggingAPI) GetTagKeysPagesWithContext(ctx aws.Context, input *GetTagKeysInput, fn func(*GetTagKeysOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *GetTagKeysInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetTagKeysRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*GetTagKeysOutput), !p.HasNextPage()) + } + return p.Err() +} + const opGetTagValues = "GetTagValues" // GetTagValuesRequest generates a "aws/request.Request" representing the @@ -231,6 +343,12 @@ func (c *ResourceGroupsTaggingAPI) GetTagValuesRequest(input *GetTagValuesInput) Name: opGetTagValues, HTTPMethod: "POST", HTTPPath: "/", + Paginator: &request.Paginator{ + InputTokens: []string{"PaginationToken"}, + OutputTokens: []string{"PaginationToken"}, + LimitToken: "", + TruncationToken: "", + }, } if input == nil { @@ -292,6 +410,56 @@ func (c *ResourceGroupsTaggingAPI) GetTagValuesWithContext(ctx aws.Context, inpu return out, req.Send() } +// GetTagValuesPages iterates over the pages of a GetTagValues operation, +// calling the "fn" function with the response data for each page. To stop +// iterating, return false from the fn function. +// +// See GetTagValues method for more information on how to use this operation. +// +// Note: This operation can generate multiple requests to a service. +// +// // Example iterating over at most 3 pages of a GetTagValues operation. +// pageNum := 0 +// err := client.GetTagValuesPages(params, +// func(page *GetTagValuesOutput, lastPage bool) bool { +// pageNum++ +// fmt.Println(page) +// return pageNum <= 3 +// }) +// +func (c *ResourceGroupsTaggingAPI) GetTagValuesPages(input *GetTagValuesInput, fn func(*GetTagValuesOutput, bool) bool) error { + return c.GetTagValuesPagesWithContext(aws.BackgroundContext(), input, fn) +} + +// GetTagValuesPagesWithContext same as GetTagValuesPages except +// it takes a Context and allows setting request options on the pages. +// +// The context must be non-nil and will be used for request cancellation. If +// the context is nil a panic will occur. In the future the SDK may create +// sub-contexts for http.Requests. See https://golang.org/pkg/context/ +// for more information on using Contexts. +func (c *ResourceGroupsTaggingAPI) GetTagValuesPagesWithContext(ctx aws.Context, input *GetTagValuesInput, fn func(*GetTagValuesOutput, bool) bool, opts ...request.Option) error { + p := request.Pagination{ + NewRequest: func() (*request.Request, error) { + var inCpy *GetTagValuesInput + if input != nil { + tmp := *input + inCpy = &tmp + } + req, _ := c.GetTagValuesRequest(inCpy) + req.SetContext(ctx) + req.ApplyOptions(opts...) + return req, nil + }, + } + + cont := true + for p.Next() && cont { + cont = fn(p.Page().(*GetTagValuesOutput), !p.HasNextPage()) + } + return p.Err() +} + const opTagResources = "TagResources" // TagResourcesRequest generates a "aws/request.Request" representing the @@ -567,6 +735,11 @@ type GetResourcesInput struct { // AWS Service Namespaces (http://docs.aws.amazon.com/general/latest/gr/aws-arns-and-namespaces.html). ResourceTypeFilters []*string `type:"list"` + // A limit that restricts the number of resources returned by GetResources in + // paginated output. You can set ResourcesPerPage to a minimum of 1 item and + // the maximum of 50 items. + ResourcesPerPage *int64 `type:"integer"` + // A list of tags (keys and values). A request can include up to 50 keys, and // each key can include up to 20 values. // @@ -595,9 +768,7 @@ type GetResourcesInput struct { // its 10 tags. // // You can set TagsPerPage - // - // TagsPerPage is a required field - TagsPerPage *int64 `min:"100" type:"integer" required:"true"` + TagsPerPage *int64 `type:"integer"` } // String returns the string representation @@ -613,12 +784,6 @@ func (s GetResourcesInput) GoString() string { // Validate inspects the fields of the type to determine if they are valid. func (s *GetResourcesInput) Validate() error { invalidParams := request.ErrInvalidParams{Context: "GetResourcesInput"} - if s.TagsPerPage == nil { - invalidParams.Add(request.NewErrParamRequired("TagsPerPage")) - } - if s.TagsPerPage != nil && *s.TagsPerPage < 100 { - invalidParams.Add(request.NewErrParamMinValue("TagsPerPage", 100)) - } if s.TagFilters != nil { for i, v := range s.TagFilters { if v == nil { @@ -648,6 +813,12 @@ func (s *GetResourcesInput) SetResourceTypeFilters(v []*string) *GetResourcesInp return s } +// SetResourcesPerPage sets the ResourcesPerPage field's value. +func (s *GetResourcesInput) SetResourcesPerPage(v int64) *GetResourcesInput { + s.ResourcesPerPage = &v + return s +} + // SetTagFilters sets the TagFilters field's value. func (s *GetResourcesInput) SetTagFilters(v []*TagFilter) *GetResourcesInput { s.TagFilters = v diff --git a/vendor/github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi/doc.go b/vendor/github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi/doc.go index 9291616b6..53b95a3b3 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi/doc.go +++ b/vendor/github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi/doc.go @@ -31,7 +31,7 @@ // * List all existing values for the specified key in the specified region // for the AWS account // -// Not all resources can have tags. For a list of resources that support tagging, +// Not all resources can have tags. For a lists of resources that you can tag, // see Supported Resources (http://docs.aws.amazon.com/awsconsolehelpdocs/latest/gsg/supported-resources.html) // in the AWS Resource Groups and Tag Editor User Guide. // diff --git a/vendor/github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi/examples_test.go index 6c8e10b68..f3a618d87 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi/examples_test.go +++ b/vendor/github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi/examples_test.go @@ -21,12 +21,12 @@ func ExampleResourceGroupsTaggingAPI_GetResources() { svc := resourcegroupstaggingapi.New(sess) params := &resourcegroupstaggingapi.GetResourcesInput{ - TagsPerPage: aws.Int64(1), // Required PaginationToken: aws.String("PaginationToken"), ResourceTypeFilters: []*string{ aws.String("AmazonResourceType"), // Required // More values... }, + ResourcesPerPage: aws.Int64(1), TagFilters: []*resourcegroupstaggingapi.TagFilter{ { // Required Key: aws.String("TagKey"), @@ -37,6 +37,7 @@ func ExampleResourceGroupsTaggingAPI_GetResources() { }, // More values... }, + TagsPerPage: aws.Int64(1), } resp, err := svc.GetResources(params) diff --git a/vendor/github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi/resourcegroupstaggingapiiface/interface.go b/vendor/github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi/resourcegroupstaggingapiiface/interface.go index cb433fcfe..0ba44380e 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi/resourcegroupstaggingapiiface/interface.go +++ b/vendor/github.com/aws/aws-sdk-go/service/resourcegroupstaggingapi/resourcegroupstaggingapiiface/interface.go @@ -64,14 +64,23 @@ type ResourceGroupsTaggingAPIAPI interface { GetResourcesWithContext(aws.Context, *resourcegroupstaggingapi.GetResourcesInput, ...request.Option) (*resourcegroupstaggingapi.GetResourcesOutput, error) GetResourcesRequest(*resourcegroupstaggingapi.GetResourcesInput) (*request.Request, *resourcegroupstaggingapi.GetResourcesOutput) + GetResourcesPages(*resourcegroupstaggingapi.GetResourcesInput, func(*resourcegroupstaggingapi.GetResourcesOutput, bool) bool) error + GetResourcesPagesWithContext(aws.Context, *resourcegroupstaggingapi.GetResourcesInput, func(*resourcegroupstaggingapi.GetResourcesOutput, bool) bool, ...request.Option) error + GetTagKeys(*resourcegroupstaggingapi.GetTagKeysInput) (*resourcegroupstaggingapi.GetTagKeysOutput, error) GetTagKeysWithContext(aws.Context, *resourcegroupstaggingapi.GetTagKeysInput, ...request.Option) (*resourcegroupstaggingapi.GetTagKeysOutput, error) GetTagKeysRequest(*resourcegroupstaggingapi.GetTagKeysInput) (*request.Request, *resourcegroupstaggingapi.GetTagKeysOutput) + GetTagKeysPages(*resourcegroupstaggingapi.GetTagKeysInput, func(*resourcegroupstaggingapi.GetTagKeysOutput, bool) bool) error + GetTagKeysPagesWithContext(aws.Context, *resourcegroupstaggingapi.GetTagKeysInput, func(*resourcegroupstaggingapi.GetTagKeysOutput, bool) bool, ...request.Option) error + GetTagValues(*resourcegroupstaggingapi.GetTagValuesInput) (*resourcegroupstaggingapi.GetTagValuesOutput, error) GetTagValuesWithContext(aws.Context, *resourcegroupstaggingapi.GetTagValuesInput, ...request.Option) (*resourcegroupstaggingapi.GetTagValuesOutput, error) GetTagValuesRequest(*resourcegroupstaggingapi.GetTagValuesInput) (*request.Request, *resourcegroupstaggingapi.GetTagValuesOutput) + GetTagValuesPages(*resourcegroupstaggingapi.GetTagValuesInput, func(*resourcegroupstaggingapi.GetTagValuesOutput, bool) bool) error + GetTagValuesPagesWithContext(aws.Context, *resourcegroupstaggingapi.GetTagValuesInput, func(*resourcegroupstaggingapi.GetTagValuesOutput, bool) bool, ...request.Option) error + TagResources(*resourcegroupstaggingapi.TagResourcesInput) (*resourcegroupstaggingapi.TagResourcesOutput, error) TagResourcesWithContext(aws.Context, *resourcegroupstaggingapi.TagResourcesInput, ...request.Option) (*resourcegroupstaggingapi.TagResourcesOutput, error) TagResourcesRequest(*resourcegroupstaggingapi.TagResourcesInput) (*request.Request, *resourcegroupstaggingapi.TagResourcesOutput) diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/download.go b/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/download.go index a8e4fd234..002df1c30 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/download.go +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/download.go @@ -31,7 +31,7 @@ const DefaultDownloadConcurrency = 5 type Downloader struct { // The buffer size (in bytes) to use when buffering data into chunks and // sending them as parts to S3. The minimum allowed part size is 5MB, and - // if this value is set to zero, the DefaultPartSize value will be used. + // if this value is set to zero, the DefaultDownloadPartSize value will be used. PartSize int64 // The number of goroutines to spin up in parallel when sending parts. diff --git a/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/upload.go b/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/upload.go index 0f9c57ed7..cec171f06 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/upload.go +++ b/vendor/github.com/aws/aws-sdk-go/service/s3/s3manager/upload.go @@ -215,7 +215,7 @@ func WithUploaderRequestOptions(opts ...request.Option) func(*Uploader) { type Uploader struct { // The buffer size (in bytes) to use when buffering data into chunks and // sending them as parts to S3. The minimum allowed part size is 5MB, and - // if this value is set to zero, the DefaultPartSize value will be used. + // if this value is set to zero, the DefaultUploadPartSize value will be used. PartSize int64 // The number of goroutines to spin up in parallel when sending parts. diff --git a/vendor/github.com/aws/aws-sdk-go/service/ssm/api.go b/vendor/github.com/aws/aws-sdk-go/service/ssm/api.go index f0170b780..6b2155f9d 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/ssm/api.go +++ b/vendor/github.com/aws/aws-sdk-go/service/ssm/api.go @@ -57,14 +57,16 @@ func (c *SSM) AddTagsToResourceRequest(input *AddTagsToResourceInput) (req *requ // AddTagsToResource API operation for Amazon Simple Systems Manager (SSM). // // Adds or overwrites one or more tags for the specified resource. Tags are -// metadata that you assign to your managed instances. Tags enable you to categorize -// your managed instances in different ways, for example, by purpose, owner, -// or environment. Each tag consists of a key and an optional value, both of -// which you define. For example, you could define a set of tags for your account's -// managed instances that helps you track each instance's owner and stack level. -// For example: Key=Owner and Value=DbAdmin, SysAdmin, or Dev. Or Key=Stack -// and Value=Production, Pre-Production, or Test. Each resource can have a maximum -// of 10 tags. +// metadata that you assign to your managed instances, Maintenance Windows, +// or Parameter Store parameters. Tags enable you to categorize your resources +// in different ways, for example, by purpose, owner, or environment. Each tag +// consists of a key and an optional value, both of which you define. For example, +// you could define a set of tags for your account's managed instances that +// helps you track each instance's owner and stack level. For example: Key=Owner +// and Value=DbAdmin, SysAdmin, or Dev. Or Key=Stack and Value=Production, Pre-Production, +// or Test. +// +// Each resource can have a maximum of 10 tags. // // We recommend that you devise a set of tag keys that meets your needs for // each resource type. Using a consistent set of tag keys makes it easier for @@ -726,7 +728,7 @@ func (c *SSM) CreateMaintenanceWindowRequest(input *CreateMaintenanceWindowInput // Returned Error Codes: // * ErrCodeIdempotentParameterMismatch "IdempotentParameterMismatch" // Error returned when an idempotent operation is retried and the parameters -// don’t match the original call to the API with the same idempotency token. +// don't match the original call to the API with the same idempotency token. // // * ErrCodeResourceLimitExceededException "ResourceLimitExceededException" // Error returned when the caller has exceeded the default resource limits (e.g. @@ -814,7 +816,7 @@ func (c *SSM) CreatePatchBaselineRequest(input *CreatePatchBaselineInput) (req * // Returned Error Codes: // * ErrCodeIdempotentParameterMismatch "IdempotentParameterMismatch" // Error returned when an idempotent operation is retried and the parameters -// don’t match the original call to the API with the same idempotency token. +// don't match the original call to the API with the same idempotency token. // // * ErrCodeResourceLimitExceededException "ResourceLimitExceededException" // Error returned when the caller has exceeded the default resource limits (e.g. @@ -1434,7 +1436,7 @@ func (c *SSM) DeregisterManagedInstanceRequest(input *DeregisterManagedInstanceI // DeregisterManagedInstance API operation for Amazon Simple Systems Manager (SSM). // // Removes the server or virtual machine from the list of registered servers. -// You can reregister the instance again at any time. If you don’t plan to use +// You can reregister the instance again at any time. If you don't plan to use // Run Command on the server, we suggest uninstalling the SSM Agent first. // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions @@ -1626,7 +1628,7 @@ func (c *SSM) DeregisterTargetFromMaintenanceWindowRequest(input *DeregisterTarg // Returned Error Codes: // * ErrCodeDoesNotExistException "DoesNotExistException" // Error returned when the ID specified for a resource (e.g. a Maintenance Window) -// doesn’t exist. +// doesn't exist. // // * ErrCodeInternalServerError "InternalServerError" // An error occurred on the server side. @@ -1710,7 +1712,7 @@ func (c *SSM) DeregisterTaskFromMaintenanceWindowRequest(input *DeregisterTaskFr // Returned Error Codes: // * ErrCodeDoesNotExistException "DoesNotExistException" // Error returned when the ID specified for a resource (e.g. a Maintenance Window) -// doesn’t exist. +// doesn't exist. // // * ErrCodeInternalServerError "InternalServerError" // An error occurred on the server side. @@ -2280,7 +2282,7 @@ func (c *SSM) DescribeDocumentPermissionRequest(input *DescribeDocumentPermissio // // Describes the permissions for a Systems Manager document. If you created // the document, you are the owner. If a document is shared, it can either be -// shared privately (by specifying a user’s AWS account ID) or publicly (All). +// shared privately (by specifying a user's AWS account ID) or publicly (All). // // Returns awserr.Error for service API and SDK errors. Use runtime type assertions // with awserr.Error's Code and Message methods to get detailed information about @@ -2482,7 +2484,7 @@ func (c *SSM) DescribeEffectivePatchesForPatchBaselineRequest(input *DescribeEff // // * ErrCodeDoesNotExistException "DoesNotExistException" // Error returned when the ID specified for a resource (e.g. a Maintenance Window) -// doesn’t exist. +// doesn't exist. // // * ErrCodeInternalServerError "InternalServerError" // An error occurred on the server side. @@ -3104,7 +3106,7 @@ func (c *SSM) DescribeMaintenanceWindowExecutionTaskInvocationsRequest(input *De // Returned Error Codes: // * ErrCodeDoesNotExistException "DoesNotExistException" // Error returned when the ID specified for a resource (e.g. a Maintenance Window) -// doesn’t exist. +// doesn't exist. // // * ErrCodeInternalServerError "InternalServerError" // An error occurred on the server side. @@ -3188,7 +3190,7 @@ func (c *SSM) DescribeMaintenanceWindowExecutionTasksRequest(input *DescribeMain // Returned Error Codes: // * ErrCodeDoesNotExistException "DoesNotExistException" // Error returned when the ID specified for a resource (e.g. a Maintenance Window) -// doesn’t exist. +// doesn't exist. // // * ErrCodeInternalServerError "InternalServerError" // An error occurred on the server side. @@ -3354,7 +3356,7 @@ func (c *SSM) DescribeMaintenanceWindowTargetsRequest(input *DescribeMaintenance // Returned Error Codes: // * ErrCodeDoesNotExistException "DoesNotExistException" // Error returned when the ID specified for a resource (e.g. a Maintenance Window) -// doesn’t exist. +// doesn't exist. // // * ErrCodeInternalServerError "InternalServerError" // An error occurred on the server side. @@ -3438,7 +3440,7 @@ func (c *SSM) DescribeMaintenanceWindowTasksRequest(input *DescribeMaintenanceWi // Returned Error Codes: // * ErrCodeDoesNotExistException "DoesNotExistException" // Error returned when the ID specified for a resource (e.g. a Maintenance Window) -// doesn’t exist. +// doesn't exist. // // * ErrCodeInternalServerError "InternalServerError" // An error occurred on the server side. @@ -4548,7 +4550,7 @@ func (c *SSM) GetMaintenanceWindowRequest(input *GetMaintenanceWindowInput) (req // Returned Error Codes: // * ErrCodeDoesNotExistException "DoesNotExistException" // Error returned when the ID specified for a resource (e.g. a Maintenance Window) -// doesn’t exist. +// doesn't exist. // // * ErrCodeInternalServerError "InternalServerError" // An error occurred on the server side. @@ -4633,7 +4635,7 @@ func (c *SSM) GetMaintenanceWindowExecutionRequest(input *GetMaintenanceWindowEx // Returned Error Codes: // * ErrCodeDoesNotExistException "DoesNotExistException" // Error returned when the ID specified for a resource (e.g. a Maintenance Window) -// doesn’t exist. +// doesn't exist. // // * ErrCodeInternalServerError "InternalServerError" // An error occurred on the server side. @@ -4718,7 +4720,7 @@ func (c *SSM) GetMaintenanceWindowExecutionTaskRequest(input *GetMaintenanceWind // Returned Error Codes: // * ErrCodeDoesNotExistException "DoesNotExistException" // Error returned when the ID specified for a resource (e.g. a Maintenance Window) -// doesn’t exist. +// doesn't exist. // // * ErrCodeInternalServerError "InternalServerError" // An error occurred on the server side. @@ -4968,7 +4970,7 @@ func (c *SSM) GetPatchBaselineRequest(input *GetPatchBaselineInput) (req *reques // Returned Error Codes: // * ErrCodeDoesNotExistException "DoesNotExistException" // Error returned when the ID specified for a resource (e.g. a Maintenance Window) -// doesn’t exist. +// doesn't exist. // // * ErrCodeInvalidResourceId "InvalidResourceId" // The resource ID is not valid. Verify that you entered the correct ID and @@ -6339,7 +6341,7 @@ func (c *SSM) RegisterDefaultPatchBaselineRequest(input *RegisterDefaultPatchBas // // * ErrCodeDoesNotExistException "DoesNotExistException" // Error returned when the ID specified for a resource (e.g. a Maintenance Window) -// doesn’t exist. +// doesn't exist. // // * ErrCodeInternalServerError "InternalServerError" // An error occurred on the server side. @@ -6427,7 +6429,7 @@ func (c *SSM) RegisterPatchBaselineForPatchGroupRequest(input *RegisterPatchBase // // * ErrCodeDoesNotExistException "DoesNotExistException" // Error returned when the ID specified for a resource (e.g. a Maintenance Window) -// doesn’t exist. +// doesn't exist. // // * ErrCodeInvalidResourceId "InvalidResourceId" // The resource ID is not valid. Verify that you entered the correct ID and @@ -6519,11 +6521,11 @@ func (c *SSM) RegisterTargetWithMaintenanceWindowRequest(input *RegisterTargetWi // Returned Error Codes: // * ErrCodeIdempotentParameterMismatch "IdempotentParameterMismatch" // Error returned when an idempotent operation is retried and the parameters -// don’t match the original call to the API with the same idempotency token. +// don't match the original call to the API with the same idempotency token. // // * ErrCodeDoesNotExistException "DoesNotExistException" // Error returned when the ID specified for a resource (e.g. a Maintenance Window) -// doesn’t exist. +// doesn't exist. // // * ErrCodeResourceLimitExceededException "ResourceLimitExceededException" // Error returned when the caller has exceeded the default resource limits (e.g. @@ -6611,11 +6613,11 @@ func (c *SSM) RegisterTaskWithMaintenanceWindowRequest(input *RegisterTaskWithMa // Returned Error Codes: // * ErrCodeIdempotentParameterMismatch "IdempotentParameterMismatch" // Error returned when an idempotent operation is retried and the parameters -// don’t match the original call to the API with the same idempotency token. +// don't match the original call to the API with the same idempotency token. // // * ErrCodeDoesNotExistException "DoesNotExistException" // Error returned when the ID specified for a resource (e.g. a Maintenance Window) -// doesn’t exist. +// doesn't exist. // // * ErrCodeResourceLimitExceededException "ResourceLimitExceededException" // Error returned when the caller has exceeded the default resource limits (e.g. @@ -7121,6 +7123,13 @@ func (c *SSM) UpdateAssociationRequest(input *UpdateAssociationInput) (req *requ // There are concurrent updates for a resource that supports one update at a // time. // +// * ErrCodeInvalidDocument "InvalidDocument" +// The specified document does not exist. +// +// * ErrCodeInvalidTarget "InvalidTarget" +// The target is not valid or does not exist. It might not be configured for +// EC2 Systems Manager or you might not have permission to perform the operation. +// // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/UpdateAssociation func (c *SSM) UpdateAssociation(input *UpdateAssociationInput) (*UpdateAssociationOutput, error) { req, out := c.UpdateAssociationRequest(input) @@ -7501,7 +7510,7 @@ func (c *SSM) UpdateMaintenanceWindowRequest(input *UpdateMaintenanceWindowInput // Returned Error Codes: // * ErrCodeDoesNotExistException "DoesNotExistException" // Error returned when the ID specified for a resource (e.g. a Maintenance Window) -// doesn’t exist. +// doesn't exist. // // * ErrCodeInternalServerError "InternalServerError" // An error occurred on the server side. @@ -7682,7 +7691,7 @@ func (c *SSM) UpdatePatchBaselineRequest(input *UpdatePatchBaselineInput) (req * // Returned Error Codes: // * ErrCodeDoesNotExistException "DoesNotExistException" // Error returned when the ID specified for a resource (e.g. a Maintenance Window) -// doesn’t exist. +// doesn't exist. // // * ErrCodeInternalServerError "InternalServerError" // An error occurred on the server side. @@ -8734,31 +8743,31 @@ type Command struct { // For more information about these statuses, see Run Command Status (http://docs.aws.amazon.com/systems-manager/latest/userguide/monitor-about-status.html). // StatusDetails can be one of the following values: // - // * Pending – The command has not been sent to any instances. + // * Pending: The command has not been sent to any instances. // - // * In Progress – The command has been sent to at least one instance but + // * In Progress: The command has been sent to at least one instance but // has not reached a final state on all instances. // - // * Success – The command successfully executed on all invocations. This + // * Success: The command successfully executed on all invocations. This // is a terminal state. // - // * Delivery Timed Out – The value of MaxErrors or more command invocations + // * Delivery Timed Out: The value of MaxErrors or more command invocations // shows a status of Delivery Timed Out. This is a terminal state. // - // * Execution Timed Out – The value of MaxErrors or more command invocations + // * Execution Timed Out: The value of MaxErrors or more command invocations // shows a status of Execution Timed Out. This is a terminal state. // - // * Failed – The value of MaxErrors or more command invocations shows a - // status of Failed. This is a terminal state. + // * Failed: The value of MaxErrors or more command invocations shows a status + // of Failed. This is a terminal state. // - // * Incomplete – The command was attempted on all instances and one or more + // * Incomplete: The command was attempted on all instances and one or more // invocations does not have a value of Success but not enough invocations // failed for the status to be Failed. This is a terminal state. // - // * Canceled – The command was terminated before it was completed. This - // is a terminal state. + // * Canceled: The command was terminated before it was completed. This is + // a terminal state. // - // * Rate Exceeded – The number of instances targeted by the command exceeded + // * Rate Exceeded: The number of instances targeted by the command exceeded // the account limit for pending invocations. The system has canceled the // command before executing it on any instance. This is a terminal state. StatusDetails *string `type:"string"` @@ -8999,13 +9008,13 @@ type CommandInvocation struct { // notifications about command status changes on a per instance basis. ServiceRole *string `type:"string"` - // The URL to the plugin’s StdErr file in Amazon S3, if the Amazon S3 bucket + // The URL to the plugin's StdErr file in Amazon S3, if the Amazon S3 bucket // was defined for the parent command. For an invocation, StandardErrorUrl is // populated if there is just one plugin defined for the command, and the Amazon // S3 bucket was defined for the command. StandardErrorUrl *string `type:"string"` - // The URL to the plugin’s StdOut file in Amazon S3, if the Amazon S3 bucket + // The URL to the plugin's StdOut file in Amazon S3, if the Amazon S3 bucket // was defined for the parent command. For an invocation, StandardOutputUrl // is populated if there is just one plugin defined for the command, and the // Amazon S3 bucket was defined for the command. @@ -9021,40 +9030,40 @@ type CommandInvocation struct { // about these statuses, see Run Command Status (http://docs.aws.amazon.com/systems-manager/latest/userguide/monitor-about-status.html). // StatusDetails can be one of the following values: // - // * Pending – The command has not been sent to the instance. + // * Pending: The command has not been sent to the instance. // - // * In Progress – The command has been sent to the instance but has not - // reached a terminal state. + // * In Progress: The command has been sent to the instance but has not reached + // a terminal state. // - // * Success – The execution of the command or plugin was successfully completed. + // * Success: The execution of the command or plugin was successfully completed. // This is a terminal state. // - // * Delivery Timed Out – The command was not delivered to the instance before + // * Delivery Timed Out: The command was not delivered to the instance before // the delivery timeout expired. Delivery timeouts do not count against the - // parent command’s MaxErrors limit, but they do contribute to whether the + // parent command's MaxErrors limit, but they do contribute to whether the // parent command status is Success or Incomplete. This is a terminal state. // - // * Execution Timed Out – Command execution started on the instance, but + // * Execution Timed Out: Command execution started on the instance, but // the execution was not complete before the execution timeout expired. Execution // timeouts count against the MaxErrors limit of the parent command. This // is a terminal state. // - // * Failed – The command was not successful on the instance. For a plugin, + // * Failed: The command was not successful on the instance. For a plugin, // this indicates that the result code was not zero. For a command invocation, // this indicates that the result code for one or more plugins was not zero. // Invocation failures count against the MaxErrors limit of the parent command. // This is a terminal state. // - // * Canceled – The command was terminated before it was completed. This - // is a terminal state. + // * Canceled: The command was terminated before it was completed. This is + // a terminal state. // - // * Undeliverable – The command can't be delivered to the instance. The - // instance might not exist or might not be responding. Undeliverable invocations - // don't count against the parent command’s MaxErrors limit and don't contribute + // * Undeliverable: The command can't be delivered to the instance. The instance + // might not exist or might not be responding. Undeliverable invocations + // don't count against the parent command's MaxErrors limit and don't contribute // to whether the parent command status is Success or Incomplete. This is // a terminal state. // - // * Terminated – The parent command exceeded its MaxErrors limit and subsequent + // * Terminated: The parent command exceeded its MaxErrors limit and subsequent // command invocations were canceled by the system. This is a terminal state. StatusDetails *string `type:"string"` @@ -9230,40 +9239,40 @@ type CommandPlugin struct { // For more information about these statuses, see Run Command Status (http://docs.aws.amazon.com/systems-manager/latest/userguide/monitor-about-status.html). // StatusDetails can be one of the following values: // - // * Pending – The command has not been sent to the instance. + // * Pending: The command has not been sent to the instance. // - // * In Progress – The command has been sent to the instance but has not - // reached a terminal state. + // * In Progress: The command has been sent to the instance but has not reached + // a terminal state. // - // * Success – The execution of the command or plugin was successfully completed. + // * Success: The execution of the command or plugin was successfully completed. // This is a terminal state. // - // * Delivery Timed Out – The command was not delivered to the instance before + // * Delivery Timed Out: The command was not delivered to the instance before // the delivery timeout expired. Delivery timeouts do not count against the - // parent command’s MaxErrors limit, but they do contribute to whether the + // parent command's MaxErrors limit, but they do contribute to whether the // parent command status is Success or Incomplete. This is a terminal state. // - // * Execution Timed Out – Command execution started on the instance, but + // * Execution Timed Out: Command execution started on the instance, but // the execution was not complete before the execution timeout expired. Execution // timeouts count against the MaxErrors limit of the parent command. This // is a terminal state. // - // * Failed – The command was not successful on the instance. For a plugin, + // * Failed: The command was not successful on the instance. For a plugin, // this indicates that the result code was not zero. For a command invocation, // this indicates that the result code for one or more plugins was not zero. // Invocation failures count against the MaxErrors limit of the parent command. // This is a terminal state. // - // * Canceled – The command was terminated before it was completed. This - // is a terminal state. + // * Canceled: The command was terminated before it was completed. This is + // a terminal state. // - // * Undeliverable – The command can't be delivered to the instance. The - // instance might not exist, or it might not be responding. Undeliverable - // invocations don't count against the parent command’s MaxErrors limit, - // and they don't contribute to whether the parent command status is Success - // or Incomplete. This is a terminal state. + // * Undeliverable: The command can't be delivered to the instance. The instance + // might not exist, or it might not be responding. Undeliverable invocations + // don't count against the parent command's MaxErrors limit, and they don't + // contribute to whether the parent command status is Success or Incomplete. + // This is a terminal state. // - // * Terminated – The parent command exceeded its MaxErrors limit and subsequent + // * Terminated: The parent command exceeded its MaxErrors limit and subsequent // command invocations were canceled by the system. This is a terminal state. StatusDetails *string `type:"string"` } @@ -9358,7 +9367,7 @@ type CreateActivationInput struct { // EC2 console or when you use the AWS command line tools to list EC2 resources. DefaultInstanceName *string `type:"string"` - // A user-defined description of the resource that you want to register with + // A userdefined description of the resource that you want to register with // Amazon EC2. Description *string `type:"string"` @@ -9682,25 +9691,15 @@ type CreateAssociationInput struct { Name *string `type:"string" required:"true"` // An Amazon S3 bucket where you want to store the output details of the request. - // For example: - // - // "{ \"S3Location\": { \"OutputS3Region\": \"\", \"OutputS3BucketName\": - // \"bucket name\", \"OutputS3KeyPrefix\": \"folder name\" } }" OutputLocation *InstanceAssociationOutputLocation `type:"structure"` // The parameters for the documents runtime configuration. Parameters map[string][]*string `type:"map"` // A cron expression when the association will be applied to the target(s). - // Supported expressions are every half, 1, 2, 4, 8 or 12 hour(s); every specified - // day and time of the week. For example: cron(0 0/30 * 1/1 * ? *) to run every - // thirty minutes; cron(0 0 0/4 1/1 * ? *) to run every four hours; and cron(0 - // 0 10 ? * SUN *) to run every Sunday at 10 a.m. ScheduleExpression *string `min:"1" type:"string"` - // The targets (either instances or tags) for the association. Instances are - // specified using Key=instanceids,Values=,. Tags - // are specified using Key=,Values=. + // The targets (either instances or tags) for the association. Targets []*Target `type:"list"` } @@ -10053,7 +10052,7 @@ type CreatePatchBaselineInput struct { // A list of explicitly approved patches for the baseline. ApprovedPatches []*string `type:"list"` - // Caller-provided idempotency token. + // User-provided idempotency token. ClientToken *string `min:"1" type:"string" idempotencyToken:"true"` // A description of the patch baseline. @@ -11831,11 +11830,11 @@ type DescribeInstancePatchStatesForPatchGroupInput struct { // Each entry in the array is a structure containing: // - // Key (string 1 ≤ length ≤ 200) + // Key (string between 1 and 200 characters) // // Values (array containing a single string) // - // Type (string “Equal”, “NotEqual”, “LessThan”, “GreaterThan”) + // Type (string "Equal", "NotEqual", "LessThan", "GreaterThan") Filters []*InstancePatchStateFilter `type:"list"` // The maximum number of patches to return (per page). @@ -12050,9 +12049,9 @@ type DescribeInstancePatchesInput struct { // Each entry in the array is a structure containing: // - // Key (string, 1 ≤ length ≤ 128) + // Key (string, between 1 and 128 characters) // - // Values (array of strings 1 ≤ length ≤ 256) + // Values (array of strings, each string between 1 and 256 characters) Filters []*PatchOrchestratorFilter `type:"list"` // The ID of the instance whose patch state information should be retrieved. @@ -12146,8 +12145,8 @@ type DescribeInstancePatchesOutput struct { // // Severity (string) // - // State (string – “INSTALLED”, “INSTALLED_OTHER”, “MISSING”, “NOT_APPLICABLE”, - // “FAILED”) + // State (string: "INSTALLED", "INSTALLED OTHER", "MISSING", "NOT APPLICABLE", + // "FAILED") // // InstalledTime (DateTime) // @@ -12444,9 +12443,9 @@ type DescribeMaintenanceWindowExecutionsInput struct { // Each entry in the array is a structure containing: // - // Key (string, 1 ≤ length ≤ 128) + // Key (string, between 1 and 128 characters) // - // Values (array of strings 1 ≤ length ≤ 256) + // Values (array of strings, each string is between 1 and 256 characters) // // The supported Keys are ExecutedBefore and ExecutedAfter with the value being // a date/time string such as 2016-11-04T05:00:00Z. @@ -13015,9 +13014,9 @@ type DescribePatchBaselinesInput struct { // Each element in the array is a structure containing: // - // Key: (string, “NAME_PREFIX” or “OWNER”) + // Key: (string, "NAME_PREFIX" or "OWNER") // - // Value: (array of strings, exactly 1 entry, 1 ≤ length ≤ 255) + // Value: (array of strings, exactly 1 entry, between 1 and 255 characters) Filters []*PatchOrchestratorFilter `type:"list"` // The maximum number of patch baselines to return (per page). @@ -13166,7 +13165,7 @@ type DescribePatchGroupStateOutput struct { // to install. InstancesWithFailedPatches *int64 `type:"integer"` - // The number of instances with patches installed that aren’t defined in the + // The number of instances with patches installed that aren't defined in the // patch baseline. InstancesWithInstalledOtherPatches *int64 `type:"integer"` @@ -13176,7 +13175,7 @@ type DescribePatchGroupStateOutput struct { // The number of instances with missing patches from the patch baseline. InstancesWithMissingPatches *int64 `type:"integer"` - // The number of instances with patches that aren’t applicable. + // The number of instances with patches that aren't applicable. InstancesWithNotApplicablePatches *int64 `type:"integer"` } @@ -13279,7 +13278,7 @@ type DescribePatchGroupsOutput struct { // Each entry in the array contains: // - // PatchGroup: string (1 ≤ length ≤ 256, Regex: ^([\p{L}\p{Z}\p{N}_.:/=+\-@]*)$) + // PatchGroup: string (between 1 and 256 characters, Regex: ^([\p{L}\p{Z}\p{N}_.:/=+\-@]*)$) // // PatchBaselineIdentity: A PatchBaselineIdentity element. Mappings []*PatchGroupPatchBaselineMapping `type:"list"` @@ -13644,7 +13643,7 @@ type DocumentParameter struct { // The name of the parameter. Name *string `type:"string"` - // The type of parameter. The type can be either “String” or “StringList”. + // The type of parameter. The type can be either String or StringList. Type *string `type:"string" enum:"DocumentParameterType"` } @@ -13819,6 +13818,51 @@ func (s *FailedCreateAssociation) SetMessage(v string) *FailedCreateAssociation return s } +// Information about an Automation failure. +// Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/FailureDetails +type FailureDetails struct { + _ struct{} `type:"structure"` + + // Detailed information about the Automation step failure. + Details map[string][]*string `min:"1" type:"map"` + + // The stage of the Automation execution when the failure occurred. The stages + // include the following: InputValidation, PreVerification, Invocation, PostVerification. + FailureStage *string `type:"string"` + + // The type of Automation failure. Failure types include the following: Action, + // Permission, Throttling, Verification, Internal. + FailureType *string `type:"string"` +} + +// String returns the string representation +func (s FailureDetails) String() string { + return awsutil.Prettify(s) +} + +// GoString returns the string representation +func (s FailureDetails) GoString() string { + return s.String() +} + +// SetDetails sets the Details field's value. +func (s *FailureDetails) SetDetails(v map[string][]*string) *FailureDetails { + s.Details = v + return s +} + +// SetFailureStage sets the FailureStage field's value. +func (s *FailureDetails) SetFailureStage(v string) *FailureDetails { + s.FailureStage = &v + return s +} + +// SetFailureType sets the FailureType field's value. +func (s *FailureDetails) SetFailureType(v string) *FailureDetails { + s.FailureType = &v + return s +} + // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/GetAutomationExecutionRequest type GetAutomationExecutionInput struct { _ struct{} `type:"structure"` @@ -14027,45 +14071,45 @@ type GetCommandInvocationOutput struct { // Status (http://docs.aws.amazon.com/systems-manager/latest/userguide/monitor-about-status.html). // StatusDetails can be one of the following values: // - // * Pending – The command has not been sent to the instance. + // * Pending: The command has not been sent to the instance. // - // * In Progress – The command has been sent to the instance but has not - // reached a terminal state. + // * In Progress: The command has been sent to the instance but has not reached + // a terminal state. // - // * Delayed – The system attempted to send the command to the target, but + // * Delayed: The system attempted to send the command to the target, but // the target was not available. The instance might not be available because // of network issues, the instance was stopped, etc. The system will try // to deliver the command again. // - // * Success – The command or plugin was executed successfully. This is a + // * Success: The command or plugin was executed successfully. This is a // terminal state. // - // * Delivery Timed Out – The command was not delivered to the instance before + // * Delivery Timed Out: The command was not delivered to the instance before // the delivery timeout expired. Delivery timeouts do not count against the - // parent command’s MaxErrors limit, but they do contribute to whether the + // parent command's MaxErrors limit, but they do contribute to whether the // parent command status is Success or Incomplete. This is a terminal state. // - // * Execution Timed Out – The command started to execute on the instance, + // * Execution Timed Out: The command started to execute on the instance, // but the execution was not complete before the timeout expired. Execution // timeouts count against the MaxErrors limit of the parent command. This // is a terminal state. // - // * Failed – The command wasn't executed successfully on the instance. For + // * Failed: The command wasn't executed successfully on the instance. For // a plugin, this indicates that the result code was not zero. For a command // invocation, this indicates that the result code for one or more plugins // was not zero. Invocation failures count against the MaxErrors limit of // the parent command. This is a terminal state. // - // * Canceled – The command was terminated before it was completed. This - // is a terminal state. + // * Canceled: The command was terminated before it was completed. This is + // a terminal state. // - // * Undeliverable – The command can't be delivered to the instance. The - // instance might not exist or might not be responding. Undeliverable invocations - // don't count against the parent command’s MaxErrors limit and don't contribute + // * Undeliverable: The command can't be delivered to the instance. The instance + // might not exist or might not be responding. Undeliverable invocations + // don't count against the parent command's MaxErrors limit and don't contribute // to whether the parent command status is Success or Incomplete. This is // a terminal state. // - // * Terminated – The parent command exceeded its MaxErrors limit and subsequent + // * Terminated: The parent command exceeded its MaxErrors limit and subsequent // command invocations were canceled by the system. This is a terminal state. StatusDetails *string `type:"string"` } @@ -14836,9 +14880,9 @@ type GetMaintenanceWindowExecutionTaskOutput struct { // The parameters passed to the task when it was executed. The map has the following // format: // - // Key: string, 1 ≤ length ≤ 255 + // Key: string, between 1 and 255 characters // - // Value: an array of strings where each string 1 ≤ length ≤ 255 + // Value: an array of strings, each string is between 1 and 255 characters TaskParameters []map[string]*MaintenanceWindowTaskParameterValueExpression `type:"list"` // The type of task executed. @@ -15996,8 +16040,8 @@ type InstanceInformationStringFilter struct { // The filter key name to describe your instances. For example: // - // "InstanceIds"|"AgentVersion"|"PingStatus"|"PlatformTypes"|"ActivationIds"|"IamRole"|"ResourceType"|”AssociationStatus”|”Tag - // Key” + // "InstanceIds"|"AgentVersion"|"PingStatus"|"PlatformTypes"|"ActivationIds"|"IamRole"|"ResourceType"|"AssociationStatus"|"Tag + // Key" // // Key is a required field Key *string `min:"1" type:"string" required:"true"` @@ -16083,11 +16127,11 @@ type InstancePatchState struct { InstanceId *string `type:"string" required:"true"` // The number of patches from the patch baseline that are applicable for the - // instance but aren’t currently installed. + // instance but aren't currently installed. MissingCount *int64 `type:"integer"` - // The number of patches from the patch baseline that aren’t applicable for - // the instance and hence aren’t installed on the instance. + // The number of patches from the patch baseline that aren't applicable for + // the instance and hence aren't installed on the instance. NotApplicableCount *int64 `type:"integer"` // The type of patching operation that was performed: SCAN (assess patch compliance @@ -18544,7 +18588,7 @@ type Patch struct { // The Microsoft Knowledge Base ID of the patch. KbNumber *string `type:"string"` - // The language of the patch if it’s language-specific. + // The language of the patch if it's language-specific. Language *string `type:"string"` // The ID of the MSRC bulletin the patch is related to. @@ -19921,8 +19965,8 @@ func (s RemoveTagsFromResourceOutput) GoString() string { type ResultAttribute struct { _ struct{} `type:"structure"` - // Name of the inventory item type. Valid value: “AWS:InstanceInformation”. - // Default Value: “AWS:InstanceInformation”. + // Name of the inventory item type. Valid value: AWS:InstanceInformation. Default + // Value: AWS:InstanceInformation. // // TypeName is a required field TypeName *string `min:"1" type:"string" required:"true"` @@ -20070,21 +20114,23 @@ type SendCommandInput struct { // DocumentName is a required field DocumentName *string `type:"string" required:"true"` - // Required. The instance IDs where the command should execute. You can specify - // a maximum of 50 IDs. + // The instance IDs where the command should execute. You can specify a maximum + // of 50 IDs. If you prefer not to list individual instance IDs, you can instead + // send commands to a fleet of instances using the Targets parameter, which + // accepts EC2 tags. InstanceIds []*string `type:"list"` // (Optional) The maximum number of instances that are allowed to execute the - // command at the same time. You can specify a number such as “10” or a percentage - // such as “10%”. The default value is 50. For more information about how to - // use MaxConcurrency, see Executing a Command Using Systems Manager Run Command + // command at the same time. You can specify a number such as 10 or a percentage + // such as 10%. The default value is 50. For more information about how to use + // MaxConcurrency, see Executing a Command Using Systems Manager Run Command // (http://docs.aws.amazon.com/systems-manager/latest/userguide/run-command.html). MaxConcurrency *string `min:"1" type:"string"` // The maximum number of errors allowed without the command failing. When the // command fails one more time beyond the value of MaxErrors, the systems stops // sending the command to additional targets. You can specify a number like - // “10” or a percentage like “10%”. The default value is 50. For more information + // 10 or a percentage like 10%. The default value is 50. For more information // about how to use MaxErrors, see Executing a Command Using Systems Manager // Run Command (http://docs.aws.amazon.com/systems-manager/latest/userguide/run-command.html). MaxErrors *string `min:"1" type:"string"` @@ -20386,6 +20432,9 @@ type StepExecution struct { // the step is in Pending status, this field is not populated. ExecutionStartTime *time.Time `type:"timestamp" timestampFormat:"unix"` + // Information about the Automation failure. + FailureDetails *FailureDetails `type:"structure"` + // If a step failed, this message explains why the execution failed. FailureMessage *string `type:"string"` @@ -20437,6 +20486,12 @@ func (s *StepExecution) SetExecutionStartTime(v time.Time) *StepExecution { return s } +// SetFailureDetails sets the FailureDetails field's value. +func (s *StepExecution) SetFailureDetails(v *FailureDetails) *StepExecution { + s.FailureDetails = v + return s +} + // SetFailureMessage sets the FailureMessage field's value. func (s *StepExecution) SetFailureMessage(v string) *StepExecution { s.FailureMessage = &v @@ -20666,10 +20721,10 @@ type UpdateAssociationInput struct { // The document version you want update for the association. DocumentVersion *string `type:"string"` + // The name of the association document. + Name *string `type:"string"` + // An Amazon S3 bucket where you want to store the results of this request. - // - // "{ \"S3Location\": { \"OutputS3Region\": \"\", \"OutputS3BucketName\": - // \"bucket name\", \"OutputS3KeyPrefix\": \"folder name\" } }" OutputLocation *InstanceAssociationOutputLocation `type:"structure"` // The parameters you want to update for the association. If you create a parameter @@ -20677,11 +20732,10 @@ type UpdateAssociationInput struct { Parameters map[string][]*string `type:"map"` // The cron expression used to schedule the association that you want to update. - // Supported expressions are every half, 1, 2, 4, 8 or 12 hour(s); every specified - // day and time of the week. For example: cron(0 0/30 * 1/1 * ? *) to run every - // thirty minutes; cron(0 0 0/4 1/1 * ? *) to run every four hours; and cron(0 - // 0 10 ? * SUN *) to run every Sunday at 10 a.m. ScheduleExpression *string `min:"1" type:"string"` + + // The targets of the association. + Targets []*Target `type:"list"` } // String returns the string representation @@ -20708,6 +20762,16 @@ func (s *UpdateAssociationInput) Validate() error { invalidParams.AddNested("OutputLocation", err.(request.ErrInvalidParams)) } } + if s.Targets != nil { + for i, v := range s.Targets { + if v == nil { + continue + } + if err := v.Validate(); err != nil { + invalidParams.AddNested(fmt.Sprintf("%s[%v]", "Targets", i), err.(request.ErrInvalidParams)) + } + } + } if invalidParams.Len() > 0 { return invalidParams @@ -20727,6 +20791,12 @@ func (s *UpdateAssociationInput) SetDocumentVersion(v string) *UpdateAssociation return s } +// SetName sets the Name field's value. +func (s *UpdateAssociationInput) SetName(v string) *UpdateAssociationInput { + s.Name = &v + return s +} + // SetOutputLocation sets the OutputLocation field's value. func (s *UpdateAssociationInput) SetOutputLocation(v *InstanceAssociationOutputLocation) *UpdateAssociationInput { s.OutputLocation = v @@ -20745,6 +20815,12 @@ func (s *UpdateAssociationInput) SetScheduleExpression(v string) *UpdateAssociat return s } +// SetTargets sets the Targets field's value. +func (s *UpdateAssociationInput) SetTargets(v []*Target) *UpdateAssociationInput { + s.Targets = v + return s +} + // Please also see https://docs.aws.amazon.com/goto/WebAPI/ssm-2014-11-06/UpdateAssociationResult type UpdateAssociationOutput struct { _ struct{} `type:"structure"` diff --git a/vendor/github.com/aws/aws-sdk-go/service/ssm/errors.go b/vendor/github.com/aws/aws-sdk-go/service/ssm/errors.go index 2107a874f..03ee7f931 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/ssm/errors.go +++ b/vendor/github.com/aws/aws-sdk-go/service/ssm/errors.go @@ -100,7 +100,7 @@ const ( // "DoesNotExistException". // // Error returned when the ID specified for a resource (e.g. a Maintenance Window) - // doesn’t exist. + // doesn't exist. ErrCodeDoesNotExistException = "DoesNotExistException" // ErrCodeDuplicateDocumentContent for service response error code @@ -120,7 +120,7 @@ const ( // "IdempotentParameterMismatch". // // Error returned when an idempotent operation is retried and the parameters - // don’t match the original call to the API with the same idempotency token. + // don't match the original call to the API with the same idempotency token. ErrCodeIdempotentParameterMismatch = "IdempotentParameterMismatch" // ErrCodeInternalServerError for service response error code diff --git a/vendor/github.com/aws/aws-sdk-go/service/ssm/examples_test.go b/vendor/github.com/aws/aws-sdk-go/service/ssm/examples_test.go index a9bda541c..ef01280c8 100644 --- a/vendor/github.com/aws/aws-sdk-go/service/ssm/examples_test.go +++ b/vendor/github.com/aws/aws-sdk-go/service/ssm/examples_test.go @@ -2085,6 +2085,7 @@ func ExampleSSM_UpdateAssociation() { params := &ssm.UpdateAssociationInput{ AssociationId: aws.String("AssociationId"), // Required DocumentVersion: aws.String("DocumentVersion"), + Name: aws.String("DocumentName"), OutputLocation: &ssm.InstanceAssociationOutputLocation{ S3Location: &ssm.S3OutputLocation{ OutputS3BucketName: aws.String("S3BucketName"), @@ -2100,6 +2101,16 @@ func ExampleSSM_UpdateAssociation() { // More values... }, ScheduleExpression: aws.String("ScheduleExpression"), + Targets: []*ssm.Target{ + { // Required + Key: aws.String("TargetKey"), + Values: []*string{ + aws.String("TargetValue"), // Required + // More values... + }, + }, + // More values... + }, } resp, err := svc.UpdateAssociation(params) diff --git a/vendor/github.com/linki/instrumented_http/client.go b/vendor/github.com/linki/instrumented_http/client.go index c13ba5cd0..ab1671cda 100644 --- a/vendor/github.com/linki/instrumented_http/client.go +++ b/vendor/github.com/linki/instrumented_http/client.go @@ -5,6 +5,7 @@ package instrumented_http import ( "fmt" "net/http" + "strings" "time" "github.com/prometheus/client_golang/prometheus" @@ -46,6 +47,11 @@ var ( EliminatingProcessor = func(_ string) string { return "" } // IdentityProcessor is callback that returns whatever is passed to it. IdentityProcessor = func(input string) string { return input } + // LastPathElementProcessor is callback that returns the last element of a URL path. + LastPathElementProcessor = func(path string) string { + parts := strings.Split(path, "/") + return parts[len(parts)-1] + } ) // init registers the Prometheus metric globally when the package is loaded. diff --git a/vendor/github.com/linki/instrumented_http/examples/googledns/main.go b/vendor/github.com/linki/instrumented_http/examples/googledns/main.go index 8cbad6fae..737f90e42 100644 --- a/vendor/github.com/linki/instrumented_http/examples/googledns/main.go +++ b/vendor/github.com/linki/instrumented_http/examples/googledns/main.go @@ -5,7 +5,6 @@ import ( "fmt" "log" "net/http" - "strings" "time" "github.com/linki/instrumented_http" @@ -27,10 +26,7 @@ func main() { } instrumentedClient := instrumented_http.NewClient(defaultClient, &instrumented_http.Callbacks{ - PathProcessor: func(path string) string { - parts := strings.Split(path, "/") - return parts[len(parts)-1] - }, + PathProcessor: instrumented_http.LastPathElementProcessor, }) dnsClient, err := dns.New(instrumentedClient) diff --git a/vendor/github.com/linki/instrumented_http/examples/kubernetes/main.go b/vendor/github.com/linki/instrumented_http/examples/kubernetes/main.go new file mode 100644 index 000000000..d2a4fd48c --- /dev/null +++ b/vendor/github.com/linki/instrumented_http/examples/kubernetes/main.go @@ -0,0 +1,61 @@ +package main + +import ( + "fmt" + "log" + "net/http" + "time" + + "github.com/linki/instrumented_http" + "github.com/prometheus/client_golang/prometheus/promhttp" + + metav1 "k8s.io/apimachinery/pkg/apis/meta/v1" + "k8s.io/client-go/kubernetes" + "k8s.io/client-go/tools/clientcmd" +) + +func main() { + go func() { + http.Handle("/metrics", promhttp.Handler()) + log.Fatal(http.ListenAndServe("127.0.0.1:9099", nil)) + }() + + config, err := clientcmd.BuildConfigFromFlags("", clientcmd.RecommendedHomeFile) + if err != nil { + log.Fatal(err) + } + + config.WrapTransport = func(rt http.RoundTripper) http.RoundTripper { + return instrumented_http.NewTransport(rt, &instrumented_http.Callbacks{ + PathProcessor: instrumented_http.LastPathElementProcessor, + }) + } + + client, err := kubernetes.NewForConfig(config) + if err != nil { + log.Fatal(err) + } + + for { + pods, err := client.CoreV1().Pods(metav1.NamespaceDefault).List(metav1.ListOptions{}) + if err != nil { + log.Fatal(err) + } + + for _, p := range pods.Items { + fmt.Println(p.Name) + } + + time.Sleep(10 * time.Second) + } +} + +// expected result: +// +// $ curl -Ss 127.0.0.1:9099/metrics | grep http +// +// http_request_duration_microseconds{handler="instrumented_http",host="my-cluster.example.org",method="GET",path="pods",query="",scheme="https",status="200",quantile="0.5"} 83626 +// http_request_duration_microseconds{handler="instrumented_http",host="my-cluster.example.org",method="GET",path="pods",query="",scheme="https",status="200",quantile="0.9"} 736648 +// http_request_duration_microseconds{handler="instrumented_http",host="my-cluster.example.org",method="GET",path="pods",query="",scheme="https",status="200",quantile="0.99"} 736648 +// http_request_duration_microseconds_sum{handler="instrumented_http",host="my-cluster.example.org",method="GET",path="pods",query="",scheme="https",status="200"} 820274 +// http_request_duration_microseconds_count{handler="instrumented_http",host="my-cluster.example.org",method="GET",path="pods",query="",scheme="https",status="200"} 2 diff --git a/vendor/github.com/linki/instrumented_http/examples/route53/main.go b/vendor/github.com/linki/instrumented_http/examples/route53/main.go index 61369ad21..1e7c07e81 100644 --- a/vendor/github.com/linki/instrumented_http/examples/route53/main.go +++ b/vendor/github.com/linki/instrumented_http/examples/route53/main.go @@ -4,7 +4,6 @@ import ( "fmt" "log" "net/http" - "strings" "time" "github.com/linki/instrumented_http" @@ -25,10 +24,7 @@ func main() { config = config.WithHTTPClient( instrumented_http.NewClient(config.HTTPClient, &instrumented_http.Callbacks{ - PathProcessor: func(path string) string { - parts := strings.Split(path, "/") - return parts[len(parts)-1] - }, + PathProcessor: instrumented_http.LastPathElementProcessor, }), ) diff --git a/vendor/github.com/pmezard/go-difflib/.travis.yml b/vendor/github.com/pmezard/go-difflib/.travis.yml new file mode 100644 index 000000000..90c9c6f91 --- /dev/null +++ b/vendor/github.com/pmezard/go-difflib/.travis.yml @@ -0,0 +1,5 @@ +language: go +go: + - 1.5 + - tip + diff --git a/vendor/github.com/pmezard/go-difflib/LICENSE b/vendor/github.com/pmezard/go-difflib/LICENSE new file mode 100644 index 000000000..c67dad612 --- /dev/null +++ b/vendor/github.com/pmezard/go-difflib/LICENSE @@ -0,0 +1,27 @@ +Copyright (c) 2013, Patrick Mezard +All rights reserved. + +Redistribution and use in source and binary forms, with or without +modification, are permitted provided that the following conditions are +met: + + Redistributions of source code must retain the above copyright +notice, this list of conditions and the following disclaimer. + Redistributions in binary form must reproduce the above copyright +notice, this list of conditions and the following disclaimer in the +documentation and/or other materials provided with the distribution. + The names of its contributors may not be used to endorse or promote +products derived from this software without specific prior written +permission. + +THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS +IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED +TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A +PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT +HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, +SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED +TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR +PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF +LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING +NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS +SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. diff --git a/vendor/github.com/pmezard/go-difflib/README.md b/vendor/github.com/pmezard/go-difflib/README.md new file mode 100644 index 000000000..e87f307ed --- /dev/null +++ b/vendor/github.com/pmezard/go-difflib/README.md @@ -0,0 +1,50 @@ +go-difflib +========== + +[![Build Status](https://travis-ci.org/pmezard/go-difflib.png?branch=master)](https://travis-ci.org/pmezard/go-difflib) +[![GoDoc](https://godoc.org/github.com/pmezard/go-difflib/difflib?status.svg)](https://godoc.org/github.com/pmezard/go-difflib/difflib) + +Go-difflib is a partial port of python 3 difflib package. Its main goal +was to make unified and context diff available in pure Go, mostly for +testing purposes. + +The following class and functions (and related tests) have be ported: + +* `SequenceMatcher` +* `unified_diff()` +* `context_diff()` + +## Installation + +```bash +$ go get github.com/pmezard/go-difflib/difflib +``` + +### Quick Start + +Diffs are configured with Unified (or ContextDiff) structures, and can +be output to an io.Writer or returned as a string. + +```Go +diff := UnifiedDiff{ + A: difflib.SplitLines("foo\nbar\n"), + B: difflib.SplitLines("foo\nbaz\n"), + FromFile: "Original", + ToFile: "Current", + Context: 3, +} +text, _ := GetUnifiedDiffString(diff) +fmt.Printf(text) +``` + +would output: + +``` +--- Original ++++ Current +@@ -1,3 +1,3 @@ + foo +-bar ++baz +``` + diff --git a/vendor/github.com/pmezard/go-difflib/difflib/difflib.go b/vendor/github.com/pmezard/go-difflib/difflib/difflib.go new file mode 100644 index 000000000..64cc40fe1 --- /dev/null +++ b/vendor/github.com/pmezard/go-difflib/difflib/difflib.go @@ -0,0 +1,758 @@ +// Package difflib is a partial port of Python difflib module. +// +// It provides tools to compare sequences of strings and generate textual diffs. +// +// The following class and functions have been ported: +// +// - SequenceMatcher +// +// - unified_diff +// +// - context_diff +// +// Getting unified diffs was the main goal of the port. Keep in mind this code +// is mostly suitable to output text differences in a human friendly way, there +// are no guarantees generated diffs are consumable by patch(1). +package difflib + +import ( + "bufio" + "bytes" + "fmt" + "io" + "strings" +) + +func min(a, b int) int { + if a < b { + return a + } + return b +} + +func max(a, b int) int { + if a > b { + return a + } + return b +} + +func calculateRatio(matches, length int) float64 { + if length > 0 { + return 2.0 * float64(matches) / float64(length) + } + return 1.0 +} + +type Match struct { + A int + B int + Size int +} + +type OpCode struct { + Tag byte + I1 int + I2 int + J1 int + J2 int +} + +// SequenceMatcher compares sequence of strings. The basic +// algorithm predates, and is a little fancier than, an algorithm +// published in the late 1980's by Ratcliff and Obershelp under the +// hyperbolic name "gestalt pattern matching". The basic idea is to find +// the longest contiguous matching subsequence that contains no "junk" +// elements (R-O doesn't address junk). The same idea is then applied +// recursively to the pieces of the sequences to the left and to the right +// of the matching subsequence. This does not yield minimal edit +// sequences, but does tend to yield matches that "look right" to people. +// +// SequenceMatcher tries to compute a "human-friendly diff" between two +// sequences. Unlike e.g. UNIX(tm) diff, the fundamental notion is the +// longest *contiguous* & junk-free matching subsequence. That's what +// catches peoples' eyes. The Windows(tm) windiff has another interesting +// notion, pairing up elements that appear uniquely in each sequence. +// That, and the method here, appear to yield more intuitive difference +// reports than does diff. This method appears to be the least vulnerable +// to synching up on blocks of "junk lines", though (like blank lines in +// ordinary text files, or maybe "

" lines in HTML files). That may be +// because this is the only method of the 3 that has a *concept* of +// "junk" . +// +// Timing: Basic R-O is cubic time worst case and quadratic time expected +// case. SequenceMatcher is quadratic time for the worst case and has +// expected-case behavior dependent in a complicated way on how many +// elements the sequences have in common; best case time is linear. +type SequenceMatcher struct { + a []string + b []string + b2j map[string][]int + IsJunk func(string) bool + autoJunk bool + bJunk map[string]struct{} + matchingBlocks []Match + fullBCount map[string]int + bPopular map[string]struct{} + opCodes []OpCode +} + +func NewMatcher(a, b []string) *SequenceMatcher { + m := SequenceMatcher{autoJunk: true} + m.SetSeqs(a, b) + return &m +} + +func NewMatcherWithJunk(a, b []string, autoJunk bool, + isJunk func(string) bool) *SequenceMatcher { + + m := SequenceMatcher{IsJunk: isJunk, autoJunk: autoJunk} + m.SetSeqs(a, b) + return &m +} + +// Set two sequences to be compared. +func (m *SequenceMatcher) SetSeqs(a, b []string) { + m.SetSeq1(a) + m.SetSeq2(b) +} + +// Set the first sequence to be compared. The second sequence to be compared is +// not changed. +// +// SequenceMatcher computes and caches detailed information about the second +// sequence, so if you want to compare one sequence S against many sequences, +// use .SetSeq2(s) once and call .SetSeq1(x) repeatedly for each of the other +// sequences. +// +// See also SetSeqs() and SetSeq2(). +func (m *SequenceMatcher) SetSeq1(a []string) { + if &a == &m.a { + return + } + m.a = a + m.matchingBlocks = nil + m.opCodes = nil +} + +// Set the second sequence to be compared. The first sequence to be compared is +// not changed. +func (m *SequenceMatcher) SetSeq2(b []string) { + if &b == &m.b { + return + } + m.b = b + m.matchingBlocks = nil + m.opCodes = nil + m.fullBCount = nil + m.chainB() +} + +func (m *SequenceMatcher) chainB() { + // Populate line -> index mapping + b2j := map[string][]int{} + for i, s := range m.b { + indices := b2j[s] + indices = append(indices, i) + b2j[s] = indices + } + + // Purge junk elements + m.bJunk = map[string]struct{}{} + if m.IsJunk != nil { + junk := m.bJunk + for s, _ := range b2j { + if m.IsJunk(s) { + junk[s] = struct{}{} + } + } + for s, _ := range junk { + delete(b2j, s) + } + } + + // Purge remaining popular elements + popular := map[string]struct{}{} + n := len(m.b) + if m.autoJunk && n >= 200 { + ntest := n/100 + 1 + for s, indices := range b2j { + if len(indices) > ntest { + popular[s] = struct{}{} + } + } + for s, _ := range popular { + delete(b2j, s) + } + } + m.bPopular = popular + m.b2j = b2j +} + +func (m *SequenceMatcher) isBJunk(s string) bool { + _, ok := m.bJunk[s] + return ok +} + +// Find longest matching block in a[alo:ahi] and b[blo:bhi]. +// +// If IsJunk is not defined: +// +// Return (i,j,k) such that a[i:i+k] is equal to b[j:j+k], where +// alo <= i <= i+k <= ahi +// blo <= j <= j+k <= bhi +// and for all (i',j',k') meeting those conditions, +// k >= k' +// i <= i' +// and if i == i', j <= j' +// +// In other words, of all maximal matching blocks, return one that +// starts earliest in a, and of all those maximal matching blocks that +// start earliest in a, return the one that starts earliest in b. +// +// If IsJunk is defined, first the longest matching block is +// determined as above, but with the additional restriction that no +// junk element appears in the block. Then that block is extended as +// far as possible by matching (only) junk elements on both sides. So +// the resulting block never matches on junk except as identical junk +// happens to be adjacent to an "interesting" match. +// +// If no blocks match, return (alo, blo, 0). +func (m *SequenceMatcher) findLongestMatch(alo, ahi, blo, bhi int) Match { + // CAUTION: stripping common prefix or suffix would be incorrect. + // E.g., + // ab + // acab + // Longest matching block is "ab", but if common prefix is + // stripped, it's "a" (tied with "b"). UNIX(tm) diff does so + // strip, so ends up claiming that ab is changed to acab by + // inserting "ca" in the middle. That's minimal but unintuitive: + // "it's obvious" that someone inserted "ac" at the front. + // Windiff ends up at the same place as diff, but by pairing up + // the unique 'b's and then matching the first two 'a's. + besti, bestj, bestsize := alo, blo, 0 + + // find longest junk-free match + // during an iteration of the loop, j2len[j] = length of longest + // junk-free match ending with a[i-1] and b[j] + j2len := map[int]int{} + for i := alo; i != ahi; i++ { + // look at all instances of a[i] in b; note that because + // b2j has no junk keys, the loop is skipped if a[i] is junk + newj2len := map[int]int{} + for _, j := range m.b2j[m.a[i]] { + // a[i] matches b[j] + if j < blo { + continue + } + if j >= bhi { + break + } + k := j2len[j-1] + 1 + newj2len[j] = k + if k > bestsize { + besti, bestj, bestsize = i-k+1, j-k+1, k + } + } + j2len = newj2len + } + + // Extend the best by non-junk elements on each end. In particular, + // "popular" non-junk elements aren't in b2j, which greatly speeds + // the inner loop above, but also means "the best" match so far + // doesn't contain any junk *or* popular non-junk elements. + for besti > alo && bestj > blo && !m.isBJunk(m.b[bestj-1]) && + m.a[besti-1] == m.b[bestj-1] { + besti, bestj, bestsize = besti-1, bestj-1, bestsize+1 + } + for besti+bestsize < ahi && bestj+bestsize < bhi && + !m.isBJunk(m.b[bestj+bestsize]) && + m.a[besti+bestsize] == m.b[bestj+bestsize] { + bestsize += 1 + } + + // Now that we have a wholly interesting match (albeit possibly + // empty!), we may as well suck up the matching junk on each + // side of it too. Can't think of a good reason not to, and it + // saves post-processing the (possibly considerable) expense of + // figuring out what to do with it. In the case of an empty + // interesting match, this is clearly the right thing to do, + // because no other kind of match is possible in the regions. + for besti > alo && bestj > blo && m.isBJunk(m.b[bestj-1]) && + m.a[besti-1] == m.b[bestj-1] { + besti, bestj, bestsize = besti-1, bestj-1, bestsize+1 + } + for besti+bestsize < ahi && bestj+bestsize < bhi && + m.isBJunk(m.b[bestj+bestsize]) && + m.a[besti+bestsize] == m.b[bestj+bestsize] { + bestsize += 1 + } + + return Match{A: besti, B: bestj, Size: bestsize} +} + +// Return list of triples describing matching subsequences. +// +// Each triple is of the form (i, j, n), and means that +// a[i:i+n] == b[j:j+n]. The triples are monotonically increasing in +// i and in j. It's also guaranteed that if (i, j, n) and (i', j', n') are +// adjacent triples in the list, and the second is not the last triple in the +// list, then i+n != i' or j+n != j'. IOW, adjacent triples never describe +// adjacent equal blocks. +// +// The last triple is a dummy, (len(a), len(b), 0), and is the only +// triple with n==0. +func (m *SequenceMatcher) GetMatchingBlocks() []Match { + if m.matchingBlocks != nil { + return m.matchingBlocks + } + + var matchBlocks func(alo, ahi, blo, bhi int, matched []Match) []Match + matchBlocks = func(alo, ahi, blo, bhi int, matched []Match) []Match { + match := m.findLongestMatch(alo, ahi, blo, bhi) + i, j, k := match.A, match.B, match.Size + if match.Size > 0 { + if alo < i && blo < j { + matched = matchBlocks(alo, i, blo, j, matched) + } + matched = append(matched, match) + if i+k < ahi && j+k < bhi { + matched = matchBlocks(i+k, ahi, j+k, bhi, matched) + } + } + return matched + } + matched := matchBlocks(0, len(m.a), 0, len(m.b), nil) + + // It's possible that we have adjacent equal blocks in the + // matching_blocks list now. + nonAdjacent := []Match{} + i1, j1, k1 := 0, 0, 0 + for _, b := range matched { + // Is this block adjacent to i1, j1, k1? + i2, j2, k2 := b.A, b.B, b.Size + if i1+k1 == i2 && j1+k1 == j2 { + // Yes, so collapse them -- this just increases the length of + // the first block by the length of the second, and the first + // block so lengthened remains the block to compare against. + k1 += k2 + } else { + // Not adjacent. Remember the first block (k1==0 means it's + // the dummy we started with), and make the second block the + // new block to compare against. + if k1 > 0 { + nonAdjacent = append(nonAdjacent, Match{i1, j1, k1}) + } + i1, j1, k1 = i2, j2, k2 + } + } + if k1 > 0 { + nonAdjacent = append(nonAdjacent, Match{i1, j1, k1}) + } + + nonAdjacent = append(nonAdjacent, Match{len(m.a), len(m.b), 0}) + m.matchingBlocks = nonAdjacent + return m.matchingBlocks +} + +// Return list of 5-tuples describing how to turn a into b. +// +// Each tuple is of the form (tag, i1, i2, j1, j2). The first tuple +// has i1 == j1 == 0, and remaining tuples have i1 == the i2 from the +// tuple preceding it, and likewise for j1 == the previous j2. +// +// The tags are characters, with these meanings: +// +// 'r' (replace): a[i1:i2] should be replaced by b[j1:j2] +// +// 'd' (delete): a[i1:i2] should be deleted, j1==j2 in this case. +// +// 'i' (insert): b[j1:j2] should be inserted at a[i1:i1], i1==i2 in this case. +// +// 'e' (equal): a[i1:i2] == b[j1:j2] +func (m *SequenceMatcher) GetOpCodes() []OpCode { + if m.opCodes != nil { + return m.opCodes + } + i, j := 0, 0 + matching := m.GetMatchingBlocks() + opCodes := make([]OpCode, 0, len(matching)) + for _, m := range matching { + // invariant: we've pumped out correct diffs to change + // a[:i] into b[:j], and the next matching block is + // a[ai:ai+size] == b[bj:bj+size]. So we need to pump + // out a diff to change a[i:ai] into b[j:bj], pump out + // the matching block, and move (i,j) beyond the match + ai, bj, size := m.A, m.B, m.Size + tag := byte(0) + if i < ai && j < bj { + tag = 'r' + } else if i < ai { + tag = 'd' + } else if j < bj { + tag = 'i' + } + if tag > 0 { + opCodes = append(opCodes, OpCode{tag, i, ai, j, bj}) + } + i, j = ai+size, bj+size + // the list of matching blocks is terminated by a + // sentinel with size 0 + if size > 0 { + opCodes = append(opCodes, OpCode{'e', ai, i, bj, j}) + } + } + m.opCodes = opCodes + return m.opCodes +} + +// Isolate change clusters by eliminating ranges with no changes. +// +// Return a generator of groups with up to n lines of context. +// Each group is in the same format as returned by GetOpCodes(). +func (m *SequenceMatcher) GetGroupedOpCodes(n int) [][]OpCode { + if n < 0 { + n = 3 + } + codes := m.GetOpCodes() + if len(codes) == 0 { + codes = []OpCode{OpCode{'e', 0, 1, 0, 1}} + } + // Fixup leading and trailing groups if they show no changes. + if codes[0].Tag == 'e' { + c := codes[0] + i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2 + codes[0] = OpCode{c.Tag, max(i1, i2-n), i2, max(j1, j2-n), j2} + } + if codes[len(codes)-1].Tag == 'e' { + c := codes[len(codes)-1] + i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2 + codes[len(codes)-1] = OpCode{c.Tag, i1, min(i2, i1+n), j1, min(j2, j1+n)} + } + nn := n + n + groups := [][]OpCode{} + group := []OpCode{} + for _, c := range codes { + i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2 + // End the current group and start a new one whenever + // there is a large range with no changes. + if c.Tag == 'e' && i2-i1 > nn { + group = append(group, OpCode{c.Tag, i1, min(i2, i1+n), + j1, min(j2, j1+n)}) + groups = append(groups, group) + group = []OpCode{} + i1, j1 = max(i1, i2-n), max(j1, j2-n) + } + group = append(group, OpCode{c.Tag, i1, i2, j1, j2}) + } + if len(group) > 0 && !(len(group) == 1 && group[0].Tag == 'e') { + groups = append(groups, group) + } + return groups +} + +// Return a measure of the sequences' similarity (float in [0,1]). +// +// Where T is the total number of elements in both sequences, and +// M is the number of matches, this is 2.0*M / T. +// Note that this is 1 if the sequences are identical, and 0 if +// they have nothing in common. +// +// .Ratio() is expensive to compute if you haven't already computed +// .GetMatchingBlocks() or .GetOpCodes(), in which case you may +// want to try .QuickRatio() or .RealQuickRation() first to get an +// upper bound. +func (m *SequenceMatcher) Ratio() float64 { + matches := 0 + for _, m := range m.GetMatchingBlocks() { + matches += m.Size + } + return calculateRatio(matches, len(m.a)+len(m.b)) +} + +// Return an upper bound on ratio() relatively quickly. +// +// This isn't defined beyond that it is an upper bound on .Ratio(), and +// is faster to compute. +func (m *SequenceMatcher) QuickRatio() float64 { + // viewing a and b as multisets, set matches to the cardinality + // of their intersection; this counts the number of matches + // without regard to order, so is clearly an upper bound + if m.fullBCount == nil { + m.fullBCount = map[string]int{} + for _, s := range m.b { + m.fullBCount[s] = m.fullBCount[s] + 1 + } + } + + // avail[x] is the number of times x appears in 'b' less the + // number of times we've seen it in 'a' so far ... kinda + avail := map[string]int{} + matches := 0 + for _, s := range m.a { + n, ok := avail[s] + if !ok { + n = m.fullBCount[s] + } + avail[s] = n - 1 + if n > 0 { + matches += 1 + } + } + return calculateRatio(matches, len(m.a)+len(m.b)) +} + +// Return an upper bound on ratio() very quickly. +// +// This isn't defined beyond that it is an upper bound on .Ratio(), and +// is faster to compute than either .Ratio() or .QuickRatio(). +func (m *SequenceMatcher) RealQuickRatio() float64 { + la, lb := len(m.a), len(m.b) + return calculateRatio(min(la, lb), la+lb) +} + +// Convert range to the "ed" format +func formatRangeUnified(start, stop int) string { + // Per the diff spec at http://www.unix.org/single_unix_specification/ + beginning := start + 1 // lines start numbering with one + length := stop - start + if length == 1 { + return fmt.Sprintf("%d", beginning) + } + if length == 0 { + beginning -= 1 // empty ranges begin at line just before the range + } + return fmt.Sprintf("%d,%d", beginning, length) +} + +// Unified diff parameters +type UnifiedDiff struct { + A []string // First sequence lines + FromFile string // First file name + FromDate string // First file time + B []string // Second sequence lines + ToFile string // Second file name + ToDate string // Second file time + Eol string // Headers end of line, defaults to LF + Context int // Number of context lines +} + +// Compare two sequences of lines; generate the delta as a unified diff. +// +// Unified diffs are a compact way of showing line changes and a few +// lines of context. The number of context lines is set by 'n' which +// defaults to three. +// +// By default, the diff control lines (those with ---, +++, or @@) are +// created with a trailing newline. This is helpful so that inputs +// created from file.readlines() result in diffs that are suitable for +// file.writelines() since both the inputs and outputs have trailing +// newlines. +// +// For inputs that do not have trailing newlines, set the lineterm +// argument to "" so that the output will be uniformly newline free. +// +// The unidiff format normally has a header for filenames and modification +// times. Any or all of these may be specified using strings for +// 'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'. +// The modification times are normally expressed in the ISO 8601 format. +func WriteUnifiedDiff(writer io.Writer, diff UnifiedDiff) error { + buf := bufio.NewWriter(writer) + defer buf.Flush() + w := func(format string, args ...interface{}) error { + _, err := buf.WriteString(fmt.Sprintf(format, args...)) + return err + } + + if len(diff.Eol) == 0 { + diff.Eol = "\n" + } + + started := false + m := NewMatcher(diff.A, diff.B) + for _, g := range m.GetGroupedOpCodes(diff.Context) { + if !started { + started = true + fromDate := "" + if len(diff.FromDate) > 0 { + fromDate = "\t" + diff.FromDate + } + toDate := "" + if len(diff.ToDate) > 0 { + toDate = "\t" + diff.ToDate + } + err := w("--- %s%s%s", diff.FromFile, fromDate, diff.Eol) + if err != nil { + return err + } + err = w("+++ %s%s%s", diff.ToFile, toDate, diff.Eol) + if err != nil { + return err + } + } + first, last := g[0], g[len(g)-1] + range1 := formatRangeUnified(first.I1, last.I2) + range2 := formatRangeUnified(first.J1, last.J2) + if err := w("@@ -%s +%s @@%s", range1, range2, diff.Eol); err != nil { + return err + } + for _, c := range g { + i1, i2, j1, j2 := c.I1, c.I2, c.J1, c.J2 + if c.Tag == 'e' { + for _, line := range diff.A[i1:i2] { + if err := w(" " + line); err != nil { + return err + } + } + continue + } + if c.Tag == 'r' || c.Tag == 'd' { + for _, line := range diff.A[i1:i2] { + if err := w("-" + line); err != nil { + return err + } + } + } + if c.Tag == 'r' || c.Tag == 'i' { + for _, line := range diff.B[j1:j2] { + if err := w("+" + line); err != nil { + return err + } + } + } + } + } + return nil +} + +// Like WriteUnifiedDiff but returns the diff a string. +func GetUnifiedDiffString(diff UnifiedDiff) (string, error) { + w := &bytes.Buffer{} + err := WriteUnifiedDiff(w, diff) + return string(w.Bytes()), err +} + +// Convert range to the "ed" format. +func formatRangeContext(start, stop int) string { + // Per the diff spec at http://www.unix.org/single_unix_specification/ + beginning := start + 1 // lines start numbering with one + length := stop - start + if length == 0 { + beginning -= 1 // empty ranges begin at line just before the range + } + if length <= 1 { + return fmt.Sprintf("%d", beginning) + } + return fmt.Sprintf("%d,%d", beginning, beginning+length-1) +} + +type ContextDiff UnifiedDiff + +// Compare two sequences of lines; generate the delta as a context diff. +// +// Context diffs are a compact way of showing line changes and a few +// lines of context. The number of context lines is set by diff.Context +// which defaults to three. +// +// By default, the diff control lines (those with *** or ---) are +// created with a trailing newline. +// +// For inputs that do not have trailing newlines, set the diff.Eol +// argument to "" so that the output will be uniformly newline free. +// +// The context diff format normally has a header for filenames and +// modification times. Any or all of these may be specified using +// strings for diff.FromFile, diff.ToFile, diff.FromDate, diff.ToDate. +// The modification times are normally expressed in the ISO 8601 format. +// If not specified, the strings default to blanks. +func WriteContextDiff(writer io.Writer, diff ContextDiff) error { + buf := bufio.NewWriter(writer) + defer buf.Flush() + var diffErr error + w := func(format string, args ...interface{}) { + _, err := buf.WriteString(fmt.Sprintf(format, args...)) + if diffErr == nil && err != nil { + diffErr = err + } + } + + if len(diff.Eol) == 0 { + diff.Eol = "\n" + } + + prefix := map[byte]string{ + 'i': "+ ", + 'd': "- ", + 'r': "! ", + 'e': " ", + } + + started := false + m := NewMatcher(diff.A, diff.B) + for _, g := range m.GetGroupedOpCodes(diff.Context) { + if !started { + started = true + fromDate := "" + if len(diff.FromDate) > 0 { + fromDate = "\t" + diff.FromDate + } + toDate := "" + if len(diff.ToDate) > 0 { + toDate = "\t" + diff.ToDate + } + w("*** %s%s%s", diff.FromFile, fromDate, diff.Eol) + w("--- %s%s%s", diff.ToFile, toDate, diff.Eol) + } + + first, last := g[0], g[len(g)-1] + w("***************" + diff.Eol) + + range1 := formatRangeContext(first.I1, last.I2) + w("*** %s ****%s", range1, diff.Eol) + for _, c := range g { + if c.Tag == 'r' || c.Tag == 'd' { + for _, cc := range g { + if cc.Tag == 'i' { + continue + } + for _, line := range diff.A[cc.I1:cc.I2] { + w(prefix[cc.Tag] + line) + } + } + break + } + } + + range2 := formatRangeContext(first.J1, last.J2) + w("--- %s ----%s", range2, diff.Eol) + for _, c := range g { + if c.Tag == 'r' || c.Tag == 'i' { + for _, cc := range g { + if cc.Tag == 'd' { + continue + } + for _, line := range diff.B[cc.J1:cc.J2] { + w(prefix[cc.Tag] + line) + } + } + break + } + } + } + return diffErr +} + +// Like WriteContextDiff but returns the diff a string. +func GetContextDiffString(diff ContextDiff) (string, error) { + w := &bytes.Buffer{} + err := WriteContextDiff(w, diff) + return string(w.Bytes()), err +} + +// Split a string on "\n" while preserving them. The output can be used +// as input for UnifiedDiff and ContextDiff structures. +func SplitLines(s string) []string { + lines := strings.SplitAfter(s, "\n") + lines[len(lines)-1] += "\n" + return lines +} diff --git a/vendor/github.com/pmezard/go-difflib/difflib/difflib_test.go b/vendor/github.com/pmezard/go-difflib/difflib/difflib_test.go new file mode 100644 index 000000000..94670bea3 --- /dev/null +++ b/vendor/github.com/pmezard/go-difflib/difflib/difflib_test.go @@ -0,0 +1,352 @@ +package difflib + +import ( + "bytes" + "fmt" + "math" + "reflect" + "strings" + "testing" +) + +func assertAlmostEqual(t *testing.T, a, b float64, places int) { + if math.Abs(a-b) > math.Pow10(-places) { + t.Errorf("%.7f != %.7f", a, b) + } +} + +func assertEqual(t *testing.T, a, b interface{}) { + if !reflect.DeepEqual(a, b) { + t.Errorf("%v != %v", a, b) + } +} + +func splitChars(s string) []string { + chars := make([]string, 0, len(s)) + // Assume ASCII inputs + for i := 0; i != len(s); i++ { + chars = append(chars, string(s[i])) + } + return chars +} + +func TestSequenceMatcherRatio(t *testing.T) { + s := NewMatcher(splitChars("abcd"), splitChars("bcde")) + assertEqual(t, s.Ratio(), 0.75) + assertEqual(t, s.QuickRatio(), 0.75) + assertEqual(t, s.RealQuickRatio(), 1.0) +} + +func TestGetOptCodes(t *testing.T) { + a := "qabxcd" + b := "abycdf" + s := NewMatcher(splitChars(a), splitChars(b)) + w := &bytes.Buffer{} + for _, op := range s.GetOpCodes() { + fmt.Fprintf(w, "%s a[%d:%d], (%s) b[%d:%d] (%s)\n", string(op.Tag), + op.I1, op.I2, a[op.I1:op.I2], op.J1, op.J2, b[op.J1:op.J2]) + } + result := string(w.Bytes()) + expected := `d a[0:1], (q) b[0:0] () +e a[1:3], (ab) b[0:2] (ab) +r a[3:4], (x) b[2:3] (y) +e a[4:6], (cd) b[3:5] (cd) +i a[6:6], () b[5:6] (f) +` + if expected != result { + t.Errorf("unexpected op codes: \n%s", result) + } +} + +func TestGroupedOpCodes(t *testing.T) { + a := []string{} + for i := 0; i != 39; i++ { + a = append(a, fmt.Sprintf("%02d", i)) + } + b := []string{} + b = append(b, a[:8]...) + b = append(b, " i") + b = append(b, a[8:19]...) + b = append(b, " x") + b = append(b, a[20:22]...) + b = append(b, a[27:34]...) + b = append(b, " y") + b = append(b, a[35:]...) + s := NewMatcher(a, b) + w := &bytes.Buffer{} + for _, g := range s.GetGroupedOpCodes(-1) { + fmt.Fprintf(w, "group\n") + for _, op := range g { + fmt.Fprintf(w, " %s, %d, %d, %d, %d\n", string(op.Tag), + op.I1, op.I2, op.J1, op.J2) + } + } + result := string(w.Bytes()) + expected := `group + e, 5, 8, 5, 8 + i, 8, 8, 8, 9 + e, 8, 11, 9, 12 +group + e, 16, 19, 17, 20 + r, 19, 20, 20, 21 + e, 20, 22, 21, 23 + d, 22, 27, 23, 23 + e, 27, 30, 23, 26 +group + e, 31, 34, 27, 30 + r, 34, 35, 30, 31 + e, 35, 38, 31, 34 +` + if expected != result { + t.Errorf("unexpected op codes: \n%s", result) + } +} + +func ExampleGetUnifiedDiffString() { + a := `one +two +three +four` + b := `zero +one +three +four` + diff := UnifiedDiff{ + A: SplitLines(a), + B: SplitLines(b), + FromFile: "Original", + FromDate: "2005-01-26 23:30:50", + ToFile: "Current", + ToDate: "2010-04-02 10:20:52", + Context: 3, + } + result, _ := GetUnifiedDiffString(diff) + fmt.Printf(strings.Replace(result, "\t", " ", -1)) + // Output: + // --- Original 2005-01-26 23:30:50 + // +++ Current 2010-04-02 10:20:52 + // @@ -1,4 +1,4 @@ + // +zero + // one + // -two + // three + // four +} + +func ExampleGetContextDiffString() { + a := `one +two +three +four` + b := `zero +one +tree +four` + diff := ContextDiff{ + A: SplitLines(a), + B: SplitLines(b), + FromFile: "Original", + ToFile: "Current", + Context: 3, + Eol: "\n", + } + result, _ := GetContextDiffString(diff) + fmt.Printf(strings.Replace(result, "\t", " ", -1)) + // Output: + // *** Original + // --- Current + // *************** + // *** 1,4 **** + // one + // ! two + // ! three + // four + // --- 1,4 ---- + // + zero + // one + // ! tree + // four +} + +func rep(s string, count int) string { + return strings.Repeat(s, count) +} + +func TestWithAsciiOneInsert(t *testing.T) { + sm := NewMatcher(splitChars(rep("b", 100)), + splitChars("a"+rep("b", 100))) + assertAlmostEqual(t, sm.Ratio(), 0.995, 3) + assertEqual(t, sm.GetOpCodes(), + []OpCode{{'i', 0, 0, 0, 1}, {'e', 0, 100, 1, 101}}) + assertEqual(t, len(sm.bPopular), 0) + + sm = NewMatcher(splitChars(rep("b", 100)), + splitChars(rep("b", 50)+"a"+rep("b", 50))) + assertAlmostEqual(t, sm.Ratio(), 0.995, 3) + assertEqual(t, sm.GetOpCodes(), + []OpCode{{'e', 0, 50, 0, 50}, {'i', 50, 50, 50, 51}, {'e', 50, 100, 51, 101}}) + assertEqual(t, len(sm.bPopular), 0) +} + +func TestWithAsciiOnDelete(t *testing.T) { + sm := NewMatcher(splitChars(rep("a", 40)+"c"+rep("b", 40)), + splitChars(rep("a", 40)+rep("b", 40))) + assertAlmostEqual(t, sm.Ratio(), 0.994, 3) + assertEqual(t, sm.GetOpCodes(), + []OpCode{{'e', 0, 40, 0, 40}, {'d', 40, 41, 40, 40}, {'e', 41, 81, 40, 80}}) +} + +func TestWithAsciiBJunk(t *testing.T) { + isJunk := func(s string) bool { + return s == " " + } + sm := NewMatcherWithJunk(splitChars(rep("a", 40)+rep("b", 40)), + splitChars(rep("a", 44)+rep("b", 40)), true, isJunk) + assertEqual(t, sm.bJunk, map[string]struct{}{}) + + sm = NewMatcherWithJunk(splitChars(rep("a", 40)+rep("b", 40)), + splitChars(rep("a", 44)+rep("b", 40)+rep(" ", 20)), false, isJunk) + assertEqual(t, sm.bJunk, map[string]struct{}{" ": struct{}{}}) + + isJunk = func(s string) bool { + return s == " " || s == "b" + } + sm = NewMatcherWithJunk(splitChars(rep("a", 40)+rep("b", 40)), + splitChars(rep("a", 44)+rep("b", 40)+rep(" ", 20)), false, isJunk) + assertEqual(t, sm.bJunk, map[string]struct{}{" ": struct{}{}, "b": struct{}{}}) +} + +func TestSFBugsRatioForNullSeqn(t *testing.T) { + sm := NewMatcher(nil, nil) + assertEqual(t, sm.Ratio(), 1.0) + assertEqual(t, sm.QuickRatio(), 1.0) + assertEqual(t, sm.RealQuickRatio(), 1.0) +} + +func TestSFBugsComparingEmptyLists(t *testing.T) { + groups := NewMatcher(nil, nil).GetGroupedOpCodes(-1) + assertEqual(t, len(groups), 0) + diff := UnifiedDiff{ + FromFile: "Original", + ToFile: "Current", + Context: 3, + } + result, err := GetUnifiedDiffString(diff) + assertEqual(t, err, nil) + assertEqual(t, result, "") +} + +func TestOutputFormatRangeFormatUnified(t *testing.T) { + // Per the diff spec at http://www.unix.org/single_unix_specification/ + // + // Each field shall be of the form: + // %1d", if the range contains exactly one line, + // and: + // "%1d,%1d", , otherwise. + // If a range is empty, its beginning line number shall be the number of + // the line just before the range, or 0 if the empty range starts the file. + fm := formatRangeUnified + assertEqual(t, fm(3, 3), "3,0") + assertEqual(t, fm(3, 4), "4") + assertEqual(t, fm(3, 5), "4,2") + assertEqual(t, fm(3, 6), "4,3") + assertEqual(t, fm(0, 0), "0,0") +} + +func TestOutputFormatRangeFormatContext(t *testing.T) { + // Per the diff spec at http://www.unix.org/single_unix_specification/ + // + // The range of lines in file1 shall be written in the following format + // if the range contains two or more lines: + // "*** %d,%d ****\n", , + // and the following format otherwise: + // "*** %d ****\n", + // The ending line number of an empty range shall be the number of the preceding line, + // or 0 if the range is at the start of the file. + // + // Next, the range of lines in file2 shall be written in the following format + // if the range contains two or more lines: + // "--- %d,%d ----\n", , + // and the following format otherwise: + // "--- %d ----\n", + fm := formatRangeContext + assertEqual(t, fm(3, 3), "3") + assertEqual(t, fm(3, 4), "4") + assertEqual(t, fm(3, 5), "4,5") + assertEqual(t, fm(3, 6), "4,6") + assertEqual(t, fm(0, 0), "0") +} + +func TestOutputFormatTabDelimiter(t *testing.T) { + diff := UnifiedDiff{ + A: splitChars("one"), + B: splitChars("two"), + FromFile: "Original", + FromDate: "2005-01-26 23:30:50", + ToFile: "Current", + ToDate: "2010-04-12 10:20:52", + Eol: "\n", + } + ud, err := GetUnifiedDiffString(diff) + assertEqual(t, err, nil) + assertEqual(t, SplitLines(ud)[:2], []string{ + "--- Original\t2005-01-26 23:30:50\n", + "+++ Current\t2010-04-12 10:20:52\n", + }) + cd, err := GetContextDiffString(ContextDiff(diff)) + assertEqual(t, err, nil) + assertEqual(t, SplitLines(cd)[:2], []string{ + "*** Original\t2005-01-26 23:30:50\n", + "--- Current\t2010-04-12 10:20:52\n", + }) +} + +func TestOutputFormatNoTrailingTabOnEmptyFiledate(t *testing.T) { + diff := UnifiedDiff{ + A: splitChars("one"), + B: splitChars("two"), + FromFile: "Original", + ToFile: "Current", + Eol: "\n", + } + ud, err := GetUnifiedDiffString(diff) + assertEqual(t, err, nil) + assertEqual(t, SplitLines(ud)[:2], []string{"--- Original\n", "+++ Current\n"}) + + cd, err := GetContextDiffString(ContextDiff(diff)) + assertEqual(t, err, nil) + assertEqual(t, SplitLines(cd)[:2], []string{"*** Original\n", "--- Current\n"}) +} + +func TestSplitLines(t *testing.T) { + allTests := []struct { + input string + want []string + }{ + {"foo", []string{"foo\n"}}, + {"foo\nbar", []string{"foo\n", "bar\n"}}, + {"foo\nbar\n", []string{"foo\n", "bar\n", "\n"}}, + } + for _, test := range allTests { + assertEqual(t, SplitLines(test.input), test.want) + } +} + +func benchmarkSplitLines(b *testing.B, count int) { + str := strings.Repeat("foo\n", count) + + b.ResetTimer() + + n := 0 + for i := 0; i < b.N; i++ { + n += len(SplitLines(str)) + } +} + +func BenchmarkSplitLines100(b *testing.B) { + benchmarkSplitLines(b, 100) +} + +func BenchmarkSplitLines10000(b *testing.B) { + benchmarkSplitLines(b, 10000) +} diff --git a/vendor/github.com/stretchr/objx/.gitignore b/vendor/github.com/stretchr/objx/.gitignore new file mode 100644 index 000000000..00268614f --- /dev/null +++ b/vendor/github.com/stretchr/objx/.gitignore @@ -0,0 +1,22 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe diff --git a/vendor/github.com/stretchr/objx/LICENSE.md b/vendor/github.com/stretchr/objx/LICENSE.md new file mode 100644 index 000000000..219994581 --- /dev/null +++ b/vendor/github.com/stretchr/objx/LICENSE.md @@ -0,0 +1,23 @@ +objx - by Mat Ryer and Tyler Bunnell + +The MIT License (MIT) + +Copyright (c) 2014 Stretchr, Inc. + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/vendor/github.com/stretchr/objx/README.md b/vendor/github.com/stretchr/objx/README.md new file mode 100644 index 000000000..4aa180687 --- /dev/null +++ b/vendor/github.com/stretchr/objx/README.md @@ -0,0 +1,3 @@ +# objx + + * Jump into the [API Documentation](http://godoc.org/github.com/stretchr/objx) diff --git a/vendor/github.com/stretchr/objx/accessors.go b/vendor/github.com/stretchr/objx/accessors.go new file mode 100644 index 000000000..721bcac79 --- /dev/null +++ b/vendor/github.com/stretchr/objx/accessors.go @@ -0,0 +1,179 @@ +package objx + +import ( + "fmt" + "regexp" + "strconv" + "strings" +) + +// arrayAccesRegexString is the regex used to extract the array number +// from the access path +const arrayAccesRegexString = `^(.+)\[([0-9]+)\]$` + +// arrayAccesRegex is the compiled arrayAccesRegexString +var arrayAccesRegex = regexp.MustCompile(arrayAccesRegexString) + +// Get gets the value using the specified selector and +// returns it inside a new Obj object. +// +// If it cannot find the value, Get will return a nil +// value inside an instance of Obj. +// +// Get can only operate directly on map[string]interface{} and []interface. +// +// Example +// +// To access the title of the third chapter of the second book, do: +// +// o.Get("books[1].chapters[2].title") +func (m Map) Get(selector string) *Value { + rawObj := access(m, selector, nil, false, false) + return &Value{data: rawObj} +} + +// Set sets the value using the specified selector and +// returns the object on which Set was called. +// +// Set can only operate directly on map[string]interface{} and []interface +// +// Example +// +// To set the title of the third chapter of the second book, do: +// +// o.Set("books[1].chapters[2].title","Time to Go") +func (m Map) Set(selector string, value interface{}) Map { + access(m, selector, value, true, false) + return m +} + +// access accesses the object using the selector and performs the +// appropriate action. +func access(current, selector, value interface{}, isSet, panics bool) interface{} { + + switch selector.(type) { + case int, int8, int16, int32, int64, uint, uint8, uint16, uint32, uint64: + + if array, ok := current.([]interface{}); ok { + index := intFromInterface(selector) + + if index >= len(array) { + if panics { + panic(fmt.Sprintf("objx: Index %d is out of range. Slice only contains %d items.", index, len(array))) + } + return nil + } + + return array[index] + } + + return nil + + case string: + + selStr := selector.(string) + selSegs := strings.SplitN(selStr, PathSeparator, 2) + thisSel := selSegs[0] + index := -1 + var err error + + // https://github.com/stretchr/objx/issues/12 + if strings.Contains(thisSel, "[") { + + arrayMatches := arrayAccesRegex.FindStringSubmatch(thisSel) + + if len(arrayMatches) > 0 { + + // Get the key into the map + thisSel = arrayMatches[1] + + // Get the index into the array at the key + index, err = strconv.Atoi(arrayMatches[2]) + + if err != nil { + // This should never happen. If it does, something has gone + // seriously wrong. Panic. + panic("objx: Array index is not an integer. Must use array[int].") + } + + } + } + + if curMap, ok := current.(Map); ok { + current = map[string]interface{}(curMap) + } + + // get the object in question + switch current.(type) { + case map[string]interface{}: + curMSI := current.(map[string]interface{}) + if len(selSegs) <= 1 && isSet { + curMSI[thisSel] = value + return nil + } else { + current = curMSI[thisSel] + } + default: + current = nil + } + + if current == nil && panics { + panic(fmt.Sprintf("objx: '%v' invalid on object.", selector)) + } + + // do we need to access the item of an array? + if index > -1 { + if array, ok := current.([]interface{}); ok { + if index < len(array) { + current = array[index] + } else { + if panics { + panic(fmt.Sprintf("objx: Index %d is out of range. Slice only contains %d items.", index, len(array))) + } + current = nil + } + } + } + + if len(selSegs) > 1 { + current = access(current, selSegs[1], value, isSet, panics) + } + + } + + return current + +} + +// intFromInterface converts an interface object to the largest +// representation of an unsigned integer using a type switch and +// assertions +func intFromInterface(selector interface{}) int { + var value int + switch selector.(type) { + case int: + value = selector.(int) + case int8: + value = int(selector.(int8)) + case int16: + value = int(selector.(int16)) + case int32: + value = int(selector.(int32)) + case int64: + value = int(selector.(int64)) + case uint: + value = int(selector.(uint)) + case uint8: + value = int(selector.(uint8)) + case uint16: + value = int(selector.(uint16)) + case uint32: + value = int(selector.(uint32)) + case uint64: + value = int(selector.(uint64)) + default: + panic("objx: array access argument is not an integer type (this should never happen)") + } + + return value +} diff --git a/vendor/github.com/stretchr/objx/accessors_test.go b/vendor/github.com/stretchr/objx/accessors_test.go new file mode 100644 index 000000000..ce5d8e4aa --- /dev/null +++ b/vendor/github.com/stretchr/objx/accessors_test.go @@ -0,0 +1,145 @@ +package objx + +import ( + "github.com/stretchr/testify/assert" + "testing" +) + +func TestAccessorsAccessGetSingleField(t *testing.T) { + + current := map[string]interface{}{"name": "Tyler"} + assert.Equal(t, "Tyler", access(current, "name", nil, false, true)) + +} +func TestAccessorsAccessGetDeep(t *testing.T) { + + current := map[string]interface{}{"name": map[string]interface{}{"first": "Tyler", "last": "Bunnell"}} + assert.Equal(t, "Tyler", access(current, "name.first", nil, false, true)) + assert.Equal(t, "Bunnell", access(current, "name.last", nil, false, true)) + +} +func TestAccessorsAccessGetDeepDeep(t *testing.T) { + + current := map[string]interface{}{"one": map[string]interface{}{"two": map[string]interface{}{"three": map[string]interface{}{"four": 4}}}} + assert.Equal(t, 4, access(current, "one.two.three.four", nil, false, true)) + +} +func TestAccessorsAccessGetInsideArray(t *testing.T) { + + current := map[string]interface{}{"names": []interface{}{map[string]interface{}{"first": "Tyler", "last": "Bunnell"}, map[string]interface{}{"first": "Capitol", "last": "Bollocks"}}} + assert.Equal(t, "Tyler", access(current, "names[0].first", nil, false, true)) + assert.Equal(t, "Bunnell", access(current, "names[0].last", nil, false, true)) + assert.Equal(t, "Capitol", access(current, "names[1].first", nil, false, true)) + assert.Equal(t, "Bollocks", access(current, "names[1].last", nil, false, true)) + + assert.Panics(t, func() { + access(current, "names[2]", nil, false, true) + }) + assert.Nil(t, access(current, "names[2]", nil, false, false)) + +} + +func TestAccessorsAccessGetFromArrayWithInt(t *testing.T) { + + current := []interface{}{map[string]interface{}{"first": "Tyler", "last": "Bunnell"}, map[string]interface{}{"first": "Capitol", "last": "Bollocks"}} + one := access(current, 0, nil, false, false) + two := access(current, 1, nil, false, false) + three := access(current, 2, nil, false, false) + + assert.Equal(t, "Tyler", one.(map[string]interface{})["first"]) + assert.Equal(t, "Capitol", two.(map[string]interface{})["first"]) + assert.Nil(t, three) + +} + +func TestAccessorsGet(t *testing.T) { + + current := New(map[string]interface{}{"name": "Tyler"}) + assert.Equal(t, "Tyler", current.Get("name").data) + +} + +func TestAccessorsAccessSetSingleField(t *testing.T) { + + current := map[string]interface{}{"name": "Tyler"} + access(current, "name", "Mat", true, false) + assert.Equal(t, current["name"], "Mat") + + access(current, "age", 29, true, true) + assert.Equal(t, current["age"], 29) + +} + +func TestAccessorsAccessSetSingleFieldNotExisting(t *testing.T) { + + current := map[string]interface{}{} + access(current, "name", "Mat", true, false) + assert.Equal(t, current["name"], "Mat") + +} + +func TestAccessorsAccessSetDeep(t *testing.T) { + + current := map[string]interface{}{"name": map[string]interface{}{"first": "Tyler", "last": "Bunnell"}} + + access(current, "name.first", "Mat", true, true) + access(current, "name.last", "Ryer", true, true) + + assert.Equal(t, "Mat", access(current, "name.first", nil, false, true)) + assert.Equal(t, "Ryer", access(current, "name.last", nil, false, true)) + +} +func TestAccessorsAccessSetDeepDeep(t *testing.T) { + + current := map[string]interface{}{"one": map[string]interface{}{"two": map[string]interface{}{"three": map[string]interface{}{"four": 4}}}} + + access(current, "one.two.three.four", 5, true, true) + + assert.Equal(t, 5, access(current, "one.two.three.four", nil, false, true)) + +} +func TestAccessorsAccessSetArray(t *testing.T) { + + current := map[string]interface{}{"names": []interface{}{"Tyler"}} + + access(current, "names[0]", "Mat", true, true) + + assert.Equal(t, "Mat", access(current, "names[0]", nil, false, true)) + +} +func TestAccessorsAccessSetInsideArray(t *testing.T) { + + current := map[string]interface{}{"names": []interface{}{map[string]interface{}{"first": "Tyler", "last": "Bunnell"}, map[string]interface{}{"first": "Capitol", "last": "Bollocks"}}} + + access(current, "names[0].first", "Mat", true, true) + access(current, "names[0].last", "Ryer", true, true) + access(current, "names[1].first", "Captain", true, true) + access(current, "names[1].last", "Underpants", true, true) + + assert.Equal(t, "Mat", access(current, "names[0].first", nil, false, true)) + assert.Equal(t, "Ryer", access(current, "names[0].last", nil, false, true)) + assert.Equal(t, "Captain", access(current, "names[1].first", nil, false, true)) + assert.Equal(t, "Underpants", access(current, "names[1].last", nil, false, true)) + +} + +func TestAccessorsAccessSetFromArrayWithInt(t *testing.T) { + + current := []interface{}{map[string]interface{}{"first": "Tyler", "last": "Bunnell"}, map[string]interface{}{"first": "Capitol", "last": "Bollocks"}} + one := access(current, 0, nil, false, false) + two := access(current, 1, nil, false, false) + three := access(current, 2, nil, false, false) + + assert.Equal(t, "Tyler", one.(map[string]interface{})["first"]) + assert.Equal(t, "Capitol", two.(map[string]interface{})["first"]) + assert.Nil(t, three) + +} + +func TestAccessorsSet(t *testing.T) { + + current := New(map[string]interface{}{"name": "Tyler"}) + current.Set("name", "Mat") + assert.Equal(t, "Mat", current.Get("name").data) + +} diff --git a/vendor/github.com/stretchr/objx/codegen/array-access.txt b/vendor/github.com/stretchr/objx/codegen/array-access.txt new file mode 100644 index 000000000..306023475 --- /dev/null +++ b/vendor/github.com/stretchr/objx/codegen/array-access.txt @@ -0,0 +1,14 @@ + case []{1}: + a := object.([]{1}) + if isSet { + a[index] = value.({1}) + } else { + if index >= len(a) { + if panics { + panic(fmt.Sprintf("objx: Index %d is out of range because the []{1} only contains %d items.", index, len(a))) + } + return nil + } else { + return a[index] + } + } diff --git a/vendor/github.com/stretchr/objx/codegen/index.html b/vendor/github.com/stretchr/objx/codegen/index.html new file mode 100644 index 000000000..379ffc3c0 --- /dev/null +++ b/vendor/github.com/stretchr/objx/codegen/index.html @@ -0,0 +1,86 @@ + + + + Codegen + + + + + +

+ Template +

+

+ Use {x} as a placeholder for each argument. +

+ + +

+ Arguments (comma separated) +

+

+ One block per line +

+ + +

+ Output +

+ + + + + + + + diff --git a/vendor/github.com/stretchr/objx/codegen/template.txt b/vendor/github.com/stretchr/objx/codegen/template.txt new file mode 100644 index 000000000..b396900b8 --- /dev/null +++ b/vendor/github.com/stretchr/objx/codegen/template.txt @@ -0,0 +1,286 @@ +/* + {4} ({1} and []{1}) + -------------------------------------------------- +*/ + +// {4} gets the value as a {1}, returns the optionalDefault +// value or a system default object if the value is the wrong type. +func (v *Value) {4}(optionalDefault ...{1}) {1} { + if s, ok := v.data.({1}); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return {3} +} + +// Must{4} gets the value as a {1}. +// +// Panics if the object is not a {1}. +func (v *Value) Must{4}() {1} { + return v.data.({1}) +} + +// {4}Slice gets the value as a []{1}, returns the optionalDefault +// value or nil if the value is not a []{1}. +func (v *Value) {4}Slice(optionalDefault ...[]{1}) []{1} { + if s, ok := v.data.([]{1}); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return nil +} + +// Must{4}Slice gets the value as a []{1}. +// +// Panics if the object is not a []{1}. +func (v *Value) Must{4}Slice() []{1} { + return v.data.([]{1}) +} + +// Is{4} gets whether the object contained is a {1} or not. +func (v *Value) Is{4}() bool { + _, ok := v.data.({1}) + return ok +} + +// Is{4}Slice gets whether the object contained is a []{1} or not. +func (v *Value) Is{4}Slice() bool { + _, ok := v.data.([]{1}) + return ok +} + +// Each{4} calls the specified callback for each object +// in the []{1}. +// +// Panics if the object is the wrong type. +func (v *Value) Each{4}(callback func(int, {1}) bool) *Value { + + for index, val := range v.Must{4}Slice() { + carryon := callback(index, val) + if carryon == false { + break + } + } + + return v + +} + +// Where{4} uses the specified decider function to select items +// from the []{1}. The object contained in the result will contain +// only the selected items. +func (v *Value) Where{4}(decider func(int, {1}) bool) *Value { + + var selected []{1} + + v.Each{4}(func(index int, val {1}) bool { + shouldSelect := decider(index, val) + if shouldSelect == false { + selected = append(selected, val) + } + return true + }) + + return &Value{data:selected} + +} + +// Group{4} uses the specified grouper function to group the items +// keyed by the return of the grouper. The object contained in the +// result will contain a map[string][]{1}. +func (v *Value) Group{4}(grouper func(int, {1}) string) *Value { + + groups := make(map[string][]{1}) + + v.Each{4}(func(index int, val {1}) bool { + group := grouper(index, val) + if _, ok := groups[group]; !ok { + groups[group] = make([]{1}, 0) + } + groups[group] = append(groups[group], val) + return true + }) + + return &Value{data:groups} + +} + +// Replace{4} uses the specified function to replace each {1}s +// by iterating each item. The data in the returned result will be a +// []{1} containing the replaced items. +func (v *Value) Replace{4}(replacer func(int, {1}) {1}) *Value { + + arr := v.Must{4}Slice() + replaced := make([]{1}, len(arr)) + + v.Each{4}(func(index int, val {1}) bool { + replaced[index] = replacer(index, val) + return true + }) + + return &Value{data:replaced} + +} + +// Collect{4} uses the specified collector function to collect a value +// for each of the {1}s in the slice. The data returned will be a +// []interface{}. +func (v *Value) Collect{4}(collector func(int, {1}) interface{}) *Value { + + arr := v.Must{4}Slice() + collected := make([]interface{}, len(arr)) + + v.Each{4}(func(index int, val {1}) bool { + collected[index] = collector(index, val) + return true + }) + + return &Value{data:collected} +} + +// ************************************************************ +// TESTS +// ************************************************************ + +func Test{4}(t *testing.T) { + + val := {1}( {2} ) + m := map[string]interface{}{"value": val, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").{4}()) + assert.Equal(t, val, New(m).Get("value").Must{4}()) + assert.Equal(t, {1}({3}), New(m).Get("nothing").{4}()) + assert.Equal(t, val, New(m).Get("nothing").{4}({2})) + + assert.Panics(t, func() { + New(m).Get("age").Must{4}() + }) + +} + +func Test{4}Slice(t *testing.T) { + + val := {1}( {2} ) + m := map[string]interface{}{"value": []{1}{ val }, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").{4}Slice()[0]) + assert.Equal(t, val, New(m).Get("value").Must{4}Slice()[0]) + assert.Equal(t, []{1}(nil), New(m).Get("nothing").{4}Slice()) + assert.Equal(t, val, New(m).Get("nothing").{4}Slice( []{1}{ {1}({2}) } )[0]) + + assert.Panics(t, func() { + New(m).Get("nothing").Must{4}Slice() + }) + +} + +func TestIs{4}(t *testing.T) { + + var v *Value + + v = &Value{data: {1}({2})} + assert.True(t, v.Is{4}()) + + v = &Value{data: []{1}{ {1}({2}) }} + assert.True(t, v.Is{4}Slice()) + +} + +func TestEach{4}(t *testing.T) { + + v := &Value{data: []{1}{ {1}({2}), {1}({2}), {1}({2}), {1}({2}), {1}({2}) }} + count := 0 + replacedVals := make([]{1}, 0) + assert.Equal(t, v, v.Each{4}(func(i int, val {1}) bool { + + count++ + replacedVals = append(replacedVals, val) + + // abort early + if i == 2 { + return false + } + + return true + + })) + + assert.Equal(t, count, 3) + assert.Equal(t, replacedVals[0], v.Must{4}Slice()[0]) + assert.Equal(t, replacedVals[1], v.Must{4}Slice()[1]) + assert.Equal(t, replacedVals[2], v.Must{4}Slice()[2]) + +} + +func TestWhere{4}(t *testing.T) { + + v := &Value{data: []{1}{ {1}({2}), {1}({2}), {1}({2}), {1}({2}), {1}({2}), {1}({2}) }} + + selected := v.Where{4}(func(i int, val {1}) bool { + return i%2==0 + }).Must{4}Slice() + + assert.Equal(t, 3, len(selected)) + +} + +func TestGroup{4}(t *testing.T) { + + v := &Value{data: []{1}{ {1}({2}), {1}({2}), {1}({2}), {1}({2}), {1}({2}), {1}({2}) }} + + grouped := v.Group{4}(func(i int, val {1}) string { + return fmt.Sprintf("%v", i%2==0) + }).data.(map[string][]{1}) + + assert.Equal(t, 2, len(grouped)) + assert.Equal(t, 3, len(grouped["true"])) + assert.Equal(t, 3, len(grouped["false"])) + +} + +func TestReplace{4}(t *testing.T) { + + v := &Value{data: []{1}{ {1}({2}), {1}({2}), {1}({2}), {1}({2}), {1}({2}), {1}({2}) }} + + rawArr := v.Must{4}Slice() + + replaced := v.Replace{4}(func(index int, val {1}) {1} { + if index < len(rawArr)-1 { + return rawArr[index+1] + } + return rawArr[0] + }) + + replacedArr := replaced.Must{4}Slice() + if assert.Equal(t, 6, len(replacedArr)) { + assert.Equal(t, replacedArr[0], rawArr[1]) + assert.Equal(t, replacedArr[1], rawArr[2]) + assert.Equal(t, replacedArr[2], rawArr[3]) + assert.Equal(t, replacedArr[3], rawArr[4]) + assert.Equal(t, replacedArr[4], rawArr[5]) + assert.Equal(t, replacedArr[5], rawArr[0]) + } + +} + +func TestCollect{4}(t *testing.T) { + + v := &Value{data: []{1}{ {1}({2}), {1}({2}), {1}({2}), {1}({2}), {1}({2}), {1}({2}) }} + + collected := v.Collect{4}(func(index int, val {1}) interface{} { + return index + }) + + collectedArr := collected.MustInterSlice() + if assert.Equal(t, 6, len(collectedArr)) { + assert.Equal(t, collectedArr[0], 0) + assert.Equal(t, collectedArr[1], 1) + assert.Equal(t, collectedArr[2], 2) + assert.Equal(t, collectedArr[3], 3) + assert.Equal(t, collectedArr[4], 4) + assert.Equal(t, collectedArr[5], 5) + } + +} diff --git a/vendor/github.com/stretchr/objx/codegen/types_list.txt b/vendor/github.com/stretchr/objx/codegen/types_list.txt new file mode 100644 index 000000000..069d43d8e --- /dev/null +++ b/vendor/github.com/stretchr/objx/codegen/types_list.txt @@ -0,0 +1,20 @@ +Interface,interface{},"something",nil,Inter +Map,map[string]interface{},map[string]interface{}{"name":"Tyler"},nil,MSI +ObjxMap,(Map),New(1),New(nil),ObjxMap +Bool,bool,true,false,Bool +String,string,"hello","",Str +Int,int,1,0,Int +Int8,int8,1,0,Int8 +Int16,int16,1,0,Int16 +Int32,int32,1,0,Int32 +Int64,int64,1,0,Int64 +Uint,uint,1,0,Uint +Uint8,uint8,1,0,Uint8 +Uint16,uint16,1,0,Uint16 +Uint32,uint32,1,0,Uint32 +Uint64,uint64,1,0,Uint64 +Uintptr,uintptr,1,0,Uintptr +Float32,float32,1,0,Float32 +Float64,float64,1,0,Float64 +Complex64,complex64,1,0,Complex64 +Complex128,complex128,1,0,Complex128 diff --git a/vendor/github.com/stretchr/objx/constants.go b/vendor/github.com/stretchr/objx/constants.go new file mode 100644 index 000000000..f9eb42a25 --- /dev/null +++ b/vendor/github.com/stretchr/objx/constants.go @@ -0,0 +1,13 @@ +package objx + +const ( + // PathSeparator is the character used to separate the elements + // of the keypath. + // + // For example, `location.address.city` + PathSeparator string = "." + + // SignatureSeparator is the character that is used to + // separate the Base64 string from the security signature. + SignatureSeparator = "_" +) diff --git a/vendor/github.com/stretchr/objx/conversions.go b/vendor/github.com/stretchr/objx/conversions.go new file mode 100644 index 000000000..9cdfa9f9f --- /dev/null +++ b/vendor/github.com/stretchr/objx/conversions.go @@ -0,0 +1,117 @@ +package objx + +import ( + "bytes" + "encoding/base64" + "encoding/json" + "errors" + "fmt" + "net/url" +) + +// JSON converts the contained object to a JSON string +// representation +func (m Map) JSON() (string, error) { + + result, err := json.Marshal(m) + + if err != nil { + err = errors.New("objx: JSON encode failed with: " + err.Error()) + } + + return string(result), err + +} + +// MustJSON converts the contained object to a JSON string +// representation and panics if there is an error +func (m Map) MustJSON() string { + result, err := m.JSON() + if err != nil { + panic(err.Error()) + } + return result +} + +// Base64 converts the contained object to a Base64 string +// representation of the JSON string representation +func (m Map) Base64() (string, error) { + + var buf bytes.Buffer + + jsonData, err := m.JSON() + if err != nil { + return "", err + } + + encoder := base64.NewEncoder(base64.StdEncoding, &buf) + encoder.Write([]byte(jsonData)) + encoder.Close() + + return buf.String(), nil + +} + +// MustBase64 converts the contained object to a Base64 string +// representation of the JSON string representation and panics +// if there is an error +func (m Map) MustBase64() string { + result, err := m.Base64() + if err != nil { + panic(err.Error()) + } + return result +} + +// SignedBase64 converts the contained object to a Base64 string +// representation of the JSON string representation and signs it +// using the provided key. +func (m Map) SignedBase64(key string) (string, error) { + + base64, err := m.Base64() + if err != nil { + return "", err + } + + sig := HashWithKey(base64, key) + + return base64 + SignatureSeparator + sig, nil + +} + +// MustSignedBase64 converts the contained object to a Base64 string +// representation of the JSON string representation and signs it +// using the provided key and panics if there is an error +func (m Map) MustSignedBase64(key string) string { + result, err := m.SignedBase64(key) + if err != nil { + panic(err.Error()) + } + return result +} + +/* + URL Query + ------------------------------------------------ +*/ + +// URLValues creates a url.Values object from an Obj. This +// function requires that the wrapped object be a map[string]interface{} +func (m Map) URLValues() url.Values { + + vals := make(url.Values) + + for k, v := range m { + //TODO: can this be done without sprintf? + vals.Set(k, fmt.Sprintf("%v", v)) + } + + return vals +} + +// URLQuery gets an encoded URL query representing the given +// Obj. This function requires that the wrapped object be a +// map[string]interface{} +func (m Map) URLQuery() (string, error) { + return m.URLValues().Encode(), nil +} diff --git a/vendor/github.com/stretchr/objx/conversions_test.go b/vendor/github.com/stretchr/objx/conversions_test.go new file mode 100644 index 000000000..e9ccd2987 --- /dev/null +++ b/vendor/github.com/stretchr/objx/conversions_test.go @@ -0,0 +1,94 @@ +package objx + +import ( + "github.com/stretchr/testify/assert" + "testing" +) + +func TestConversionJSON(t *testing.T) { + + jsonString := `{"name":"Mat"}` + o := MustFromJSON(jsonString) + + result, err := o.JSON() + + if assert.NoError(t, err) { + assert.Equal(t, jsonString, result) + } + + assert.Equal(t, jsonString, o.MustJSON()) + +} + +func TestConversionJSONWithError(t *testing.T) { + + o := MSI() + o["test"] = func() {} + + assert.Panics(t, func() { + o.MustJSON() + }) + + _, err := o.JSON() + + assert.Error(t, err) + +} + +func TestConversionBase64(t *testing.T) { + + o := New(map[string]interface{}{"name": "Mat"}) + + result, err := o.Base64() + + if assert.NoError(t, err) { + assert.Equal(t, "eyJuYW1lIjoiTWF0In0=", result) + } + + assert.Equal(t, "eyJuYW1lIjoiTWF0In0=", o.MustBase64()) + +} + +func TestConversionBase64WithError(t *testing.T) { + + o := MSI() + o["test"] = func() {} + + assert.Panics(t, func() { + o.MustBase64() + }) + + _, err := o.Base64() + + assert.Error(t, err) + +} + +func TestConversionSignedBase64(t *testing.T) { + + o := New(map[string]interface{}{"name": "Mat"}) + + result, err := o.SignedBase64("key") + + if assert.NoError(t, err) { + assert.Equal(t, "eyJuYW1lIjoiTWF0In0=_67ee82916f90b2c0d68c903266e8998c9ef0c3d6", result) + } + + assert.Equal(t, "eyJuYW1lIjoiTWF0In0=_67ee82916f90b2c0d68c903266e8998c9ef0c3d6", o.MustSignedBase64("key")) + +} + +func TestConversionSignedBase64WithError(t *testing.T) { + + o := MSI() + o["test"] = func() {} + + assert.Panics(t, func() { + o.MustSignedBase64("key") + }) + + _, err := o.SignedBase64("key") + + assert.Error(t, err) + +} diff --git a/vendor/github.com/stretchr/objx/doc.go b/vendor/github.com/stretchr/objx/doc.go new file mode 100644 index 000000000..47bf85e46 --- /dev/null +++ b/vendor/github.com/stretchr/objx/doc.go @@ -0,0 +1,72 @@ +// objx - Go package for dealing with maps, slices, JSON and other data. +// +// Overview +// +// Objx provides the `objx.Map` type, which is a `map[string]interface{}` that exposes +// a powerful `Get` method (among others) that allows you to easily and quickly get +// access to data within the map, without having to worry too much about type assertions, +// missing data, default values etc. +// +// Pattern +// +// Objx uses a preditable pattern to make access data from within `map[string]interface{}'s +// easy. +// +// Call one of the `objx.` functions to create your `objx.Map` to get going: +// +// m, err := objx.FromJSON(json) +// +// NOTE: Any methods or functions with the `Must` prefix will panic if something goes wrong, +// the rest will be optimistic and try to figure things out without panicking. +// +// Use `Get` to access the value you're interested in. You can use dot and array +// notation too: +// +// m.Get("places[0].latlng") +// +// Once you have saught the `Value` you're interested in, you can use the `Is*` methods +// to determine its type. +// +// if m.Get("code").IsStr() { /* ... */ } +// +// Or you can just assume the type, and use one of the strong type methods to +// extract the real value: +// +// m.Get("code").Int() +// +// If there's no value there (or if it's the wrong type) then a default value +// will be returned, or you can be explicit about the default value. +// +// Get("code").Int(-1) +// +// If you're dealing with a slice of data as a value, Objx provides many useful +// methods for iterating, manipulating and selecting that data. You can find out more +// by exploring the index below. +// +// Reading data +// +// A simple example of how to use Objx: +// +// // use MustFromJSON to make an objx.Map from some JSON +// m := objx.MustFromJSON(`{"name": "Mat", "age": 30}`) +// +// // get the details +// name := m.Get("name").Str() +// age := m.Get("age").Int() +// +// // get their nickname (or use their name if they +// // don't have one) +// nickname := m.Get("nickname").Str(name) +// +// Ranging +// +// Since `objx.Map` is a `map[string]interface{}` you can treat it as such. For +// example, to `range` the data, do what you would expect: +// +// m := objx.MustFromJSON(json) +// for key, value := range m { +// +// /* ... do your magic ... */ +// +// } +package objx diff --git a/vendor/github.com/stretchr/objx/fixture_test.go b/vendor/github.com/stretchr/objx/fixture_test.go new file mode 100644 index 000000000..27f7d9049 --- /dev/null +++ b/vendor/github.com/stretchr/objx/fixture_test.go @@ -0,0 +1,98 @@ +package objx + +import ( + "github.com/stretchr/testify/assert" + "testing" +) + +var fixtures = []struct { + // name is the name of the fixture (used for reporting + // failures) + name string + // data is the JSON data to be worked on + data string + // get is the argument(s) to pass to Get + get interface{} + // output is the expected output + output interface{} +}{ + { + name: "Simple get", + data: `{"name": "Mat"}`, + get: "name", + output: "Mat", + }, + { + name: "Get with dot notation", + data: `{"address": {"city": "Boulder"}}`, + get: "address.city", + output: "Boulder", + }, + { + name: "Deep get with dot notation", + data: `{"one": {"two": {"three": {"four": "hello"}}}}`, + get: "one.two.three.four", + output: "hello", + }, + { + name: "Get missing with dot notation", + data: `{"one": {"two": {"three": {"four": "hello"}}}}`, + get: "one.ten", + output: nil, + }, + { + name: "Get with array notation", + data: `{"tags": ["one", "two", "three"]}`, + get: "tags[1]", + output: "two", + }, + { + name: "Get with array and dot notation", + data: `{"types": { "tags": ["one", "two", "three"]}}`, + get: "types.tags[1]", + output: "two", + }, + { + name: "Get with array and dot notation - field after array", + data: `{"tags": [{"name":"one"}, {"name":"two"}, {"name":"three"}]}`, + get: "tags[1].name", + output: "two", + }, + { + name: "Complex get with array and dot notation", + data: `{"tags": [{"list": [{"one":"pizza"}]}]}`, + get: "tags[0].list[0].one", + output: "pizza", + }, + { + name: "Get field from within string should be nil", + data: `{"name":"Tyler"}`, + get: "name.something", + output: nil, + }, + { + name: "Get field from within string (using array accessor) should be nil", + data: `{"numbers":["one", "two", "three"]}`, + get: "numbers[0].nope", + output: nil, + }, +} + +func TestFixtures(t *testing.T) { + + for _, fixture := range fixtures { + + m := MustFromJSON(fixture.data) + + // get the value + t.Logf("Running get fixture: \"%s\" (%v)", fixture.name, fixture) + value := m.Get(fixture.get.(string)) + + // make sure it matches + assert.Equal(t, fixture.output, value.data, + "Get fixture \"%s\" failed: %v", fixture.name, fixture, + ) + + } + +} diff --git a/vendor/github.com/stretchr/objx/map.go b/vendor/github.com/stretchr/objx/map.go new file mode 100644 index 000000000..eb6ed8e28 --- /dev/null +++ b/vendor/github.com/stretchr/objx/map.go @@ -0,0 +1,222 @@ +package objx + +import ( + "encoding/base64" + "encoding/json" + "errors" + "io/ioutil" + "net/url" + "strings" +) + +// MSIConvertable is an interface that defines methods for converting your +// custom types to a map[string]interface{} representation. +type MSIConvertable interface { + // MSI gets a map[string]interface{} (msi) representing the + // object. + MSI() map[string]interface{} +} + +// Map provides extended functionality for working with +// untyped data, in particular map[string]interface (msi). +type Map map[string]interface{} + +// Value returns the internal value instance +func (m Map) Value() *Value { + return &Value{data: m} +} + +// Nil represents a nil Map. +var Nil Map = New(nil) + +// New creates a new Map containing the map[string]interface{} in the data argument. +// If the data argument is not a map[string]interface, New attempts to call the +// MSI() method on the MSIConvertable interface to create one. +func New(data interface{}) Map { + if _, ok := data.(map[string]interface{}); !ok { + if converter, ok := data.(MSIConvertable); ok { + data = converter.MSI() + } else { + return nil + } + } + return Map(data.(map[string]interface{})) +} + +// MSI creates a map[string]interface{} and puts it inside a new Map. +// +// The arguments follow a key, value pattern. +// +// Panics +// +// Panics if any key arugment is non-string or if there are an odd number of arguments. +// +// Example +// +// To easily create Maps: +// +// m := objx.MSI("name", "Mat", "age", 29, "subobj", objx.MSI("active", true)) +// +// // creates an Map equivalent to +// m := objx.New(map[string]interface{}{"name": "Mat", "age": 29, "subobj": map[string]interface{}{"active": true}}) +func MSI(keyAndValuePairs ...interface{}) Map { + + newMap := make(map[string]interface{}) + keyAndValuePairsLen := len(keyAndValuePairs) + + if keyAndValuePairsLen%2 != 0 { + panic("objx: MSI must have an even number of arguments following the 'key, value' pattern.") + } + + for i := 0; i < keyAndValuePairsLen; i = i + 2 { + + key := keyAndValuePairs[i] + value := keyAndValuePairs[i+1] + + // make sure the key is a string + keyString, keyStringOK := key.(string) + if !keyStringOK { + panic("objx: MSI must follow 'string, interface{}' pattern. " + keyString + " is not a valid key.") + } + + newMap[keyString] = value + + } + + return New(newMap) +} + +// ****** Conversion Constructors + +// MustFromJSON creates a new Map containing the data specified in the +// jsonString. +// +// Panics if the JSON is invalid. +func MustFromJSON(jsonString string) Map { + o, err := FromJSON(jsonString) + + if err != nil { + panic("objx: MustFromJSON failed with error: " + err.Error()) + } + + return o +} + +// FromJSON creates a new Map containing the data specified in the +// jsonString. +// +// Returns an error if the JSON is invalid. +func FromJSON(jsonString string) (Map, error) { + + var data interface{} + err := json.Unmarshal([]byte(jsonString), &data) + + if err != nil { + return Nil, err + } + + return New(data), nil + +} + +// FromBase64 creates a new Obj containing the data specified +// in the Base64 string. +// +// The string is an encoded JSON string returned by Base64 +func FromBase64(base64String string) (Map, error) { + + decoder := base64.NewDecoder(base64.StdEncoding, strings.NewReader(base64String)) + + decoded, err := ioutil.ReadAll(decoder) + if err != nil { + return nil, err + } + + return FromJSON(string(decoded)) +} + +// MustFromBase64 creates a new Obj containing the data specified +// in the Base64 string and panics if there is an error. +// +// The string is an encoded JSON string returned by Base64 +func MustFromBase64(base64String string) Map { + + result, err := FromBase64(base64String) + + if err != nil { + panic("objx: MustFromBase64 failed with error: " + err.Error()) + } + + return result +} + +// FromSignedBase64 creates a new Obj containing the data specified +// in the Base64 string. +// +// The string is an encoded JSON string returned by SignedBase64 +func FromSignedBase64(base64String, key string) (Map, error) { + parts := strings.Split(base64String, SignatureSeparator) + if len(parts) != 2 { + return nil, errors.New("objx: Signed base64 string is malformed.") + } + + sig := HashWithKey(parts[0], key) + if parts[1] != sig { + return nil, errors.New("objx: Signature for base64 data does not match.") + } + + return FromBase64(parts[0]) +} + +// MustFromSignedBase64 creates a new Obj containing the data specified +// in the Base64 string and panics if there is an error. +// +// The string is an encoded JSON string returned by Base64 +func MustFromSignedBase64(base64String, key string) Map { + + result, err := FromSignedBase64(base64String, key) + + if err != nil { + panic("objx: MustFromSignedBase64 failed with error: " + err.Error()) + } + + return result +} + +// FromURLQuery generates a new Obj by parsing the specified +// query. +// +// For queries with multiple values, the first value is selected. +func FromURLQuery(query string) (Map, error) { + + vals, err := url.ParseQuery(query) + + if err != nil { + return nil, err + } + + m := make(map[string]interface{}) + for k, vals := range vals { + m[k] = vals[0] + } + + return New(m), nil +} + +// MustFromURLQuery generates a new Obj by parsing the specified +// query. +// +// For queries with multiple values, the first value is selected. +// +// Panics if it encounters an error +func MustFromURLQuery(query string) Map { + + o, err := FromURLQuery(query) + + if err != nil { + panic("objx: MustFromURLQuery failed with error: " + err.Error()) + } + + return o + +} diff --git a/vendor/github.com/stretchr/objx/map_for_test.go b/vendor/github.com/stretchr/objx/map_for_test.go new file mode 100644 index 000000000..6beb50675 --- /dev/null +++ b/vendor/github.com/stretchr/objx/map_for_test.go @@ -0,0 +1,10 @@ +package objx + +var TestMap map[string]interface{} = map[string]interface{}{ + "name": "Tyler", + "address": map[string]interface{}{ + "city": "Salt Lake City", + "state": "UT", + }, + "numbers": []interface{}{"one", "two", "three", "four", "five"}, +} diff --git a/vendor/github.com/stretchr/objx/map_test.go b/vendor/github.com/stretchr/objx/map_test.go new file mode 100644 index 000000000..1f8b45c61 --- /dev/null +++ b/vendor/github.com/stretchr/objx/map_test.go @@ -0,0 +1,147 @@ +package objx + +import ( + "github.com/stretchr/testify/assert" + "testing" +) + +type Convertable struct { + name string +} + +func (c *Convertable) MSI() map[string]interface{} { + return map[string]interface{}{"name": c.name} +} + +type Unconvertable struct { + name string +} + +func TestMapCreation(t *testing.T) { + + o := New(nil) + assert.Nil(t, o) + + o = New("Tyler") + assert.Nil(t, o) + + unconvertable := &Unconvertable{name: "Tyler"} + o = New(unconvertable) + assert.Nil(t, o) + + convertable := &Convertable{name: "Tyler"} + o = New(convertable) + if assert.NotNil(t, convertable) { + assert.Equal(t, "Tyler", o["name"], "Tyler") + } + + o = MSI() + if assert.NotNil(t, o) { + assert.NotNil(t, o) + } + + o = MSI("name", "Tyler") + if assert.NotNil(t, o) { + if assert.NotNil(t, o) { + assert.Equal(t, o["name"], "Tyler") + } + } + +} + +func TestMapMustFromJSONWithError(t *testing.T) { + + _, err := FromJSON(`"name":"Mat"}`) + assert.Error(t, err) + +} + +func TestMapFromJSON(t *testing.T) { + + o := MustFromJSON(`{"name":"Mat"}`) + + if assert.NotNil(t, o) { + if assert.NotNil(t, o) { + assert.Equal(t, "Mat", o["name"]) + } + } + +} + +func TestMapFromJSONWithError(t *testing.T) { + + var m Map + + assert.Panics(t, func() { + m = MustFromJSON(`"name":"Mat"}`) + }) + + assert.Nil(t, m) + +} + +func TestMapFromBase64String(t *testing.T) { + + base64String := "eyJuYW1lIjoiTWF0In0=" + + o, err := FromBase64(base64String) + + if assert.NoError(t, err) { + assert.Equal(t, o.Get("name").Str(), "Mat") + } + + assert.Equal(t, MustFromBase64(base64String).Get("name").Str(), "Mat") + +} + +func TestMapFromBase64StringWithError(t *testing.T) { + + base64String := "eyJuYW1lIjoiTWFasd0In0=" + + _, err := FromBase64(base64String) + + assert.Error(t, err) + + assert.Panics(t, func() { + MustFromBase64(base64String) + }) + +} + +func TestMapFromSignedBase64String(t *testing.T) { + + base64String := "eyJuYW1lIjoiTWF0In0=_67ee82916f90b2c0d68c903266e8998c9ef0c3d6" + + o, err := FromSignedBase64(base64String, "key") + + if assert.NoError(t, err) { + assert.Equal(t, o.Get("name").Str(), "Mat") + } + + assert.Equal(t, MustFromSignedBase64(base64String, "key").Get("name").Str(), "Mat") + +} + +func TestMapFromSignedBase64StringWithError(t *testing.T) { + + base64String := "eyJuYW1lasdIjoiTWF0In0=_67ee82916f90b2c0d68c903266e8998c9ef0c3d6" + + _, err := FromSignedBase64(base64String, "key") + + assert.Error(t, err) + + assert.Panics(t, func() { + MustFromSignedBase64(base64String, "key") + }) + +} + +func TestMapFromURLQuery(t *testing.T) { + + m, err := FromURLQuery("name=tyler&state=UT") + if assert.NoError(t, err) && assert.NotNil(t, m) { + assert.Equal(t, "tyler", m.Get("name").Str()) + assert.Equal(t, "UT", m.Get("state").Str()) + } + +} diff --git a/vendor/github.com/stretchr/objx/mutations.go b/vendor/github.com/stretchr/objx/mutations.go new file mode 100644 index 000000000..b35c86392 --- /dev/null +++ b/vendor/github.com/stretchr/objx/mutations.go @@ -0,0 +1,81 @@ +package objx + +// Exclude returns a new Map with the keys in the specified []string +// excluded. +func (d Map) Exclude(exclude []string) Map { + + excluded := make(Map) + for k, v := range d { + var shouldInclude bool = true + for _, toExclude := range exclude { + if k == toExclude { + shouldInclude = false + break + } + } + if shouldInclude { + excluded[k] = v + } + } + + return excluded +} + +// Copy creates a shallow copy of the Obj. +func (m Map) Copy() Map { + copied := make(map[string]interface{}) + for k, v := range m { + copied[k] = v + } + return New(copied) +} + +// Merge blends the specified map with a copy of this map and returns the result. +// +// Keys that appear in both will be selected from the specified map. +// This method requires that the wrapped object be a map[string]interface{} +func (m Map) Merge(merge Map) Map { + return m.Copy().MergeHere(merge) +} + +// Merge blends the specified map with this map and returns the current map. +// +// Keys that appear in both will be selected from the specified map. The original map +// will be modified. This method requires that +// the wrapped object be a map[string]interface{} +func (m Map) MergeHere(merge Map) Map { + + for k, v := range merge { + m[k] = v + } + + return m + +} + +// Transform builds a new Obj giving the transformer a chance +// to change the keys and values as it goes. This method requires that +// the wrapped object be a map[string]interface{} +func (m Map) Transform(transformer func(key string, value interface{}) (string, interface{})) Map { + newMap := make(map[string]interface{}) + for k, v := range m { + modifiedKey, modifiedVal := transformer(k, v) + newMap[modifiedKey] = modifiedVal + } + return New(newMap) +} + +// TransformKeys builds a new map using the specified key mapping. +// +// Unspecified keys will be unaltered. +// This method requires that the wrapped object be a map[string]interface{} +func (m Map) TransformKeys(mapping map[string]string) Map { + return m.Transform(func(key string, value interface{}) (string, interface{}) { + + if newKey, ok := mapping[key]; ok { + return newKey, value + } + + return key, value + }) +} diff --git a/vendor/github.com/stretchr/objx/mutations_test.go b/vendor/github.com/stretchr/objx/mutations_test.go new file mode 100644 index 000000000..e20ee23bc --- /dev/null +++ b/vendor/github.com/stretchr/objx/mutations_test.go @@ -0,0 +1,77 @@ +package objx + +import ( + "github.com/stretchr/testify/assert" + "testing" +) + +func TestExclude(t *testing.T) { + + d := make(Map) + d["name"] = "Mat" + d["age"] = 29 + d["secret"] = "ABC" + + excluded := d.Exclude([]string{"secret"}) + + assert.Equal(t, d["name"], excluded["name"]) + assert.Equal(t, d["age"], excluded["age"]) + assert.False(t, excluded.Has("secret"), "secret should be excluded") + +} + +func TestCopy(t *testing.T) { + + d1 := make(map[string]interface{}) + d1["name"] = "Tyler" + d1["location"] = "UT" + + d1Obj := New(d1) + d2Obj := d1Obj.Copy() + + d2Obj["name"] = "Mat" + + assert.Equal(t, d1Obj.Get("name").Str(), "Tyler") + assert.Equal(t, d2Obj.Get("name").Str(), "Mat") + +} + +func TestMerge(t *testing.T) { + + d := make(map[string]interface{}) + d["name"] = "Mat" + + d1 := make(map[string]interface{}) + d1["name"] = "Tyler" + d1["location"] = "UT" + + dObj := New(d) + d1Obj := New(d1) + + merged := dObj.Merge(d1Obj) + + assert.Equal(t, merged.Get("name").Str(), d1Obj.Get("name").Str()) + assert.Equal(t, merged.Get("location").Str(), d1Obj.Get("location").Str()) + assert.Empty(t, dObj.Get("location").Str()) + +} + +func TestMergeHere(t *testing.T) { + + d := make(map[string]interface{}) + d["name"] = "Mat" + + d1 := make(map[string]interface{}) + d1["name"] = "Tyler" + d1["location"] = "UT" + + dObj := New(d) + d1Obj := New(d1) + + merged := dObj.MergeHere(d1Obj) + + assert.Equal(t, dObj, merged, "With MergeHere, it should return the first modified map") + assert.Equal(t, merged.Get("name").Str(), d1Obj.Get("name").Str()) + assert.Equal(t, merged.Get("location").Str(), d1Obj.Get("location").Str()) + assert.Equal(t, merged.Get("location").Str(), dObj.Get("location").Str()) +} diff --git a/vendor/github.com/stretchr/objx/security.go b/vendor/github.com/stretchr/objx/security.go new file mode 100644 index 000000000..fdd6be9cf --- /dev/null +++ b/vendor/github.com/stretchr/objx/security.go @@ -0,0 +1,14 @@ +package objx + +import ( + "crypto/sha1" + "encoding/hex" +) + +// HashWithKey hashes the specified string using the security +// key. +func HashWithKey(data, key string) string { + hash := sha1.New() + hash.Write([]byte(data + ":" + key)) + return hex.EncodeToString(hash.Sum(nil)) +} diff --git a/vendor/github.com/stretchr/objx/security_test.go b/vendor/github.com/stretchr/objx/security_test.go new file mode 100644 index 000000000..8f0898f62 --- /dev/null +++ b/vendor/github.com/stretchr/objx/security_test.go @@ -0,0 +1,12 @@ +package objx + +import ( + "github.com/stretchr/testify/assert" + "testing" +) + +func TestHashWithKey(t *testing.T) { + + assert.Equal(t, "0ce84d8d01f2c7b6e0882b784429c54d280ea2d9", HashWithKey("abc", "def")) + +} diff --git a/vendor/github.com/stretchr/objx/simple_example_test.go b/vendor/github.com/stretchr/objx/simple_example_test.go new file mode 100644 index 000000000..5408c7fd3 --- /dev/null +++ b/vendor/github.com/stretchr/objx/simple_example_test.go @@ -0,0 +1,41 @@ +package objx + +import ( + "github.com/stretchr/testify/assert" + "testing" +) + +func TestSimpleExample(t *testing.T) { + + // build a map from a JSON object + o := MustFromJSON(`{"name":"Mat","foods":["indian","chinese"], "location":{"county":"hobbiton","city":"the shire"}}`) + + // Map can be used as a straight map[string]interface{} + assert.Equal(t, o["name"], "Mat") + + // Get an Value object + v := o.Get("name") + assert.Equal(t, v, &Value{data: "Mat"}) + + // Test the contained value + assert.False(t, v.IsInt()) + assert.False(t, v.IsBool()) + assert.True(t, v.IsStr()) + + // Get the contained value + assert.Equal(t, v.Str(), "Mat") + + // Get a default value if the contained value is not of the expected type or does not exist + assert.Equal(t, 1, v.Int(1)) + + // Get a value by using array notation + assert.Equal(t, "indian", o.Get("foods[0]").Data()) + + // Set a value by using array notation + o.Set("foods[0]", "italian") + assert.Equal(t, "italian", o.Get("foods[0]").Str()) + + // Get a value by using dot notation + assert.Equal(t, "hobbiton", o.Get("location.county").Str()) + +} diff --git a/vendor/github.com/stretchr/objx/tests.go b/vendor/github.com/stretchr/objx/tests.go new file mode 100644 index 000000000..d9e0b479a --- /dev/null +++ b/vendor/github.com/stretchr/objx/tests.go @@ -0,0 +1,17 @@ +package objx + +// Has gets whether there is something at the specified selector +// or not. +// +// If m is nil, Has will always return false. +func (m Map) Has(selector string) bool { + if m == nil { + return false + } + return !m.Get(selector).IsNil() +} + +// IsNil gets whether the data is nil or not. +func (v *Value) IsNil() bool { + return v == nil || v.data == nil +} diff --git a/vendor/github.com/stretchr/objx/tests_test.go b/vendor/github.com/stretchr/objx/tests_test.go new file mode 100644 index 000000000..bcc1eb03d --- /dev/null +++ b/vendor/github.com/stretchr/objx/tests_test.go @@ -0,0 +1,24 @@ +package objx + +import ( + "github.com/stretchr/testify/assert" + "testing" +) + +func TestHas(t *testing.T) { + + m := New(TestMap) + + assert.True(t, m.Has("name")) + assert.True(t, m.Has("address.state")) + assert.True(t, m.Has("numbers[4]")) + + assert.False(t, m.Has("address.state.nope")) + assert.False(t, m.Has("address.nope")) + assert.False(t, m.Has("nope")) + assert.False(t, m.Has("numbers[5]")) + + m = nil + assert.False(t, m.Has("nothing")) + +} diff --git a/vendor/github.com/stretchr/objx/type_specific_codegen.go b/vendor/github.com/stretchr/objx/type_specific_codegen.go new file mode 100644 index 000000000..f3ecb29b9 --- /dev/null +++ b/vendor/github.com/stretchr/objx/type_specific_codegen.go @@ -0,0 +1,2881 @@ +package objx + +/* + Inter (interface{} and []interface{}) + -------------------------------------------------- +*/ + +// Inter gets the value as a interface{}, returns the optionalDefault +// value or a system default object if the value is the wrong type. +func (v *Value) Inter(optionalDefault ...interface{}) interface{} { + if s, ok := v.data.(interface{}); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return nil +} + +// MustInter gets the value as a interface{}. +// +// Panics if the object is not a interface{}. +func (v *Value) MustInter() interface{} { + return v.data.(interface{}) +} + +// InterSlice gets the value as a []interface{}, returns the optionalDefault +// value or nil if the value is not a []interface{}. +func (v *Value) InterSlice(optionalDefault ...[]interface{}) []interface{} { + if s, ok := v.data.([]interface{}); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return nil +} + +// MustInterSlice gets the value as a []interface{}. +// +// Panics if the object is not a []interface{}. +func (v *Value) MustInterSlice() []interface{} { + return v.data.([]interface{}) +} + +// IsInter gets whether the object contained is a interface{} or not. +func (v *Value) IsInter() bool { + _, ok := v.data.(interface{}) + return ok +} + +// IsInterSlice gets whether the object contained is a []interface{} or not. +func (v *Value) IsInterSlice() bool { + _, ok := v.data.([]interface{}) + return ok +} + +// EachInter calls the specified callback for each object +// in the []interface{}. +// +// Panics if the object is the wrong type. +func (v *Value) EachInter(callback func(int, interface{}) bool) *Value { + + for index, val := range v.MustInterSlice() { + carryon := callback(index, val) + if carryon == false { + break + } + } + + return v + +} + +// WhereInter uses the specified decider function to select items +// from the []interface{}. The object contained in the result will contain +// only the selected items. +func (v *Value) WhereInter(decider func(int, interface{}) bool) *Value { + + var selected []interface{} + + v.EachInter(func(index int, val interface{}) bool { + shouldSelect := decider(index, val) + if shouldSelect == false { + selected = append(selected, val) + } + return true + }) + + return &Value{data: selected} + +} + +// GroupInter uses the specified grouper function to group the items +// keyed by the return of the grouper. The object contained in the +// result will contain a map[string][]interface{}. +func (v *Value) GroupInter(grouper func(int, interface{}) string) *Value { + + groups := make(map[string][]interface{}) + + v.EachInter(func(index int, val interface{}) bool { + group := grouper(index, val) + if _, ok := groups[group]; !ok { + groups[group] = make([]interface{}, 0) + } + groups[group] = append(groups[group], val) + return true + }) + + return &Value{data: groups} + +} + +// ReplaceInter uses the specified function to replace each interface{}s +// by iterating each item. The data in the returned result will be a +// []interface{} containing the replaced items. +func (v *Value) ReplaceInter(replacer func(int, interface{}) interface{}) *Value { + + arr := v.MustInterSlice() + replaced := make([]interface{}, len(arr)) + + v.EachInter(func(index int, val interface{}) bool { + replaced[index] = replacer(index, val) + return true + }) + + return &Value{data: replaced} + +} + +// CollectInter uses the specified collector function to collect a value +// for each of the interface{}s in the slice. The data returned will be a +// []interface{}. +func (v *Value) CollectInter(collector func(int, interface{}) interface{}) *Value { + + arr := v.MustInterSlice() + collected := make([]interface{}, len(arr)) + + v.EachInter(func(index int, val interface{}) bool { + collected[index] = collector(index, val) + return true + }) + + return &Value{data: collected} +} + +/* + MSI (map[string]interface{} and []map[string]interface{}) + -------------------------------------------------- +*/ + +// MSI gets the value as a map[string]interface{}, returns the optionalDefault +// value or a system default object if the value is the wrong type. +func (v *Value) MSI(optionalDefault ...map[string]interface{}) map[string]interface{} { + if s, ok := v.data.(map[string]interface{}); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return nil +} + +// MustMSI gets the value as a map[string]interface{}. +// +// Panics if the object is not a map[string]interface{}. +func (v *Value) MustMSI() map[string]interface{} { + return v.data.(map[string]interface{}) +} + +// MSISlice gets the value as a []map[string]interface{}, returns the optionalDefault +// value or nil if the value is not a []map[string]interface{}. +func (v *Value) MSISlice(optionalDefault ...[]map[string]interface{}) []map[string]interface{} { + if s, ok := v.data.([]map[string]interface{}); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return nil +} + +// MustMSISlice gets the value as a []map[string]interface{}. +// +// Panics if the object is not a []map[string]interface{}. +func (v *Value) MustMSISlice() []map[string]interface{} { + return v.data.([]map[string]interface{}) +} + +// IsMSI gets whether the object contained is a map[string]interface{} or not. +func (v *Value) IsMSI() bool { + _, ok := v.data.(map[string]interface{}) + return ok +} + +// IsMSISlice gets whether the object contained is a []map[string]interface{} or not. +func (v *Value) IsMSISlice() bool { + _, ok := v.data.([]map[string]interface{}) + return ok +} + +// EachMSI calls the specified callback for each object +// in the []map[string]interface{}. +// +// Panics if the object is the wrong type. +func (v *Value) EachMSI(callback func(int, map[string]interface{}) bool) *Value { + + for index, val := range v.MustMSISlice() { + carryon := callback(index, val) + if carryon == false { + break + } + } + + return v + +} + +// WhereMSI uses the specified decider function to select items +// from the []map[string]interface{}. The object contained in the result will contain +// only the selected items. +func (v *Value) WhereMSI(decider func(int, map[string]interface{}) bool) *Value { + + var selected []map[string]interface{} + + v.EachMSI(func(index int, val map[string]interface{}) bool { + shouldSelect := decider(index, val) + if shouldSelect == false { + selected = append(selected, val) + } + return true + }) + + return &Value{data: selected} + +} + +// GroupMSI uses the specified grouper function to group the items +// keyed by the return of the grouper. The object contained in the +// result will contain a map[string][]map[string]interface{}. +func (v *Value) GroupMSI(grouper func(int, map[string]interface{}) string) *Value { + + groups := make(map[string][]map[string]interface{}) + + v.EachMSI(func(index int, val map[string]interface{}) bool { + group := grouper(index, val) + if _, ok := groups[group]; !ok { + groups[group] = make([]map[string]interface{}, 0) + } + groups[group] = append(groups[group], val) + return true + }) + + return &Value{data: groups} + +} + +// ReplaceMSI uses the specified function to replace each map[string]interface{}s +// by iterating each item. The data in the returned result will be a +// []map[string]interface{} containing the replaced items. +func (v *Value) ReplaceMSI(replacer func(int, map[string]interface{}) map[string]interface{}) *Value { + + arr := v.MustMSISlice() + replaced := make([]map[string]interface{}, len(arr)) + + v.EachMSI(func(index int, val map[string]interface{}) bool { + replaced[index] = replacer(index, val) + return true + }) + + return &Value{data: replaced} + +} + +// CollectMSI uses the specified collector function to collect a value +// for each of the map[string]interface{}s in the slice. The data returned will be a +// []interface{}. +func (v *Value) CollectMSI(collector func(int, map[string]interface{}) interface{}) *Value { + + arr := v.MustMSISlice() + collected := make([]interface{}, len(arr)) + + v.EachMSI(func(index int, val map[string]interface{}) bool { + collected[index] = collector(index, val) + return true + }) + + return &Value{data: collected} +} + +/* + ObjxMap ((Map) and [](Map)) + -------------------------------------------------- +*/ + +// ObjxMap gets the value as a (Map), returns the optionalDefault +// value or a system default object if the value is the wrong type. +func (v *Value) ObjxMap(optionalDefault ...(Map)) Map { + if s, ok := v.data.((Map)); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return New(nil) +} + +// MustObjxMap gets the value as a (Map). +// +// Panics if the object is not a (Map). +func (v *Value) MustObjxMap() Map { + return v.data.((Map)) +} + +// ObjxMapSlice gets the value as a [](Map), returns the optionalDefault +// value or nil if the value is not a [](Map). +func (v *Value) ObjxMapSlice(optionalDefault ...[](Map)) [](Map) { + if s, ok := v.data.([](Map)); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return nil +} + +// MustObjxMapSlice gets the value as a [](Map). +// +// Panics if the object is not a [](Map). +func (v *Value) MustObjxMapSlice() [](Map) { + return v.data.([](Map)) +} + +// IsObjxMap gets whether the object contained is a (Map) or not. +func (v *Value) IsObjxMap() bool { + _, ok := v.data.((Map)) + return ok +} + +// IsObjxMapSlice gets whether the object contained is a [](Map) or not. +func (v *Value) IsObjxMapSlice() bool { + _, ok := v.data.([](Map)) + return ok +} + +// EachObjxMap calls the specified callback for each object +// in the [](Map). +// +// Panics if the object is the wrong type. +func (v *Value) EachObjxMap(callback func(int, Map) bool) *Value { + + for index, val := range v.MustObjxMapSlice() { + carryon := callback(index, val) + if carryon == false { + break + } + } + + return v + +} + +// WhereObjxMap uses the specified decider function to select items +// from the [](Map). The object contained in the result will contain +// only the selected items. +func (v *Value) WhereObjxMap(decider func(int, Map) bool) *Value { + + var selected [](Map) + + v.EachObjxMap(func(index int, val Map) bool { + shouldSelect := decider(index, val) + if shouldSelect == false { + selected = append(selected, val) + } + return true + }) + + return &Value{data: selected} + +} + +// GroupObjxMap uses the specified grouper function to group the items +// keyed by the return of the grouper. The object contained in the +// result will contain a map[string][](Map). +func (v *Value) GroupObjxMap(grouper func(int, Map) string) *Value { + + groups := make(map[string][](Map)) + + v.EachObjxMap(func(index int, val Map) bool { + group := grouper(index, val) + if _, ok := groups[group]; !ok { + groups[group] = make([](Map), 0) + } + groups[group] = append(groups[group], val) + return true + }) + + return &Value{data: groups} + +} + +// ReplaceObjxMap uses the specified function to replace each (Map)s +// by iterating each item. The data in the returned result will be a +// [](Map) containing the replaced items. +func (v *Value) ReplaceObjxMap(replacer func(int, Map) Map) *Value { + + arr := v.MustObjxMapSlice() + replaced := make([](Map), len(arr)) + + v.EachObjxMap(func(index int, val Map) bool { + replaced[index] = replacer(index, val) + return true + }) + + return &Value{data: replaced} + +} + +// CollectObjxMap uses the specified collector function to collect a value +// for each of the (Map)s in the slice. The data returned will be a +// []interface{}. +func (v *Value) CollectObjxMap(collector func(int, Map) interface{}) *Value { + + arr := v.MustObjxMapSlice() + collected := make([]interface{}, len(arr)) + + v.EachObjxMap(func(index int, val Map) bool { + collected[index] = collector(index, val) + return true + }) + + return &Value{data: collected} +} + +/* + Bool (bool and []bool) + -------------------------------------------------- +*/ + +// Bool gets the value as a bool, returns the optionalDefault +// value or a system default object if the value is the wrong type. +func (v *Value) Bool(optionalDefault ...bool) bool { + if s, ok := v.data.(bool); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return false +} + +// MustBool gets the value as a bool. +// +// Panics if the object is not a bool. +func (v *Value) MustBool() bool { + return v.data.(bool) +} + +// BoolSlice gets the value as a []bool, returns the optionalDefault +// value or nil if the value is not a []bool. +func (v *Value) BoolSlice(optionalDefault ...[]bool) []bool { + if s, ok := v.data.([]bool); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return nil +} + +// MustBoolSlice gets the value as a []bool. +// +// Panics if the object is not a []bool. +func (v *Value) MustBoolSlice() []bool { + return v.data.([]bool) +} + +// IsBool gets whether the object contained is a bool or not. +func (v *Value) IsBool() bool { + _, ok := v.data.(bool) + return ok +} + +// IsBoolSlice gets whether the object contained is a []bool or not. +func (v *Value) IsBoolSlice() bool { + _, ok := v.data.([]bool) + return ok +} + +// EachBool calls the specified callback for each object +// in the []bool. +// +// Panics if the object is the wrong type. +func (v *Value) EachBool(callback func(int, bool) bool) *Value { + + for index, val := range v.MustBoolSlice() { + carryon := callback(index, val) + if carryon == false { + break + } + } + + return v + +} + +// WhereBool uses the specified decider function to select items +// from the []bool. The object contained in the result will contain +// only the selected items. +func (v *Value) WhereBool(decider func(int, bool) bool) *Value { + + var selected []bool + + v.EachBool(func(index int, val bool) bool { + shouldSelect := decider(index, val) + if shouldSelect == false { + selected = append(selected, val) + } + return true + }) + + return &Value{data: selected} + +} + +// GroupBool uses the specified grouper function to group the items +// keyed by the return of the grouper. The object contained in the +// result will contain a map[string][]bool. +func (v *Value) GroupBool(grouper func(int, bool) string) *Value { + + groups := make(map[string][]bool) + + v.EachBool(func(index int, val bool) bool { + group := grouper(index, val) + if _, ok := groups[group]; !ok { + groups[group] = make([]bool, 0) + } + groups[group] = append(groups[group], val) + return true + }) + + return &Value{data: groups} + +} + +// ReplaceBool uses the specified function to replace each bools +// by iterating each item. The data in the returned result will be a +// []bool containing the replaced items. +func (v *Value) ReplaceBool(replacer func(int, bool) bool) *Value { + + arr := v.MustBoolSlice() + replaced := make([]bool, len(arr)) + + v.EachBool(func(index int, val bool) bool { + replaced[index] = replacer(index, val) + return true + }) + + return &Value{data: replaced} + +} + +// CollectBool uses the specified collector function to collect a value +// for each of the bools in the slice. The data returned will be a +// []interface{}. +func (v *Value) CollectBool(collector func(int, bool) interface{}) *Value { + + arr := v.MustBoolSlice() + collected := make([]interface{}, len(arr)) + + v.EachBool(func(index int, val bool) bool { + collected[index] = collector(index, val) + return true + }) + + return &Value{data: collected} +} + +/* + Str (string and []string) + -------------------------------------------------- +*/ + +// Str gets the value as a string, returns the optionalDefault +// value or a system default object if the value is the wrong type. +func (v *Value) Str(optionalDefault ...string) string { + if s, ok := v.data.(string); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return "" +} + +// MustStr gets the value as a string. +// +// Panics if the object is not a string. +func (v *Value) MustStr() string { + return v.data.(string) +} + +// StrSlice gets the value as a []string, returns the optionalDefault +// value or nil if the value is not a []string. +func (v *Value) StrSlice(optionalDefault ...[]string) []string { + if s, ok := v.data.([]string); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return nil +} + +// MustStrSlice gets the value as a []string. +// +// Panics if the object is not a []string. +func (v *Value) MustStrSlice() []string { + return v.data.([]string) +} + +// IsStr gets whether the object contained is a string or not. +func (v *Value) IsStr() bool { + _, ok := v.data.(string) + return ok +} + +// IsStrSlice gets whether the object contained is a []string or not. +func (v *Value) IsStrSlice() bool { + _, ok := v.data.([]string) + return ok +} + +// EachStr calls the specified callback for each object +// in the []string. +// +// Panics if the object is the wrong type. +func (v *Value) EachStr(callback func(int, string) bool) *Value { + + for index, val := range v.MustStrSlice() { + carryon := callback(index, val) + if carryon == false { + break + } + } + + return v + +} + +// WhereStr uses the specified decider function to select items +// from the []string. The object contained in the result will contain +// only the selected items. +func (v *Value) WhereStr(decider func(int, string) bool) *Value { + + var selected []string + + v.EachStr(func(index int, val string) bool { + shouldSelect := decider(index, val) + if shouldSelect == false { + selected = append(selected, val) + } + return true + }) + + return &Value{data: selected} + +} + +// GroupStr uses the specified grouper function to group the items +// keyed by the return of the grouper. The object contained in the +// result will contain a map[string][]string. +func (v *Value) GroupStr(grouper func(int, string) string) *Value { + + groups := make(map[string][]string) + + v.EachStr(func(index int, val string) bool { + group := grouper(index, val) + if _, ok := groups[group]; !ok { + groups[group] = make([]string, 0) + } + groups[group] = append(groups[group], val) + return true + }) + + return &Value{data: groups} + +} + +// ReplaceStr uses the specified function to replace each strings +// by iterating each item. The data in the returned result will be a +// []string containing the replaced items. +func (v *Value) ReplaceStr(replacer func(int, string) string) *Value { + + arr := v.MustStrSlice() + replaced := make([]string, len(arr)) + + v.EachStr(func(index int, val string) bool { + replaced[index] = replacer(index, val) + return true + }) + + return &Value{data: replaced} + +} + +// CollectStr uses the specified collector function to collect a value +// for each of the strings in the slice. The data returned will be a +// []interface{}. +func (v *Value) CollectStr(collector func(int, string) interface{}) *Value { + + arr := v.MustStrSlice() + collected := make([]interface{}, len(arr)) + + v.EachStr(func(index int, val string) bool { + collected[index] = collector(index, val) + return true + }) + + return &Value{data: collected} +} + +/* + Int (int and []int) + -------------------------------------------------- +*/ + +// Int gets the value as a int, returns the optionalDefault +// value or a system default object if the value is the wrong type. +func (v *Value) Int(optionalDefault ...int) int { + if s, ok := v.data.(int); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return 0 +} + +// MustInt gets the value as a int. +// +// Panics if the object is not a int. +func (v *Value) MustInt() int { + return v.data.(int) +} + +// IntSlice gets the value as a []int, returns the optionalDefault +// value or nil if the value is not a []int. +func (v *Value) IntSlice(optionalDefault ...[]int) []int { + if s, ok := v.data.([]int); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return nil +} + +// MustIntSlice gets the value as a []int. +// +// Panics if the object is not a []int. +func (v *Value) MustIntSlice() []int { + return v.data.([]int) +} + +// IsInt gets whether the object contained is a int or not. +func (v *Value) IsInt() bool { + _, ok := v.data.(int) + return ok +} + +// IsIntSlice gets whether the object contained is a []int or not. +func (v *Value) IsIntSlice() bool { + _, ok := v.data.([]int) + return ok +} + +// EachInt calls the specified callback for each object +// in the []int. +// +// Panics if the object is the wrong type. +func (v *Value) EachInt(callback func(int, int) bool) *Value { + + for index, val := range v.MustIntSlice() { + carryon := callback(index, val) + if carryon == false { + break + } + } + + return v + +} + +// WhereInt uses the specified decider function to select items +// from the []int. The object contained in the result will contain +// only the selected items. +func (v *Value) WhereInt(decider func(int, int) bool) *Value { + + var selected []int + + v.EachInt(func(index int, val int) bool { + shouldSelect := decider(index, val) + if shouldSelect == false { + selected = append(selected, val) + } + return true + }) + + return &Value{data: selected} + +} + +// GroupInt uses the specified grouper function to group the items +// keyed by the return of the grouper. The object contained in the +// result will contain a map[string][]int. +func (v *Value) GroupInt(grouper func(int, int) string) *Value { + + groups := make(map[string][]int) + + v.EachInt(func(index int, val int) bool { + group := grouper(index, val) + if _, ok := groups[group]; !ok { + groups[group] = make([]int, 0) + } + groups[group] = append(groups[group], val) + return true + }) + + return &Value{data: groups} + +} + +// ReplaceInt uses the specified function to replace each ints +// by iterating each item. The data in the returned result will be a +// []int containing the replaced items. +func (v *Value) ReplaceInt(replacer func(int, int) int) *Value { + + arr := v.MustIntSlice() + replaced := make([]int, len(arr)) + + v.EachInt(func(index int, val int) bool { + replaced[index] = replacer(index, val) + return true + }) + + return &Value{data: replaced} + +} + +// CollectInt uses the specified collector function to collect a value +// for each of the ints in the slice. The data returned will be a +// []interface{}. +func (v *Value) CollectInt(collector func(int, int) interface{}) *Value { + + arr := v.MustIntSlice() + collected := make([]interface{}, len(arr)) + + v.EachInt(func(index int, val int) bool { + collected[index] = collector(index, val) + return true + }) + + return &Value{data: collected} +} + +/* + Int8 (int8 and []int8) + -------------------------------------------------- +*/ + +// Int8 gets the value as a int8, returns the optionalDefault +// value or a system default object if the value is the wrong type. +func (v *Value) Int8(optionalDefault ...int8) int8 { + if s, ok := v.data.(int8); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return 0 +} + +// MustInt8 gets the value as a int8. +// +// Panics if the object is not a int8. +func (v *Value) MustInt8() int8 { + return v.data.(int8) +} + +// Int8Slice gets the value as a []int8, returns the optionalDefault +// value or nil if the value is not a []int8. +func (v *Value) Int8Slice(optionalDefault ...[]int8) []int8 { + if s, ok := v.data.([]int8); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return nil +} + +// MustInt8Slice gets the value as a []int8. +// +// Panics if the object is not a []int8. +func (v *Value) MustInt8Slice() []int8 { + return v.data.([]int8) +} + +// IsInt8 gets whether the object contained is a int8 or not. +func (v *Value) IsInt8() bool { + _, ok := v.data.(int8) + return ok +} + +// IsInt8Slice gets whether the object contained is a []int8 or not. +func (v *Value) IsInt8Slice() bool { + _, ok := v.data.([]int8) + return ok +} + +// EachInt8 calls the specified callback for each object +// in the []int8. +// +// Panics if the object is the wrong type. +func (v *Value) EachInt8(callback func(int, int8) bool) *Value { + + for index, val := range v.MustInt8Slice() { + carryon := callback(index, val) + if carryon == false { + break + } + } + + return v + +} + +// WhereInt8 uses the specified decider function to select items +// from the []int8. The object contained in the result will contain +// only the selected items. +func (v *Value) WhereInt8(decider func(int, int8) bool) *Value { + + var selected []int8 + + v.EachInt8(func(index int, val int8) bool { + shouldSelect := decider(index, val) + if shouldSelect == false { + selected = append(selected, val) + } + return true + }) + + return &Value{data: selected} + +} + +// GroupInt8 uses the specified grouper function to group the items +// keyed by the return of the grouper. The object contained in the +// result will contain a map[string][]int8. +func (v *Value) GroupInt8(grouper func(int, int8) string) *Value { + + groups := make(map[string][]int8) + + v.EachInt8(func(index int, val int8) bool { + group := grouper(index, val) + if _, ok := groups[group]; !ok { + groups[group] = make([]int8, 0) + } + groups[group] = append(groups[group], val) + return true + }) + + return &Value{data: groups} + +} + +// ReplaceInt8 uses the specified function to replace each int8s +// by iterating each item. The data in the returned result will be a +// []int8 containing the replaced items. +func (v *Value) ReplaceInt8(replacer func(int, int8) int8) *Value { + + arr := v.MustInt8Slice() + replaced := make([]int8, len(arr)) + + v.EachInt8(func(index int, val int8) bool { + replaced[index] = replacer(index, val) + return true + }) + + return &Value{data: replaced} + +} + +// CollectInt8 uses the specified collector function to collect a value +// for each of the int8s in the slice. The data returned will be a +// []interface{}. +func (v *Value) CollectInt8(collector func(int, int8) interface{}) *Value { + + arr := v.MustInt8Slice() + collected := make([]interface{}, len(arr)) + + v.EachInt8(func(index int, val int8) bool { + collected[index] = collector(index, val) + return true + }) + + return &Value{data: collected} +} + +/* + Int16 (int16 and []int16) + -------------------------------------------------- +*/ + +// Int16 gets the value as a int16, returns the optionalDefault +// value or a system default object if the value is the wrong type. +func (v *Value) Int16(optionalDefault ...int16) int16 { + if s, ok := v.data.(int16); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return 0 +} + +// MustInt16 gets the value as a int16. +// +// Panics if the object is not a int16. +func (v *Value) MustInt16() int16 { + return v.data.(int16) +} + +// Int16Slice gets the value as a []int16, returns the optionalDefault +// value or nil if the value is not a []int16. +func (v *Value) Int16Slice(optionalDefault ...[]int16) []int16 { + if s, ok := v.data.([]int16); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return nil +} + +// MustInt16Slice gets the value as a []int16. +// +// Panics if the object is not a []int16. +func (v *Value) MustInt16Slice() []int16 { + return v.data.([]int16) +} + +// IsInt16 gets whether the object contained is a int16 or not. +func (v *Value) IsInt16() bool { + _, ok := v.data.(int16) + return ok +} + +// IsInt16Slice gets whether the object contained is a []int16 or not. +func (v *Value) IsInt16Slice() bool { + _, ok := v.data.([]int16) + return ok +} + +// EachInt16 calls the specified callback for each object +// in the []int16. +// +// Panics if the object is the wrong type. +func (v *Value) EachInt16(callback func(int, int16) bool) *Value { + + for index, val := range v.MustInt16Slice() { + carryon := callback(index, val) + if carryon == false { + break + } + } + + return v + +} + +// WhereInt16 uses the specified decider function to select items +// from the []int16. The object contained in the result will contain +// only the selected items. +func (v *Value) WhereInt16(decider func(int, int16) bool) *Value { + + var selected []int16 + + v.EachInt16(func(index int, val int16) bool { + shouldSelect := decider(index, val) + if shouldSelect == false { + selected = append(selected, val) + } + return true + }) + + return &Value{data: selected} + +} + +// GroupInt16 uses the specified grouper function to group the items +// keyed by the return of the grouper. The object contained in the +// result will contain a map[string][]int16. +func (v *Value) GroupInt16(grouper func(int, int16) string) *Value { + + groups := make(map[string][]int16) + + v.EachInt16(func(index int, val int16) bool { + group := grouper(index, val) + if _, ok := groups[group]; !ok { + groups[group] = make([]int16, 0) + } + groups[group] = append(groups[group], val) + return true + }) + + return &Value{data: groups} + +} + +// ReplaceInt16 uses the specified function to replace each int16s +// by iterating each item. The data in the returned result will be a +// []int16 containing the replaced items. +func (v *Value) ReplaceInt16(replacer func(int, int16) int16) *Value { + + arr := v.MustInt16Slice() + replaced := make([]int16, len(arr)) + + v.EachInt16(func(index int, val int16) bool { + replaced[index] = replacer(index, val) + return true + }) + + return &Value{data: replaced} + +} + +// CollectInt16 uses the specified collector function to collect a value +// for each of the int16s in the slice. The data returned will be a +// []interface{}. +func (v *Value) CollectInt16(collector func(int, int16) interface{}) *Value { + + arr := v.MustInt16Slice() + collected := make([]interface{}, len(arr)) + + v.EachInt16(func(index int, val int16) bool { + collected[index] = collector(index, val) + return true + }) + + return &Value{data: collected} +} + +/* + Int32 (int32 and []int32) + -------------------------------------------------- +*/ + +// Int32 gets the value as a int32, returns the optionalDefault +// value or a system default object if the value is the wrong type. +func (v *Value) Int32(optionalDefault ...int32) int32 { + if s, ok := v.data.(int32); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return 0 +} + +// MustInt32 gets the value as a int32. +// +// Panics if the object is not a int32. +func (v *Value) MustInt32() int32 { + return v.data.(int32) +} + +// Int32Slice gets the value as a []int32, returns the optionalDefault +// value or nil if the value is not a []int32. +func (v *Value) Int32Slice(optionalDefault ...[]int32) []int32 { + if s, ok := v.data.([]int32); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return nil +} + +// MustInt32Slice gets the value as a []int32. +// +// Panics if the object is not a []int32. +func (v *Value) MustInt32Slice() []int32 { + return v.data.([]int32) +} + +// IsInt32 gets whether the object contained is a int32 or not. +func (v *Value) IsInt32() bool { + _, ok := v.data.(int32) + return ok +} + +// IsInt32Slice gets whether the object contained is a []int32 or not. +func (v *Value) IsInt32Slice() bool { + _, ok := v.data.([]int32) + return ok +} + +// EachInt32 calls the specified callback for each object +// in the []int32. +// +// Panics if the object is the wrong type. +func (v *Value) EachInt32(callback func(int, int32) bool) *Value { + + for index, val := range v.MustInt32Slice() { + carryon := callback(index, val) + if carryon == false { + break + } + } + + return v + +} + +// WhereInt32 uses the specified decider function to select items +// from the []int32. The object contained in the result will contain +// only the selected items. +func (v *Value) WhereInt32(decider func(int, int32) bool) *Value { + + var selected []int32 + + v.EachInt32(func(index int, val int32) bool { + shouldSelect := decider(index, val) + if shouldSelect == false { + selected = append(selected, val) + } + return true + }) + + return &Value{data: selected} + +} + +// GroupInt32 uses the specified grouper function to group the items +// keyed by the return of the grouper. The object contained in the +// result will contain a map[string][]int32. +func (v *Value) GroupInt32(grouper func(int, int32) string) *Value { + + groups := make(map[string][]int32) + + v.EachInt32(func(index int, val int32) bool { + group := grouper(index, val) + if _, ok := groups[group]; !ok { + groups[group] = make([]int32, 0) + } + groups[group] = append(groups[group], val) + return true + }) + + return &Value{data: groups} + +} + +// ReplaceInt32 uses the specified function to replace each int32s +// by iterating each item. The data in the returned result will be a +// []int32 containing the replaced items. +func (v *Value) ReplaceInt32(replacer func(int, int32) int32) *Value { + + arr := v.MustInt32Slice() + replaced := make([]int32, len(arr)) + + v.EachInt32(func(index int, val int32) bool { + replaced[index] = replacer(index, val) + return true + }) + + return &Value{data: replaced} + +} + +// CollectInt32 uses the specified collector function to collect a value +// for each of the int32s in the slice. The data returned will be a +// []interface{}. +func (v *Value) CollectInt32(collector func(int, int32) interface{}) *Value { + + arr := v.MustInt32Slice() + collected := make([]interface{}, len(arr)) + + v.EachInt32(func(index int, val int32) bool { + collected[index] = collector(index, val) + return true + }) + + return &Value{data: collected} +} + +/* + Int64 (int64 and []int64) + -------------------------------------------------- +*/ + +// Int64 gets the value as a int64, returns the optionalDefault +// value or a system default object if the value is the wrong type. +func (v *Value) Int64(optionalDefault ...int64) int64 { + if s, ok := v.data.(int64); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return 0 +} + +// MustInt64 gets the value as a int64. +// +// Panics if the object is not a int64. +func (v *Value) MustInt64() int64 { + return v.data.(int64) +} + +// Int64Slice gets the value as a []int64, returns the optionalDefault +// value or nil if the value is not a []int64. +func (v *Value) Int64Slice(optionalDefault ...[]int64) []int64 { + if s, ok := v.data.([]int64); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return nil +} + +// MustInt64Slice gets the value as a []int64. +// +// Panics if the object is not a []int64. +func (v *Value) MustInt64Slice() []int64 { + return v.data.([]int64) +} + +// IsInt64 gets whether the object contained is a int64 or not. +func (v *Value) IsInt64() bool { + _, ok := v.data.(int64) + return ok +} + +// IsInt64Slice gets whether the object contained is a []int64 or not. +func (v *Value) IsInt64Slice() bool { + _, ok := v.data.([]int64) + return ok +} + +// EachInt64 calls the specified callback for each object +// in the []int64. +// +// Panics if the object is the wrong type. +func (v *Value) EachInt64(callback func(int, int64) bool) *Value { + + for index, val := range v.MustInt64Slice() { + carryon := callback(index, val) + if carryon == false { + break + } + } + + return v + +} + +// WhereInt64 uses the specified decider function to select items +// from the []int64. The object contained in the result will contain +// only the selected items. +func (v *Value) WhereInt64(decider func(int, int64) bool) *Value { + + var selected []int64 + + v.EachInt64(func(index int, val int64) bool { + shouldSelect := decider(index, val) + if shouldSelect == false { + selected = append(selected, val) + } + return true + }) + + return &Value{data: selected} + +} + +// GroupInt64 uses the specified grouper function to group the items +// keyed by the return of the grouper. The object contained in the +// result will contain a map[string][]int64. +func (v *Value) GroupInt64(grouper func(int, int64) string) *Value { + + groups := make(map[string][]int64) + + v.EachInt64(func(index int, val int64) bool { + group := grouper(index, val) + if _, ok := groups[group]; !ok { + groups[group] = make([]int64, 0) + } + groups[group] = append(groups[group], val) + return true + }) + + return &Value{data: groups} + +} + +// ReplaceInt64 uses the specified function to replace each int64s +// by iterating each item. The data in the returned result will be a +// []int64 containing the replaced items. +func (v *Value) ReplaceInt64(replacer func(int, int64) int64) *Value { + + arr := v.MustInt64Slice() + replaced := make([]int64, len(arr)) + + v.EachInt64(func(index int, val int64) bool { + replaced[index] = replacer(index, val) + return true + }) + + return &Value{data: replaced} + +} + +// CollectInt64 uses the specified collector function to collect a value +// for each of the int64s in the slice. The data returned will be a +// []interface{}. +func (v *Value) CollectInt64(collector func(int, int64) interface{}) *Value { + + arr := v.MustInt64Slice() + collected := make([]interface{}, len(arr)) + + v.EachInt64(func(index int, val int64) bool { + collected[index] = collector(index, val) + return true + }) + + return &Value{data: collected} +} + +/* + Uint (uint and []uint) + -------------------------------------------------- +*/ + +// Uint gets the value as a uint, returns the optionalDefault +// value or a system default object if the value is the wrong type. +func (v *Value) Uint(optionalDefault ...uint) uint { + if s, ok := v.data.(uint); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return 0 +} + +// MustUint gets the value as a uint. +// +// Panics if the object is not a uint. +func (v *Value) MustUint() uint { + return v.data.(uint) +} + +// UintSlice gets the value as a []uint, returns the optionalDefault +// value or nil if the value is not a []uint. +func (v *Value) UintSlice(optionalDefault ...[]uint) []uint { + if s, ok := v.data.([]uint); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return nil +} + +// MustUintSlice gets the value as a []uint. +// +// Panics if the object is not a []uint. +func (v *Value) MustUintSlice() []uint { + return v.data.([]uint) +} + +// IsUint gets whether the object contained is a uint or not. +func (v *Value) IsUint() bool { + _, ok := v.data.(uint) + return ok +} + +// IsUintSlice gets whether the object contained is a []uint or not. +func (v *Value) IsUintSlice() bool { + _, ok := v.data.([]uint) + return ok +} + +// EachUint calls the specified callback for each object +// in the []uint. +// +// Panics if the object is the wrong type. +func (v *Value) EachUint(callback func(int, uint) bool) *Value { + + for index, val := range v.MustUintSlice() { + carryon := callback(index, val) + if carryon == false { + break + } + } + + return v + +} + +// WhereUint uses the specified decider function to select items +// from the []uint. The object contained in the result will contain +// only the selected items. +func (v *Value) WhereUint(decider func(int, uint) bool) *Value { + + var selected []uint + + v.EachUint(func(index int, val uint) bool { + shouldSelect := decider(index, val) + if shouldSelect == false { + selected = append(selected, val) + } + return true + }) + + return &Value{data: selected} + +} + +// GroupUint uses the specified grouper function to group the items +// keyed by the return of the grouper. The object contained in the +// result will contain a map[string][]uint. +func (v *Value) GroupUint(grouper func(int, uint) string) *Value { + + groups := make(map[string][]uint) + + v.EachUint(func(index int, val uint) bool { + group := grouper(index, val) + if _, ok := groups[group]; !ok { + groups[group] = make([]uint, 0) + } + groups[group] = append(groups[group], val) + return true + }) + + return &Value{data: groups} + +} + +// ReplaceUint uses the specified function to replace each uints +// by iterating each item. The data in the returned result will be a +// []uint containing the replaced items. +func (v *Value) ReplaceUint(replacer func(int, uint) uint) *Value { + + arr := v.MustUintSlice() + replaced := make([]uint, len(arr)) + + v.EachUint(func(index int, val uint) bool { + replaced[index] = replacer(index, val) + return true + }) + + return &Value{data: replaced} + +} + +// CollectUint uses the specified collector function to collect a value +// for each of the uints in the slice. The data returned will be a +// []interface{}. +func (v *Value) CollectUint(collector func(int, uint) interface{}) *Value { + + arr := v.MustUintSlice() + collected := make([]interface{}, len(arr)) + + v.EachUint(func(index int, val uint) bool { + collected[index] = collector(index, val) + return true + }) + + return &Value{data: collected} +} + +/* + Uint8 (uint8 and []uint8) + -------------------------------------------------- +*/ + +// Uint8 gets the value as a uint8, returns the optionalDefault +// value or a system default object if the value is the wrong type. +func (v *Value) Uint8(optionalDefault ...uint8) uint8 { + if s, ok := v.data.(uint8); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return 0 +} + +// MustUint8 gets the value as a uint8. +// +// Panics if the object is not a uint8. +func (v *Value) MustUint8() uint8 { + return v.data.(uint8) +} + +// Uint8Slice gets the value as a []uint8, returns the optionalDefault +// value or nil if the value is not a []uint8. +func (v *Value) Uint8Slice(optionalDefault ...[]uint8) []uint8 { + if s, ok := v.data.([]uint8); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return nil +} + +// MustUint8Slice gets the value as a []uint8. +// +// Panics if the object is not a []uint8. +func (v *Value) MustUint8Slice() []uint8 { + return v.data.([]uint8) +} + +// IsUint8 gets whether the object contained is a uint8 or not. +func (v *Value) IsUint8() bool { + _, ok := v.data.(uint8) + return ok +} + +// IsUint8Slice gets whether the object contained is a []uint8 or not. +func (v *Value) IsUint8Slice() bool { + _, ok := v.data.([]uint8) + return ok +} + +// EachUint8 calls the specified callback for each object +// in the []uint8. +// +// Panics if the object is the wrong type. +func (v *Value) EachUint8(callback func(int, uint8) bool) *Value { + + for index, val := range v.MustUint8Slice() { + carryon := callback(index, val) + if carryon == false { + break + } + } + + return v + +} + +// WhereUint8 uses the specified decider function to select items +// from the []uint8. The object contained in the result will contain +// only the selected items. +func (v *Value) WhereUint8(decider func(int, uint8) bool) *Value { + + var selected []uint8 + + v.EachUint8(func(index int, val uint8) bool { + shouldSelect := decider(index, val) + if shouldSelect == false { + selected = append(selected, val) + } + return true + }) + + return &Value{data: selected} + +} + +// GroupUint8 uses the specified grouper function to group the items +// keyed by the return of the grouper. The object contained in the +// result will contain a map[string][]uint8. +func (v *Value) GroupUint8(grouper func(int, uint8) string) *Value { + + groups := make(map[string][]uint8) + + v.EachUint8(func(index int, val uint8) bool { + group := grouper(index, val) + if _, ok := groups[group]; !ok { + groups[group] = make([]uint8, 0) + } + groups[group] = append(groups[group], val) + return true + }) + + return &Value{data: groups} + +} + +// ReplaceUint8 uses the specified function to replace each uint8s +// by iterating each item. The data in the returned result will be a +// []uint8 containing the replaced items. +func (v *Value) ReplaceUint8(replacer func(int, uint8) uint8) *Value { + + arr := v.MustUint8Slice() + replaced := make([]uint8, len(arr)) + + v.EachUint8(func(index int, val uint8) bool { + replaced[index] = replacer(index, val) + return true + }) + + return &Value{data: replaced} + +} + +// CollectUint8 uses the specified collector function to collect a value +// for each of the uint8s in the slice. The data returned will be a +// []interface{}. +func (v *Value) CollectUint8(collector func(int, uint8) interface{}) *Value { + + arr := v.MustUint8Slice() + collected := make([]interface{}, len(arr)) + + v.EachUint8(func(index int, val uint8) bool { + collected[index] = collector(index, val) + return true + }) + + return &Value{data: collected} +} + +/* + Uint16 (uint16 and []uint16) + -------------------------------------------------- +*/ + +// Uint16 gets the value as a uint16, returns the optionalDefault +// value or a system default object if the value is the wrong type. +func (v *Value) Uint16(optionalDefault ...uint16) uint16 { + if s, ok := v.data.(uint16); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return 0 +} + +// MustUint16 gets the value as a uint16. +// +// Panics if the object is not a uint16. +func (v *Value) MustUint16() uint16 { + return v.data.(uint16) +} + +// Uint16Slice gets the value as a []uint16, returns the optionalDefault +// value or nil if the value is not a []uint16. +func (v *Value) Uint16Slice(optionalDefault ...[]uint16) []uint16 { + if s, ok := v.data.([]uint16); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return nil +} + +// MustUint16Slice gets the value as a []uint16. +// +// Panics if the object is not a []uint16. +func (v *Value) MustUint16Slice() []uint16 { + return v.data.([]uint16) +} + +// IsUint16 gets whether the object contained is a uint16 or not. +func (v *Value) IsUint16() bool { + _, ok := v.data.(uint16) + return ok +} + +// IsUint16Slice gets whether the object contained is a []uint16 or not. +func (v *Value) IsUint16Slice() bool { + _, ok := v.data.([]uint16) + return ok +} + +// EachUint16 calls the specified callback for each object +// in the []uint16. +// +// Panics if the object is the wrong type. +func (v *Value) EachUint16(callback func(int, uint16) bool) *Value { + + for index, val := range v.MustUint16Slice() { + carryon := callback(index, val) + if carryon == false { + break + } + } + + return v + +} + +// WhereUint16 uses the specified decider function to select items +// from the []uint16. The object contained in the result will contain +// only the selected items. +func (v *Value) WhereUint16(decider func(int, uint16) bool) *Value { + + var selected []uint16 + + v.EachUint16(func(index int, val uint16) bool { + shouldSelect := decider(index, val) + if shouldSelect == false { + selected = append(selected, val) + } + return true + }) + + return &Value{data: selected} + +} + +// GroupUint16 uses the specified grouper function to group the items +// keyed by the return of the grouper. The object contained in the +// result will contain a map[string][]uint16. +func (v *Value) GroupUint16(grouper func(int, uint16) string) *Value { + + groups := make(map[string][]uint16) + + v.EachUint16(func(index int, val uint16) bool { + group := grouper(index, val) + if _, ok := groups[group]; !ok { + groups[group] = make([]uint16, 0) + } + groups[group] = append(groups[group], val) + return true + }) + + return &Value{data: groups} + +} + +// ReplaceUint16 uses the specified function to replace each uint16s +// by iterating each item. The data in the returned result will be a +// []uint16 containing the replaced items. +func (v *Value) ReplaceUint16(replacer func(int, uint16) uint16) *Value { + + arr := v.MustUint16Slice() + replaced := make([]uint16, len(arr)) + + v.EachUint16(func(index int, val uint16) bool { + replaced[index] = replacer(index, val) + return true + }) + + return &Value{data: replaced} + +} + +// CollectUint16 uses the specified collector function to collect a value +// for each of the uint16s in the slice. The data returned will be a +// []interface{}. +func (v *Value) CollectUint16(collector func(int, uint16) interface{}) *Value { + + arr := v.MustUint16Slice() + collected := make([]interface{}, len(arr)) + + v.EachUint16(func(index int, val uint16) bool { + collected[index] = collector(index, val) + return true + }) + + return &Value{data: collected} +} + +/* + Uint32 (uint32 and []uint32) + -------------------------------------------------- +*/ + +// Uint32 gets the value as a uint32, returns the optionalDefault +// value or a system default object if the value is the wrong type. +func (v *Value) Uint32(optionalDefault ...uint32) uint32 { + if s, ok := v.data.(uint32); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return 0 +} + +// MustUint32 gets the value as a uint32. +// +// Panics if the object is not a uint32. +func (v *Value) MustUint32() uint32 { + return v.data.(uint32) +} + +// Uint32Slice gets the value as a []uint32, returns the optionalDefault +// value or nil if the value is not a []uint32. +func (v *Value) Uint32Slice(optionalDefault ...[]uint32) []uint32 { + if s, ok := v.data.([]uint32); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return nil +} + +// MustUint32Slice gets the value as a []uint32. +// +// Panics if the object is not a []uint32. +func (v *Value) MustUint32Slice() []uint32 { + return v.data.([]uint32) +} + +// IsUint32 gets whether the object contained is a uint32 or not. +func (v *Value) IsUint32() bool { + _, ok := v.data.(uint32) + return ok +} + +// IsUint32Slice gets whether the object contained is a []uint32 or not. +func (v *Value) IsUint32Slice() bool { + _, ok := v.data.([]uint32) + return ok +} + +// EachUint32 calls the specified callback for each object +// in the []uint32. +// +// Panics if the object is the wrong type. +func (v *Value) EachUint32(callback func(int, uint32) bool) *Value { + + for index, val := range v.MustUint32Slice() { + carryon := callback(index, val) + if carryon == false { + break + } + } + + return v + +} + +// WhereUint32 uses the specified decider function to select items +// from the []uint32. The object contained in the result will contain +// only the selected items. +func (v *Value) WhereUint32(decider func(int, uint32) bool) *Value { + + var selected []uint32 + + v.EachUint32(func(index int, val uint32) bool { + shouldSelect := decider(index, val) + if shouldSelect == false { + selected = append(selected, val) + } + return true + }) + + return &Value{data: selected} + +} + +// GroupUint32 uses the specified grouper function to group the items +// keyed by the return of the grouper. The object contained in the +// result will contain a map[string][]uint32. +func (v *Value) GroupUint32(grouper func(int, uint32) string) *Value { + + groups := make(map[string][]uint32) + + v.EachUint32(func(index int, val uint32) bool { + group := grouper(index, val) + if _, ok := groups[group]; !ok { + groups[group] = make([]uint32, 0) + } + groups[group] = append(groups[group], val) + return true + }) + + return &Value{data: groups} + +} + +// ReplaceUint32 uses the specified function to replace each uint32s +// by iterating each item. The data in the returned result will be a +// []uint32 containing the replaced items. +func (v *Value) ReplaceUint32(replacer func(int, uint32) uint32) *Value { + + arr := v.MustUint32Slice() + replaced := make([]uint32, len(arr)) + + v.EachUint32(func(index int, val uint32) bool { + replaced[index] = replacer(index, val) + return true + }) + + return &Value{data: replaced} + +} + +// CollectUint32 uses the specified collector function to collect a value +// for each of the uint32s in the slice. The data returned will be a +// []interface{}. +func (v *Value) CollectUint32(collector func(int, uint32) interface{}) *Value { + + arr := v.MustUint32Slice() + collected := make([]interface{}, len(arr)) + + v.EachUint32(func(index int, val uint32) bool { + collected[index] = collector(index, val) + return true + }) + + return &Value{data: collected} +} + +/* + Uint64 (uint64 and []uint64) + -------------------------------------------------- +*/ + +// Uint64 gets the value as a uint64, returns the optionalDefault +// value or a system default object if the value is the wrong type. +func (v *Value) Uint64(optionalDefault ...uint64) uint64 { + if s, ok := v.data.(uint64); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return 0 +} + +// MustUint64 gets the value as a uint64. +// +// Panics if the object is not a uint64. +func (v *Value) MustUint64() uint64 { + return v.data.(uint64) +} + +// Uint64Slice gets the value as a []uint64, returns the optionalDefault +// value or nil if the value is not a []uint64. +func (v *Value) Uint64Slice(optionalDefault ...[]uint64) []uint64 { + if s, ok := v.data.([]uint64); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return nil +} + +// MustUint64Slice gets the value as a []uint64. +// +// Panics if the object is not a []uint64. +func (v *Value) MustUint64Slice() []uint64 { + return v.data.([]uint64) +} + +// IsUint64 gets whether the object contained is a uint64 or not. +func (v *Value) IsUint64() bool { + _, ok := v.data.(uint64) + return ok +} + +// IsUint64Slice gets whether the object contained is a []uint64 or not. +func (v *Value) IsUint64Slice() bool { + _, ok := v.data.([]uint64) + return ok +} + +// EachUint64 calls the specified callback for each object +// in the []uint64. +// +// Panics if the object is the wrong type. +func (v *Value) EachUint64(callback func(int, uint64) bool) *Value { + + for index, val := range v.MustUint64Slice() { + carryon := callback(index, val) + if carryon == false { + break + } + } + + return v + +} + +// WhereUint64 uses the specified decider function to select items +// from the []uint64. The object contained in the result will contain +// only the selected items. +func (v *Value) WhereUint64(decider func(int, uint64) bool) *Value { + + var selected []uint64 + + v.EachUint64(func(index int, val uint64) bool { + shouldSelect := decider(index, val) + if shouldSelect == false { + selected = append(selected, val) + } + return true + }) + + return &Value{data: selected} + +} + +// GroupUint64 uses the specified grouper function to group the items +// keyed by the return of the grouper. The object contained in the +// result will contain a map[string][]uint64. +func (v *Value) GroupUint64(grouper func(int, uint64) string) *Value { + + groups := make(map[string][]uint64) + + v.EachUint64(func(index int, val uint64) bool { + group := grouper(index, val) + if _, ok := groups[group]; !ok { + groups[group] = make([]uint64, 0) + } + groups[group] = append(groups[group], val) + return true + }) + + return &Value{data: groups} + +} + +// ReplaceUint64 uses the specified function to replace each uint64s +// by iterating each item. The data in the returned result will be a +// []uint64 containing the replaced items. +func (v *Value) ReplaceUint64(replacer func(int, uint64) uint64) *Value { + + arr := v.MustUint64Slice() + replaced := make([]uint64, len(arr)) + + v.EachUint64(func(index int, val uint64) bool { + replaced[index] = replacer(index, val) + return true + }) + + return &Value{data: replaced} + +} + +// CollectUint64 uses the specified collector function to collect a value +// for each of the uint64s in the slice. The data returned will be a +// []interface{}. +func (v *Value) CollectUint64(collector func(int, uint64) interface{}) *Value { + + arr := v.MustUint64Slice() + collected := make([]interface{}, len(arr)) + + v.EachUint64(func(index int, val uint64) bool { + collected[index] = collector(index, val) + return true + }) + + return &Value{data: collected} +} + +/* + Uintptr (uintptr and []uintptr) + -------------------------------------------------- +*/ + +// Uintptr gets the value as a uintptr, returns the optionalDefault +// value or a system default object if the value is the wrong type. +func (v *Value) Uintptr(optionalDefault ...uintptr) uintptr { + if s, ok := v.data.(uintptr); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return 0 +} + +// MustUintptr gets the value as a uintptr. +// +// Panics if the object is not a uintptr. +func (v *Value) MustUintptr() uintptr { + return v.data.(uintptr) +} + +// UintptrSlice gets the value as a []uintptr, returns the optionalDefault +// value or nil if the value is not a []uintptr. +func (v *Value) UintptrSlice(optionalDefault ...[]uintptr) []uintptr { + if s, ok := v.data.([]uintptr); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return nil +} + +// MustUintptrSlice gets the value as a []uintptr. +// +// Panics if the object is not a []uintptr. +func (v *Value) MustUintptrSlice() []uintptr { + return v.data.([]uintptr) +} + +// IsUintptr gets whether the object contained is a uintptr or not. +func (v *Value) IsUintptr() bool { + _, ok := v.data.(uintptr) + return ok +} + +// IsUintptrSlice gets whether the object contained is a []uintptr or not. +func (v *Value) IsUintptrSlice() bool { + _, ok := v.data.([]uintptr) + return ok +} + +// EachUintptr calls the specified callback for each object +// in the []uintptr. +// +// Panics if the object is the wrong type. +func (v *Value) EachUintptr(callback func(int, uintptr) bool) *Value { + + for index, val := range v.MustUintptrSlice() { + carryon := callback(index, val) + if carryon == false { + break + } + } + + return v + +} + +// WhereUintptr uses the specified decider function to select items +// from the []uintptr. The object contained in the result will contain +// only the selected items. +func (v *Value) WhereUintptr(decider func(int, uintptr) bool) *Value { + + var selected []uintptr + + v.EachUintptr(func(index int, val uintptr) bool { + shouldSelect := decider(index, val) + if shouldSelect == false { + selected = append(selected, val) + } + return true + }) + + return &Value{data: selected} + +} + +// GroupUintptr uses the specified grouper function to group the items +// keyed by the return of the grouper. The object contained in the +// result will contain a map[string][]uintptr. +func (v *Value) GroupUintptr(grouper func(int, uintptr) string) *Value { + + groups := make(map[string][]uintptr) + + v.EachUintptr(func(index int, val uintptr) bool { + group := grouper(index, val) + if _, ok := groups[group]; !ok { + groups[group] = make([]uintptr, 0) + } + groups[group] = append(groups[group], val) + return true + }) + + return &Value{data: groups} + +} + +// ReplaceUintptr uses the specified function to replace each uintptrs +// by iterating each item. The data in the returned result will be a +// []uintptr containing the replaced items. +func (v *Value) ReplaceUintptr(replacer func(int, uintptr) uintptr) *Value { + + arr := v.MustUintptrSlice() + replaced := make([]uintptr, len(arr)) + + v.EachUintptr(func(index int, val uintptr) bool { + replaced[index] = replacer(index, val) + return true + }) + + return &Value{data: replaced} + +} + +// CollectUintptr uses the specified collector function to collect a value +// for each of the uintptrs in the slice. The data returned will be a +// []interface{}. +func (v *Value) CollectUintptr(collector func(int, uintptr) interface{}) *Value { + + arr := v.MustUintptrSlice() + collected := make([]interface{}, len(arr)) + + v.EachUintptr(func(index int, val uintptr) bool { + collected[index] = collector(index, val) + return true + }) + + return &Value{data: collected} +} + +/* + Float32 (float32 and []float32) + -------------------------------------------------- +*/ + +// Float32 gets the value as a float32, returns the optionalDefault +// value or a system default object if the value is the wrong type. +func (v *Value) Float32(optionalDefault ...float32) float32 { + if s, ok := v.data.(float32); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return 0 +} + +// MustFloat32 gets the value as a float32. +// +// Panics if the object is not a float32. +func (v *Value) MustFloat32() float32 { + return v.data.(float32) +} + +// Float32Slice gets the value as a []float32, returns the optionalDefault +// value or nil if the value is not a []float32. +func (v *Value) Float32Slice(optionalDefault ...[]float32) []float32 { + if s, ok := v.data.([]float32); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return nil +} + +// MustFloat32Slice gets the value as a []float32. +// +// Panics if the object is not a []float32. +func (v *Value) MustFloat32Slice() []float32 { + return v.data.([]float32) +} + +// IsFloat32 gets whether the object contained is a float32 or not. +func (v *Value) IsFloat32() bool { + _, ok := v.data.(float32) + return ok +} + +// IsFloat32Slice gets whether the object contained is a []float32 or not. +func (v *Value) IsFloat32Slice() bool { + _, ok := v.data.([]float32) + return ok +} + +// EachFloat32 calls the specified callback for each object +// in the []float32. +// +// Panics if the object is the wrong type. +func (v *Value) EachFloat32(callback func(int, float32) bool) *Value { + + for index, val := range v.MustFloat32Slice() { + carryon := callback(index, val) + if carryon == false { + break + } + } + + return v + +} + +// WhereFloat32 uses the specified decider function to select items +// from the []float32. The object contained in the result will contain +// only the selected items. +func (v *Value) WhereFloat32(decider func(int, float32) bool) *Value { + + var selected []float32 + + v.EachFloat32(func(index int, val float32) bool { + shouldSelect := decider(index, val) + if shouldSelect == false { + selected = append(selected, val) + } + return true + }) + + return &Value{data: selected} + +} + +// GroupFloat32 uses the specified grouper function to group the items +// keyed by the return of the grouper. The object contained in the +// result will contain a map[string][]float32. +func (v *Value) GroupFloat32(grouper func(int, float32) string) *Value { + + groups := make(map[string][]float32) + + v.EachFloat32(func(index int, val float32) bool { + group := grouper(index, val) + if _, ok := groups[group]; !ok { + groups[group] = make([]float32, 0) + } + groups[group] = append(groups[group], val) + return true + }) + + return &Value{data: groups} + +} + +// ReplaceFloat32 uses the specified function to replace each float32s +// by iterating each item. The data in the returned result will be a +// []float32 containing the replaced items. +func (v *Value) ReplaceFloat32(replacer func(int, float32) float32) *Value { + + arr := v.MustFloat32Slice() + replaced := make([]float32, len(arr)) + + v.EachFloat32(func(index int, val float32) bool { + replaced[index] = replacer(index, val) + return true + }) + + return &Value{data: replaced} + +} + +// CollectFloat32 uses the specified collector function to collect a value +// for each of the float32s in the slice. The data returned will be a +// []interface{}. +func (v *Value) CollectFloat32(collector func(int, float32) interface{}) *Value { + + arr := v.MustFloat32Slice() + collected := make([]interface{}, len(arr)) + + v.EachFloat32(func(index int, val float32) bool { + collected[index] = collector(index, val) + return true + }) + + return &Value{data: collected} +} + +/* + Float64 (float64 and []float64) + -------------------------------------------------- +*/ + +// Float64 gets the value as a float64, returns the optionalDefault +// value or a system default object if the value is the wrong type. +func (v *Value) Float64(optionalDefault ...float64) float64 { + if s, ok := v.data.(float64); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return 0 +} + +// MustFloat64 gets the value as a float64. +// +// Panics if the object is not a float64. +func (v *Value) MustFloat64() float64 { + return v.data.(float64) +} + +// Float64Slice gets the value as a []float64, returns the optionalDefault +// value or nil if the value is not a []float64. +func (v *Value) Float64Slice(optionalDefault ...[]float64) []float64 { + if s, ok := v.data.([]float64); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return nil +} + +// MustFloat64Slice gets the value as a []float64. +// +// Panics if the object is not a []float64. +func (v *Value) MustFloat64Slice() []float64 { + return v.data.([]float64) +} + +// IsFloat64 gets whether the object contained is a float64 or not. +func (v *Value) IsFloat64() bool { + _, ok := v.data.(float64) + return ok +} + +// IsFloat64Slice gets whether the object contained is a []float64 or not. +func (v *Value) IsFloat64Slice() bool { + _, ok := v.data.([]float64) + return ok +} + +// EachFloat64 calls the specified callback for each object +// in the []float64. +// +// Panics if the object is the wrong type. +func (v *Value) EachFloat64(callback func(int, float64) bool) *Value { + + for index, val := range v.MustFloat64Slice() { + carryon := callback(index, val) + if carryon == false { + break + } + } + + return v + +} + +// WhereFloat64 uses the specified decider function to select items +// from the []float64. The object contained in the result will contain +// only the selected items. +func (v *Value) WhereFloat64(decider func(int, float64) bool) *Value { + + var selected []float64 + + v.EachFloat64(func(index int, val float64) bool { + shouldSelect := decider(index, val) + if shouldSelect == false { + selected = append(selected, val) + } + return true + }) + + return &Value{data: selected} + +} + +// GroupFloat64 uses the specified grouper function to group the items +// keyed by the return of the grouper. The object contained in the +// result will contain a map[string][]float64. +func (v *Value) GroupFloat64(grouper func(int, float64) string) *Value { + + groups := make(map[string][]float64) + + v.EachFloat64(func(index int, val float64) bool { + group := grouper(index, val) + if _, ok := groups[group]; !ok { + groups[group] = make([]float64, 0) + } + groups[group] = append(groups[group], val) + return true + }) + + return &Value{data: groups} + +} + +// ReplaceFloat64 uses the specified function to replace each float64s +// by iterating each item. The data in the returned result will be a +// []float64 containing the replaced items. +func (v *Value) ReplaceFloat64(replacer func(int, float64) float64) *Value { + + arr := v.MustFloat64Slice() + replaced := make([]float64, len(arr)) + + v.EachFloat64(func(index int, val float64) bool { + replaced[index] = replacer(index, val) + return true + }) + + return &Value{data: replaced} + +} + +// CollectFloat64 uses the specified collector function to collect a value +// for each of the float64s in the slice. The data returned will be a +// []interface{}. +func (v *Value) CollectFloat64(collector func(int, float64) interface{}) *Value { + + arr := v.MustFloat64Slice() + collected := make([]interface{}, len(arr)) + + v.EachFloat64(func(index int, val float64) bool { + collected[index] = collector(index, val) + return true + }) + + return &Value{data: collected} +} + +/* + Complex64 (complex64 and []complex64) + -------------------------------------------------- +*/ + +// Complex64 gets the value as a complex64, returns the optionalDefault +// value or a system default object if the value is the wrong type. +func (v *Value) Complex64(optionalDefault ...complex64) complex64 { + if s, ok := v.data.(complex64); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return 0 +} + +// MustComplex64 gets the value as a complex64. +// +// Panics if the object is not a complex64. +func (v *Value) MustComplex64() complex64 { + return v.data.(complex64) +} + +// Complex64Slice gets the value as a []complex64, returns the optionalDefault +// value or nil if the value is not a []complex64. +func (v *Value) Complex64Slice(optionalDefault ...[]complex64) []complex64 { + if s, ok := v.data.([]complex64); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return nil +} + +// MustComplex64Slice gets the value as a []complex64. +// +// Panics if the object is not a []complex64. +func (v *Value) MustComplex64Slice() []complex64 { + return v.data.([]complex64) +} + +// IsComplex64 gets whether the object contained is a complex64 or not. +func (v *Value) IsComplex64() bool { + _, ok := v.data.(complex64) + return ok +} + +// IsComplex64Slice gets whether the object contained is a []complex64 or not. +func (v *Value) IsComplex64Slice() bool { + _, ok := v.data.([]complex64) + return ok +} + +// EachComplex64 calls the specified callback for each object +// in the []complex64. +// +// Panics if the object is the wrong type. +func (v *Value) EachComplex64(callback func(int, complex64) bool) *Value { + + for index, val := range v.MustComplex64Slice() { + carryon := callback(index, val) + if carryon == false { + break + } + } + + return v + +} + +// WhereComplex64 uses the specified decider function to select items +// from the []complex64. The object contained in the result will contain +// only the selected items. +func (v *Value) WhereComplex64(decider func(int, complex64) bool) *Value { + + var selected []complex64 + + v.EachComplex64(func(index int, val complex64) bool { + shouldSelect := decider(index, val) + if shouldSelect == false { + selected = append(selected, val) + } + return true + }) + + return &Value{data: selected} + +} + +// GroupComplex64 uses the specified grouper function to group the items +// keyed by the return of the grouper. The object contained in the +// result will contain a map[string][]complex64. +func (v *Value) GroupComplex64(grouper func(int, complex64) string) *Value { + + groups := make(map[string][]complex64) + + v.EachComplex64(func(index int, val complex64) bool { + group := grouper(index, val) + if _, ok := groups[group]; !ok { + groups[group] = make([]complex64, 0) + } + groups[group] = append(groups[group], val) + return true + }) + + return &Value{data: groups} + +} + +// ReplaceComplex64 uses the specified function to replace each complex64s +// by iterating each item. The data in the returned result will be a +// []complex64 containing the replaced items. +func (v *Value) ReplaceComplex64(replacer func(int, complex64) complex64) *Value { + + arr := v.MustComplex64Slice() + replaced := make([]complex64, len(arr)) + + v.EachComplex64(func(index int, val complex64) bool { + replaced[index] = replacer(index, val) + return true + }) + + return &Value{data: replaced} + +} + +// CollectComplex64 uses the specified collector function to collect a value +// for each of the complex64s in the slice. The data returned will be a +// []interface{}. +func (v *Value) CollectComplex64(collector func(int, complex64) interface{}) *Value { + + arr := v.MustComplex64Slice() + collected := make([]interface{}, len(arr)) + + v.EachComplex64(func(index int, val complex64) bool { + collected[index] = collector(index, val) + return true + }) + + return &Value{data: collected} +} + +/* + Complex128 (complex128 and []complex128) + -------------------------------------------------- +*/ + +// Complex128 gets the value as a complex128, returns the optionalDefault +// value or a system default object if the value is the wrong type. +func (v *Value) Complex128(optionalDefault ...complex128) complex128 { + if s, ok := v.data.(complex128); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return 0 +} + +// MustComplex128 gets the value as a complex128. +// +// Panics if the object is not a complex128. +func (v *Value) MustComplex128() complex128 { + return v.data.(complex128) +} + +// Complex128Slice gets the value as a []complex128, returns the optionalDefault +// value or nil if the value is not a []complex128. +func (v *Value) Complex128Slice(optionalDefault ...[]complex128) []complex128 { + if s, ok := v.data.([]complex128); ok { + return s + } + if len(optionalDefault) == 1 { + return optionalDefault[0] + } + return nil +} + +// MustComplex128Slice gets the value as a []complex128. +// +// Panics if the object is not a []complex128. +func (v *Value) MustComplex128Slice() []complex128 { + return v.data.([]complex128) +} + +// IsComplex128 gets whether the object contained is a complex128 or not. +func (v *Value) IsComplex128() bool { + _, ok := v.data.(complex128) + return ok +} + +// IsComplex128Slice gets whether the object contained is a []complex128 or not. +func (v *Value) IsComplex128Slice() bool { + _, ok := v.data.([]complex128) + return ok +} + +// EachComplex128 calls the specified callback for each object +// in the []complex128. +// +// Panics if the object is the wrong type. +func (v *Value) EachComplex128(callback func(int, complex128) bool) *Value { + + for index, val := range v.MustComplex128Slice() { + carryon := callback(index, val) + if carryon == false { + break + } + } + + return v + +} + +// WhereComplex128 uses the specified decider function to select items +// from the []complex128. The object contained in the result will contain +// only the selected items. +func (v *Value) WhereComplex128(decider func(int, complex128) bool) *Value { + + var selected []complex128 + + v.EachComplex128(func(index int, val complex128) bool { + shouldSelect := decider(index, val) + if shouldSelect == false { + selected = append(selected, val) + } + return true + }) + + return &Value{data: selected} + +} + +// GroupComplex128 uses the specified grouper function to group the items +// keyed by the return of the grouper. The object contained in the +// result will contain a map[string][]complex128. +func (v *Value) GroupComplex128(grouper func(int, complex128) string) *Value { + + groups := make(map[string][]complex128) + + v.EachComplex128(func(index int, val complex128) bool { + group := grouper(index, val) + if _, ok := groups[group]; !ok { + groups[group] = make([]complex128, 0) + } + groups[group] = append(groups[group], val) + return true + }) + + return &Value{data: groups} + +} + +// ReplaceComplex128 uses the specified function to replace each complex128s +// by iterating each item. The data in the returned result will be a +// []complex128 containing the replaced items. +func (v *Value) ReplaceComplex128(replacer func(int, complex128) complex128) *Value { + + arr := v.MustComplex128Slice() + replaced := make([]complex128, len(arr)) + + v.EachComplex128(func(index int, val complex128) bool { + replaced[index] = replacer(index, val) + return true + }) + + return &Value{data: replaced} + +} + +// CollectComplex128 uses the specified collector function to collect a value +// for each of the complex128s in the slice. The data returned will be a +// []interface{}. +func (v *Value) CollectComplex128(collector func(int, complex128) interface{}) *Value { + + arr := v.MustComplex128Slice() + collected := make([]interface{}, len(arr)) + + v.EachComplex128(func(index int, val complex128) bool { + collected[index] = collector(index, val) + return true + }) + + return &Value{data: collected} +} diff --git a/vendor/github.com/stretchr/objx/type_specific_codegen_test.go b/vendor/github.com/stretchr/objx/type_specific_codegen_test.go new file mode 100644 index 000000000..f7a4fceea --- /dev/null +++ b/vendor/github.com/stretchr/objx/type_specific_codegen_test.go @@ -0,0 +1,2867 @@ +package objx + +import ( + "fmt" + "github.com/stretchr/testify/assert" + "testing" +) + +// ************************************************************ +// TESTS +// ************************************************************ + +func TestInter(t *testing.T) { + + val := interface{}("something") + m := map[string]interface{}{"value": val, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").Inter()) + assert.Equal(t, val, New(m).Get("value").MustInter()) + assert.Equal(t, interface{}(nil), New(m).Get("nothing").Inter()) + assert.Equal(t, val, New(m).Get("nothing").Inter("something")) + + assert.Panics(t, func() { + New(m).Get("age").MustInter() + }) + +} + +func TestInterSlice(t *testing.T) { + + val := interface{}("something") + m := map[string]interface{}{"value": []interface{}{val}, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").InterSlice()[0]) + assert.Equal(t, val, New(m).Get("value").MustInterSlice()[0]) + assert.Equal(t, []interface{}(nil), New(m).Get("nothing").InterSlice()) + assert.Equal(t, val, New(m).Get("nothing").InterSlice([]interface{}{interface{}("something")})[0]) + + assert.Panics(t, func() { + New(m).Get("nothing").MustInterSlice() + }) + +} + +func TestIsInter(t *testing.T) { + + var v *Value + + v = &Value{data: interface{}("something")} + assert.True(t, v.IsInter()) + + v = &Value{data: []interface{}{interface{}("something")}} + assert.True(t, v.IsInterSlice()) + +} + +func TestEachInter(t *testing.T) { + + v := &Value{data: []interface{}{interface{}("something"), interface{}("something"), interface{}("something"), interface{}("something"), interface{}("something")}} + count := 0 + replacedVals := make([]interface{}, 0) + assert.Equal(t, v, v.EachInter(func(i int, val interface{}) bool { + + count++ + replacedVals = append(replacedVals, val) + + // abort early + if i == 2 { + return false + } + + return true + + })) + + assert.Equal(t, count, 3) + assert.Equal(t, replacedVals[0], v.MustInterSlice()[0]) + assert.Equal(t, replacedVals[1], v.MustInterSlice()[1]) + assert.Equal(t, replacedVals[2], v.MustInterSlice()[2]) + +} + +func TestWhereInter(t *testing.T) { + + v := &Value{data: []interface{}{interface{}("something"), interface{}("something"), interface{}("something"), interface{}("something"), interface{}("something"), interface{}("something")}} + + selected := v.WhereInter(func(i int, val interface{}) bool { + return i%2 == 0 + }).MustInterSlice() + + assert.Equal(t, 3, len(selected)) + +} + +func TestGroupInter(t *testing.T) { + + v := &Value{data: []interface{}{interface{}("something"), interface{}("something"), interface{}("something"), interface{}("something"), interface{}("something"), interface{}("something")}} + + grouped := v.GroupInter(func(i int, val interface{}) string { + return fmt.Sprintf("%v", i%2 == 0) + }).data.(map[string][]interface{}) + + assert.Equal(t, 2, len(grouped)) + assert.Equal(t, 3, len(grouped["true"])) + assert.Equal(t, 3, len(grouped["false"])) + +} + +func TestReplaceInter(t *testing.T) { + + v := &Value{data: []interface{}{interface{}("something"), interface{}("something"), interface{}("something"), interface{}("something"), interface{}("something"), interface{}("something")}} + + rawArr := v.MustInterSlice() + + replaced := v.ReplaceInter(func(index int, val interface{}) interface{} { + if index < len(rawArr)-1 { + return rawArr[index+1] + } + return rawArr[0] + }) + + replacedArr := replaced.MustInterSlice() + if assert.Equal(t, 6, len(replacedArr)) { + assert.Equal(t, replacedArr[0], rawArr[1]) + assert.Equal(t, replacedArr[1], rawArr[2]) + assert.Equal(t, replacedArr[2], rawArr[3]) + assert.Equal(t, replacedArr[3], rawArr[4]) + assert.Equal(t, replacedArr[4], rawArr[5]) + assert.Equal(t, replacedArr[5], rawArr[0]) + } + +} + +func TestCollectInter(t *testing.T) { + + v := &Value{data: []interface{}{interface{}("something"), interface{}("something"), interface{}("something"), interface{}("something"), interface{}("something"), interface{}("something")}} + + collected := v.CollectInter(func(index int, val interface{}) interface{} { + return index + }) + + collectedArr := collected.MustInterSlice() + if assert.Equal(t, 6, len(collectedArr)) { + assert.Equal(t, collectedArr[0], 0) + assert.Equal(t, collectedArr[1], 1) + assert.Equal(t, collectedArr[2], 2) + assert.Equal(t, collectedArr[3], 3) + assert.Equal(t, collectedArr[4], 4) + assert.Equal(t, collectedArr[5], 5) + } + +} + +// ************************************************************ +// TESTS +// ************************************************************ + +func TestMSI(t *testing.T) { + + val := map[string]interface{}(map[string]interface{}{"name": "Tyler"}) + m := map[string]interface{}{"value": val, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").MSI()) + assert.Equal(t, val, New(m).Get("value").MustMSI()) + assert.Equal(t, map[string]interface{}(nil), New(m).Get("nothing").MSI()) + assert.Equal(t, val, New(m).Get("nothing").MSI(map[string]interface{}{"name": "Tyler"})) + + assert.Panics(t, func() { + New(m).Get("age").MustMSI() + }) + +} + +func TestMSISlice(t *testing.T) { + + val := map[string]interface{}(map[string]interface{}{"name": "Tyler"}) + m := map[string]interface{}{"value": []map[string]interface{}{val}, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").MSISlice()[0]) + assert.Equal(t, val, New(m).Get("value").MustMSISlice()[0]) + assert.Equal(t, []map[string]interface{}(nil), New(m).Get("nothing").MSISlice()) + assert.Equal(t, val, New(m).Get("nothing").MSISlice([]map[string]interface{}{map[string]interface{}(map[string]interface{}{"name": "Tyler"})})[0]) + + assert.Panics(t, func() { + New(m).Get("nothing").MustMSISlice() + }) + +} + +func TestIsMSI(t *testing.T) { + + var v *Value + + v = &Value{data: map[string]interface{}(map[string]interface{}{"name": "Tyler"})} + assert.True(t, v.IsMSI()) + + v = &Value{data: []map[string]interface{}{map[string]interface{}(map[string]interface{}{"name": "Tyler"})}} + assert.True(t, v.IsMSISlice()) + +} + +func TestEachMSI(t *testing.T) { + + v := &Value{data: []map[string]interface{}{map[string]interface{}(map[string]interface{}{"name": "Tyler"}), map[string]interface{}(map[string]interface{}{"name": "Tyler"}), map[string]interface{}(map[string]interface{}{"name": "Tyler"}), map[string]interface{}(map[string]interface{}{"name": "Tyler"}), map[string]interface{}(map[string]interface{}{"name": "Tyler"})}} + count := 0 + replacedVals := make([]map[string]interface{}, 0) + assert.Equal(t, v, v.EachMSI(func(i int, val map[string]interface{}) bool { + + count++ + replacedVals = append(replacedVals, val) + + // abort early + if i == 2 { + return false + } + + return true + + })) + + assert.Equal(t, count, 3) + assert.Equal(t, replacedVals[0], v.MustMSISlice()[0]) + assert.Equal(t, replacedVals[1], v.MustMSISlice()[1]) + assert.Equal(t, replacedVals[2], v.MustMSISlice()[2]) + +} + +func TestWhereMSI(t *testing.T) { + + v := &Value{data: []map[string]interface{}{map[string]interface{}(map[string]interface{}{"name": "Tyler"}), map[string]interface{}(map[string]interface{}{"name": "Tyler"}), map[string]interface{}(map[string]interface{}{"name": "Tyler"}), map[string]interface{}(map[string]interface{}{"name": "Tyler"}), map[string]interface{}(map[string]interface{}{"name": "Tyler"}), map[string]interface{}(map[string]interface{}{"name": "Tyler"})}} + + selected := v.WhereMSI(func(i int, val map[string]interface{}) bool { + return i%2 == 0 + }).MustMSISlice() + + assert.Equal(t, 3, len(selected)) + +} + +func TestGroupMSI(t *testing.T) { + + v := &Value{data: []map[string]interface{}{map[string]interface{}(map[string]interface{}{"name": "Tyler"}), map[string]interface{}(map[string]interface{}{"name": "Tyler"}), map[string]interface{}(map[string]interface{}{"name": "Tyler"}), map[string]interface{}(map[string]interface{}{"name": "Tyler"}), map[string]interface{}(map[string]interface{}{"name": "Tyler"}), map[string]interface{}(map[string]interface{}{"name": "Tyler"})}} + + grouped := v.GroupMSI(func(i int, val map[string]interface{}) string { + return fmt.Sprintf("%v", i%2 == 0) + }).data.(map[string][]map[string]interface{}) + + assert.Equal(t, 2, len(grouped)) + assert.Equal(t, 3, len(grouped["true"])) + assert.Equal(t, 3, len(grouped["false"])) + +} + +func TestReplaceMSI(t *testing.T) { + + v := &Value{data: []map[string]interface{}{map[string]interface{}(map[string]interface{}{"name": "Tyler"}), map[string]interface{}(map[string]interface{}{"name": "Tyler"}), map[string]interface{}(map[string]interface{}{"name": "Tyler"}), map[string]interface{}(map[string]interface{}{"name": "Tyler"}), map[string]interface{}(map[string]interface{}{"name": "Tyler"}), map[string]interface{}(map[string]interface{}{"name": "Tyler"})}} + + rawArr := v.MustMSISlice() + + replaced := v.ReplaceMSI(func(index int, val map[string]interface{}) map[string]interface{} { + if index < len(rawArr)-1 { + return rawArr[index+1] + } + return rawArr[0] + }) + + replacedArr := replaced.MustMSISlice() + if assert.Equal(t, 6, len(replacedArr)) { + assert.Equal(t, replacedArr[0], rawArr[1]) + assert.Equal(t, replacedArr[1], rawArr[2]) + assert.Equal(t, replacedArr[2], rawArr[3]) + assert.Equal(t, replacedArr[3], rawArr[4]) + assert.Equal(t, replacedArr[4], rawArr[5]) + assert.Equal(t, replacedArr[5], rawArr[0]) + } + +} + +func TestCollectMSI(t *testing.T) { + + v := &Value{data: []map[string]interface{}{map[string]interface{}(map[string]interface{}{"name": "Tyler"}), map[string]interface{}(map[string]interface{}{"name": "Tyler"}), map[string]interface{}(map[string]interface{}{"name": "Tyler"}), map[string]interface{}(map[string]interface{}{"name": "Tyler"}), map[string]interface{}(map[string]interface{}{"name": "Tyler"}), map[string]interface{}(map[string]interface{}{"name": "Tyler"})}} + + collected := v.CollectMSI(func(index int, val map[string]interface{}) interface{} { + return index + }) + + collectedArr := collected.MustInterSlice() + if assert.Equal(t, 6, len(collectedArr)) { + assert.Equal(t, collectedArr[0], 0) + assert.Equal(t, collectedArr[1], 1) + assert.Equal(t, collectedArr[2], 2) + assert.Equal(t, collectedArr[3], 3) + assert.Equal(t, collectedArr[4], 4) + assert.Equal(t, collectedArr[5], 5) + } + +} + +// ************************************************************ +// TESTS +// ************************************************************ + +func TestObjxMap(t *testing.T) { + + val := (Map)(New(1)) + m := map[string]interface{}{"value": val, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").ObjxMap()) + assert.Equal(t, val, New(m).Get("value").MustObjxMap()) + assert.Equal(t, (Map)(New(nil)), New(m).Get("nothing").ObjxMap()) + assert.Equal(t, val, New(m).Get("nothing").ObjxMap(New(1))) + + assert.Panics(t, func() { + New(m).Get("age").MustObjxMap() + }) + +} + +func TestObjxMapSlice(t *testing.T) { + + val := (Map)(New(1)) + m := map[string]interface{}{"value": [](Map){val}, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").ObjxMapSlice()[0]) + assert.Equal(t, val, New(m).Get("value").MustObjxMapSlice()[0]) + assert.Equal(t, [](Map)(nil), New(m).Get("nothing").ObjxMapSlice()) + assert.Equal(t, val, New(m).Get("nothing").ObjxMapSlice([](Map){(Map)(New(1))})[0]) + + assert.Panics(t, func() { + New(m).Get("nothing").MustObjxMapSlice() + }) + +} + +func TestIsObjxMap(t *testing.T) { + + var v *Value + + v = &Value{data: (Map)(New(1))} + assert.True(t, v.IsObjxMap()) + + v = &Value{data: [](Map){(Map)(New(1))}} + assert.True(t, v.IsObjxMapSlice()) + +} + +func TestEachObjxMap(t *testing.T) { + + v := &Value{data: [](Map){(Map)(New(1)), (Map)(New(1)), (Map)(New(1)), (Map)(New(1)), (Map)(New(1))}} + count := 0 + replacedVals := make([](Map), 0) + assert.Equal(t, v, v.EachObjxMap(func(i int, val Map) bool { + + count++ + replacedVals = append(replacedVals, val) + + // abort early + if i == 2 { + return false + } + + return true + + })) + + assert.Equal(t, count, 3) + assert.Equal(t, replacedVals[0], v.MustObjxMapSlice()[0]) + assert.Equal(t, replacedVals[1], v.MustObjxMapSlice()[1]) + assert.Equal(t, replacedVals[2], v.MustObjxMapSlice()[2]) + +} + +func TestWhereObjxMap(t *testing.T) { + + v := &Value{data: [](Map){(Map)(New(1)), (Map)(New(1)), (Map)(New(1)), (Map)(New(1)), (Map)(New(1)), (Map)(New(1))}} + + selected := v.WhereObjxMap(func(i int, val Map) bool { + return i%2 == 0 + }).MustObjxMapSlice() + + assert.Equal(t, 3, len(selected)) + +} + +func TestGroupObjxMap(t *testing.T) { + + v := &Value{data: [](Map){(Map)(New(1)), (Map)(New(1)), (Map)(New(1)), (Map)(New(1)), (Map)(New(1)), (Map)(New(1))}} + + grouped := v.GroupObjxMap(func(i int, val Map) string { + return fmt.Sprintf("%v", i%2 == 0) + }).data.(map[string][](Map)) + + assert.Equal(t, 2, len(grouped)) + assert.Equal(t, 3, len(grouped["true"])) + assert.Equal(t, 3, len(grouped["false"])) + +} + +func TestReplaceObjxMap(t *testing.T) { + + v := &Value{data: [](Map){(Map)(New(1)), (Map)(New(1)), (Map)(New(1)), (Map)(New(1)), (Map)(New(1)), (Map)(New(1))}} + + rawArr := v.MustObjxMapSlice() + + replaced := v.ReplaceObjxMap(func(index int, val Map) Map { + if index < len(rawArr)-1 { + return rawArr[index+1] + } + return rawArr[0] + }) + + replacedArr := replaced.MustObjxMapSlice() + if assert.Equal(t, 6, len(replacedArr)) { + assert.Equal(t, replacedArr[0], rawArr[1]) + assert.Equal(t, replacedArr[1], rawArr[2]) + assert.Equal(t, replacedArr[2], rawArr[3]) + assert.Equal(t, replacedArr[3], rawArr[4]) + assert.Equal(t, replacedArr[4], rawArr[5]) + assert.Equal(t, replacedArr[5], rawArr[0]) + } + +} + +func TestCollectObjxMap(t *testing.T) { + + v := &Value{data: [](Map){(Map)(New(1)), (Map)(New(1)), (Map)(New(1)), (Map)(New(1)), (Map)(New(1)), (Map)(New(1))}} + + collected := v.CollectObjxMap(func(index int, val Map) interface{} { + return index + }) + + collectedArr := collected.MustInterSlice() + if assert.Equal(t, 6, len(collectedArr)) { + assert.Equal(t, collectedArr[0], 0) + assert.Equal(t, collectedArr[1], 1) + assert.Equal(t, collectedArr[2], 2) + assert.Equal(t, collectedArr[3], 3) + assert.Equal(t, collectedArr[4], 4) + assert.Equal(t, collectedArr[5], 5) + } + +} + +// ************************************************************ +// TESTS +// ************************************************************ + +func TestBool(t *testing.T) { + + val := bool(true) + m := map[string]interface{}{"value": val, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").Bool()) + assert.Equal(t, val, New(m).Get("value").MustBool()) + assert.Equal(t, bool(false), New(m).Get("nothing").Bool()) + assert.Equal(t, val, New(m).Get("nothing").Bool(true)) + + assert.Panics(t, func() { + New(m).Get("age").MustBool() + }) + +} + +func TestBoolSlice(t *testing.T) { + + val := bool(true) + m := map[string]interface{}{"value": []bool{val}, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").BoolSlice()[0]) + assert.Equal(t, val, New(m).Get("value").MustBoolSlice()[0]) + assert.Equal(t, []bool(nil), New(m).Get("nothing").BoolSlice()) + assert.Equal(t, val, New(m).Get("nothing").BoolSlice([]bool{bool(true)})[0]) + + assert.Panics(t, func() { + New(m).Get("nothing").MustBoolSlice() + }) + +} + +func TestIsBool(t *testing.T) { + + var v *Value + + v = &Value{data: bool(true)} + assert.True(t, v.IsBool()) + + v = &Value{data: []bool{bool(true)}} + assert.True(t, v.IsBoolSlice()) + +} + +func TestEachBool(t *testing.T) { + + v := &Value{data: []bool{bool(true), bool(true), bool(true), bool(true), bool(true)}} + count := 0 + replacedVals := make([]bool, 0) + assert.Equal(t, v, v.EachBool(func(i int, val bool) bool { + + count++ + replacedVals = append(replacedVals, val) + + // abort early + if i == 2 { + return false + } + + return true + + })) + + assert.Equal(t, count, 3) + assert.Equal(t, replacedVals[0], v.MustBoolSlice()[0]) + assert.Equal(t, replacedVals[1], v.MustBoolSlice()[1]) + assert.Equal(t, replacedVals[2], v.MustBoolSlice()[2]) + +} + +func TestWhereBool(t *testing.T) { + + v := &Value{data: []bool{bool(true), bool(true), bool(true), bool(true), bool(true), bool(true)}} + + selected := v.WhereBool(func(i int, val bool) bool { + return i%2 == 0 + }).MustBoolSlice() + + assert.Equal(t, 3, len(selected)) + +} + +func TestGroupBool(t *testing.T) { + + v := &Value{data: []bool{bool(true), bool(true), bool(true), bool(true), bool(true), bool(true)}} + + grouped := v.GroupBool(func(i int, val bool) string { + return fmt.Sprintf("%v", i%2 == 0) + }).data.(map[string][]bool) + + assert.Equal(t, 2, len(grouped)) + assert.Equal(t, 3, len(grouped["true"])) + assert.Equal(t, 3, len(grouped["false"])) + +} + +func TestReplaceBool(t *testing.T) { + + v := &Value{data: []bool{bool(true), bool(true), bool(true), bool(true), bool(true), bool(true)}} + + rawArr := v.MustBoolSlice() + + replaced := v.ReplaceBool(func(index int, val bool) bool { + if index < len(rawArr)-1 { + return rawArr[index+1] + } + return rawArr[0] + }) + + replacedArr := replaced.MustBoolSlice() + if assert.Equal(t, 6, len(replacedArr)) { + assert.Equal(t, replacedArr[0], rawArr[1]) + assert.Equal(t, replacedArr[1], rawArr[2]) + assert.Equal(t, replacedArr[2], rawArr[3]) + assert.Equal(t, replacedArr[3], rawArr[4]) + assert.Equal(t, replacedArr[4], rawArr[5]) + assert.Equal(t, replacedArr[5], rawArr[0]) + } + +} + +func TestCollectBool(t *testing.T) { + + v := &Value{data: []bool{bool(true), bool(true), bool(true), bool(true), bool(true), bool(true)}} + + collected := v.CollectBool(func(index int, val bool) interface{} { + return index + }) + + collectedArr := collected.MustInterSlice() + if assert.Equal(t, 6, len(collectedArr)) { + assert.Equal(t, collectedArr[0], 0) + assert.Equal(t, collectedArr[1], 1) + assert.Equal(t, collectedArr[2], 2) + assert.Equal(t, collectedArr[3], 3) + assert.Equal(t, collectedArr[4], 4) + assert.Equal(t, collectedArr[5], 5) + } + +} + +// ************************************************************ +// TESTS +// ************************************************************ + +func TestStr(t *testing.T) { + + val := string("hello") + m := map[string]interface{}{"value": val, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").Str()) + assert.Equal(t, val, New(m).Get("value").MustStr()) + assert.Equal(t, string(""), New(m).Get("nothing").Str()) + assert.Equal(t, val, New(m).Get("nothing").Str("hello")) + + assert.Panics(t, func() { + New(m).Get("age").MustStr() + }) + +} + +func TestStrSlice(t *testing.T) { + + val := string("hello") + m := map[string]interface{}{"value": []string{val}, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").StrSlice()[0]) + assert.Equal(t, val, New(m).Get("value").MustStrSlice()[0]) + assert.Equal(t, []string(nil), New(m).Get("nothing").StrSlice()) + assert.Equal(t, val, New(m).Get("nothing").StrSlice([]string{string("hello")})[0]) + + assert.Panics(t, func() { + New(m).Get("nothing").MustStrSlice() + }) + +} + +func TestIsStr(t *testing.T) { + + var v *Value + + v = &Value{data: string("hello")} + assert.True(t, v.IsStr()) + + v = &Value{data: []string{string("hello")}} + assert.True(t, v.IsStrSlice()) + +} + +func TestEachStr(t *testing.T) { + + v := &Value{data: []string{string("hello"), string("hello"), string("hello"), string("hello"), string("hello")}} + count := 0 + replacedVals := make([]string, 0) + assert.Equal(t, v, v.EachStr(func(i int, val string) bool { + + count++ + replacedVals = append(replacedVals, val) + + // abort early + if i == 2 { + return false + } + + return true + + })) + + assert.Equal(t, count, 3) + assert.Equal(t, replacedVals[0], v.MustStrSlice()[0]) + assert.Equal(t, replacedVals[1], v.MustStrSlice()[1]) + assert.Equal(t, replacedVals[2], v.MustStrSlice()[2]) + +} + +func TestWhereStr(t *testing.T) { + + v := &Value{data: []string{string("hello"), string("hello"), string("hello"), string("hello"), string("hello"), string("hello")}} + + selected := v.WhereStr(func(i int, val string) bool { + return i%2 == 0 + }).MustStrSlice() + + assert.Equal(t, 3, len(selected)) + +} + +func TestGroupStr(t *testing.T) { + + v := &Value{data: []string{string("hello"), string("hello"), string("hello"), string("hello"), string("hello"), string("hello")}} + + grouped := v.GroupStr(func(i int, val string) string { + return fmt.Sprintf("%v", i%2 == 0) + }).data.(map[string][]string) + + assert.Equal(t, 2, len(grouped)) + assert.Equal(t, 3, len(grouped["true"])) + assert.Equal(t, 3, len(grouped["false"])) + +} + +func TestReplaceStr(t *testing.T) { + + v := &Value{data: []string{string("hello"), string("hello"), string("hello"), string("hello"), string("hello"), string("hello")}} + + rawArr := v.MustStrSlice() + + replaced := v.ReplaceStr(func(index int, val string) string { + if index < len(rawArr)-1 { + return rawArr[index+1] + } + return rawArr[0] + }) + + replacedArr := replaced.MustStrSlice() + if assert.Equal(t, 6, len(replacedArr)) { + assert.Equal(t, replacedArr[0], rawArr[1]) + assert.Equal(t, replacedArr[1], rawArr[2]) + assert.Equal(t, replacedArr[2], rawArr[3]) + assert.Equal(t, replacedArr[3], rawArr[4]) + assert.Equal(t, replacedArr[4], rawArr[5]) + assert.Equal(t, replacedArr[5], rawArr[0]) + } + +} + +func TestCollectStr(t *testing.T) { + + v := &Value{data: []string{string("hello"), string("hello"), string("hello"), string("hello"), string("hello"), string("hello")}} + + collected := v.CollectStr(func(index int, val string) interface{} { + return index + }) + + collectedArr := collected.MustInterSlice() + if assert.Equal(t, 6, len(collectedArr)) { + assert.Equal(t, collectedArr[0], 0) + assert.Equal(t, collectedArr[1], 1) + assert.Equal(t, collectedArr[2], 2) + assert.Equal(t, collectedArr[3], 3) + assert.Equal(t, collectedArr[4], 4) + assert.Equal(t, collectedArr[5], 5) + } + +} + +// ************************************************************ +// TESTS +// ************************************************************ + +func TestInt(t *testing.T) { + + val := int(1) + m := map[string]interface{}{"value": val, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").Int()) + assert.Equal(t, val, New(m).Get("value").MustInt()) + assert.Equal(t, int(0), New(m).Get("nothing").Int()) + assert.Equal(t, val, New(m).Get("nothing").Int(1)) + + assert.Panics(t, func() { + New(m).Get("age").MustInt() + }) + +} + +func TestIntSlice(t *testing.T) { + + val := int(1) + m := map[string]interface{}{"value": []int{val}, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").IntSlice()[0]) + assert.Equal(t, val, New(m).Get("value").MustIntSlice()[0]) + assert.Equal(t, []int(nil), New(m).Get("nothing").IntSlice()) + assert.Equal(t, val, New(m).Get("nothing").IntSlice([]int{int(1)})[0]) + + assert.Panics(t, func() { + New(m).Get("nothing").MustIntSlice() + }) + +} + +func TestIsInt(t *testing.T) { + + var v *Value + + v = &Value{data: int(1)} + assert.True(t, v.IsInt()) + + v = &Value{data: []int{int(1)}} + assert.True(t, v.IsIntSlice()) + +} + +func TestEachInt(t *testing.T) { + + v := &Value{data: []int{int(1), int(1), int(1), int(1), int(1)}} + count := 0 + replacedVals := make([]int, 0) + assert.Equal(t, v, v.EachInt(func(i int, val int) bool { + + count++ + replacedVals = append(replacedVals, val) + + // abort early + if i == 2 { + return false + } + + return true + + })) + + assert.Equal(t, count, 3) + assert.Equal(t, replacedVals[0], v.MustIntSlice()[0]) + assert.Equal(t, replacedVals[1], v.MustIntSlice()[1]) + assert.Equal(t, replacedVals[2], v.MustIntSlice()[2]) + +} + +func TestWhereInt(t *testing.T) { + + v := &Value{data: []int{int(1), int(1), int(1), int(1), int(1), int(1)}} + + selected := v.WhereInt(func(i int, val int) bool { + return i%2 == 0 + }).MustIntSlice() + + assert.Equal(t, 3, len(selected)) + +} + +func TestGroupInt(t *testing.T) { + + v := &Value{data: []int{int(1), int(1), int(1), int(1), int(1), int(1)}} + + grouped := v.GroupInt(func(i int, val int) string { + return fmt.Sprintf("%v", i%2 == 0) + }).data.(map[string][]int) + + assert.Equal(t, 2, len(grouped)) + assert.Equal(t, 3, len(grouped["true"])) + assert.Equal(t, 3, len(grouped["false"])) + +} + +func TestReplaceInt(t *testing.T) { + + v := &Value{data: []int{int(1), int(1), int(1), int(1), int(1), int(1)}} + + rawArr := v.MustIntSlice() + + replaced := v.ReplaceInt(func(index int, val int) int { + if index < len(rawArr)-1 { + return rawArr[index+1] + } + return rawArr[0] + }) + + replacedArr := replaced.MustIntSlice() + if assert.Equal(t, 6, len(replacedArr)) { + assert.Equal(t, replacedArr[0], rawArr[1]) + assert.Equal(t, replacedArr[1], rawArr[2]) + assert.Equal(t, replacedArr[2], rawArr[3]) + assert.Equal(t, replacedArr[3], rawArr[4]) + assert.Equal(t, replacedArr[4], rawArr[5]) + assert.Equal(t, replacedArr[5], rawArr[0]) + } + +} + +func TestCollectInt(t *testing.T) { + + v := &Value{data: []int{int(1), int(1), int(1), int(1), int(1), int(1)}} + + collected := v.CollectInt(func(index int, val int) interface{} { + return index + }) + + collectedArr := collected.MustInterSlice() + if assert.Equal(t, 6, len(collectedArr)) { + assert.Equal(t, collectedArr[0], 0) + assert.Equal(t, collectedArr[1], 1) + assert.Equal(t, collectedArr[2], 2) + assert.Equal(t, collectedArr[3], 3) + assert.Equal(t, collectedArr[4], 4) + assert.Equal(t, collectedArr[5], 5) + } + +} + +// ************************************************************ +// TESTS +// ************************************************************ + +func TestInt8(t *testing.T) { + + val := int8(1) + m := map[string]interface{}{"value": val, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").Int8()) + assert.Equal(t, val, New(m).Get("value").MustInt8()) + assert.Equal(t, int8(0), New(m).Get("nothing").Int8()) + assert.Equal(t, val, New(m).Get("nothing").Int8(1)) + + assert.Panics(t, func() { + New(m).Get("age").MustInt8() + }) + +} + +func TestInt8Slice(t *testing.T) { + + val := int8(1) + m := map[string]interface{}{"value": []int8{val}, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").Int8Slice()[0]) + assert.Equal(t, val, New(m).Get("value").MustInt8Slice()[0]) + assert.Equal(t, []int8(nil), New(m).Get("nothing").Int8Slice()) + assert.Equal(t, val, New(m).Get("nothing").Int8Slice([]int8{int8(1)})[0]) + + assert.Panics(t, func() { + New(m).Get("nothing").MustInt8Slice() + }) + +} + +func TestIsInt8(t *testing.T) { + + var v *Value + + v = &Value{data: int8(1)} + assert.True(t, v.IsInt8()) + + v = &Value{data: []int8{int8(1)}} + assert.True(t, v.IsInt8Slice()) + +} + +func TestEachInt8(t *testing.T) { + + v := &Value{data: []int8{int8(1), int8(1), int8(1), int8(1), int8(1)}} + count := 0 + replacedVals := make([]int8, 0) + assert.Equal(t, v, v.EachInt8(func(i int, val int8) bool { + + count++ + replacedVals = append(replacedVals, val) + + // abort early + if i == 2 { + return false + } + + return true + + })) + + assert.Equal(t, count, 3) + assert.Equal(t, replacedVals[0], v.MustInt8Slice()[0]) + assert.Equal(t, replacedVals[1], v.MustInt8Slice()[1]) + assert.Equal(t, replacedVals[2], v.MustInt8Slice()[2]) + +} + +func TestWhereInt8(t *testing.T) { + + v := &Value{data: []int8{int8(1), int8(1), int8(1), int8(1), int8(1), int8(1)}} + + selected := v.WhereInt8(func(i int, val int8) bool { + return i%2 == 0 + }).MustInt8Slice() + + assert.Equal(t, 3, len(selected)) + +} + +func TestGroupInt8(t *testing.T) { + + v := &Value{data: []int8{int8(1), int8(1), int8(1), int8(1), int8(1), int8(1)}} + + grouped := v.GroupInt8(func(i int, val int8) string { + return fmt.Sprintf("%v", i%2 == 0) + }).data.(map[string][]int8) + + assert.Equal(t, 2, len(grouped)) + assert.Equal(t, 3, len(grouped["true"])) + assert.Equal(t, 3, len(grouped["false"])) + +} + +func TestReplaceInt8(t *testing.T) { + + v := &Value{data: []int8{int8(1), int8(1), int8(1), int8(1), int8(1), int8(1)}} + + rawArr := v.MustInt8Slice() + + replaced := v.ReplaceInt8(func(index int, val int8) int8 { + if index < len(rawArr)-1 { + return rawArr[index+1] + } + return rawArr[0] + }) + + replacedArr := replaced.MustInt8Slice() + if assert.Equal(t, 6, len(replacedArr)) { + assert.Equal(t, replacedArr[0], rawArr[1]) + assert.Equal(t, replacedArr[1], rawArr[2]) + assert.Equal(t, replacedArr[2], rawArr[3]) + assert.Equal(t, replacedArr[3], rawArr[4]) + assert.Equal(t, replacedArr[4], rawArr[5]) + assert.Equal(t, replacedArr[5], rawArr[0]) + } + +} + +func TestCollectInt8(t *testing.T) { + + v := &Value{data: []int8{int8(1), int8(1), int8(1), int8(1), int8(1), int8(1)}} + + collected := v.CollectInt8(func(index int, val int8) interface{} { + return index + }) + + collectedArr := collected.MustInterSlice() + if assert.Equal(t, 6, len(collectedArr)) { + assert.Equal(t, collectedArr[0], 0) + assert.Equal(t, collectedArr[1], 1) + assert.Equal(t, collectedArr[2], 2) + assert.Equal(t, collectedArr[3], 3) + assert.Equal(t, collectedArr[4], 4) + assert.Equal(t, collectedArr[5], 5) + } + +} + +// ************************************************************ +// TESTS +// ************************************************************ + +func TestInt16(t *testing.T) { + + val := int16(1) + m := map[string]interface{}{"value": val, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").Int16()) + assert.Equal(t, val, New(m).Get("value").MustInt16()) + assert.Equal(t, int16(0), New(m).Get("nothing").Int16()) + assert.Equal(t, val, New(m).Get("nothing").Int16(1)) + + assert.Panics(t, func() { + New(m).Get("age").MustInt16() + }) + +} + +func TestInt16Slice(t *testing.T) { + + val := int16(1) + m := map[string]interface{}{"value": []int16{val}, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").Int16Slice()[0]) + assert.Equal(t, val, New(m).Get("value").MustInt16Slice()[0]) + assert.Equal(t, []int16(nil), New(m).Get("nothing").Int16Slice()) + assert.Equal(t, val, New(m).Get("nothing").Int16Slice([]int16{int16(1)})[0]) + + assert.Panics(t, func() { + New(m).Get("nothing").MustInt16Slice() + }) + +} + +func TestIsInt16(t *testing.T) { + + var v *Value + + v = &Value{data: int16(1)} + assert.True(t, v.IsInt16()) + + v = &Value{data: []int16{int16(1)}} + assert.True(t, v.IsInt16Slice()) + +} + +func TestEachInt16(t *testing.T) { + + v := &Value{data: []int16{int16(1), int16(1), int16(1), int16(1), int16(1)}} + count := 0 + replacedVals := make([]int16, 0) + assert.Equal(t, v, v.EachInt16(func(i int, val int16) bool { + + count++ + replacedVals = append(replacedVals, val) + + // abort early + if i == 2 { + return false + } + + return true + + })) + + assert.Equal(t, count, 3) + assert.Equal(t, replacedVals[0], v.MustInt16Slice()[0]) + assert.Equal(t, replacedVals[1], v.MustInt16Slice()[1]) + assert.Equal(t, replacedVals[2], v.MustInt16Slice()[2]) + +} + +func TestWhereInt16(t *testing.T) { + + v := &Value{data: []int16{int16(1), int16(1), int16(1), int16(1), int16(1), int16(1)}} + + selected := v.WhereInt16(func(i int, val int16) bool { + return i%2 == 0 + }).MustInt16Slice() + + assert.Equal(t, 3, len(selected)) + +} + +func TestGroupInt16(t *testing.T) { + + v := &Value{data: []int16{int16(1), int16(1), int16(1), int16(1), int16(1), int16(1)}} + + grouped := v.GroupInt16(func(i int, val int16) string { + return fmt.Sprintf("%v", i%2 == 0) + }).data.(map[string][]int16) + + assert.Equal(t, 2, len(grouped)) + assert.Equal(t, 3, len(grouped["true"])) + assert.Equal(t, 3, len(grouped["false"])) + +} + +func TestReplaceInt16(t *testing.T) { + + v := &Value{data: []int16{int16(1), int16(1), int16(1), int16(1), int16(1), int16(1)}} + + rawArr := v.MustInt16Slice() + + replaced := v.ReplaceInt16(func(index int, val int16) int16 { + if index < len(rawArr)-1 { + return rawArr[index+1] + } + return rawArr[0] + }) + + replacedArr := replaced.MustInt16Slice() + if assert.Equal(t, 6, len(replacedArr)) { + assert.Equal(t, replacedArr[0], rawArr[1]) + assert.Equal(t, replacedArr[1], rawArr[2]) + assert.Equal(t, replacedArr[2], rawArr[3]) + assert.Equal(t, replacedArr[3], rawArr[4]) + assert.Equal(t, replacedArr[4], rawArr[5]) + assert.Equal(t, replacedArr[5], rawArr[0]) + } + +} + +func TestCollectInt16(t *testing.T) { + + v := &Value{data: []int16{int16(1), int16(1), int16(1), int16(1), int16(1), int16(1)}} + + collected := v.CollectInt16(func(index int, val int16) interface{} { + return index + }) + + collectedArr := collected.MustInterSlice() + if assert.Equal(t, 6, len(collectedArr)) { + assert.Equal(t, collectedArr[0], 0) + assert.Equal(t, collectedArr[1], 1) + assert.Equal(t, collectedArr[2], 2) + assert.Equal(t, collectedArr[3], 3) + assert.Equal(t, collectedArr[4], 4) + assert.Equal(t, collectedArr[5], 5) + } + +} + +// ************************************************************ +// TESTS +// ************************************************************ + +func TestInt32(t *testing.T) { + + val := int32(1) + m := map[string]interface{}{"value": val, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").Int32()) + assert.Equal(t, val, New(m).Get("value").MustInt32()) + assert.Equal(t, int32(0), New(m).Get("nothing").Int32()) + assert.Equal(t, val, New(m).Get("nothing").Int32(1)) + + assert.Panics(t, func() { + New(m).Get("age").MustInt32() + }) + +} + +func TestInt32Slice(t *testing.T) { + + val := int32(1) + m := map[string]interface{}{"value": []int32{val}, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").Int32Slice()[0]) + assert.Equal(t, val, New(m).Get("value").MustInt32Slice()[0]) + assert.Equal(t, []int32(nil), New(m).Get("nothing").Int32Slice()) + assert.Equal(t, val, New(m).Get("nothing").Int32Slice([]int32{int32(1)})[0]) + + assert.Panics(t, func() { + New(m).Get("nothing").MustInt32Slice() + }) + +} + +func TestIsInt32(t *testing.T) { + + var v *Value + + v = &Value{data: int32(1)} + assert.True(t, v.IsInt32()) + + v = &Value{data: []int32{int32(1)}} + assert.True(t, v.IsInt32Slice()) + +} + +func TestEachInt32(t *testing.T) { + + v := &Value{data: []int32{int32(1), int32(1), int32(1), int32(1), int32(1)}} + count := 0 + replacedVals := make([]int32, 0) + assert.Equal(t, v, v.EachInt32(func(i int, val int32) bool { + + count++ + replacedVals = append(replacedVals, val) + + // abort early + if i == 2 { + return false + } + + return true + + })) + + assert.Equal(t, count, 3) + assert.Equal(t, replacedVals[0], v.MustInt32Slice()[0]) + assert.Equal(t, replacedVals[1], v.MustInt32Slice()[1]) + assert.Equal(t, replacedVals[2], v.MustInt32Slice()[2]) + +} + +func TestWhereInt32(t *testing.T) { + + v := &Value{data: []int32{int32(1), int32(1), int32(1), int32(1), int32(1), int32(1)}} + + selected := v.WhereInt32(func(i int, val int32) bool { + return i%2 == 0 + }).MustInt32Slice() + + assert.Equal(t, 3, len(selected)) + +} + +func TestGroupInt32(t *testing.T) { + + v := &Value{data: []int32{int32(1), int32(1), int32(1), int32(1), int32(1), int32(1)}} + + grouped := v.GroupInt32(func(i int, val int32) string { + return fmt.Sprintf("%v", i%2 == 0) + }).data.(map[string][]int32) + + assert.Equal(t, 2, len(grouped)) + assert.Equal(t, 3, len(grouped["true"])) + assert.Equal(t, 3, len(grouped["false"])) + +} + +func TestReplaceInt32(t *testing.T) { + + v := &Value{data: []int32{int32(1), int32(1), int32(1), int32(1), int32(1), int32(1)}} + + rawArr := v.MustInt32Slice() + + replaced := v.ReplaceInt32(func(index int, val int32) int32 { + if index < len(rawArr)-1 { + return rawArr[index+1] + } + return rawArr[0] + }) + + replacedArr := replaced.MustInt32Slice() + if assert.Equal(t, 6, len(replacedArr)) { + assert.Equal(t, replacedArr[0], rawArr[1]) + assert.Equal(t, replacedArr[1], rawArr[2]) + assert.Equal(t, replacedArr[2], rawArr[3]) + assert.Equal(t, replacedArr[3], rawArr[4]) + assert.Equal(t, replacedArr[4], rawArr[5]) + assert.Equal(t, replacedArr[5], rawArr[0]) + } + +} + +func TestCollectInt32(t *testing.T) { + + v := &Value{data: []int32{int32(1), int32(1), int32(1), int32(1), int32(1), int32(1)}} + + collected := v.CollectInt32(func(index int, val int32) interface{} { + return index + }) + + collectedArr := collected.MustInterSlice() + if assert.Equal(t, 6, len(collectedArr)) { + assert.Equal(t, collectedArr[0], 0) + assert.Equal(t, collectedArr[1], 1) + assert.Equal(t, collectedArr[2], 2) + assert.Equal(t, collectedArr[3], 3) + assert.Equal(t, collectedArr[4], 4) + assert.Equal(t, collectedArr[5], 5) + } + +} + +// ************************************************************ +// TESTS +// ************************************************************ + +func TestInt64(t *testing.T) { + + val := int64(1) + m := map[string]interface{}{"value": val, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").Int64()) + assert.Equal(t, val, New(m).Get("value").MustInt64()) + assert.Equal(t, int64(0), New(m).Get("nothing").Int64()) + assert.Equal(t, val, New(m).Get("nothing").Int64(1)) + + assert.Panics(t, func() { + New(m).Get("age").MustInt64() + }) + +} + +func TestInt64Slice(t *testing.T) { + + val := int64(1) + m := map[string]interface{}{"value": []int64{val}, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").Int64Slice()[0]) + assert.Equal(t, val, New(m).Get("value").MustInt64Slice()[0]) + assert.Equal(t, []int64(nil), New(m).Get("nothing").Int64Slice()) + assert.Equal(t, val, New(m).Get("nothing").Int64Slice([]int64{int64(1)})[0]) + + assert.Panics(t, func() { + New(m).Get("nothing").MustInt64Slice() + }) + +} + +func TestIsInt64(t *testing.T) { + + var v *Value + + v = &Value{data: int64(1)} + assert.True(t, v.IsInt64()) + + v = &Value{data: []int64{int64(1)}} + assert.True(t, v.IsInt64Slice()) + +} + +func TestEachInt64(t *testing.T) { + + v := &Value{data: []int64{int64(1), int64(1), int64(1), int64(1), int64(1)}} + count := 0 + replacedVals := make([]int64, 0) + assert.Equal(t, v, v.EachInt64(func(i int, val int64) bool { + + count++ + replacedVals = append(replacedVals, val) + + // abort early + if i == 2 { + return false + } + + return true + + })) + + assert.Equal(t, count, 3) + assert.Equal(t, replacedVals[0], v.MustInt64Slice()[0]) + assert.Equal(t, replacedVals[1], v.MustInt64Slice()[1]) + assert.Equal(t, replacedVals[2], v.MustInt64Slice()[2]) + +} + +func TestWhereInt64(t *testing.T) { + + v := &Value{data: []int64{int64(1), int64(1), int64(1), int64(1), int64(1), int64(1)}} + + selected := v.WhereInt64(func(i int, val int64) bool { + return i%2 == 0 + }).MustInt64Slice() + + assert.Equal(t, 3, len(selected)) + +} + +func TestGroupInt64(t *testing.T) { + + v := &Value{data: []int64{int64(1), int64(1), int64(1), int64(1), int64(1), int64(1)}} + + grouped := v.GroupInt64(func(i int, val int64) string { + return fmt.Sprintf("%v", i%2 == 0) + }).data.(map[string][]int64) + + assert.Equal(t, 2, len(grouped)) + assert.Equal(t, 3, len(grouped["true"])) + assert.Equal(t, 3, len(grouped["false"])) + +} + +func TestReplaceInt64(t *testing.T) { + + v := &Value{data: []int64{int64(1), int64(1), int64(1), int64(1), int64(1), int64(1)}} + + rawArr := v.MustInt64Slice() + + replaced := v.ReplaceInt64(func(index int, val int64) int64 { + if index < len(rawArr)-1 { + return rawArr[index+1] + } + return rawArr[0] + }) + + replacedArr := replaced.MustInt64Slice() + if assert.Equal(t, 6, len(replacedArr)) { + assert.Equal(t, replacedArr[0], rawArr[1]) + assert.Equal(t, replacedArr[1], rawArr[2]) + assert.Equal(t, replacedArr[2], rawArr[3]) + assert.Equal(t, replacedArr[3], rawArr[4]) + assert.Equal(t, replacedArr[4], rawArr[5]) + assert.Equal(t, replacedArr[5], rawArr[0]) + } + +} + +func TestCollectInt64(t *testing.T) { + + v := &Value{data: []int64{int64(1), int64(1), int64(1), int64(1), int64(1), int64(1)}} + + collected := v.CollectInt64(func(index int, val int64) interface{} { + return index + }) + + collectedArr := collected.MustInterSlice() + if assert.Equal(t, 6, len(collectedArr)) { + assert.Equal(t, collectedArr[0], 0) + assert.Equal(t, collectedArr[1], 1) + assert.Equal(t, collectedArr[2], 2) + assert.Equal(t, collectedArr[3], 3) + assert.Equal(t, collectedArr[4], 4) + assert.Equal(t, collectedArr[5], 5) + } + +} + +// ************************************************************ +// TESTS +// ************************************************************ + +func TestUint(t *testing.T) { + + val := uint(1) + m := map[string]interface{}{"value": val, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").Uint()) + assert.Equal(t, val, New(m).Get("value").MustUint()) + assert.Equal(t, uint(0), New(m).Get("nothing").Uint()) + assert.Equal(t, val, New(m).Get("nothing").Uint(1)) + + assert.Panics(t, func() { + New(m).Get("age").MustUint() + }) + +} + +func TestUintSlice(t *testing.T) { + + val := uint(1) + m := map[string]interface{}{"value": []uint{val}, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").UintSlice()[0]) + assert.Equal(t, val, New(m).Get("value").MustUintSlice()[0]) + assert.Equal(t, []uint(nil), New(m).Get("nothing").UintSlice()) + assert.Equal(t, val, New(m).Get("nothing").UintSlice([]uint{uint(1)})[0]) + + assert.Panics(t, func() { + New(m).Get("nothing").MustUintSlice() + }) + +} + +func TestIsUint(t *testing.T) { + + var v *Value + + v = &Value{data: uint(1)} + assert.True(t, v.IsUint()) + + v = &Value{data: []uint{uint(1)}} + assert.True(t, v.IsUintSlice()) + +} + +func TestEachUint(t *testing.T) { + + v := &Value{data: []uint{uint(1), uint(1), uint(1), uint(1), uint(1)}} + count := 0 + replacedVals := make([]uint, 0) + assert.Equal(t, v, v.EachUint(func(i int, val uint) bool { + + count++ + replacedVals = append(replacedVals, val) + + // abort early + if i == 2 { + return false + } + + return true + + })) + + assert.Equal(t, count, 3) + assert.Equal(t, replacedVals[0], v.MustUintSlice()[0]) + assert.Equal(t, replacedVals[1], v.MustUintSlice()[1]) + assert.Equal(t, replacedVals[2], v.MustUintSlice()[2]) + +} + +func TestWhereUint(t *testing.T) { + + v := &Value{data: []uint{uint(1), uint(1), uint(1), uint(1), uint(1), uint(1)}} + + selected := v.WhereUint(func(i int, val uint) bool { + return i%2 == 0 + }).MustUintSlice() + + assert.Equal(t, 3, len(selected)) + +} + +func TestGroupUint(t *testing.T) { + + v := &Value{data: []uint{uint(1), uint(1), uint(1), uint(1), uint(1), uint(1)}} + + grouped := v.GroupUint(func(i int, val uint) string { + return fmt.Sprintf("%v", i%2 == 0) + }).data.(map[string][]uint) + + assert.Equal(t, 2, len(grouped)) + assert.Equal(t, 3, len(grouped["true"])) + assert.Equal(t, 3, len(grouped["false"])) + +} + +func TestReplaceUint(t *testing.T) { + + v := &Value{data: []uint{uint(1), uint(1), uint(1), uint(1), uint(1), uint(1)}} + + rawArr := v.MustUintSlice() + + replaced := v.ReplaceUint(func(index int, val uint) uint { + if index < len(rawArr)-1 { + return rawArr[index+1] + } + return rawArr[0] + }) + + replacedArr := replaced.MustUintSlice() + if assert.Equal(t, 6, len(replacedArr)) { + assert.Equal(t, replacedArr[0], rawArr[1]) + assert.Equal(t, replacedArr[1], rawArr[2]) + assert.Equal(t, replacedArr[2], rawArr[3]) + assert.Equal(t, replacedArr[3], rawArr[4]) + assert.Equal(t, replacedArr[4], rawArr[5]) + assert.Equal(t, replacedArr[5], rawArr[0]) + } + +} + +func TestCollectUint(t *testing.T) { + + v := &Value{data: []uint{uint(1), uint(1), uint(1), uint(1), uint(1), uint(1)}} + + collected := v.CollectUint(func(index int, val uint) interface{} { + return index + }) + + collectedArr := collected.MustInterSlice() + if assert.Equal(t, 6, len(collectedArr)) { + assert.Equal(t, collectedArr[0], 0) + assert.Equal(t, collectedArr[1], 1) + assert.Equal(t, collectedArr[2], 2) + assert.Equal(t, collectedArr[3], 3) + assert.Equal(t, collectedArr[4], 4) + assert.Equal(t, collectedArr[5], 5) + } + +} + +// ************************************************************ +// TESTS +// ************************************************************ + +func TestUint8(t *testing.T) { + + val := uint8(1) + m := map[string]interface{}{"value": val, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").Uint8()) + assert.Equal(t, val, New(m).Get("value").MustUint8()) + assert.Equal(t, uint8(0), New(m).Get("nothing").Uint8()) + assert.Equal(t, val, New(m).Get("nothing").Uint8(1)) + + assert.Panics(t, func() { + New(m).Get("age").MustUint8() + }) + +} + +func TestUint8Slice(t *testing.T) { + + val := uint8(1) + m := map[string]interface{}{"value": []uint8{val}, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").Uint8Slice()[0]) + assert.Equal(t, val, New(m).Get("value").MustUint8Slice()[0]) + assert.Equal(t, []uint8(nil), New(m).Get("nothing").Uint8Slice()) + assert.Equal(t, val, New(m).Get("nothing").Uint8Slice([]uint8{uint8(1)})[0]) + + assert.Panics(t, func() { + New(m).Get("nothing").MustUint8Slice() + }) + +} + +func TestIsUint8(t *testing.T) { + + var v *Value + + v = &Value{data: uint8(1)} + assert.True(t, v.IsUint8()) + + v = &Value{data: []uint8{uint8(1)}} + assert.True(t, v.IsUint8Slice()) + +} + +func TestEachUint8(t *testing.T) { + + v := &Value{data: []uint8{uint8(1), uint8(1), uint8(1), uint8(1), uint8(1)}} + count := 0 + replacedVals := make([]uint8, 0) + assert.Equal(t, v, v.EachUint8(func(i int, val uint8) bool { + + count++ + replacedVals = append(replacedVals, val) + + // abort early + if i == 2 { + return false + } + + return true + + })) + + assert.Equal(t, count, 3) + assert.Equal(t, replacedVals[0], v.MustUint8Slice()[0]) + assert.Equal(t, replacedVals[1], v.MustUint8Slice()[1]) + assert.Equal(t, replacedVals[2], v.MustUint8Slice()[2]) + +} + +func TestWhereUint8(t *testing.T) { + + v := &Value{data: []uint8{uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1)}} + + selected := v.WhereUint8(func(i int, val uint8) bool { + return i%2 == 0 + }).MustUint8Slice() + + assert.Equal(t, 3, len(selected)) + +} + +func TestGroupUint8(t *testing.T) { + + v := &Value{data: []uint8{uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1)}} + + grouped := v.GroupUint8(func(i int, val uint8) string { + return fmt.Sprintf("%v", i%2 == 0) + }).data.(map[string][]uint8) + + assert.Equal(t, 2, len(grouped)) + assert.Equal(t, 3, len(grouped["true"])) + assert.Equal(t, 3, len(grouped["false"])) + +} + +func TestReplaceUint8(t *testing.T) { + + v := &Value{data: []uint8{uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1)}} + + rawArr := v.MustUint8Slice() + + replaced := v.ReplaceUint8(func(index int, val uint8) uint8 { + if index < len(rawArr)-1 { + return rawArr[index+1] + } + return rawArr[0] + }) + + replacedArr := replaced.MustUint8Slice() + if assert.Equal(t, 6, len(replacedArr)) { + assert.Equal(t, replacedArr[0], rawArr[1]) + assert.Equal(t, replacedArr[1], rawArr[2]) + assert.Equal(t, replacedArr[2], rawArr[3]) + assert.Equal(t, replacedArr[3], rawArr[4]) + assert.Equal(t, replacedArr[4], rawArr[5]) + assert.Equal(t, replacedArr[5], rawArr[0]) + } + +} + +func TestCollectUint8(t *testing.T) { + + v := &Value{data: []uint8{uint8(1), uint8(1), uint8(1), uint8(1), uint8(1), uint8(1)}} + + collected := v.CollectUint8(func(index int, val uint8) interface{} { + return index + }) + + collectedArr := collected.MustInterSlice() + if assert.Equal(t, 6, len(collectedArr)) { + assert.Equal(t, collectedArr[0], 0) + assert.Equal(t, collectedArr[1], 1) + assert.Equal(t, collectedArr[2], 2) + assert.Equal(t, collectedArr[3], 3) + assert.Equal(t, collectedArr[4], 4) + assert.Equal(t, collectedArr[5], 5) + } + +} + +// ************************************************************ +// TESTS +// ************************************************************ + +func TestUint16(t *testing.T) { + + val := uint16(1) + m := map[string]interface{}{"value": val, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").Uint16()) + assert.Equal(t, val, New(m).Get("value").MustUint16()) + assert.Equal(t, uint16(0), New(m).Get("nothing").Uint16()) + assert.Equal(t, val, New(m).Get("nothing").Uint16(1)) + + assert.Panics(t, func() { + New(m).Get("age").MustUint16() + }) + +} + +func TestUint16Slice(t *testing.T) { + + val := uint16(1) + m := map[string]interface{}{"value": []uint16{val}, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").Uint16Slice()[0]) + assert.Equal(t, val, New(m).Get("value").MustUint16Slice()[0]) + assert.Equal(t, []uint16(nil), New(m).Get("nothing").Uint16Slice()) + assert.Equal(t, val, New(m).Get("nothing").Uint16Slice([]uint16{uint16(1)})[0]) + + assert.Panics(t, func() { + New(m).Get("nothing").MustUint16Slice() + }) + +} + +func TestIsUint16(t *testing.T) { + + var v *Value + + v = &Value{data: uint16(1)} + assert.True(t, v.IsUint16()) + + v = &Value{data: []uint16{uint16(1)}} + assert.True(t, v.IsUint16Slice()) + +} + +func TestEachUint16(t *testing.T) { + + v := &Value{data: []uint16{uint16(1), uint16(1), uint16(1), uint16(1), uint16(1)}} + count := 0 + replacedVals := make([]uint16, 0) + assert.Equal(t, v, v.EachUint16(func(i int, val uint16) bool { + + count++ + replacedVals = append(replacedVals, val) + + // abort early + if i == 2 { + return false + } + + return true + + })) + + assert.Equal(t, count, 3) + assert.Equal(t, replacedVals[0], v.MustUint16Slice()[0]) + assert.Equal(t, replacedVals[1], v.MustUint16Slice()[1]) + assert.Equal(t, replacedVals[2], v.MustUint16Slice()[2]) + +} + +func TestWhereUint16(t *testing.T) { + + v := &Value{data: []uint16{uint16(1), uint16(1), uint16(1), uint16(1), uint16(1), uint16(1)}} + + selected := v.WhereUint16(func(i int, val uint16) bool { + return i%2 == 0 + }).MustUint16Slice() + + assert.Equal(t, 3, len(selected)) + +} + +func TestGroupUint16(t *testing.T) { + + v := &Value{data: []uint16{uint16(1), uint16(1), uint16(1), uint16(1), uint16(1), uint16(1)}} + + grouped := v.GroupUint16(func(i int, val uint16) string { + return fmt.Sprintf("%v", i%2 == 0) + }).data.(map[string][]uint16) + + assert.Equal(t, 2, len(grouped)) + assert.Equal(t, 3, len(grouped["true"])) + assert.Equal(t, 3, len(grouped["false"])) + +} + +func TestReplaceUint16(t *testing.T) { + + v := &Value{data: []uint16{uint16(1), uint16(1), uint16(1), uint16(1), uint16(1), uint16(1)}} + + rawArr := v.MustUint16Slice() + + replaced := v.ReplaceUint16(func(index int, val uint16) uint16 { + if index < len(rawArr)-1 { + return rawArr[index+1] + } + return rawArr[0] + }) + + replacedArr := replaced.MustUint16Slice() + if assert.Equal(t, 6, len(replacedArr)) { + assert.Equal(t, replacedArr[0], rawArr[1]) + assert.Equal(t, replacedArr[1], rawArr[2]) + assert.Equal(t, replacedArr[2], rawArr[3]) + assert.Equal(t, replacedArr[3], rawArr[4]) + assert.Equal(t, replacedArr[4], rawArr[5]) + assert.Equal(t, replacedArr[5], rawArr[0]) + } + +} + +func TestCollectUint16(t *testing.T) { + + v := &Value{data: []uint16{uint16(1), uint16(1), uint16(1), uint16(1), uint16(1), uint16(1)}} + + collected := v.CollectUint16(func(index int, val uint16) interface{} { + return index + }) + + collectedArr := collected.MustInterSlice() + if assert.Equal(t, 6, len(collectedArr)) { + assert.Equal(t, collectedArr[0], 0) + assert.Equal(t, collectedArr[1], 1) + assert.Equal(t, collectedArr[2], 2) + assert.Equal(t, collectedArr[3], 3) + assert.Equal(t, collectedArr[4], 4) + assert.Equal(t, collectedArr[5], 5) + } + +} + +// ************************************************************ +// TESTS +// ************************************************************ + +func TestUint32(t *testing.T) { + + val := uint32(1) + m := map[string]interface{}{"value": val, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").Uint32()) + assert.Equal(t, val, New(m).Get("value").MustUint32()) + assert.Equal(t, uint32(0), New(m).Get("nothing").Uint32()) + assert.Equal(t, val, New(m).Get("nothing").Uint32(1)) + + assert.Panics(t, func() { + New(m).Get("age").MustUint32() + }) + +} + +func TestUint32Slice(t *testing.T) { + + val := uint32(1) + m := map[string]interface{}{"value": []uint32{val}, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").Uint32Slice()[0]) + assert.Equal(t, val, New(m).Get("value").MustUint32Slice()[0]) + assert.Equal(t, []uint32(nil), New(m).Get("nothing").Uint32Slice()) + assert.Equal(t, val, New(m).Get("nothing").Uint32Slice([]uint32{uint32(1)})[0]) + + assert.Panics(t, func() { + New(m).Get("nothing").MustUint32Slice() + }) + +} + +func TestIsUint32(t *testing.T) { + + var v *Value + + v = &Value{data: uint32(1)} + assert.True(t, v.IsUint32()) + + v = &Value{data: []uint32{uint32(1)}} + assert.True(t, v.IsUint32Slice()) + +} + +func TestEachUint32(t *testing.T) { + + v := &Value{data: []uint32{uint32(1), uint32(1), uint32(1), uint32(1), uint32(1)}} + count := 0 + replacedVals := make([]uint32, 0) + assert.Equal(t, v, v.EachUint32(func(i int, val uint32) bool { + + count++ + replacedVals = append(replacedVals, val) + + // abort early + if i == 2 { + return false + } + + return true + + })) + + assert.Equal(t, count, 3) + assert.Equal(t, replacedVals[0], v.MustUint32Slice()[0]) + assert.Equal(t, replacedVals[1], v.MustUint32Slice()[1]) + assert.Equal(t, replacedVals[2], v.MustUint32Slice()[2]) + +} + +func TestWhereUint32(t *testing.T) { + + v := &Value{data: []uint32{uint32(1), uint32(1), uint32(1), uint32(1), uint32(1), uint32(1)}} + + selected := v.WhereUint32(func(i int, val uint32) bool { + return i%2 == 0 + }).MustUint32Slice() + + assert.Equal(t, 3, len(selected)) + +} + +func TestGroupUint32(t *testing.T) { + + v := &Value{data: []uint32{uint32(1), uint32(1), uint32(1), uint32(1), uint32(1), uint32(1)}} + + grouped := v.GroupUint32(func(i int, val uint32) string { + return fmt.Sprintf("%v", i%2 == 0) + }).data.(map[string][]uint32) + + assert.Equal(t, 2, len(grouped)) + assert.Equal(t, 3, len(grouped["true"])) + assert.Equal(t, 3, len(grouped["false"])) + +} + +func TestReplaceUint32(t *testing.T) { + + v := &Value{data: []uint32{uint32(1), uint32(1), uint32(1), uint32(1), uint32(1), uint32(1)}} + + rawArr := v.MustUint32Slice() + + replaced := v.ReplaceUint32(func(index int, val uint32) uint32 { + if index < len(rawArr)-1 { + return rawArr[index+1] + } + return rawArr[0] + }) + + replacedArr := replaced.MustUint32Slice() + if assert.Equal(t, 6, len(replacedArr)) { + assert.Equal(t, replacedArr[0], rawArr[1]) + assert.Equal(t, replacedArr[1], rawArr[2]) + assert.Equal(t, replacedArr[2], rawArr[3]) + assert.Equal(t, replacedArr[3], rawArr[4]) + assert.Equal(t, replacedArr[4], rawArr[5]) + assert.Equal(t, replacedArr[5], rawArr[0]) + } + +} + +func TestCollectUint32(t *testing.T) { + + v := &Value{data: []uint32{uint32(1), uint32(1), uint32(1), uint32(1), uint32(1), uint32(1)}} + + collected := v.CollectUint32(func(index int, val uint32) interface{} { + return index + }) + + collectedArr := collected.MustInterSlice() + if assert.Equal(t, 6, len(collectedArr)) { + assert.Equal(t, collectedArr[0], 0) + assert.Equal(t, collectedArr[1], 1) + assert.Equal(t, collectedArr[2], 2) + assert.Equal(t, collectedArr[3], 3) + assert.Equal(t, collectedArr[4], 4) + assert.Equal(t, collectedArr[5], 5) + } + +} + +// ************************************************************ +// TESTS +// ************************************************************ + +func TestUint64(t *testing.T) { + + val := uint64(1) + m := map[string]interface{}{"value": val, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").Uint64()) + assert.Equal(t, val, New(m).Get("value").MustUint64()) + assert.Equal(t, uint64(0), New(m).Get("nothing").Uint64()) + assert.Equal(t, val, New(m).Get("nothing").Uint64(1)) + + assert.Panics(t, func() { + New(m).Get("age").MustUint64() + }) + +} + +func TestUint64Slice(t *testing.T) { + + val := uint64(1) + m := map[string]interface{}{"value": []uint64{val}, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").Uint64Slice()[0]) + assert.Equal(t, val, New(m).Get("value").MustUint64Slice()[0]) + assert.Equal(t, []uint64(nil), New(m).Get("nothing").Uint64Slice()) + assert.Equal(t, val, New(m).Get("nothing").Uint64Slice([]uint64{uint64(1)})[0]) + + assert.Panics(t, func() { + New(m).Get("nothing").MustUint64Slice() + }) + +} + +func TestIsUint64(t *testing.T) { + + var v *Value + + v = &Value{data: uint64(1)} + assert.True(t, v.IsUint64()) + + v = &Value{data: []uint64{uint64(1)}} + assert.True(t, v.IsUint64Slice()) + +} + +func TestEachUint64(t *testing.T) { + + v := &Value{data: []uint64{uint64(1), uint64(1), uint64(1), uint64(1), uint64(1)}} + count := 0 + replacedVals := make([]uint64, 0) + assert.Equal(t, v, v.EachUint64(func(i int, val uint64) bool { + + count++ + replacedVals = append(replacedVals, val) + + // abort early + if i == 2 { + return false + } + + return true + + })) + + assert.Equal(t, count, 3) + assert.Equal(t, replacedVals[0], v.MustUint64Slice()[0]) + assert.Equal(t, replacedVals[1], v.MustUint64Slice()[1]) + assert.Equal(t, replacedVals[2], v.MustUint64Slice()[2]) + +} + +func TestWhereUint64(t *testing.T) { + + v := &Value{data: []uint64{uint64(1), uint64(1), uint64(1), uint64(1), uint64(1), uint64(1)}} + + selected := v.WhereUint64(func(i int, val uint64) bool { + return i%2 == 0 + }).MustUint64Slice() + + assert.Equal(t, 3, len(selected)) + +} + +func TestGroupUint64(t *testing.T) { + + v := &Value{data: []uint64{uint64(1), uint64(1), uint64(1), uint64(1), uint64(1), uint64(1)}} + + grouped := v.GroupUint64(func(i int, val uint64) string { + return fmt.Sprintf("%v", i%2 == 0) + }).data.(map[string][]uint64) + + assert.Equal(t, 2, len(grouped)) + assert.Equal(t, 3, len(grouped["true"])) + assert.Equal(t, 3, len(grouped["false"])) + +} + +func TestReplaceUint64(t *testing.T) { + + v := &Value{data: []uint64{uint64(1), uint64(1), uint64(1), uint64(1), uint64(1), uint64(1)}} + + rawArr := v.MustUint64Slice() + + replaced := v.ReplaceUint64(func(index int, val uint64) uint64 { + if index < len(rawArr)-1 { + return rawArr[index+1] + } + return rawArr[0] + }) + + replacedArr := replaced.MustUint64Slice() + if assert.Equal(t, 6, len(replacedArr)) { + assert.Equal(t, replacedArr[0], rawArr[1]) + assert.Equal(t, replacedArr[1], rawArr[2]) + assert.Equal(t, replacedArr[2], rawArr[3]) + assert.Equal(t, replacedArr[3], rawArr[4]) + assert.Equal(t, replacedArr[4], rawArr[5]) + assert.Equal(t, replacedArr[5], rawArr[0]) + } + +} + +func TestCollectUint64(t *testing.T) { + + v := &Value{data: []uint64{uint64(1), uint64(1), uint64(1), uint64(1), uint64(1), uint64(1)}} + + collected := v.CollectUint64(func(index int, val uint64) interface{} { + return index + }) + + collectedArr := collected.MustInterSlice() + if assert.Equal(t, 6, len(collectedArr)) { + assert.Equal(t, collectedArr[0], 0) + assert.Equal(t, collectedArr[1], 1) + assert.Equal(t, collectedArr[2], 2) + assert.Equal(t, collectedArr[3], 3) + assert.Equal(t, collectedArr[4], 4) + assert.Equal(t, collectedArr[5], 5) + } + +} + +// ************************************************************ +// TESTS +// ************************************************************ + +func TestUintptr(t *testing.T) { + + val := uintptr(1) + m := map[string]interface{}{"value": val, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").Uintptr()) + assert.Equal(t, val, New(m).Get("value").MustUintptr()) + assert.Equal(t, uintptr(0), New(m).Get("nothing").Uintptr()) + assert.Equal(t, val, New(m).Get("nothing").Uintptr(1)) + + assert.Panics(t, func() { + New(m).Get("age").MustUintptr() + }) + +} + +func TestUintptrSlice(t *testing.T) { + + val := uintptr(1) + m := map[string]interface{}{"value": []uintptr{val}, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").UintptrSlice()[0]) + assert.Equal(t, val, New(m).Get("value").MustUintptrSlice()[0]) + assert.Equal(t, []uintptr(nil), New(m).Get("nothing").UintptrSlice()) + assert.Equal(t, val, New(m).Get("nothing").UintptrSlice([]uintptr{uintptr(1)})[0]) + + assert.Panics(t, func() { + New(m).Get("nothing").MustUintptrSlice() + }) + +} + +func TestIsUintptr(t *testing.T) { + + var v *Value + + v = &Value{data: uintptr(1)} + assert.True(t, v.IsUintptr()) + + v = &Value{data: []uintptr{uintptr(1)}} + assert.True(t, v.IsUintptrSlice()) + +} + +func TestEachUintptr(t *testing.T) { + + v := &Value{data: []uintptr{uintptr(1), uintptr(1), uintptr(1), uintptr(1), uintptr(1)}} + count := 0 + replacedVals := make([]uintptr, 0) + assert.Equal(t, v, v.EachUintptr(func(i int, val uintptr) bool { + + count++ + replacedVals = append(replacedVals, val) + + // abort early + if i == 2 { + return false + } + + return true + + })) + + assert.Equal(t, count, 3) + assert.Equal(t, replacedVals[0], v.MustUintptrSlice()[0]) + assert.Equal(t, replacedVals[1], v.MustUintptrSlice()[1]) + assert.Equal(t, replacedVals[2], v.MustUintptrSlice()[2]) + +} + +func TestWhereUintptr(t *testing.T) { + + v := &Value{data: []uintptr{uintptr(1), uintptr(1), uintptr(1), uintptr(1), uintptr(1), uintptr(1)}} + + selected := v.WhereUintptr(func(i int, val uintptr) bool { + return i%2 == 0 + }).MustUintptrSlice() + + assert.Equal(t, 3, len(selected)) + +} + +func TestGroupUintptr(t *testing.T) { + + v := &Value{data: []uintptr{uintptr(1), uintptr(1), uintptr(1), uintptr(1), uintptr(1), uintptr(1)}} + + grouped := v.GroupUintptr(func(i int, val uintptr) string { + return fmt.Sprintf("%v", i%2 == 0) + }).data.(map[string][]uintptr) + + assert.Equal(t, 2, len(grouped)) + assert.Equal(t, 3, len(grouped["true"])) + assert.Equal(t, 3, len(grouped["false"])) + +} + +func TestReplaceUintptr(t *testing.T) { + + v := &Value{data: []uintptr{uintptr(1), uintptr(1), uintptr(1), uintptr(1), uintptr(1), uintptr(1)}} + + rawArr := v.MustUintptrSlice() + + replaced := v.ReplaceUintptr(func(index int, val uintptr) uintptr { + if index < len(rawArr)-1 { + return rawArr[index+1] + } + return rawArr[0] + }) + + replacedArr := replaced.MustUintptrSlice() + if assert.Equal(t, 6, len(replacedArr)) { + assert.Equal(t, replacedArr[0], rawArr[1]) + assert.Equal(t, replacedArr[1], rawArr[2]) + assert.Equal(t, replacedArr[2], rawArr[3]) + assert.Equal(t, replacedArr[3], rawArr[4]) + assert.Equal(t, replacedArr[4], rawArr[5]) + assert.Equal(t, replacedArr[5], rawArr[0]) + } + +} + +func TestCollectUintptr(t *testing.T) { + + v := &Value{data: []uintptr{uintptr(1), uintptr(1), uintptr(1), uintptr(1), uintptr(1), uintptr(1)}} + + collected := v.CollectUintptr(func(index int, val uintptr) interface{} { + return index + }) + + collectedArr := collected.MustInterSlice() + if assert.Equal(t, 6, len(collectedArr)) { + assert.Equal(t, collectedArr[0], 0) + assert.Equal(t, collectedArr[1], 1) + assert.Equal(t, collectedArr[2], 2) + assert.Equal(t, collectedArr[3], 3) + assert.Equal(t, collectedArr[4], 4) + assert.Equal(t, collectedArr[5], 5) + } + +} + +// ************************************************************ +// TESTS +// ************************************************************ + +func TestFloat32(t *testing.T) { + + val := float32(1) + m := map[string]interface{}{"value": val, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").Float32()) + assert.Equal(t, val, New(m).Get("value").MustFloat32()) + assert.Equal(t, float32(0), New(m).Get("nothing").Float32()) + assert.Equal(t, val, New(m).Get("nothing").Float32(1)) + + assert.Panics(t, func() { + New(m).Get("age").MustFloat32() + }) + +} + +func TestFloat32Slice(t *testing.T) { + + val := float32(1) + m := map[string]interface{}{"value": []float32{val}, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").Float32Slice()[0]) + assert.Equal(t, val, New(m).Get("value").MustFloat32Slice()[0]) + assert.Equal(t, []float32(nil), New(m).Get("nothing").Float32Slice()) + assert.Equal(t, val, New(m).Get("nothing").Float32Slice([]float32{float32(1)})[0]) + + assert.Panics(t, func() { + New(m).Get("nothing").MustFloat32Slice() + }) + +} + +func TestIsFloat32(t *testing.T) { + + var v *Value + + v = &Value{data: float32(1)} + assert.True(t, v.IsFloat32()) + + v = &Value{data: []float32{float32(1)}} + assert.True(t, v.IsFloat32Slice()) + +} + +func TestEachFloat32(t *testing.T) { + + v := &Value{data: []float32{float32(1), float32(1), float32(1), float32(1), float32(1)}} + count := 0 + replacedVals := make([]float32, 0) + assert.Equal(t, v, v.EachFloat32(func(i int, val float32) bool { + + count++ + replacedVals = append(replacedVals, val) + + // abort early + if i == 2 { + return false + } + + return true + + })) + + assert.Equal(t, count, 3) + assert.Equal(t, replacedVals[0], v.MustFloat32Slice()[0]) + assert.Equal(t, replacedVals[1], v.MustFloat32Slice()[1]) + assert.Equal(t, replacedVals[2], v.MustFloat32Slice()[2]) + +} + +func TestWhereFloat32(t *testing.T) { + + v := &Value{data: []float32{float32(1), float32(1), float32(1), float32(1), float32(1), float32(1)}} + + selected := v.WhereFloat32(func(i int, val float32) bool { + return i%2 == 0 + }).MustFloat32Slice() + + assert.Equal(t, 3, len(selected)) + +} + +func TestGroupFloat32(t *testing.T) { + + v := &Value{data: []float32{float32(1), float32(1), float32(1), float32(1), float32(1), float32(1)}} + + grouped := v.GroupFloat32(func(i int, val float32) string { + return fmt.Sprintf("%v", i%2 == 0) + }).data.(map[string][]float32) + + assert.Equal(t, 2, len(grouped)) + assert.Equal(t, 3, len(grouped["true"])) + assert.Equal(t, 3, len(grouped["false"])) + +} + +func TestReplaceFloat32(t *testing.T) { + + v := &Value{data: []float32{float32(1), float32(1), float32(1), float32(1), float32(1), float32(1)}} + + rawArr := v.MustFloat32Slice() + + replaced := v.ReplaceFloat32(func(index int, val float32) float32 { + if index < len(rawArr)-1 { + return rawArr[index+1] + } + return rawArr[0] + }) + + replacedArr := replaced.MustFloat32Slice() + if assert.Equal(t, 6, len(replacedArr)) { + assert.Equal(t, replacedArr[0], rawArr[1]) + assert.Equal(t, replacedArr[1], rawArr[2]) + assert.Equal(t, replacedArr[2], rawArr[3]) + assert.Equal(t, replacedArr[3], rawArr[4]) + assert.Equal(t, replacedArr[4], rawArr[5]) + assert.Equal(t, replacedArr[5], rawArr[0]) + } + +} + +func TestCollectFloat32(t *testing.T) { + + v := &Value{data: []float32{float32(1), float32(1), float32(1), float32(1), float32(1), float32(1)}} + + collected := v.CollectFloat32(func(index int, val float32) interface{} { + return index + }) + + collectedArr := collected.MustInterSlice() + if assert.Equal(t, 6, len(collectedArr)) { + assert.Equal(t, collectedArr[0], 0) + assert.Equal(t, collectedArr[1], 1) + assert.Equal(t, collectedArr[2], 2) + assert.Equal(t, collectedArr[3], 3) + assert.Equal(t, collectedArr[4], 4) + assert.Equal(t, collectedArr[5], 5) + } + +} + +// ************************************************************ +// TESTS +// ************************************************************ + +func TestFloat64(t *testing.T) { + + val := float64(1) + m := map[string]interface{}{"value": val, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").Float64()) + assert.Equal(t, val, New(m).Get("value").MustFloat64()) + assert.Equal(t, float64(0), New(m).Get("nothing").Float64()) + assert.Equal(t, val, New(m).Get("nothing").Float64(1)) + + assert.Panics(t, func() { + New(m).Get("age").MustFloat64() + }) + +} + +func TestFloat64Slice(t *testing.T) { + + val := float64(1) + m := map[string]interface{}{"value": []float64{val}, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").Float64Slice()[0]) + assert.Equal(t, val, New(m).Get("value").MustFloat64Slice()[0]) + assert.Equal(t, []float64(nil), New(m).Get("nothing").Float64Slice()) + assert.Equal(t, val, New(m).Get("nothing").Float64Slice([]float64{float64(1)})[0]) + + assert.Panics(t, func() { + New(m).Get("nothing").MustFloat64Slice() + }) + +} + +func TestIsFloat64(t *testing.T) { + + var v *Value + + v = &Value{data: float64(1)} + assert.True(t, v.IsFloat64()) + + v = &Value{data: []float64{float64(1)}} + assert.True(t, v.IsFloat64Slice()) + +} + +func TestEachFloat64(t *testing.T) { + + v := &Value{data: []float64{float64(1), float64(1), float64(1), float64(1), float64(1)}} + count := 0 + replacedVals := make([]float64, 0) + assert.Equal(t, v, v.EachFloat64(func(i int, val float64) bool { + + count++ + replacedVals = append(replacedVals, val) + + // abort early + if i == 2 { + return false + } + + return true + + })) + + assert.Equal(t, count, 3) + assert.Equal(t, replacedVals[0], v.MustFloat64Slice()[0]) + assert.Equal(t, replacedVals[1], v.MustFloat64Slice()[1]) + assert.Equal(t, replacedVals[2], v.MustFloat64Slice()[2]) + +} + +func TestWhereFloat64(t *testing.T) { + + v := &Value{data: []float64{float64(1), float64(1), float64(1), float64(1), float64(1), float64(1)}} + + selected := v.WhereFloat64(func(i int, val float64) bool { + return i%2 == 0 + }).MustFloat64Slice() + + assert.Equal(t, 3, len(selected)) + +} + +func TestGroupFloat64(t *testing.T) { + + v := &Value{data: []float64{float64(1), float64(1), float64(1), float64(1), float64(1), float64(1)}} + + grouped := v.GroupFloat64(func(i int, val float64) string { + return fmt.Sprintf("%v", i%2 == 0) + }).data.(map[string][]float64) + + assert.Equal(t, 2, len(grouped)) + assert.Equal(t, 3, len(grouped["true"])) + assert.Equal(t, 3, len(grouped["false"])) + +} + +func TestReplaceFloat64(t *testing.T) { + + v := &Value{data: []float64{float64(1), float64(1), float64(1), float64(1), float64(1), float64(1)}} + + rawArr := v.MustFloat64Slice() + + replaced := v.ReplaceFloat64(func(index int, val float64) float64 { + if index < len(rawArr)-1 { + return rawArr[index+1] + } + return rawArr[0] + }) + + replacedArr := replaced.MustFloat64Slice() + if assert.Equal(t, 6, len(replacedArr)) { + assert.Equal(t, replacedArr[0], rawArr[1]) + assert.Equal(t, replacedArr[1], rawArr[2]) + assert.Equal(t, replacedArr[2], rawArr[3]) + assert.Equal(t, replacedArr[3], rawArr[4]) + assert.Equal(t, replacedArr[4], rawArr[5]) + assert.Equal(t, replacedArr[5], rawArr[0]) + } + +} + +func TestCollectFloat64(t *testing.T) { + + v := &Value{data: []float64{float64(1), float64(1), float64(1), float64(1), float64(1), float64(1)}} + + collected := v.CollectFloat64(func(index int, val float64) interface{} { + return index + }) + + collectedArr := collected.MustInterSlice() + if assert.Equal(t, 6, len(collectedArr)) { + assert.Equal(t, collectedArr[0], 0) + assert.Equal(t, collectedArr[1], 1) + assert.Equal(t, collectedArr[2], 2) + assert.Equal(t, collectedArr[3], 3) + assert.Equal(t, collectedArr[4], 4) + assert.Equal(t, collectedArr[5], 5) + } + +} + +// ************************************************************ +// TESTS +// ************************************************************ + +func TestComplex64(t *testing.T) { + + val := complex64(1) + m := map[string]interface{}{"value": val, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").Complex64()) + assert.Equal(t, val, New(m).Get("value").MustComplex64()) + assert.Equal(t, complex64(0), New(m).Get("nothing").Complex64()) + assert.Equal(t, val, New(m).Get("nothing").Complex64(1)) + + assert.Panics(t, func() { + New(m).Get("age").MustComplex64() + }) + +} + +func TestComplex64Slice(t *testing.T) { + + val := complex64(1) + m := map[string]interface{}{"value": []complex64{val}, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").Complex64Slice()[0]) + assert.Equal(t, val, New(m).Get("value").MustComplex64Slice()[0]) + assert.Equal(t, []complex64(nil), New(m).Get("nothing").Complex64Slice()) + assert.Equal(t, val, New(m).Get("nothing").Complex64Slice([]complex64{complex64(1)})[0]) + + assert.Panics(t, func() { + New(m).Get("nothing").MustComplex64Slice() + }) + +} + +func TestIsComplex64(t *testing.T) { + + var v *Value + + v = &Value{data: complex64(1)} + assert.True(t, v.IsComplex64()) + + v = &Value{data: []complex64{complex64(1)}} + assert.True(t, v.IsComplex64Slice()) + +} + +func TestEachComplex64(t *testing.T) { + + v := &Value{data: []complex64{complex64(1), complex64(1), complex64(1), complex64(1), complex64(1)}} + count := 0 + replacedVals := make([]complex64, 0) + assert.Equal(t, v, v.EachComplex64(func(i int, val complex64) bool { + + count++ + replacedVals = append(replacedVals, val) + + // abort early + if i == 2 { + return false + } + + return true + + })) + + assert.Equal(t, count, 3) + assert.Equal(t, replacedVals[0], v.MustComplex64Slice()[0]) + assert.Equal(t, replacedVals[1], v.MustComplex64Slice()[1]) + assert.Equal(t, replacedVals[2], v.MustComplex64Slice()[2]) + +} + +func TestWhereComplex64(t *testing.T) { + + v := &Value{data: []complex64{complex64(1), complex64(1), complex64(1), complex64(1), complex64(1), complex64(1)}} + + selected := v.WhereComplex64(func(i int, val complex64) bool { + return i%2 == 0 + }).MustComplex64Slice() + + assert.Equal(t, 3, len(selected)) + +} + +func TestGroupComplex64(t *testing.T) { + + v := &Value{data: []complex64{complex64(1), complex64(1), complex64(1), complex64(1), complex64(1), complex64(1)}} + + grouped := v.GroupComplex64(func(i int, val complex64) string { + return fmt.Sprintf("%v", i%2 == 0) + }).data.(map[string][]complex64) + + assert.Equal(t, 2, len(grouped)) + assert.Equal(t, 3, len(grouped["true"])) + assert.Equal(t, 3, len(grouped["false"])) + +} + +func TestReplaceComplex64(t *testing.T) { + + v := &Value{data: []complex64{complex64(1), complex64(1), complex64(1), complex64(1), complex64(1), complex64(1)}} + + rawArr := v.MustComplex64Slice() + + replaced := v.ReplaceComplex64(func(index int, val complex64) complex64 { + if index < len(rawArr)-1 { + return rawArr[index+1] + } + return rawArr[0] + }) + + replacedArr := replaced.MustComplex64Slice() + if assert.Equal(t, 6, len(replacedArr)) { + assert.Equal(t, replacedArr[0], rawArr[1]) + assert.Equal(t, replacedArr[1], rawArr[2]) + assert.Equal(t, replacedArr[2], rawArr[3]) + assert.Equal(t, replacedArr[3], rawArr[4]) + assert.Equal(t, replacedArr[4], rawArr[5]) + assert.Equal(t, replacedArr[5], rawArr[0]) + } + +} + +func TestCollectComplex64(t *testing.T) { + + v := &Value{data: []complex64{complex64(1), complex64(1), complex64(1), complex64(1), complex64(1), complex64(1)}} + + collected := v.CollectComplex64(func(index int, val complex64) interface{} { + return index + }) + + collectedArr := collected.MustInterSlice() + if assert.Equal(t, 6, len(collectedArr)) { + assert.Equal(t, collectedArr[0], 0) + assert.Equal(t, collectedArr[1], 1) + assert.Equal(t, collectedArr[2], 2) + assert.Equal(t, collectedArr[3], 3) + assert.Equal(t, collectedArr[4], 4) + assert.Equal(t, collectedArr[5], 5) + } + +} + +// ************************************************************ +// TESTS +// ************************************************************ + +func TestComplex128(t *testing.T) { + + val := complex128(1) + m := map[string]interface{}{"value": val, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").Complex128()) + assert.Equal(t, val, New(m).Get("value").MustComplex128()) + assert.Equal(t, complex128(0), New(m).Get("nothing").Complex128()) + assert.Equal(t, val, New(m).Get("nothing").Complex128(1)) + + assert.Panics(t, func() { + New(m).Get("age").MustComplex128() + }) + +} + +func TestComplex128Slice(t *testing.T) { + + val := complex128(1) + m := map[string]interface{}{"value": []complex128{val}, "nothing": nil} + assert.Equal(t, val, New(m).Get("value").Complex128Slice()[0]) + assert.Equal(t, val, New(m).Get("value").MustComplex128Slice()[0]) + assert.Equal(t, []complex128(nil), New(m).Get("nothing").Complex128Slice()) + assert.Equal(t, val, New(m).Get("nothing").Complex128Slice([]complex128{complex128(1)})[0]) + + assert.Panics(t, func() { + New(m).Get("nothing").MustComplex128Slice() + }) + +} + +func TestIsComplex128(t *testing.T) { + + var v *Value + + v = &Value{data: complex128(1)} + assert.True(t, v.IsComplex128()) + + v = &Value{data: []complex128{complex128(1)}} + assert.True(t, v.IsComplex128Slice()) + +} + +func TestEachComplex128(t *testing.T) { + + v := &Value{data: []complex128{complex128(1), complex128(1), complex128(1), complex128(1), complex128(1)}} + count := 0 + replacedVals := make([]complex128, 0) + assert.Equal(t, v, v.EachComplex128(func(i int, val complex128) bool { + + count++ + replacedVals = append(replacedVals, val) + + // abort early + if i == 2 { + return false + } + + return true + + })) + + assert.Equal(t, count, 3) + assert.Equal(t, replacedVals[0], v.MustComplex128Slice()[0]) + assert.Equal(t, replacedVals[1], v.MustComplex128Slice()[1]) + assert.Equal(t, replacedVals[2], v.MustComplex128Slice()[2]) + +} + +func TestWhereComplex128(t *testing.T) { + + v := &Value{data: []complex128{complex128(1), complex128(1), complex128(1), complex128(1), complex128(1), complex128(1)}} + + selected := v.WhereComplex128(func(i int, val complex128) bool { + return i%2 == 0 + }).MustComplex128Slice() + + assert.Equal(t, 3, len(selected)) + +} + +func TestGroupComplex128(t *testing.T) { + + v := &Value{data: []complex128{complex128(1), complex128(1), complex128(1), complex128(1), complex128(1), complex128(1)}} + + grouped := v.GroupComplex128(func(i int, val complex128) string { + return fmt.Sprintf("%v", i%2 == 0) + }).data.(map[string][]complex128) + + assert.Equal(t, 2, len(grouped)) + assert.Equal(t, 3, len(grouped["true"])) + assert.Equal(t, 3, len(grouped["false"])) + +} + +func TestReplaceComplex128(t *testing.T) { + + v := &Value{data: []complex128{complex128(1), complex128(1), complex128(1), complex128(1), complex128(1), complex128(1)}} + + rawArr := v.MustComplex128Slice() + + replaced := v.ReplaceComplex128(func(index int, val complex128) complex128 { + if index < len(rawArr)-1 { + return rawArr[index+1] + } + return rawArr[0] + }) + + replacedArr := replaced.MustComplex128Slice() + if assert.Equal(t, 6, len(replacedArr)) { + assert.Equal(t, replacedArr[0], rawArr[1]) + assert.Equal(t, replacedArr[1], rawArr[2]) + assert.Equal(t, replacedArr[2], rawArr[3]) + assert.Equal(t, replacedArr[3], rawArr[4]) + assert.Equal(t, replacedArr[4], rawArr[5]) + assert.Equal(t, replacedArr[5], rawArr[0]) + } + +} + +func TestCollectComplex128(t *testing.T) { + + v := &Value{data: []complex128{complex128(1), complex128(1), complex128(1), complex128(1), complex128(1), complex128(1)}} + + collected := v.CollectComplex128(func(index int, val complex128) interface{} { + return index + }) + + collectedArr := collected.MustInterSlice() + if assert.Equal(t, 6, len(collectedArr)) { + assert.Equal(t, collectedArr[0], 0) + assert.Equal(t, collectedArr[1], 1) + assert.Equal(t, collectedArr[2], 2) + assert.Equal(t, collectedArr[3], 3) + assert.Equal(t, collectedArr[4], 4) + assert.Equal(t, collectedArr[5], 5) + } + +} diff --git a/vendor/github.com/stretchr/objx/value.go b/vendor/github.com/stretchr/objx/value.go new file mode 100644 index 000000000..7aaef06b1 --- /dev/null +++ b/vendor/github.com/stretchr/objx/value.go @@ -0,0 +1,13 @@ +package objx + +// Value provides methods for extracting interface{} data in various +// types. +type Value struct { + // data contains the raw data being managed by this Value + data interface{} +} + +// Data returns the raw data contained by this Value +func (v *Value) Data() interface{} { + return v.data +} diff --git a/vendor/github.com/stretchr/objx/value_test.go b/vendor/github.com/stretchr/objx/value_test.go new file mode 100644 index 000000000..0bc65d92c --- /dev/null +++ b/vendor/github.com/stretchr/objx/value_test.go @@ -0,0 +1 @@ +package objx diff --git a/vendor/github.com/stretchr/testify/.gitignore b/vendor/github.com/stretchr/testify/.gitignore new file mode 100644 index 000000000..5aacdb7cc --- /dev/null +++ b/vendor/github.com/stretchr/testify/.gitignore @@ -0,0 +1,24 @@ +# Compiled Object files, Static and Dynamic libs (Shared Objects) +*.o +*.a +*.so + +# Folders +_obj +_test + +# Architecture specific extensions/prefixes +*.[568vq] +[568vq].out + +*.cgo1.go +*.cgo2.c +_cgo_defun.c +_cgo_gotypes.go +_cgo_export.* + +_testmain.go + +*.exe + +.DS_Store diff --git a/vendor/github.com/stretchr/testify/.travis.yml b/vendor/github.com/stretchr/testify/.travis.yml new file mode 100644 index 000000000..ffb9e0ddb --- /dev/null +++ b/vendor/github.com/stretchr/testify/.travis.yml @@ -0,0 +1,16 @@ +language: go + +sudo: false + +go: + - 1.1 + - 1.2 + - 1.3 + - 1.4 + - 1.5 + - 1.6 + - 1.7 + - tip + +script: + - go test -v ./... diff --git a/vendor/github.com/stretchr/testify/Godeps/Godeps.json b/vendor/github.com/stretchr/testify/Godeps/Godeps.json new file mode 100644 index 000000000..df032ac31 --- /dev/null +++ b/vendor/github.com/stretchr/testify/Godeps/Godeps.json @@ -0,0 +1,23 @@ +{ + "ImportPath": "github.com/stretchr/testify", + "GoVersion": "go1.5", + "GodepVersion": "v74", + "Packages": [ + "./..." + ], + "Deps": [ + { + "ImportPath": "github.com/davecgh/go-spew/spew", + "Comment": "v1.0.0-3-g6d21280", + "Rev": "6d212800a42e8ab5c146b8ace3490ee17e5225f9" + }, + { + "ImportPath": "github.com/pmezard/go-difflib/difflib", + "Rev": "d8ed2627bdf02c080bf22230dbb337003b7aba2d" + }, + { + "ImportPath": "github.com/stretchr/objx", + "Rev": "cbeaeb16a013161a98496fad62933b1d21786672" + } + ] +} diff --git a/vendor/github.com/stretchr/testify/Godeps/Readme b/vendor/github.com/stretchr/testify/Godeps/Readme new file mode 100644 index 000000000..4cdaa53d5 --- /dev/null +++ b/vendor/github.com/stretchr/testify/Godeps/Readme @@ -0,0 +1,5 @@ +This directory tree is generated automatically by godep. + +Please do not edit. + +See https://github.com/tools/godep for more information. diff --git a/vendor/github.com/stretchr/testify/LICENCE.txt b/vendor/github.com/stretchr/testify/LICENCE.txt new file mode 100644 index 000000000..473b670a7 --- /dev/null +++ b/vendor/github.com/stretchr/testify/LICENCE.txt @@ -0,0 +1,22 @@ +Copyright (c) 2012 - 2013 Mat Ryer and Tyler Bunnell + +Please consider promoting this project if you find it useful. + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, +and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT +OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/stretchr/testify/LICENSE b/vendor/github.com/stretchr/testify/LICENSE new file mode 100644 index 000000000..473b670a7 --- /dev/null +++ b/vendor/github.com/stretchr/testify/LICENSE @@ -0,0 +1,22 @@ +Copyright (c) 2012 - 2013 Mat Ryer and Tyler Bunnell + +Please consider promoting this project if you find it useful. + +Permission is hereby granted, free of charge, to any person +obtaining a copy of this software and associated documentation +files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, +publish, distribute, sublicense, and/or sell copies of the Software, +and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included +in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, +EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. +IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, +DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT +OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE +OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/stretchr/testify/README.md b/vendor/github.com/stretchr/testify/README.md new file mode 100644 index 000000000..e57b1811f --- /dev/null +++ b/vendor/github.com/stretchr/testify/README.md @@ -0,0 +1,332 @@ +Testify - Thou Shalt Write Tests +================================ + +[![Build Status](https://travis-ci.org/stretchr/testify.svg)](https://travis-ci.org/stretchr/testify) [![Go Report Card](https://goreportcard.com/badge/github.com/stretchr/testify)](https://goreportcard.com/report/github.com/stretchr/testify) [![GoDoc](https://godoc.org/github.com/stretchr/testify?status.svg)](https://godoc.org/github.com/stretchr/testify) + +Go code (golang) set of packages that provide many tools for testifying that your code will behave as you intend. + +Features include: + + * [Easy assertions](#assert-package) + * [Mocking](#mock-package) + * [HTTP response trapping](#http-package) + * [Testing suite interfaces and functions](#suite-package) + +Get started: + + * Install testify with [one line of code](#installation), or [update it with another](#staying-up-to-date) + * For an introduction to writing test code in Go, see http://golang.org/doc/code.html#Testing + * Check out the API Documentation http://godoc.org/github.com/stretchr/testify + * To make your testing life easier, check out our other project, [gorc](http://github.com/stretchr/gorc) + * A little about [Test-Driven Development (TDD)](http://en.wikipedia.org/wiki/Test-driven_development) + + + +[`assert`](http://godoc.org/github.com/stretchr/testify/assert "API documentation") package +------------------------------------------------------------------------------------------- + +The `assert` package provides some helpful methods that allow you to write better test code in Go. + + * Prints friendly, easy to read failure descriptions + * Allows for very readable code + * Optionally annotate each assertion with a message + +See it in action: + +```go +package yours + +import ( + "testing" + "github.com/stretchr/testify/assert" +) + +func TestSomething(t *testing.T) { + + // assert equality + assert.Equal(t, 123, 123, "they should be equal") + + // assert inequality + assert.NotEqual(t, 123, 456, "they should not be equal") + + // assert for nil (good for errors) + assert.Nil(t, object) + + // assert for not nil (good when you expect something) + if assert.NotNil(t, object) { + + // now we know that object isn't nil, we are safe to make + // further assertions without causing any errors + assert.Equal(t, "Something", object.Value) + + } + +} +``` + + * Every assert func takes the `testing.T` object as the first argument. This is how it writes the errors out through the normal `go test` capabilities. + * Every assert func returns a bool indicating whether the assertion was successful or not, this is useful for if you want to go on making further assertions under certain conditions. + +if you assert many times, use the below: + +```go +package yours + +import ( + "testing" + "github.com/stretchr/testify/assert" +) + +func TestSomething(t *testing.T) { + assert := assert.New(t) + + // assert equality + assert.Equal(123, 123, "they should be equal") + + // assert inequality + assert.NotEqual(123, 456, "they should not be equal") + + // assert for nil (good for errors) + assert.Nil(object) + + // assert for not nil (good when you expect something) + if assert.NotNil(object) { + + // now we know that object isn't nil, we are safe to make + // further assertions without causing any errors + assert.Equal("Something", object.Value) + } +} +``` + +[`require`](http://godoc.org/github.com/stretchr/testify/require "API documentation") package +--------------------------------------------------------------------------------------------- + +The `require` package provides same global functions as the `assert` package, but instead of returning a boolean result they terminate current test. + +See [t.FailNow](http://golang.org/pkg/testing/#T.FailNow) for details. + + +[`http`](http://godoc.org/github.com/stretchr/testify/http "API documentation") package +--------------------------------------------------------------------------------------- + +The `http` package contains test objects useful for testing code that relies on the `net/http` package. Check out the [(deprecated) API documentation for the `http` package](http://godoc.org/github.com/stretchr/testify/http). + +We recommend you use [httptest](http://golang.org/pkg/net/http/httptest) instead. + +[`mock`](http://godoc.org/github.com/stretchr/testify/mock "API documentation") package +---------------------------------------------------------------------------------------- + +The `mock` package provides a mechanism for easily writing mock objects that can be used in place of real objects when writing test code. + +An example test function that tests a piece of code that relies on an external object `testObj`, can setup expectations (testify) and assert that they indeed happened: + +```go +package yours + +import ( + "testing" + "github.com/stretchr/testify/mock" +) + +/* + Test objects +*/ + +// MyMockedObject is a mocked object that implements an interface +// that describes an object that the code I am testing relies on. +type MyMockedObject struct{ + mock.Mock +} + +// DoSomething is a method on MyMockedObject that implements some interface +// and just records the activity, and returns what the Mock object tells it to. +// +// In the real object, this method would do something useful, but since this +// is a mocked object - we're just going to stub it out. +// +// NOTE: This method is not being tested here, code that uses this object is. +func (m *MyMockedObject) DoSomething(number int) (bool, error) { + + args := m.Called(number) + return args.Bool(0), args.Error(1) + +} + +/* + Actual test functions +*/ + +// TestSomething is an example of how to use our test object to +// make assertions about some target code we are testing. +func TestSomething(t *testing.T) { + + // create an instance of our test object + testObj := new(MyMockedObject) + + // setup expectations + testObj.On("DoSomething", 123).Return(true, nil) + + // call the code we are testing + targetFuncThatDoesSomethingWithObj(testObj) + + // assert that the expectations were met + testObj.AssertExpectations(t) + +} +``` + +For more information on how to write mock code, check out the [API documentation for the `mock` package](http://godoc.org/github.com/stretchr/testify/mock). + +You can use the [mockery tool](http://github.com/vektra/mockery) to autogenerate the mock code against an interface as well, making using mocks much quicker. + +[`suite`](http://godoc.org/github.com/stretchr/testify/suite "API documentation") package +----------------------------------------------------------------------------------------- + +The `suite` package provides functionality that you might be used to from more common object oriented languages. With it, you can build a testing suite as a struct, build setup/teardown methods and testing methods on your struct, and run them with 'go test' as per normal. + +An example suite is shown below: + +```go +// Basic imports +import ( + "testing" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/suite" +) + +// Define the suite, and absorb the built-in basic suite +// functionality from testify - including a T() method which +// returns the current testing context +type ExampleTestSuite struct { + suite.Suite + VariableThatShouldStartAtFive int +} + +// Make sure that VariableThatShouldStartAtFive is set to five +// before each test +func (suite *ExampleTestSuite) SetupTest() { + suite.VariableThatShouldStartAtFive = 5 +} + +// All methods that begin with "Test" are run as tests within a +// suite. +func (suite *ExampleTestSuite) TestExample() { + assert.Equal(suite.T(), 5, suite.VariableThatShouldStartAtFive) +} + +// In order for 'go test' to run this suite, we need to create +// a normal test function and pass our suite to suite.Run +func TestExampleTestSuite(t *testing.T) { + suite.Run(t, new(ExampleTestSuite)) +} +``` + +For a more complete example, using all of the functionality provided by the suite package, look at our [example testing suite](https://github.com/stretchr/testify/blob/master/suite/suite_test.go) + +For more information on writing suites, check out the [API documentation for the `suite` package](http://godoc.org/github.com/stretchr/testify/suite). + +`Suite` object has assertion methods: + +```go +// Basic imports +import ( + "testing" + "github.com/stretchr/testify/suite" +) + +// Define the suite, and absorb the built-in basic suite +// functionality from testify - including assertion methods. +type ExampleTestSuite struct { + suite.Suite + VariableThatShouldStartAtFive int +} + +// Make sure that VariableThatShouldStartAtFive is set to five +// before each test +func (suite *ExampleTestSuite) SetupTest() { + suite.VariableThatShouldStartAtFive = 5 +} + +// All methods that begin with "Test" are run as tests within a +// suite. +func (suite *ExampleTestSuite) TestExample() { + suite.Equal(suite.VariableThatShouldStartAtFive, 5) +} + +// In order for 'go test' to run this suite, we need to create +// a normal test function and pass our suite to suite.Run +func TestExampleTestSuite(t *testing.T) { + suite.Run(t, new(ExampleTestSuite)) +} +``` + +------ + +Installation +============ + +To install Testify, use `go get`: + + * Latest version: go get github.com/stretchr/testify + * Specific version: go get gopkg.in/stretchr/testify.v1 + +This will then make the following packages available to you: + + github.com/stretchr/testify/assert + github.com/stretchr/testify/mock + github.com/stretchr/testify/http + +Import the `testify/assert` package into your code using this template: + +```go +package yours + +import ( + "testing" + "github.com/stretchr/testify/assert" +) + +func TestSomething(t *testing.T) { + + assert.True(t, true, "True is true!") + +} +``` + +------ + +Staying up to date +================== + +To update Testify to the latest version, use `go get -u github.com/stretchr/testify`. + +------ + +Version History +=============== + + * 1.0 - New package versioning strategy adopted. + +------ + +Contributing +============ + +Please feel free to submit issues, fork the repository and send pull requests! + +When submitting an issue, we ask that you please include a complete test function that demonstrates the issue. Extra credit for those using Testify to write the test code that demonstrates it. + +------ + +Licence +======= +Copyright (c) 2012 - 2013 Mat Ryer and Tyler Bunnell + +Please consider promoting this project if you find it useful. + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/vendor/github.com/stretchr/testify/_codegen/main.go b/vendor/github.com/stretchr/testify/_codegen/main.go new file mode 100644 index 000000000..328009f84 --- /dev/null +++ b/vendor/github.com/stretchr/testify/_codegen/main.go @@ -0,0 +1,287 @@ +// This program reads all assertion functions from the assert package and +// automatically generates the corersponding requires and forwarded assertions + +package main + +import ( + "bytes" + "flag" + "fmt" + "go/ast" + "go/build" + "go/doc" + "go/importer" + "go/parser" + "go/token" + "go/types" + "io" + "io/ioutil" + "log" + "os" + "path" + "strings" + "text/template" + + "github.com/ernesto-jimenez/gogen/imports" +) + +var ( + pkg = flag.String("assert-path", "github.com/stretchr/testify/assert", "Path to the assert package") + outputPkg = flag.String("output-package", "", "package for the resulting code") + tmplFile = flag.String("template", "", "What file to load the function template from") + out = flag.String("out", "", "What file to write the source code to") +) + +func main() { + flag.Parse() + + scope, docs, err := parsePackageSource(*pkg) + if err != nil { + log.Fatal(err) + } + + importer, funcs, err := analyzeCode(scope, docs) + if err != nil { + log.Fatal(err) + } + + if err := generateCode(importer, funcs); err != nil { + log.Fatal(err) + } +} + +func generateCode(importer imports.Importer, funcs []testFunc) error { + buff := bytes.NewBuffer(nil) + + tmplHead, tmplFunc, err := parseTemplates() + if err != nil { + return err + } + + // Generate header + if err := tmplHead.Execute(buff, struct { + Name string + Imports map[string]string + }{ + *outputPkg, + importer.Imports(), + }); err != nil { + return err + } + + // Generate funcs + for _, fn := range funcs { + buff.Write([]byte("\n\n")) + if err := tmplFunc.Execute(buff, &fn); err != nil { + return err + } + } + + // Write file + output, err := outputFile() + if err != nil { + return err + } + defer output.Close() + _, err = io.Copy(output, buff) + return err +} + +func parseTemplates() (*template.Template, *template.Template, error) { + tmplHead, err := template.New("header").Parse(headerTemplate) + if err != nil { + return nil, nil, err + } + if *tmplFile != "" { + f, err := ioutil.ReadFile(*tmplFile) + if err != nil { + return nil, nil, err + } + funcTemplate = string(f) + } + tmpl, err := template.New("function").Parse(funcTemplate) + if err != nil { + return nil, nil, err + } + return tmplHead, tmpl, nil +} + +func outputFile() (*os.File, error) { + filename := *out + if filename == "-" || (filename == "" && *tmplFile == "") { + return os.Stdout, nil + } + if filename == "" { + filename = strings.TrimSuffix(strings.TrimSuffix(*tmplFile, ".tmpl"), ".go") + ".go" + } + return os.Create(filename) +} + +// analyzeCode takes the types scope and the docs and returns the import +// information and information about all the assertion functions. +func analyzeCode(scope *types.Scope, docs *doc.Package) (imports.Importer, []testFunc, error) { + testingT := scope.Lookup("TestingT").Type().Underlying().(*types.Interface) + + importer := imports.New(*outputPkg) + var funcs []testFunc + // Go through all the top level functions + for _, fdocs := range docs.Funcs { + // Find the function + obj := scope.Lookup(fdocs.Name) + + fn, ok := obj.(*types.Func) + if !ok { + continue + } + // Check function signatuer has at least two arguments + sig := fn.Type().(*types.Signature) + if sig.Params().Len() < 2 { + continue + } + // Check first argument is of type testingT + first, ok := sig.Params().At(0).Type().(*types.Named) + if !ok { + continue + } + firstType, ok := first.Underlying().(*types.Interface) + if !ok { + continue + } + if !types.Implements(firstType, testingT) { + continue + } + + funcs = append(funcs, testFunc{*outputPkg, fdocs, fn}) + importer.AddImportsFrom(sig.Params()) + } + return importer, funcs, nil +} + +// parsePackageSource returns the types scope and the package documentation from the pa +func parsePackageSource(pkg string) (*types.Scope, *doc.Package, error) { + pd, err := build.Import(pkg, ".", 0) + if err != nil { + return nil, nil, err + } + + fset := token.NewFileSet() + files := make(map[string]*ast.File) + fileList := make([]*ast.File, len(pd.GoFiles)) + for i, fname := range pd.GoFiles { + src, err := ioutil.ReadFile(path.Join(pd.SrcRoot, pd.ImportPath, fname)) + if err != nil { + return nil, nil, err + } + f, err := parser.ParseFile(fset, fname, src, parser.ParseComments|parser.AllErrors) + if err != nil { + return nil, nil, err + } + files[fname] = f + fileList[i] = f + } + + cfg := types.Config{ + Importer: importer.Default(), + } + info := types.Info{ + Defs: make(map[*ast.Ident]types.Object), + } + tp, err := cfg.Check(pkg, fset, fileList, &info) + if err != nil { + return nil, nil, err + } + + scope := tp.Scope() + + ap, _ := ast.NewPackage(fset, files, nil, nil) + docs := doc.New(ap, pkg, 0) + + return scope, docs, nil +} + +type testFunc struct { + CurrentPkg string + DocInfo *doc.Func + TypeInfo *types.Func +} + +func (f *testFunc) Qualifier(p *types.Package) string { + if p == nil || p.Name() == f.CurrentPkg { + return "" + } + return p.Name() +} + +func (f *testFunc) Params() string { + sig := f.TypeInfo.Type().(*types.Signature) + params := sig.Params() + p := "" + comma := "" + to := params.Len() + var i int + + if sig.Variadic() { + to-- + } + for i = 1; i < to; i++ { + param := params.At(i) + p += fmt.Sprintf("%s%s %s", comma, param.Name(), types.TypeString(param.Type(), f.Qualifier)) + comma = ", " + } + if sig.Variadic() { + param := params.At(params.Len() - 1) + p += fmt.Sprintf("%s%s ...%s", comma, param.Name(), types.TypeString(param.Type().(*types.Slice).Elem(), f.Qualifier)) + } + return p +} + +func (f *testFunc) ForwardedParams() string { + sig := f.TypeInfo.Type().(*types.Signature) + params := sig.Params() + p := "" + comma := "" + to := params.Len() + var i int + + if sig.Variadic() { + to-- + } + for i = 1; i < to; i++ { + param := params.At(i) + p += fmt.Sprintf("%s%s", comma, param.Name()) + comma = ", " + } + if sig.Variadic() { + param := params.At(params.Len() - 1) + p += fmt.Sprintf("%s%s...", comma, param.Name()) + } + return p +} + +func (f *testFunc) Comment() string { + return "// " + strings.Replace(strings.TrimSpace(f.DocInfo.Doc), "\n", "\n// ", -1) +} + +func (f *testFunc) CommentWithoutT(receiver string) string { + search := fmt.Sprintf("assert.%s(t, ", f.DocInfo.Name) + replace := fmt.Sprintf("%s.%s(", receiver, f.DocInfo.Name) + return strings.Replace(f.Comment(), search, replace, -1) +} + +var headerTemplate = `/* +* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen +* THIS FILE MUST NOT BE EDITED BY HAND +*/ + +package {{.Name}} + +import ( +{{range $path, $name := .Imports}} + {{$name}} "{{$path}}"{{end}} +) +` + +var funcTemplate = `{{.Comment}} +func (fwd *AssertionsForwarder) {{.DocInfo.Name}}({{.Params}}) bool { + return assert.{{.DocInfo.Name}}({{.ForwardedParams}}) +}` diff --git a/vendor/github.com/stretchr/testify/assert/assertion_forward.go b/vendor/github.com/stretchr/testify/assert/assertion_forward.go new file mode 100644 index 000000000..e6a796046 --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/assertion_forward.go @@ -0,0 +1,387 @@ +/* +* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen +* THIS FILE MUST NOT BE EDITED BY HAND +*/ + +package assert + +import ( + + http "net/http" + url "net/url" + time "time" +) + + +// Condition uses a Comparison to assert a complex condition. +func (a *Assertions) Condition(comp Comparison, msgAndArgs ...interface{}) bool { + return Condition(a.t, comp, msgAndArgs...) +} + + +// Contains asserts that the specified string, list(array, slice...) or map contains the +// specified substring or element. +// +// a.Contains("Hello World", "World", "But 'Hello World' does contain 'World'") +// a.Contains(["Hello", "World"], "World", "But ["Hello", "World"] does contain 'World'") +// a.Contains({"Hello": "World"}, "Hello", "But {'Hello': 'World'} does contain 'Hello'") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool { + return Contains(a.t, s, contains, msgAndArgs...) +} + + +// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// a.Empty(obj) +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) bool { + return Empty(a.t, object, msgAndArgs...) +} + + +// Equal asserts that two objects are equal. +// +// a.Equal(123, 123, "123 and 123 should be equal") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { + return Equal(a.t, expected, actual, msgAndArgs...) +} + + +// EqualError asserts that a function returned an error (i.e. not `nil`) +// and that it is equal to the provided error. +// +// actualObj, err := SomeFunction() +// if assert.Error(t, err, "An error was expected") { +// assert.Equal(t, err, expectedError) +// } +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) bool { + return EqualError(a.t, theError, errString, msgAndArgs...) +} + + +// EqualValues asserts that two objects are equal or convertable to the same types +// and equal. +// +// a.EqualValues(uint32(123), int32(123), "123 and 123 should be equal") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { + return EqualValues(a.t, expected, actual, msgAndArgs...) +} + + +// Error asserts that a function returned an error (i.e. not `nil`). +// +// actualObj, err := SomeFunction() +// if a.Error(err, "An error was expected") { +// assert.Equal(t, err, expectedError) +// } +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Error(err error, msgAndArgs ...interface{}) bool { + return Error(a.t, err, msgAndArgs...) +} + + +// Exactly asserts that two objects are equal is value and type. +// +// a.Exactly(int32(123), int64(123), "123 and 123 should NOT be equal") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { + return Exactly(a.t, expected, actual, msgAndArgs...) +} + + +// Fail reports a failure through +func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) bool { + return Fail(a.t, failureMessage, msgAndArgs...) +} + + +// FailNow fails test +func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) bool { + return FailNow(a.t, failureMessage, msgAndArgs...) +} + + +// False asserts that the specified value is false. +// +// a.False(myBool, "myBool should be false") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) False(value bool, msgAndArgs ...interface{}) bool { + return False(a.t, value, msgAndArgs...) +} + + +// HTTPBodyContains asserts that a specified handler returns a +// body that contains a string. +// +// a.HTTPBodyContains(myHandler, "www.google.com", nil, "I'm Feeling Lucky") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) bool { + return HTTPBodyContains(a.t, handler, method, url, values, str) +} + + +// HTTPBodyNotContains asserts that a specified handler returns a +// body that does not contain a string. +// +// a.HTTPBodyNotContains(myHandler, "www.google.com", nil, "I'm Feeling Lucky") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) bool { + return HTTPBodyNotContains(a.t, handler, method, url, values, str) +} + + +// HTTPError asserts that a specified handler returns an error status code. +// +// a.HTTPError(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values) bool { + return HTTPError(a.t, handler, method, url, values) +} + + +// HTTPRedirect asserts that a specified handler returns a redirect status code. +// +// a.HTTPRedirect(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values) bool { + return HTTPRedirect(a.t, handler, method, url, values) +} + + +// HTTPSuccess asserts that a specified handler returns a success status code. +// +// a.HTTPSuccess(myHandler, "POST", "http://www.google.com", nil) +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values) bool { + return HTTPSuccess(a.t, handler, method, url, values) +} + + +// Implements asserts that an object is implemented by the specified interface. +// +// a.Implements((*MyInterface)(nil), new(MyObject), "MyObject") +func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool { + return Implements(a.t, interfaceObject, object, msgAndArgs...) +} + + +// InDelta asserts that the two numerals are within delta of each other. +// +// a.InDelta(math.Pi, (22 / 7.0), 0.01) +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { + return InDelta(a.t, expected, actual, delta, msgAndArgs...) +} + + +// InDeltaSlice is the same as InDelta, except it compares two slices. +func (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { + return InDeltaSlice(a.t, expected, actual, delta, msgAndArgs...) +} + + +// InEpsilon asserts that expected and actual have a relative error less than epsilon +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool { + return InEpsilon(a.t, expected, actual, epsilon, msgAndArgs...) +} + + +// InEpsilonSlice is the same as InEpsilon, except it compares two slices. +func (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { + return InEpsilonSlice(a.t, expected, actual, delta, msgAndArgs...) +} + + +// IsType asserts that the specified objects are of the same type. +func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool { + return IsType(a.t, expectedType, object, msgAndArgs...) +} + + +// JSONEq asserts that two JSON strings are equivalent. +// +// a.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) bool { + return JSONEq(a.t, expected, actual, msgAndArgs...) +} + + +// Len asserts that the specified object has specific length. +// Len also fails if the object has a type that len() not accept. +// +// a.Len(mySlice, 3, "The size of slice is not 3") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) bool { + return Len(a.t, object, length, msgAndArgs...) +} + + +// Nil asserts that the specified object is nil. +// +// a.Nil(err, "err should be nothing") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) bool { + return Nil(a.t, object, msgAndArgs...) +} + + +// NoError asserts that a function returned no error (i.e. `nil`). +// +// actualObj, err := SomeFunction() +// if a.NoError(err) { +// assert.Equal(t, actualObj, expectedObj) +// } +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) bool { + return NoError(a.t, err, msgAndArgs...) +} + + +// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the +// specified substring or element. +// +// a.NotContains("Hello World", "Earth", "But 'Hello World' does NOT contain 'Earth'") +// a.NotContains(["Hello", "World"], "Earth", "But ['Hello', 'World'] does NOT contain 'Earth'") +// a.NotContains({"Hello": "World"}, "Earth", "But {'Hello': 'World'} does NOT contain 'Earth'") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) bool { + return NotContains(a.t, s, contains, msgAndArgs...) +} + + +// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// if a.NotEmpty(obj) { +// assert.Equal(t, "two", obj[1]) +// } +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) bool { + return NotEmpty(a.t, object, msgAndArgs...) +} + + +// NotEqual asserts that the specified values are NOT equal. +// +// a.NotEqual(obj1, obj2, "two objects shouldn't be equal") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) bool { + return NotEqual(a.t, expected, actual, msgAndArgs...) +} + + +// NotNil asserts that the specified object is not nil. +// +// a.NotNil(err, "err should be something") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) bool { + return NotNil(a.t, object, msgAndArgs...) +} + + +// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. +// +// a.NotPanics(func(){ +// RemainCalm() +// }, "Calling RemainCalm() should NOT panic") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) NotPanics(f PanicTestFunc, msgAndArgs ...interface{}) bool { + return NotPanics(a.t, f, msgAndArgs...) +} + + +// NotRegexp asserts that a specified regexp does not match a string. +// +// a.NotRegexp(regexp.MustCompile("starts"), "it's starting") +// a.NotRegexp("^start", "it's not starting") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool { + return NotRegexp(a.t, rx, str, msgAndArgs...) +} + + +// NotZero asserts that i is not the zero value for its type and returns the truth. +func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) bool { + return NotZero(a.t, i, msgAndArgs...) +} + + +// Panics asserts that the code inside the specified PanicTestFunc panics. +// +// a.Panics(func(){ +// GoCrazy() +// }, "Calling GoCrazy() should panic") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Panics(f PanicTestFunc, msgAndArgs ...interface{}) bool { + return Panics(a.t, f, msgAndArgs...) +} + + +// Regexp asserts that a specified regexp matches a string. +// +// a.Regexp(regexp.MustCompile("start"), "it's starting") +// a.Regexp("start...$", "it's not starting") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) bool { + return Regexp(a.t, rx, str, msgAndArgs...) +} + + +// True asserts that the specified value is true. +// +// a.True(myBool, "myBool should be true") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) True(value bool, msgAndArgs ...interface{}) bool { + return True(a.t, value, msgAndArgs...) +} + + +// WithinDuration asserts that the two times are within duration delta of each other. +// +// a.WithinDuration(time.Now(), time.Now(), 10*time.Second, "The difference should not be more than 10s") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool { + return WithinDuration(a.t, expected, actual, delta, msgAndArgs...) +} + + +// Zero asserts that i is the zero value for its type and returns the truth. +func (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) bool { + return Zero(a.t, i, msgAndArgs...) +} diff --git a/vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl b/vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl new file mode 100644 index 000000000..99f9acfbb --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/assertion_forward.go.tmpl @@ -0,0 +1,4 @@ +{{.CommentWithoutT "a"}} +func (a *Assertions) {{.DocInfo.Name}}({{.Params}}) bool { + return {{.DocInfo.Name}}(a.t, {{.ForwardedParams}}) +} diff --git a/vendor/github.com/stretchr/testify/assert/assertions.go b/vendor/github.com/stretchr/testify/assert/assertions.go new file mode 100644 index 000000000..b3f4e170d --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/assertions.go @@ -0,0 +1,1052 @@ +package assert + +import ( + "bufio" + "bytes" + "encoding/json" + "fmt" + "math" + "reflect" + "regexp" + "runtime" + "strings" + "time" + "unicode" + "unicode/utf8" + + "github.com/davecgh/go-spew/spew" + "github.com/pmezard/go-difflib/difflib" +) + +func init() { + spew.Config.SortKeys = true +} + +// TestingT is an interface wrapper around *testing.T +type TestingT interface { + Errorf(format string, args ...interface{}) +} + +// Comparison a custom function that returns true on success and false on failure +type Comparison func() (success bool) + +/* + Helper functions +*/ + +// ObjectsAreEqual determines if two objects are considered equal. +// +// This function does no assertion of any kind. +func ObjectsAreEqual(expected, actual interface{}) bool { + + if expected == nil || actual == nil { + return expected == actual + } + + return reflect.DeepEqual(expected, actual) + +} + +// ObjectsAreEqualValues gets whether two objects are equal, or if their +// values are equal. +func ObjectsAreEqualValues(expected, actual interface{}) bool { + if ObjectsAreEqual(expected, actual) { + return true + } + + actualType := reflect.TypeOf(actual) + if actualType == nil { + return false + } + expectedValue := reflect.ValueOf(expected) + if expectedValue.IsValid() && expectedValue.Type().ConvertibleTo(actualType) { + // Attempt comparison after type conversion + return reflect.DeepEqual(expectedValue.Convert(actualType).Interface(), actual) + } + + return false +} + +/* CallerInfo is necessary because the assert functions use the testing object +internally, causing it to print the file:line of the assert method, rather than where +the problem actually occurred in calling code.*/ + +// CallerInfo returns an array of strings containing the file and line number +// of each stack frame leading from the current test to the assert call that +// failed. +func CallerInfo() []string { + + pc := uintptr(0) + file := "" + line := 0 + ok := false + name := "" + + callers := []string{} + for i := 0; ; i++ { + pc, file, line, ok = runtime.Caller(i) + if !ok { + // The breaks below failed to terminate the loop, and we ran off the + // end of the call stack. + break + } + + // This is a huge edge case, but it will panic if this is the case, see #180 + if file == "" { + break + } + + f := runtime.FuncForPC(pc) + if f == nil { + break + } + name = f.Name() + + // testing.tRunner is the standard library function that calls + // tests. Subtests are called directly by tRunner, without going through + // the Test/Benchmark/Example function that contains the t.Run calls, so + // with subtests we should break when we hit tRunner, without adding it + // to the list of callers. + if name == "testing.tRunner" { + break + } + + parts := strings.Split(file, "/") + dir := parts[len(parts)-2] + file = parts[len(parts)-1] + if (dir != "assert" && dir != "mock" && dir != "require") || file == "mock_test.go" { + callers = append(callers, fmt.Sprintf("%s:%d", file, line)) + } + + // Drop the package + segments := strings.Split(name, ".") + name = segments[len(segments)-1] + if isTest(name, "Test") || + isTest(name, "Benchmark") || + isTest(name, "Example") { + break + } + } + + return callers +} + +// Stolen from the `go test` tool. +// isTest tells whether name looks like a test (or benchmark, according to prefix). +// It is a Test (say) if there is a character after Test that is not a lower-case letter. +// We don't want TesticularCancer. +func isTest(name, prefix string) bool { + if !strings.HasPrefix(name, prefix) { + return false + } + if len(name) == len(prefix) { // "Test" is ok + return true + } + rune, _ := utf8.DecodeRuneInString(name[len(prefix):]) + return !unicode.IsLower(rune) +} + +// getWhitespaceString returns a string that is long enough to overwrite the default +// output from the go testing framework. +func getWhitespaceString() string { + + _, file, line, ok := runtime.Caller(1) + if !ok { + return "" + } + parts := strings.Split(file, "/") + file = parts[len(parts)-1] + + return strings.Repeat(" ", len(fmt.Sprintf("%s:%d: ", file, line))) + +} + +func messageFromMsgAndArgs(msgAndArgs ...interface{}) string { + if len(msgAndArgs) == 0 || msgAndArgs == nil { + return "" + } + if len(msgAndArgs) == 1 { + return msgAndArgs[0].(string) + } + if len(msgAndArgs) > 1 { + return fmt.Sprintf(msgAndArgs[0].(string), msgAndArgs[1:]...) + } + return "" +} + +// Indents all lines of the message by appending a number of tabs to each line, in an output format compatible with Go's +// test printing (see inner comment for specifics) +func indentMessageLines(message string, tabs int) string { + outBuf := new(bytes.Buffer) + + for i, scanner := 0, bufio.NewScanner(strings.NewReader(message)); scanner.Scan(); i++ { + if i != 0 { + outBuf.WriteRune('\n') + } + for ii := 0; ii < tabs; ii++ { + outBuf.WriteRune('\t') + // Bizarrely, all lines except the first need one fewer tabs prepended, so deliberately advance the counter + // by 1 prematurely. + if ii == 0 && i > 0 { + ii++ + } + } + outBuf.WriteString(scanner.Text()) + } + + return outBuf.String() +} + +type failNower interface { + FailNow() +} + +// FailNow fails test +func FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool { + Fail(t, failureMessage, msgAndArgs...) + + // We cannot extend TestingT with FailNow() and + // maintain backwards compatibility, so we fallback + // to panicking when FailNow is not available in + // TestingT. + // See issue #263 + + if t, ok := t.(failNower); ok { + t.FailNow() + } else { + panic("test failed and t is missing `FailNow()`") + } + return false +} + +// Fail reports a failure through +func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) bool { + + message := messageFromMsgAndArgs(msgAndArgs...) + + errorTrace := strings.Join(CallerInfo(), "\n\r\t\t\t") + if len(message) > 0 { + t.Errorf("\r%s\r\tError Trace:\t%s\n"+ + "\r\tError:%s\n"+ + "\r\tMessages:\t%s\n\r", + getWhitespaceString(), + errorTrace, + indentMessageLines(failureMessage, 2), + message) + } else { + t.Errorf("\r%s\r\tError Trace:\t%s\n"+ + "\r\tError:%s\n\r", + getWhitespaceString(), + errorTrace, + indentMessageLines(failureMessage, 2)) + } + + return false +} + +// Implements asserts that an object is implemented by the specified interface. +// +// assert.Implements(t, (*MyInterface)(nil), new(MyObject), "MyObject") +func Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) bool { + + interfaceType := reflect.TypeOf(interfaceObject).Elem() + + if !reflect.TypeOf(object).Implements(interfaceType) { + return Fail(t, fmt.Sprintf("%T must implement %v", object, interfaceType), msgAndArgs...) + } + + return true + +} + +// IsType asserts that the specified objects are of the same type. +func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) bool { + + if !ObjectsAreEqual(reflect.TypeOf(object), reflect.TypeOf(expectedType)) { + return Fail(t, fmt.Sprintf("Object expected to be of type %v, but was %v", reflect.TypeOf(expectedType), reflect.TypeOf(object)), msgAndArgs...) + } + + return true +} + +// Equal asserts that two objects are equal. +// +// assert.Equal(t, 123, 123, "123 and 123 should be equal") +// +// Returns whether the assertion was successful (true) or not (false). +func Equal(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { + + if !ObjectsAreEqual(expected, actual) { + diff := diff(expected, actual) + expected, actual = formatUnequalValues(expected, actual) + return Fail(t, fmt.Sprintf("Not equal: %s (expected)\n"+ + " != %s (actual)%s", expected, actual, diff), msgAndArgs...) + } + + return true + +} + +// formatUnequalValues takes two values of arbitrary types and returns string +// representations appropriate to be presented to the user. +// +// If the values are not of like type, the returned strings will be prefixed +// with the type name, and the value will be enclosed in parenthesis similar +// to a type conversion in the Go grammar. +func formatUnequalValues(expected, actual interface{}) (e string, a string) { + aType := reflect.TypeOf(expected) + bType := reflect.TypeOf(actual) + + if aType != bType && isNumericType(aType) && isNumericType(bType) { + return fmt.Sprintf("%v(%#v)", aType, expected), + fmt.Sprintf("%v(%#v)", bType, actual) + } + + return fmt.Sprintf("%#v", expected), + fmt.Sprintf("%#v", actual) +} + +func isNumericType(t reflect.Type) bool { + switch t.Kind() { + case reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64: + return true + case reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64: + return true + case reflect.Float32, reflect.Float64: + return true + } + + return false +} + +// EqualValues asserts that two objects are equal or convertable to the same types +// and equal. +// +// assert.EqualValues(t, uint32(123), int32(123), "123 and 123 should be equal") +// +// Returns whether the assertion was successful (true) or not (false). +func EqualValues(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { + + if !ObjectsAreEqualValues(expected, actual) { + return Fail(t, fmt.Sprintf("Not equal: %#v (expected)\n"+ + " != %#v (actual)", expected, actual), msgAndArgs...) + } + + return true + +} + +// Exactly asserts that two objects are equal is value and type. +// +// assert.Exactly(t, int32(123), int64(123), "123 and 123 should NOT be equal") +// +// Returns whether the assertion was successful (true) or not (false). +func Exactly(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { + + aType := reflect.TypeOf(expected) + bType := reflect.TypeOf(actual) + + if aType != bType { + return Fail(t, fmt.Sprintf("Types expected to match exactly\n\r\t%v != %v", aType, bType), msgAndArgs...) + } + + return Equal(t, expected, actual, msgAndArgs...) + +} + +// NotNil asserts that the specified object is not nil. +// +// assert.NotNil(t, err, "err should be something") +// +// Returns whether the assertion was successful (true) or not (false). +func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { + if !isNil(object) { + return true + } + return Fail(t, "Expected value not to be nil.", msgAndArgs...) +} + +// isNil checks if a specified object is nil or not, without Failing. +func isNil(object interface{}) bool { + if object == nil { + return true + } + + value := reflect.ValueOf(object) + kind := value.Kind() + if kind >= reflect.Chan && kind <= reflect.Slice && value.IsNil() { + return true + } + + return false +} + +// Nil asserts that the specified object is nil. +// +// assert.Nil(t, err, "err should be nothing") +// +// Returns whether the assertion was successful (true) or not (false). +func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { + if isNil(object) { + return true + } + return Fail(t, fmt.Sprintf("Expected nil, but got: %#v", object), msgAndArgs...) +} + +var numericZeros = []interface{}{ + int(0), + int8(0), + int16(0), + int32(0), + int64(0), + uint(0), + uint8(0), + uint16(0), + uint32(0), + uint64(0), + float32(0), + float64(0), +} + +// isEmpty gets whether the specified object is considered empty or not. +func isEmpty(object interface{}) bool { + + if object == nil { + return true + } else if object == "" { + return true + } else if object == false { + return true + } + + for _, v := range numericZeros { + if object == v { + return true + } + } + + objValue := reflect.ValueOf(object) + + switch objValue.Kind() { + case reflect.Map: + fallthrough + case reflect.Slice, reflect.Chan: + { + return (objValue.Len() == 0) + } + case reflect.Struct: + switch object.(type) { + case time.Time: + return object.(time.Time).IsZero() + } + case reflect.Ptr: + { + if objValue.IsNil() { + return true + } + switch object.(type) { + case *time.Time: + return object.(*time.Time).IsZero() + default: + return false + } + } + } + return false +} + +// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// assert.Empty(t, obj) +// +// Returns whether the assertion was successful (true) or not (false). +func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { + + pass := isEmpty(object) + if !pass { + Fail(t, fmt.Sprintf("Should be empty, but was %v", object), msgAndArgs...) + } + + return pass + +} + +// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// if assert.NotEmpty(t, obj) { +// assert.Equal(t, "two", obj[1]) +// } +// +// Returns whether the assertion was successful (true) or not (false). +func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) bool { + + pass := !isEmpty(object) + if !pass { + Fail(t, fmt.Sprintf("Should NOT be empty, but was %v", object), msgAndArgs...) + } + + return pass + +} + +// getLen try to get length of object. +// return (false, 0) if impossible. +func getLen(x interface{}) (ok bool, length int) { + v := reflect.ValueOf(x) + defer func() { + if e := recover(); e != nil { + ok = false + } + }() + return true, v.Len() +} + +// Len asserts that the specified object has specific length. +// Len also fails if the object has a type that len() not accept. +// +// assert.Len(t, mySlice, 3, "The size of slice is not 3") +// +// Returns whether the assertion was successful (true) or not (false). +func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) bool { + ok, l := getLen(object) + if !ok { + return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", object), msgAndArgs...) + } + + if l != length { + return Fail(t, fmt.Sprintf("\"%s\" should have %d item(s), but has %d", object, length, l), msgAndArgs...) + } + return true +} + +// True asserts that the specified value is true. +// +// assert.True(t, myBool, "myBool should be true") +// +// Returns whether the assertion was successful (true) or not (false). +func True(t TestingT, value bool, msgAndArgs ...interface{}) bool { + + if value != true { + return Fail(t, "Should be true", msgAndArgs...) + } + + return true + +} + +// False asserts that the specified value is false. +// +// assert.False(t, myBool, "myBool should be false") +// +// Returns whether the assertion was successful (true) or not (false). +func False(t TestingT, value bool, msgAndArgs ...interface{}) bool { + + if value != false { + return Fail(t, "Should be false", msgAndArgs...) + } + + return true + +} + +// NotEqual asserts that the specified values are NOT equal. +// +// assert.NotEqual(t, obj1, obj2, "two objects shouldn't be equal") +// +// Returns whether the assertion was successful (true) or not (false). +func NotEqual(t TestingT, expected, actual interface{}, msgAndArgs ...interface{}) bool { + + if ObjectsAreEqual(expected, actual) { + return Fail(t, fmt.Sprintf("Should not be: %#v\n", actual), msgAndArgs...) + } + + return true + +} + +// containsElement try loop over the list check if the list includes the element. +// return (false, false) if impossible. +// return (true, false) if element was not found. +// return (true, true) if element was found. +func includeElement(list interface{}, element interface{}) (ok, found bool) { + + listValue := reflect.ValueOf(list) + elementValue := reflect.ValueOf(element) + defer func() { + if e := recover(); e != nil { + ok = false + found = false + } + }() + + if reflect.TypeOf(list).Kind() == reflect.String { + return true, strings.Contains(listValue.String(), elementValue.String()) + } + + if reflect.TypeOf(list).Kind() == reflect.Map { + mapKeys := listValue.MapKeys() + for i := 0; i < len(mapKeys); i++ { + if ObjectsAreEqual(mapKeys[i].Interface(), element) { + return true, true + } + } + return true, false + } + + for i := 0; i < listValue.Len(); i++ { + if ObjectsAreEqual(listValue.Index(i).Interface(), element) { + return true, true + } + } + return true, false + +} + +// Contains asserts that the specified string, list(array, slice...) or map contains the +// specified substring or element. +// +// assert.Contains(t, "Hello World", "World", "But 'Hello World' does contain 'World'") +// assert.Contains(t, ["Hello", "World"], "World", "But ["Hello", "World"] does contain 'World'") +// assert.Contains(t, {"Hello": "World"}, "Hello", "But {'Hello': 'World'} does contain 'Hello'") +// +// Returns whether the assertion was successful (true) or not (false). +func Contains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool { + + ok, found := includeElement(s, contains) + if !ok { + return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", s), msgAndArgs...) + } + if !found { + return Fail(t, fmt.Sprintf("\"%s\" does not contain \"%s\"", s, contains), msgAndArgs...) + } + + return true + +} + +// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the +// specified substring or element. +// +// assert.NotContains(t, "Hello World", "Earth", "But 'Hello World' does NOT contain 'Earth'") +// assert.NotContains(t, ["Hello", "World"], "Earth", "But ['Hello', 'World'] does NOT contain 'Earth'") +// assert.NotContains(t, {"Hello": "World"}, "Earth", "But {'Hello': 'World'} does NOT contain 'Earth'") +// +// Returns whether the assertion was successful (true) or not (false). +func NotContains(t TestingT, s, contains interface{}, msgAndArgs ...interface{}) bool { + + ok, found := includeElement(s, contains) + if !ok { + return Fail(t, fmt.Sprintf("\"%s\" could not be applied builtin len()", s), msgAndArgs...) + } + if found { + return Fail(t, fmt.Sprintf("\"%s\" should not contain \"%s\"", s, contains), msgAndArgs...) + } + + return true + +} + +// Condition uses a Comparison to assert a complex condition. +func Condition(t TestingT, comp Comparison, msgAndArgs ...interface{}) bool { + result := comp() + if !result { + Fail(t, "Condition failed!", msgAndArgs...) + } + return result +} + +// PanicTestFunc defines a func that should be passed to the assert.Panics and assert.NotPanics +// methods, and represents a simple func that takes no arguments, and returns nothing. +type PanicTestFunc func() + +// didPanic returns true if the function passed to it panics. Otherwise, it returns false. +func didPanic(f PanicTestFunc) (bool, interface{}) { + + didPanic := false + var message interface{} + func() { + + defer func() { + if message = recover(); message != nil { + didPanic = true + } + }() + + // call the target function + f() + + }() + + return didPanic, message + +} + +// Panics asserts that the code inside the specified PanicTestFunc panics. +// +// assert.Panics(t, func(){ +// GoCrazy() +// }, "Calling GoCrazy() should panic") +// +// Returns whether the assertion was successful (true) or not (false). +func Panics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool { + + if funcDidPanic, panicValue := didPanic(f); !funcDidPanic { + return Fail(t, fmt.Sprintf("func %#v should panic\n\r\tPanic value:\t%v", f, panicValue), msgAndArgs...) + } + + return true +} + +// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. +// +// assert.NotPanics(t, func(){ +// RemainCalm() +// }, "Calling RemainCalm() should NOT panic") +// +// Returns whether the assertion was successful (true) or not (false). +func NotPanics(t TestingT, f PanicTestFunc, msgAndArgs ...interface{}) bool { + + if funcDidPanic, panicValue := didPanic(f); funcDidPanic { + return Fail(t, fmt.Sprintf("func %#v should not panic\n\r\tPanic value:\t%v", f, panicValue), msgAndArgs...) + } + + return true +} + +// WithinDuration asserts that the two times are within duration delta of each other. +// +// assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second, "The difference should not be more than 10s") +// +// Returns whether the assertion was successful (true) or not (false). +func WithinDuration(t TestingT, expected, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) bool { + + dt := expected.Sub(actual) + if dt < -delta || dt > delta { + return Fail(t, fmt.Sprintf("Max difference between %v and %v allowed is %v, but difference was %v", expected, actual, delta, dt), msgAndArgs...) + } + + return true +} + +func toFloat(x interface{}) (float64, bool) { + var xf float64 + xok := true + + switch xn := x.(type) { + case uint8: + xf = float64(xn) + case uint16: + xf = float64(xn) + case uint32: + xf = float64(xn) + case uint64: + xf = float64(xn) + case int: + xf = float64(xn) + case int8: + xf = float64(xn) + case int16: + xf = float64(xn) + case int32: + xf = float64(xn) + case int64: + xf = float64(xn) + case float32: + xf = float64(xn) + case float64: + xf = float64(xn) + default: + xok = false + } + + return xf, xok +} + +// InDelta asserts that the two numerals are within delta of each other. +// +// assert.InDelta(t, math.Pi, (22 / 7.0), 0.01) +// +// Returns whether the assertion was successful (true) or not (false). +func InDelta(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { + + af, aok := toFloat(expected) + bf, bok := toFloat(actual) + + if !aok || !bok { + return Fail(t, fmt.Sprintf("Parameters must be numerical"), msgAndArgs...) + } + + if math.IsNaN(af) { + return Fail(t, fmt.Sprintf("Actual must not be NaN"), msgAndArgs...) + } + + if math.IsNaN(bf) { + return Fail(t, fmt.Sprintf("Expected %v with delta %v, but was NaN", expected, delta), msgAndArgs...) + } + + dt := af - bf + if dt < -delta || dt > delta { + return Fail(t, fmt.Sprintf("Max difference between %v and %v allowed is %v, but difference was %v", expected, actual, delta, dt), msgAndArgs...) + } + + return true +} + +// InDeltaSlice is the same as InDelta, except it compares two slices. +func InDeltaSlice(t TestingT, expected, actual interface{}, delta float64, msgAndArgs ...interface{}) bool { + if expected == nil || actual == nil || + reflect.TypeOf(actual).Kind() != reflect.Slice || + reflect.TypeOf(expected).Kind() != reflect.Slice { + return Fail(t, fmt.Sprintf("Parameters must be slice"), msgAndArgs...) + } + + actualSlice := reflect.ValueOf(actual) + expectedSlice := reflect.ValueOf(expected) + + for i := 0; i < actualSlice.Len(); i++ { + result := InDelta(t, actualSlice.Index(i).Interface(), expectedSlice.Index(i).Interface(), delta) + if !result { + return result + } + } + + return true +} + +func calcRelativeError(expected, actual interface{}) (float64, error) { + af, aok := toFloat(expected) + if !aok { + return 0, fmt.Errorf("expected value %q cannot be converted to float", expected) + } + if af == 0 { + return 0, fmt.Errorf("expected value must have a value other than zero to calculate the relative error") + } + bf, bok := toFloat(actual) + if !bok { + return 0, fmt.Errorf("expected value %q cannot be converted to float", actual) + } + + return math.Abs(af-bf) / math.Abs(af), nil +} + +// InEpsilon asserts that expected and actual have a relative error less than epsilon +// +// Returns whether the assertion was successful (true) or not (false). +func InEpsilon(t TestingT, expected, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool { + actualEpsilon, err := calcRelativeError(expected, actual) + if err != nil { + return Fail(t, err.Error(), msgAndArgs...) + } + if actualEpsilon > epsilon { + return Fail(t, fmt.Sprintf("Relative error is too high: %#v (expected)\n"+ + " < %#v (actual)", actualEpsilon, epsilon), msgAndArgs...) + } + + return true +} + +// InEpsilonSlice is the same as InEpsilon, except it compares each value from two slices. +func InEpsilonSlice(t TestingT, expected, actual interface{}, epsilon float64, msgAndArgs ...interface{}) bool { + if expected == nil || actual == nil || + reflect.TypeOf(actual).Kind() != reflect.Slice || + reflect.TypeOf(expected).Kind() != reflect.Slice { + return Fail(t, fmt.Sprintf("Parameters must be slice"), msgAndArgs...) + } + + actualSlice := reflect.ValueOf(actual) + expectedSlice := reflect.ValueOf(expected) + + for i := 0; i < actualSlice.Len(); i++ { + result := InEpsilon(t, actualSlice.Index(i).Interface(), expectedSlice.Index(i).Interface(), epsilon) + if !result { + return result + } + } + + return true +} + +/* + Errors +*/ + +// NoError asserts that a function returned no error (i.e. `nil`). +// +// actualObj, err := SomeFunction() +// if assert.NoError(t, err) { +// assert.Equal(t, actualObj, expectedObj) +// } +// +// Returns whether the assertion was successful (true) or not (false). +func NoError(t TestingT, err error, msgAndArgs ...interface{}) bool { + if err != nil { + return Fail(t, fmt.Sprintf("Received unexpected error %+v", err), msgAndArgs...) + } + + return true +} + +// Error asserts that a function returned an error (i.e. not `nil`). +// +// actualObj, err := SomeFunction() +// if assert.Error(t, err, "An error was expected") { +// assert.Equal(t, err, expectedError) +// } +// +// Returns whether the assertion was successful (true) or not (false). +func Error(t TestingT, err error, msgAndArgs ...interface{}) bool { + + if err == nil { + return Fail(t, "An error is expected but got nil.", msgAndArgs...) + } + + return true +} + +// EqualError asserts that a function returned an error (i.e. not `nil`) +// and that it is equal to the provided error. +// +// actualObj, err := SomeFunction() +// assert.EqualError(t, err, expectedErrorString, "An error was expected") +// +// Returns whether the assertion was successful (true) or not (false). +func EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) bool { + + message := messageFromMsgAndArgs(msgAndArgs...) + if !NotNil(t, theError, "An error is expected but got nil. %s", message) { + return false + } + s := "An error with value \"%s\" is expected but got \"%s\". %s" + return Equal(t, errString, theError.Error(), + s, errString, theError.Error(), message) +} + +// matchRegexp return true if a specified regexp matches a string. +func matchRegexp(rx interface{}, str interface{}) bool { + + var r *regexp.Regexp + if rr, ok := rx.(*regexp.Regexp); ok { + r = rr + } else { + r = regexp.MustCompile(fmt.Sprint(rx)) + } + + return (r.FindStringIndex(fmt.Sprint(str)) != nil) + +} + +// Regexp asserts that a specified regexp matches a string. +// +// assert.Regexp(t, regexp.MustCompile("start"), "it's starting") +// assert.Regexp(t, "start...$", "it's not starting") +// +// Returns whether the assertion was successful (true) or not (false). +func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool { + + match := matchRegexp(rx, str) + + if !match { + Fail(t, fmt.Sprintf("Expect \"%v\" to match \"%v\"", str, rx), msgAndArgs...) + } + + return match +} + +// NotRegexp asserts that a specified regexp does not match a string. +// +// assert.NotRegexp(t, regexp.MustCompile("starts"), "it's starting") +// assert.NotRegexp(t, "^start", "it's not starting") +// +// Returns whether the assertion was successful (true) or not (false). +func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) bool { + match := matchRegexp(rx, str) + + if match { + Fail(t, fmt.Sprintf("Expect \"%v\" to NOT match \"%v\"", str, rx), msgAndArgs...) + } + + return !match + +} + +// Zero asserts that i is the zero value for its type and returns the truth. +func Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool { + if i != nil && !reflect.DeepEqual(i, reflect.Zero(reflect.TypeOf(i)).Interface()) { + return Fail(t, fmt.Sprintf("Should be zero, but was %v", i), msgAndArgs...) + } + return true +} + +// NotZero asserts that i is not the zero value for its type and returns the truth. +func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) bool { + if i == nil || reflect.DeepEqual(i, reflect.Zero(reflect.TypeOf(i)).Interface()) { + return Fail(t, fmt.Sprintf("Should not be zero, but was %v", i), msgAndArgs...) + } + return true +} + +// JSONEq asserts that two JSON strings are equivalent. +// +// assert.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) +// +// Returns whether the assertion was successful (true) or not (false). +func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) bool { + var expectedJSONAsInterface, actualJSONAsInterface interface{} + + if err := json.Unmarshal([]byte(expected), &expectedJSONAsInterface); err != nil { + return Fail(t, fmt.Sprintf("Expected value ('%s') is not valid json.\nJSON parsing error: '%s'", expected, err.Error()), msgAndArgs...) + } + + if err := json.Unmarshal([]byte(actual), &actualJSONAsInterface); err != nil { + return Fail(t, fmt.Sprintf("Input ('%s') needs to be valid json.\nJSON parsing error: '%s'", actual, err.Error()), msgAndArgs...) + } + + return Equal(t, expectedJSONAsInterface, actualJSONAsInterface, msgAndArgs...) +} + +func typeAndKind(v interface{}) (reflect.Type, reflect.Kind) { + t := reflect.TypeOf(v) + k := t.Kind() + + if k == reflect.Ptr { + t = t.Elem() + k = t.Kind() + } + return t, k +} + +// diff returns a diff of both values as long as both are of the same type and +// are a struct, map, slice or array. Otherwise it returns an empty string. +func diff(expected interface{}, actual interface{}) string { + if expected == nil || actual == nil { + return "" + } + + et, ek := typeAndKind(expected) + at, _ := typeAndKind(actual) + + if et != at { + return "" + } + + if ek != reflect.Struct && ek != reflect.Map && ek != reflect.Slice && ek != reflect.Array { + return "" + } + + e := spew.Sdump(expected) + a := spew.Sdump(actual) + + diff, _ := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{ + A: difflib.SplitLines(e), + B: difflib.SplitLines(a), + FromFile: "Expected", + FromDate: "", + ToFile: "Actual", + ToDate: "", + Context: 1, + }) + + return "\n\nDiff:\n" + diff +} diff --git a/vendor/github.com/stretchr/testify/assert/assertions_test.go b/vendor/github.com/stretchr/testify/assert/assertions_test.go new file mode 100644 index 000000000..ac9b70172 --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/assertions_test.go @@ -0,0 +1,1210 @@ +package assert + +import ( + "errors" + "io" + "math" + "os" + "reflect" + "regexp" + "testing" + "time" +) + +var ( + i interface{} + zeros = []interface{}{ + false, + byte(0), + complex64(0), + complex128(0), + float32(0), + float64(0), + int(0), + int8(0), + int16(0), + int32(0), + int64(0), + rune(0), + uint(0), + uint8(0), + uint16(0), + uint32(0), + uint64(0), + uintptr(0), + "", + [0]interface{}{}, + []interface{}(nil), + struct{ x int }{}, + (*interface{})(nil), + (func())(nil), + nil, + interface{}(nil), + map[interface{}]interface{}(nil), + (chan interface{})(nil), + (<-chan interface{})(nil), + (chan<- interface{})(nil), + } + nonZeros = []interface{}{ + true, + byte(1), + complex64(1), + complex128(1), + float32(1), + float64(1), + int(1), + int8(1), + int16(1), + int32(1), + int64(1), + rune(1), + uint(1), + uint8(1), + uint16(1), + uint32(1), + uint64(1), + uintptr(1), + "s", + [1]interface{}{1}, + []interface{}{}, + struct{ x int }{1}, + (*interface{})(&i), + (func())(func() {}), + interface{}(1), + map[interface{}]interface{}{}, + (chan interface{})(make(chan interface{})), + (<-chan interface{})(make(chan interface{})), + (chan<- interface{})(make(chan interface{})), + } +) + +// AssertionTesterInterface defines an interface to be used for testing assertion methods +type AssertionTesterInterface interface { + TestMethod() +} + +// AssertionTesterConformingObject is an object that conforms to the AssertionTesterInterface interface +type AssertionTesterConformingObject struct { +} + +func (a *AssertionTesterConformingObject) TestMethod() { +} + +// AssertionTesterNonConformingObject is an object that does not conform to the AssertionTesterInterface interface +type AssertionTesterNonConformingObject struct { +} + +func TestObjectsAreEqual(t *testing.T) { + + if !ObjectsAreEqual("Hello World", "Hello World") { + t.Error("objectsAreEqual should return true") + } + if !ObjectsAreEqual(123, 123) { + t.Error("objectsAreEqual should return true") + } + if !ObjectsAreEqual(123.5, 123.5) { + t.Error("objectsAreEqual should return true") + } + if !ObjectsAreEqual([]byte("Hello World"), []byte("Hello World")) { + t.Error("objectsAreEqual should return true") + } + if !ObjectsAreEqual(nil, nil) { + t.Error("objectsAreEqual should return true") + } + if ObjectsAreEqual(map[int]int{5: 10}, map[int]int{10: 20}) { + t.Error("objectsAreEqual should return false") + } + if ObjectsAreEqual('x', "x") { + t.Error("objectsAreEqual should return false") + } + if ObjectsAreEqual("x", 'x') { + t.Error("objectsAreEqual should return false") + } + if ObjectsAreEqual(0, 0.1) { + t.Error("objectsAreEqual should return false") + } + if ObjectsAreEqual(0.1, 0) { + t.Error("objectsAreEqual should return false") + } + if ObjectsAreEqual(uint32(10), int32(10)) { + t.Error("objectsAreEqual should return false") + } + if !ObjectsAreEqualValues(uint32(10), int32(10)) { + t.Error("ObjectsAreEqualValues should return true") + } + if ObjectsAreEqualValues(0, nil) { + t.Fail() + } + if ObjectsAreEqualValues(nil, 0) { + t.Fail() + } + +} + +func TestImplements(t *testing.T) { + + mockT := new(testing.T) + + if !Implements(mockT, (*AssertionTesterInterface)(nil), new(AssertionTesterConformingObject)) { + t.Error("Implements method should return true: AssertionTesterConformingObject implements AssertionTesterInterface") + } + if Implements(mockT, (*AssertionTesterInterface)(nil), new(AssertionTesterNonConformingObject)) { + t.Error("Implements method should return false: AssertionTesterNonConformingObject does not implements AssertionTesterInterface") + } + +} + +func TestIsType(t *testing.T) { + + mockT := new(testing.T) + + if !IsType(mockT, new(AssertionTesterConformingObject), new(AssertionTesterConformingObject)) { + t.Error("IsType should return true: AssertionTesterConformingObject is the same type as AssertionTesterConformingObject") + } + if IsType(mockT, new(AssertionTesterConformingObject), new(AssertionTesterNonConformingObject)) { + t.Error("IsType should return false: AssertionTesterConformingObject is not the same type as AssertionTesterNonConformingObject") + } + +} + +func TestEqual(t *testing.T) { + + mockT := new(testing.T) + + if !Equal(mockT, "Hello World", "Hello World") { + t.Error("Equal should return true") + } + if !Equal(mockT, 123, 123) { + t.Error("Equal should return true") + } + if !Equal(mockT, 123.5, 123.5) { + t.Error("Equal should return true") + } + if !Equal(mockT, []byte("Hello World"), []byte("Hello World")) { + t.Error("Equal should return true") + } + if !Equal(mockT, nil, nil) { + t.Error("Equal should return true") + } + if !Equal(mockT, int32(123), int32(123)) { + t.Error("Equal should return true") + } + if !Equal(mockT, uint64(123), uint64(123)) { + t.Error("Equal should return true") + } + +} + +func TestFormatUnequalValues(t *testing.T) { + expected, actual := formatUnequalValues("foo", "bar") + Equal(t, `"foo"`, expected, "value should not include type") + Equal(t, `"bar"`, actual, "value should not include type") + + expected, actual = formatUnequalValues(123, 123) + Equal(t, `123`, expected, "value should not include type") + Equal(t, `123`, actual, "value should not include type") + + expected, actual = formatUnequalValues(int64(123), int32(123)) + Equal(t, `int64(123)`, expected, "value should include type") + Equal(t, `int32(123)`, actual, "value should include type") + + type testStructType struct { + Val string + } + + expected, actual = formatUnequalValues(&testStructType{Val: "test"}, &testStructType{Val: "test"}) + Equal(t, `&assert.testStructType{Val:"test"}`, expected, "value should not include type annotation") + Equal(t, `&assert.testStructType{Val:"test"}`, actual, "value should not include type annotation") +} + +func TestNotNil(t *testing.T) { + + mockT := new(testing.T) + + if !NotNil(mockT, new(AssertionTesterConformingObject)) { + t.Error("NotNil should return true: object is not nil") + } + if NotNil(mockT, nil) { + t.Error("NotNil should return false: object is nil") + } + if NotNil(mockT, (*struct{})(nil)) { + t.Error("NotNil should return false: object is (*struct{})(nil)") + } + +} + +func TestNil(t *testing.T) { + + mockT := new(testing.T) + + if !Nil(mockT, nil) { + t.Error("Nil should return true: object is nil") + } + if !Nil(mockT, (*struct{})(nil)) { + t.Error("Nil should return true: object is (*struct{})(nil)") + } + if Nil(mockT, new(AssertionTesterConformingObject)) { + t.Error("Nil should return false: object is not nil") + } + +} + +func TestTrue(t *testing.T) { + + mockT := new(testing.T) + + if !True(mockT, true) { + t.Error("True should return true") + } + if True(mockT, false) { + t.Error("True should return false") + } + +} + +func TestFalse(t *testing.T) { + + mockT := new(testing.T) + + if !False(mockT, false) { + t.Error("False should return true") + } + if False(mockT, true) { + t.Error("False should return false") + } + +} + +func TestExactly(t *testing.T) { + + mockT := new(testing.T) + + a := float32(1) + b := float64(1) + c := float32(1) + d := float32(2) + + if Exactly(mockT, a, b) { + t.Error("Exactly should return false") + } + if Exactly(mockT, a, d) { + t.Error("Exactly should return false") + } + if !Exactly(mockT, a, c) { + t.Error("Exactly should return true") + } + + if Exactly(mockT, nil, a) { + t.Error("Exactly should return false") + } + if Exactly(mockT, a, nil) { + t.Error("Exactly should return false") + } + +} + +func TestNotEqual(t *testing.T) { + + mockT := new(testing.T) + + if !NotEqual(mockT, "Hello World", "Hello World!") { + t.Error("NotEqual should return true") + } + if !NotEqual(mockT, 123, 1234) { + t.Error("NotEqual should return true") + } + if !NotEqual(mockT, 123.5, 123.55) { + t.Error("NotEqual should return true") + } + if !NotEqual(mockT, []byte("Hello World"), []byte("Hello World!")) { + t.Error("NotEqual should return true") + } + if !NotEqual(mockT, nil, new(AssertionTesterConformingObject)) { + t.Error("NotEqual should return true") + } + funcA := func() int { return 23 } + funcB := func() int { return 42 } + if !NotEqual(mockT, funcA, funcB) { + t.Error("NotEqual should return true") + } + + if NotEqual(mockT, "Hello World", "Hello World") { + t.Error("NotEqual should return false") + } + if NotEqual(mockT, 123, 123) { + t.Error("NotEqual should return false") + } + if NotEqual(mockT, 123.5, 123.5) { + t.Error("NotEqual should return false") + } + if NotEqual(mockT, []byte("Hello World"), []byte("Hello World")) { + t.Error("NotEqual should return false") + } + if NotEqual(mockT, new(AssertionTesterConformingObject), new(AssertionTesterConformingObject)) { + t.Error("NotEqual should return false") + } +} + +type A struct { + Name, Value string +} + +func TestContains(t *testing.T) { + + mockT := new(testing.T) + list := []string{"Foo", "Bar"} + complexList := []*A{ + {"b", "c"}, + {"d", "e"}, + {"g", "h"}, + {"j", "k"}, + } + simpleMap := map[interface{}]interface{}{"Foo": "Bar"} + + if !Contains(mockT, "Hello World", "Hello") { + t.Error("Contains should return true: \"Hello World\" contains \"Hello\"") + } + if Contains(mockT, "Hello World", "Salut") { + t.Error("Contains should return false: \"Hello World\" does not contain \"Salut\"") + } + + if !Contains(mockT, list, "Bar") { + t.Error("Contains should return true: \"[\"Foo\", \"Bar\"]\" contains \"Bar\"") + } + if Contains(mockT, list, "Salut") { + t.Error("Contains should return false: \"[\"Foo\", \"Bar\"]\" does not contain \"Salut\"") + } + if !Contains(mockT, complexList, &A{"g", "h"}) { + t.Error("Contains should return true: complexList contains {\"g\", \"h\"}") + } + if Contains(mockT, complexList, &A{"g", "e"}) { + t.Error("Contains should return false: complexList contains {\"g\", \"e\"}") + } + if Contains(mockT, complexList, &A{"g", "e"}) { + t.Error("Contains should return false: complexList contains {\"g\", \"e\"}") + } + if !Contains(mockT, simpleMap, "Foo") { + t.Error("Contains should return true: \"{\"Foo\": \"Bar\"}\" contains \"Foo\"") + } + if Contains(mockT, simpleMap, "Bar") { + t.Error("Contains should return false: \"{\"Foo\": \"Bar\"}\" does not contains \"Bar\"") + } +} + +func TestNotContains(t *testing.T) { + + mockT := new(testing.T) + list := []string{"Foo", "Bar"} + simpleMap := map[interface{}]interface{}{"Foo": "Bar"} + + if !NotContains(mockT, "Hello World", "Hello!") { + t.Error("NotContains should return true: \"Hello World\" does not contain \"Hello!\"") + } + if NotContains(mockT, "Hello World", "Hello") { + t.Error("NotContains should return false: \"Hello World\" contains \"Hello\"") + } + + if !NotContains(mockT, list, "Foo!") { + t.Error("NotContains should return true: \"[\"Foo\", \"Bar\"]\" does not contain \"Foo!\"") + } + if NotContains(mockT, list, "Foo") { + t.Error("NotContains should return false: \"[\"Foo\", \"Bar\"]\" contains \"Foo\"") + } + if NotContains(mockT, simpleMap, "Foo") { + t.Error("Contains should return true: \"{\"Foo\": \"Bar\"}\" contains \"Foo\"") + } + if !NotContains(mockT, simpleMap, "Bar") { + t.Error("Contains should return false: \"{\"Foo\": \"Bar\"}\" does not contains \"Bar\"") + } +} + +func Test_includeElement(t *testing.T) { + + list1 := []string{"Foo", "Bar"} + list2 := []int{1, 2} + simpleMap := map[interface{}]interface{}{"Foo": "Bar"} + + ok, found := includeElement("Hello World", "World") + True(t, ok) + True(t, found) + + ok, found = includeElement(list1, "Foo") + True(t, ok) + True(t, found) + + ok, found = includeElement(list1, "Bar") + True(t, ok) + True(t, found) + + ok, found = includeElement(list2, 1) + True(t, ok) + True(t, found) + + ok, found = includeElement(list2, 2) + True(t, ok) + True(t, found) + + ok, found = includeElement(list1, "Foo!") + True(t, ok) + False(t, found) + + ok, found = includeElement(list2, 3) + True(t, ok) + False(t, found) + + ok, found = includeElement(list2, "1") + True(t, ok) + False(t, found) + + ok, found = includeElement(simpleMap, "Foo") + True(t, ok) + True(t, found) + + ok, found = includeElement(simpleMap, "Bar") + True(t, ok) + False(t, found) + + ok, found = includeElement(1433, "1") + False(t, ok) + False(t, found) +} + +func TestCondition(t *testing.T) { + mockT := new(testing.T) + + if !Condition(mockT, func() bool { return true }, "Truth") { + t.Error("Condition should return true") + } + + if Condition(mockT, func() bool { return false }, "Lie") { + t.Error("Condition should return false") + } + +} + +func TestDidPanic(t *testing.T) { + + if funcDidPanic, _ := didPanic(func() { + panic("Panic!") + }); !funcDidPanic { + t.Error("didPanic should return true") + } + + if funcDidPanic, _ := didPanic(func() { + }); funcDidPanic { + t.Error("didPanic should return false") + } + +} + +func TestPanics(t *testing.T) { + + mockT := new(testing.T) + + if !Panics(mockT, func() { + panic("Panic!") + }) { + t.Error("Panics should return true") + } + + if Panics(mockT, func() { + }) { + t.Error("Panics should return false") + } + +} + +func TestNotPanics(t *testing.T) { + + mockT := new(testing.T) + + if !NotPanics(mockT, func() { + }) { + t.Error("NotPanics should return true") + } + + if NotPanics(mockT, func() { + panic("Panic!") + }) { + t.Error("NotPanics should return false") + } + +} + +func TestNoError(t *testing.T) { + + mockT := new(testing.T) + + // start with a nil error + var err error + + True(t, NoError(mockT, err), "NoError should return True for nil arg") + + // now set an error + err = errors.New("some error") + + False(t, NoError(mockT, err), "NoError with error should return False") + + // returning an empty error interface + err = func() error { + var err *customError + if err != nil { + t.Fatal("err should be nil here") + } + return err + }() + + if err == nil { // err is not nil here! + t.Errorf("Error should be nil due to empty interface", err) + } + + False(t, NoError(mockT, err), "NoError should fail with empty error interface") +} + +type customError struct{} + +func (*customError) Error() string { return "fail" } + +func TestError(t *testing.T) { + + mockT := new(testing.T) + + // start with a nil error + var err error + + False(t, Error(mockT, err), "Error should return False for nil arg") + + // now set an error + err = errors.New("some error") + + True(t, Error(mockT, err), "Error with error should return True") + + // returning an empty error interface + err = func() error { + var err *customError + if err != nil { + t.Fatal("err should be nil here") + } + return err + }() + + if err == nil { // err is not nil here! + t.Errorf("Error should be nil due to empty interface", err) + } + + True(t, Error(mockT, err), "Error should pass with empty error interface") +} + +func TestEqualError(t *testing.T) { + mockT := new(testing.T) + + // start with a nil error + var err error + False(t, EqualError(mockT, err, ""), + "EqualError should return false for nil arg") + + // now set an error + err = errors.New("some error") + False(t, EqualError(mockT, err, "Not some error"), + "EqualError should return false for different error string") + True(t, EqualError(mockT, err, "some error"), + "EqualError should return true") +} + +func Test_isEmpty(t *testing.T) { + + chWithValue := make(chan struct{}, 1) + chWithValue <- struct{}{} + + True(t, isEmpty("")) + True(t, isEmpty(nil)) + True(t, isEmpty([]string{})) + True(t, isEmpty(0)) + True(t, isEmpty(int32(0))) + True(t, isEmpty(int64(0))) + True(t, isEmpty(false)) + True(t, isEmpty(map[string]string{})) + True(t, isEmpty(new(time.Time))) + True(t, isEmpty(time.Time{})) + True(t, isEmpty(make(chan struct{}))) + False(t, isEmpty("something")) + False(t, isEmpty(errors.New("something"))) + False(t, isEmpty([]string{"something"})) + False(t, isEmpty(1)) + False(t, isEmpty(true)) + False(t, isEmpty(map[string]string{"Hello": "World"})) + False(t, isEmpty(chWithValue)) + +} + +func TestEmpty(t *testing.T) { + + mockT := new(testing.T) + chWithValue := make(chan struct{}, 1) + chWithValue <- struct{}{} + var tiP *time.Time + var tiNP time.Time + var s *string + var f *os.File + + True(t, Empty(mockT, ""), "Empty string is empty") + True(t, Empty(mockT, nil), "Nil is empty") + True(t, Empty(mockT, []string{}), "Empty string array is empty") + True(t, Empty(mockT, 0), "Zero int value is empty") + True(t, Empty(mockT, false), "False value is empty") + True(t, Empty(mockT, make(chan struct{})), "Channel without values is empty") + True(t, Empty(mockT, s), "Nil string pointer is empty") + True(t, Empty(mockT, f), "Nil os.File pointer is empty") + True(t, Empty(mockT, tiP), "Nil time.Time pointer is empty") + True(t, Empty(mockT, tiNP), "time.Time is empty") + + False(t, Empty(mockT, "something"), "Non Empty string is not empty") + False(t, Empty(mockT, errors.New("something")), "Non nil object is not empty") + False(t, Empty(mockT, []string{"something"}), "Non empty string array is not empty") + False(t, Empty(mockT, 1), "Non-zero int value is not empty") + False(t, Empty(mockT, true), "True value is not empty") + False(t, Empty(mockT, chWithValue), "Channel with values is not empty") +} + +func TestNotEmpty(t *testing.T) { + + mockT := new(testing.T) + chWithValue := make(chan struct{}, 1) + chWithValue <- struct{}{} + + False(t, NotEmpty(mockT, ""), "Empty string is empty") + False(t, NotEmpty(mockT, nil), "Nil is empty") + False(t, NotEmpty(mockT, []string{}), "Empty string array is empty") + False(t, NotEmpty(mockT, 0), "Zero int value is empty") + False(t, NotEmpty(mockT, false), "False value is empty") + False(t, NotEmpty(mockT, make(chan struct{})), "Channel without values is empty") + + True(t, NotEmpty(mockT, "something"), "Non Empty string is not empty") + True(t, NotEmpty(mockT, errors.New("something")), "Non nil object is not empty") + True(t, NotEmpty(mockT, []string{"something"}), "Non empty string array is not empty") + True(t, NotEmpty(mockT, 1), "Non-zero int value is not empty") + True(t, NotEmpty(mockT, true), "True value is not empty") + True(t, NotEmpty(mockT, chWithValue), "Channel with values is not empty") +} + +func Test_getLen(t *testing.T) { + falseCases := []interface{}{ + nil, + 0, + true, + false, + 'A', + struct{}{}, + } + for _, v := range falseCases { + ok, l := getLen(v) + False(t, ok, "Expected getLen fail to get length of %#v", v) + Equal(t, 0, l, "getLen should return 0 for %#v", v) + } + + ch := make(chan int, 5) + ch <- 1 + ch <- 2 + ch <- 3 + trueCases := []struct { + v interface{} + l int + }{ + {[]int{1, 2, 3}, 3}, + {[...]int{1, 2, 3}, 3}, + {"ABC", 3}, + {map[int]int{1: 2, 2: 4, 3: 6}, 3}, + {ch, 3}, + + {[]int{}, 0}, + {map[int]int{}, 0}, + {make(chan int), 0}, + + {[]int(nil), 0}, + {map[int]int(nil), 0}, + {(chan int)(nil), 0}, + } + + for _, c := range trueCases { + ok, l := getLen(c.v) + True(t, ok, "Expected getLen success to get length of %#v", c.v) + Equal(t, c.l, l) + } +} + +func TestLen(t *testing.T) { + mockT := new(testing.T) + + False(t, Len(mockT, nil, 0), "nil does not have length") + False(t, Len(mockT, 0, 0), "int does not have length") + False(t, Len(mockT, true, 0), "true does not have length") + False(t, Len(mockT, false, 0), "false does not have length") + False(t, Len(mockT, 'A', 0), "Rune does not have length") + False(t, Len(mockT, struct{}{}, 0), "Struct does not have length") + + ch := make(chan int, 5) + ch <- 1 + ch <- 2 + ch <- 3 + + cases := []struct { + v interface{} + l int + }{ + {[]int{1, 2, 3}, 3}, + {[...]int{1, 2, 3}, 3}, + {"ABC", 3}, + {map[int]int{1: 2, 2: 4, 3: 6}, 3}, + {ch, 3}, + + {[]int{}, 0}, + {map[int]int{}, 0}, + {make(chan int), 0}, + + {[]int(nil), 0}, + {map[int]int(nil), 0}, + {(chan int)(nil), 0}, + } + + for _, c := range cases { + True(t, Len(mockT, c.v, c.l), "%#v have %d items", c.v, c.l) + } + + cases = []struct { + v interface{} + l int + }{ + {[]int{1, 2, 3}, 4}, + {[...]int{1, 2, 3}, 2}, + {"ABC", 2}, + {map[int]int{1: 2, 2: 4, 3: 6}, 4}, + {ch, 2}, + + {[]int{}, 1}, + {map[int]int{}, 1}, + {make(chan int), 1}, + + {[]int(nil), 1}, + {map[int]int(nil), 1}, + {(chan int)(nil), 1}, + } + + for _, c := range cases { + False(t, Len(mockT, c.v, c.l), "%#v have %d items", c.v, c.l) + } +} + +func TestWithinDuration(t *testing.T) { + + mockT := new(testing.T) + a := time.Now() + b := a.Add(10 * time.Second) + + True(t, WithinDuration(mockT, a, b, 10*time.Second), "A 10s difference is within a 10s time difference") + True(t, WithinDuration(mockT, b, a, 10*time.Second), "A 10s difference is within a 10s time difference") + + False(t, WithinDuration(mockT, a, b, 9*time.Second), "A 10s difference is not within a 9s time difference") + False(t, WithinDuration(mockT, b, a, 9*time.Second), "A 10s difference is not within a 9s time difference") + + False(t, WithinDuration(mockT, a, b, -9*time.Second), "A 10s difference is not within a 9s time difference") + False(t, WithinDuration(mockT, b, a, -9*time.Second), "A 10s difference is not within a 9s time difference") + + False(t, WithinDuration(mockT, a, b, -11*time.Second), "A 10s difference is not within a 9s time difference") + False(t, WithinDuration(mockT, b, a, -11*time.Second), "A 10s difference is not within a 9s time difference") +} + +func TestInDelta(t *testing.T) { + mockT := new(testing.T) + + True(t, InDelta(mockT, 1.001, 1, 0.01), "|1.001 - 1| <= 0.01") + True(t, InDelta(mockT, 1, 1.001, 0.01), "|1 - 1.001| <= 0.01") + True(t, InDelta(mockT, 1, 2, 1), "|1 - 2| <= 1") + False(t, InDelta(mockT, 1, 2, 0.5), "Expected |1 - 2| <= 0.5 to fail") + False(t, InDelta(mockT, 2, 1, 0.5), "Expected |2 - 1| <= 0.5 to fail") + False(t, InDelta(mockT, "", nil, 1), "Expected non numerals to fail") + False(t, InDelta(mockT, 42, math.NaN(), 0.01), "Expected NaN for actual to fail") + False(t, InDelta(mockT, math.NaN(), 42, 0.01), "Expected NaN for expected to fail") + + cases := []struct { + a, b interface{} + delta float64 + }{ + {uint8(2), uint8(1), 1}, + {uint16(2), uint16(1), 1}, + {uint32(2), uint32(1), 1}, + {uint64(2), uint64(1), 1}, + + {int(2), int(1), 1}, + {int8(2), int8(1), 1}, + {int16(2), int16(1), 1}, + {int32(2), int32(1), 1}, + {int64(2), int64(1), 1}, + + {float32(2), float32(1), 1}, + {float64(2), float64(1), 1}, + } + + for _, tc := range cases { + True(t, InDelta(mockT, tc.a, tc.b, tc.delta), "Expected |%V - %V| <= %v", tc.a, tc.b, tc.delta) + } +} + +func TestInDeltaSlice(t *testing.T) { + mockT := new(testing.T) + + True(t, InDeltaSlice(mockT, + []float64{1.001, 0.999}, + []float64{1, 1}, + 0.1), "{1.001, 0.009} is element-wise close to {1, 1} in delta=0.1") + + True(t, InDeltaSlice(mockT, + []float64{1, 2}, + []float64{0, 3}, + 1), "{1, 2} is element-wise close to {0, 3} in delta=1") + + False(t, InDeltaSlice(mockT, + []float64{1, 2}, + []float64{0, 3}, + 0.1), "{1, 2} is not element-wise close to {0, 3} in delta=0.1") + + False(t, InDeltaSlice(mockT, "", nil, 1), "Expected non numeral slices to fail") +} + +func TestInEpsilon(t *testing.T) { + mockT := new(testing.T) + + cases := []struct { + a, b interface{} + epsilon float64 + }{ + {uint8(2), uint16(2), .001}, + {2.1, 2.2, 0.1}, + {2.2, 2.1, 0.1}, + {-2.1, -2.2, 0.1}, + {-2.2, -2.1, 0.1}, + {uint64(100), uint8(101), 0.01}, + {0.1, -0.1, 2}, + {0.1, 0, 2}, + } + + for _, tc := range cases { + True(t, InEpsilon(t, tc.a, tc.b, tc.epsilon, "Expected %V and %V to have a relative difference of %v", tc.a, tc.b, tc.epsilon), "test: %q", tc) + } + + cases = []struct { + a, b interface{} + epsilon float64 + }{ + {uint8(2), int16(-2), .001}, + {uint64(100), uint8(102), 0.01}, + {2.1, 2.2, 0.001}, + {2.2, 2.1, 0.001}, + {2.1, -2.2, 1}, + {2.1, "bla-bla", 0}, + {0.1, -0.1, 1.99}, + {0, 0.1, 2}, // expected must be different to zero + } + + for _, tc := range cases { + False(t, InEpsilon(mockT, tc.a, tc.b, tc.epsilon, "Expected %V and %V to have a relative difference of %v", tc.a, tc.b, tc.epsilon)) + } + +} + +func TestInEpsilonSlice(t *testing.T) { + mockT := new(testing.T) + + True(t, InEpsilonSlice(mockT, + []float64{2.2, 2.0}, + []float64{2.1, 2.1}, + 0.06), "{2.2, 2.0} is element-wise close to {2.1, 2.1} in espilon=0.06") + + False(t, InEpsilonSlice(mockT, + []float64{2.2, 2.0}, + []float64{2.1, 2.1}, + 0.04), "{2.2, 2.0} is not element-wise close to {2.1, 2.1} in espilon=0.04") + + False(t, InEpsilonSlice(mockT, "", nil, 1), "Expected non numeral slices to fail") +} + +func TestRegexp(t *testing.T) { + mockT := new(testing.T) + + cases := []struct { + rx, str string + }{ + {"^start", "start of the line"}, + {"end$", "in the end"}, + {"[0-9]{3}[.-]?[0-9]{2}[.-]?[0-9]{2}", "My phone number is 650.12.34"}, + } + + for _, tc := range cases { + True(t, Regexp(mockT, tc.rx, tc.str)) + True(t, Regexp(mockT, regexp.MustCompile(tc.rx), tc.str)) + False(t, NotRegexp(mockT, tc.rx, tc.str)) + False(t, NotRegexp(mockT, regexp.MustCompile(tc.rx), tc.str)) + } + + cases = []struct { + rx, str string + }{ + {"^asdfastart", "Not the start of the line"}, + {"end$", "in the end."}, + {"[0-9]{3}[.-]?[0-9]{2}[.-]?[0-9]{2}", "My phone number is 650.12a.34"}, + } + + for _, tc := range cases { + False(t, Regexp(mockT, tc.rx, tc.str), "Expected \"%s\" to not match \"%s\"", tc.rx, tc.str) + False(t, Regexp(mockT, regexp.MustCompile(tc.rx), tc.str)) + True(t, NotRegexp(mockT, tc.rx, tc.str)) + True(t, NotRegexp(mockT, regexp.MustCompile(tc.rx), tc.str)) + } +} + +func testAutogeneratedFunction() { + defer func() { + if err := recover(); err == nil { + panic("did not panic") + } + CallerInfo() + }() + t := struct { + io.Closer + }{} + var c io.Closer + c = t + c.Close() +} + +func TestCallerInfoWithAutogeneratedFunctions(t *testing.T) { + NotPanics(t, func() { + testAutogeneratedFunction() + }) +} + +func TestZero(t *testing.T) { + mockT := new(testing.T) + + for _, test := range zeros { + True(t, Zero(mockT, test, "%#v is not the %v zero value", test, reflect.TypeOf(test))) + } + + for _, test := range nonZeros { + False(t, Zero(mockT, test, "%#v is not the %v zero value", test, reflect.TypeOf(test))) + } +} + +func TestNotZero(t *testing.T) { + mockT := new(testing.T) + + for _, test := range zeros { + False(t, NotZero(mockT, test, "%#v is not the %v zero value", test, reflect.TypeOf(test))) + } + + for _, test := range nonZeros { + True(t, NotZero(mockT, test, "%#v is not the %v zero value", test, reflect.TypeOf(test))) + } +} + +func TestJSONEq_EqualSONString(t *testing.T) { + mockT := new(testing.T) + True(t, JSONEq(mockT, `{"hello": "world", "foo": "bar"}`, `{"hello": "world", "foo": "bar"}`)) +} + +func TestJSONEq_EquivalentButNotEqual(t *testing.T) { + mockT := new(testing.T) + True(t, JSONEq(mockT, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)) +} + +func TestJSONEq_HashOfArraysAndHashes(t *testing.T) { + mockT := new(testing.T) + True(t, JSONEq(mockT, "{\r\n\t\"numeric\": 1.5,\r\n\t\"array\": [{\"foo\": \"bar\"}, 1, \"string\", [\"nested\", \"array\", 5.5]],\r\n\t\"hash\": {\"nested\": \"hash\", \"nested_slice\": [\"this\", \"is\", \"nested\"]},\r\n\t\"string\": \"foo\"\r\n}", + "{\r\n\t\"numeric\": 1.5,\r\n\t\"hash\": {\"nested\": \"hash\", \"nested_slice\": [\"this\", \"is\", \"nested\"]},\r\n\t\"string\": \"foo\",\r\n\t\"array\": [{\"foo\": \"bar\"}, 1, \"string\", [\"nested\", \"array\", 5.5]]\r\n}")) +} + +func TestJSONEq_Array(t *testing.T) { + mockT := new(testing.T) + True(t, JSONEq(mockT, `["foo", {"hello": "world", "nested": "hash"}]`, `["foo", {"nested": "hash", "hello": "world"}]`)) +} + +func TestJSONEq_HashAndArrayNotEquivalent(t *testing.T) { + mockT := new(testing.T) + False(t, JSONEq(mockT, `["foo", {"hello": "world", "nested": "hash"}]`, `{"foo": "bar", {"nested": "hash", "hello": "world"}}`)) +} + +func TestJSONEq_HashesNotEquivalent(t *testing.T) { + mockT := new(testing.T) + False(t, JSONEq(mockT, `{"foo": "bar"}`, `{"foo": "bar", "hello": "world"}`)) +} + +func TestJSONEq_ActualIsNotJSON(t *testing.T) { + mockT := new(testing.T) + False(t, JSONEq(mockT, `{"foo": "bar"}`, "Not JSON")) +} + +func TestJSONEq_ExpectedIsNotJSON(t *testing.T) { + mockT := new(testing.T) + False(t, JSONEq(mockT, "Not JSON", `{"foo": "bar", "hello": "world"}`)) +} + +func TestJSONEq_ExpectedAndActualNotJSON(t *testing.T) { + mockT := new(testing.T) + False(t, JSONEq(mockT, "Not JSON", "Not JSON")) +} + +func TestJSONEq_ArraysOfDifferentOrder(t *testing.T) { + mockT := new(testing.T) + False(t, JSONEq(mockT, `["foo", {"hello": "world", "nested": "hash"}]`, `[{ "hello": "world", "nested": "hash"}, "foo"]`)) +} + +func TestDiff(t *testing.T) { + expected := ` + +Diff: +--- Expected ++++ Actual +@@ -1,3 +1,3 @@ + (struct { foo string }) { +- foo: (string) (len=5) "hello" ++ foo: (string) (len=3) "bar" + } +` + actual := diff( + struct{ foo string }{"hello"}, + struct{ foo string }{"bar"}, + ) + Equal(t, expected, actual) + + expected = ` + +Diff: +--- Expected ++++ Actual +@@ -2,5 +2,5 @@ + (int) 1, +- (int) 2, + (int) 3, +- (int) 4 ++ (int) 5, ++ (int) 7 + } +` + actual = diff( + []int{1, 2, 3, 4}, + []int{1, 3, 5, 7}, + ) + Equal(t, expected, actual) + + expected = ` + +Diff: +--- Expected ++++ Actual +@@ -2,4 +2,4 @@ + (int) 1, +- (int) 2, +- (int) 3 ++ (int) 3, ++ (int) 5 + } +` + actual = diff( + []int{1, 2, 3, 4}[0:3], + []int{1, 3, 5, 7}[0:3], + ) + Equal(t, expected, actual) + + expected = ` + +Diff: +--- Expected ++++ Actual +@@ -1,6 +1,6 @@ + (map[string]int) (len=4) { +- (string) (len=4) "four": (int) 4, ++ (string) (len=4) "five": (int) 5, + (string) (len=3) "one": (int) 1, +- (string) (len=5) "three": (int) 3, +- (string) (len=3) "two": (int) 2 ++ (string) (len=5) "seven": (int) 7, ++ (string) (len=5) "three": (int) 3 + } +` + + actual = diff( + map[string]int{"one": 1, "two": 2, "three": 3, "four": 4}, + map[string]int{"one": 1, "three": 3, "five": 5, "seven": 7}, + ) + Equal(t, expected, actual) +} + +func TestDiffEmptyCases(t *testing.T) { + Equal(t, "", diff(nil, nil)) + Equal(t, "", diff(struct{ foo string }{}, nil)) + Equal(t, "", diff(nil, struct{ foo string }{})) + Equal(t, "", diff(1, 2)) + Equal(t, "", diff(1, 2)) + Equal(t, "", diff([]int{1}, []bool{true})) +} + +// Ensure there are no data races +func TestDiffRace(t *testing.T) { + t.Parallel() + + expected := map[string]string{ + "a": "A", + "b": "B", + "c": "C", + } + + actual := map[string]string{ + "d": "D", + "e": "E", + "f": "F", + } + + // run diffs in parallel simulating tests with t.Parallel() + numRoutines := 10 + rChans := make([]chan string, numRoutines) + for idx := range rChans { + rChans[idx] = make(chan string) + go func(ch chan string) { + defer close(ch) + ch <- diff(expected, actual) + }(rChans[idx]) + } + + for _, ch := range rChans { + for msg := range ch { + NotZero(t, msg) // dummy assert + } + } +} + +type mockTestingT struct { +} + +func (m *mockTestingT) Errorf(format string, args ...interface{}) {} + +func TestFailNowWithPlainTestingT(t *testing.T) { + mockT := &mockTestingT{} + + Panics(t, func() { + FailNow(mockT, "failed") + }, "should panic since mockT is missing FailNow()") +} + +type mockFailNowTestingT struct { +} + +func (m *mockFailNowTestingT) Errorf(format string, args ...interface{}) {} + +func (m *mockFailNowTestingT) FailNow() {} + +func TestFailNowWithFullTestingT(t *testing.T) { + mockT := &mockFailNowTestingT{} + + NotPanics(t, func() { + FailNow(mockT, "failed") + }, "should call mockT.FailNow() rather than panicking") +} diff --git a/vendor/github.com/stretchr/testify/assert/doc.go b/vendor/github.com/stretchr/testify/assert/doc.go new file mode 100644 index 000000000..c9dccc4d6 --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/doc.go @@ -0,0 +1,45 @@ +// Package assert provides a set of comprehensive testing tools for use with the normal Go testing system. +// +// Example Usage +// +// The following is a complete example using assert in a standard test function: +// import ( +// "testing" +// "github.com/stretchr/testify/assert" +// ) +// +// func TestSomething(t *testing.T) { +// +// var a string = "Hello" +// var b string = "Hello" +// +// assert.Equal(t, a, b, "The two words should be the same.") +// +// } +// +// if you assert many times, use the format below: +// +// import ( +// "testing" +// "github.com/stretchr/testify/assert" +// ) +// +// func TestSomething(t *testing.T) { +// assert := assert.New(t) +// +// var a string = "Hello" +// var b string = "Hello" +// +// assert.Equal(a, b, "The two words should be the same.") +// } +// +// Assertions +// +// Assertions allow you to easily write test code, and are global funcs in the `assert` package. +// All assertion functions take, as the first argument, the `*testing.T` object provided by the +// testing framework. This allows the assertion funcs to write the failings and other details to +// the correct place. +// +// Every assertion function also takes an optional string message as the final argument, +// allowing custom error messages to be appended to the message the assertion method outputs. +package assert diff --git a/vendor/github.com/stretchr/testify/assert/errors.go b/vendor/github.com/stretchr/testify/assert/errors.go new file mode 100644 index 000000000..ac9dc9d1d --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/errors.go @@ -0,0 +1,10 @@ +package assert + +import ( + "errors" +) + +// AnError is an error instance useful for testing. If the code does not care +// about error specifics, and only needs to return the error for example, this +// error should be used to make the test code more readable. +var AnError = errors.New("assert.AnError general error for testing") diff --git a/vendor/github.com/stretchr/testify/assert/forward_assertions.go b/vendor/github.com/stretchr/testify/assert/forward_assertions.go new file mode 100644 index 000000000..b867e95ea --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/forward_assertions.go @@ -0,0 +1,16 @@ +package assert + +// Assertions provides assertion methods around the +// TestingT interface. +type Assertions struct { + t TestingT +} + +// New makes a new Assertions object for the specified TestingT. +func New(t TestingT) *Assertions { + return &Assertions{ + t: t, + } +} + +//go:generate go run ../_codegen/main.go -output-package=assert -template=assertion_forward.go.tmpl diff --git a/vendor/github.com/stretchr/testify/assert/forward_assertions_test.go b/vendor/github.com/stretchr/testify/assert/forward_assertions_test.go new file mode 100644 index 000000000..22e1df1d9 --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/forward_assertions_test.go @@ -0,0 +1,611 @@ +package assert + +import ( + "errors" + "regexp" + "testing" + "time" +) + +func TestImplementsWrapper(t *testing.T) { + assert := New(new(testing.T)) + + if !assert.Implements((*AssertionTesterInterface)(nil), new(AssertionTesterConformingObject)) { + t.Error("Implements method should return true: AssertionTesterConformingObject implements AssertionTesterInterface") + } + if assert.Implements((*AssertionTesterInterface)(nil), new(AssertionTesterNonConformingObject)) { + t.Error("Implements method should return false: AssertionTesterNonConformingObject does not implements AssertionTesterInterface") + } +} + +func TestIsTypeWrapper(t *testing.T) { + assert := New(new(testing.T)) + + if !assert.IsType(new(AssertionTesterConformingObject), new(AssertionTesterConformingObject)) { + t.Error("IsType should return true: AssertionTesterConformingObject is the same type as AssertionTesterConformingObject") + } + if assert.IsType(new(AssertionTesterConformingObject), new(AssertionTesterNonConformingObject)) { + t.Error("IsType should return false: AssertionTesterConformingObject is not the same type as AssertionTesterNonConformingObject") + } + +} + +func TestEqualWrapper(t *testing.T) { + assert := New(new(testing.T)) + + if !assert.Equal("Hello World", "Hello World") { + t.Error("Equal should return true") + } + if !assert.Equal(123, 123) { + t.Error("Equal should return true") + } + if !assert.Equal(123.5, 123.5) { + t.Error("Equal should return true") + } + if !assert.Equal([]byte("Hello World"), []byte("Hello World")) { + t.Error("Equal should return true") + } + if !assert.Equal(nil, nil) { + t.Error("Equal should return true") + } +} + +func TestEqualValuesWrapper(t *testing.T) { + assert := New(new(testing.T)) + + if !assert.EqualValues(uint32(10), int32(10)) { + t.Error("EqualValues should return true") + } +} + +func TestNotNilWrapper(t *testing.T) { + assert := New(new(testing.T)) + + if !assert.NotNil(new(AssertionTesterConformingObject)) { + t.Error("NotNil should return true: object is not nil") + } + if assert.NotNil(nil) { + t.Error("NotNil should return false: object is nil") + } + +} + +func TestNilWrapper(t *testing.T) { + assert := New(new(testing.T)) + + if !assert.Nil(nil) { + t.Error("Nil should return true: object is nil") + } + if assert.Nil(new(AssertionTesterConformingObject)) { + t.Error("Nil should return false: object is not nil") + } + +} + +func TestTrueWrapper(t *testing.T) { + assert := New(new(testing.T)) + + if !assert.True(true) { + t.Error("True should return true") + } + if assert.True(false) { + t.Error("True should return false") + } + +} + +func TestFalseWrapper(t *testing.T) { + assert := New(new(testing.T)) + + if !assert.False(false) { + t.Error("False should return true") + } + if assert.False(true) { + t.Error("False should return false") + } + +} + +func TestExactlyWrapper(t *testing.T) { + assert := New(new(testing.T)) + + a := float32(1) + b := float64(1) + c := float32(1) + d := float32(2) + + if assert.Exactly(a, b) { + t.Error("Exactly should return false") + } + if assert.Exactly(a, d) { + t.Error("Exactly should return false") + } + if !assert.Exactly(a, c) { + t.Error("Exactly should return true") + } + + if assert.Exactly(nil, a) { + t.Error("Exactly should return false") + } + if assert.Exactly(a, nil) { + t.Error("Exactly should return false") + } + +} + +func TestNotEqualWrapper(t *testing.T) { + + assert := New(new(testing.T)) + + if !assert.NotEqual("Hello World", "Hello World!") { + t.Error("NotEqual should return true") + } + if !assert.NotEqual(123, 1234) { + t.Error("NotEqual should return true") + } + if !assert.NotEqual(123.5, 123.55) { + t.Error("NotEqual should return true") + } + if !assert.NotEqual([]byte("Hello World"), []byte("Hello World!")) { + t.Error("NotEqual should return true") + } + if !assert.NotEqual(nil, new(AssertionTesterConformingObject)) { + t.Error("NotEqual should return true") + } +} + +func TestContainsWrapper(t *testing.T) { + + assert := New(new(testing.T)) + list := []string{"Foo", "Bar"} + + if !assert.Contains("Hello World", "Hello") { + t.Error("Contains should return true: \"Hello World\" contains \"Hello\"") + } + if assert.Contains("Hello World", "Salut") { + t.Error("Contains should return false: \"Hello World\" does not contain \"Salut\"") + } + + if !assert.Contains(list, "Foo") { + t.Error("Contains should return true: \"[\"Foo\", \"Bar\"]\" contains \"Foo\"") + } + if assert.Contains(list, "Salut") { + t.Error("Contains should return false: \"[\"Foo\", \"Bar\"]\" does not contain \"Salut\"") + } + +} + +func TestNotContainsWrapper(t *testing.T) { + + assert := New(new(testing.T)) + list := []string{"Foo", "Bar"} + + if !assert.NotContains("Hello World", "Hello!") { + t.Error("NotContains should return true: \"Hello World\" does not contain \"Hello!\"") + } + if assert.NotContains("Hello World", "Hello") { + t.Error("NotContains should return false: \"Hello World\" contains \"Hello\"") + } + + if !assert.NotContains(list, "Foo!") { + t.Error("NotContains should return true: \"[\"Foo\", \"Bar\"]\" does not contain \"Foo!\"") + } + if assert.NotContains(list, "Foo") { + t.Error("NotContains should return false: \"[\"Foo\", \"Bar\"]\" contains \"Foo\"") + } + +} + +func TestConditionWrapper(t *testing.T) { + + assert := New(new(testing.T)) + + if !assert.Condition(func() bool { return true }, "Truth") { + t.Error("Condition should return true") + } + + if assert.Condition(func() bool { return false }, "Lie") { + t.Error("Condition should return false") + } + +} + +func TestDidPanicWrapper(t *testing.T) { + + if funcDidPanic, _ := didPanic(func() { + panic("Panic!") + }); !funcDidPanic { + t.Error("didPanic should return true") + } + + if funcDidPanic, _ := didPanic(func() { + }); funcDidPanic { + t.Error("didPanic should return false") + } + +} + +func TestPanicsWrapper(t *testing.T) { + + assert := New(new(testing.T)) + + if !assert.Panics(func() { + panic("Panic!") + }) { + t.Error("Panics should return true") + } + + if assert.Panics(func() { + }) { + t.Error("Panics should return false") + } + +} + +func TestNotPanicsWrapper(t *testing.T) { + + assert := New(new(testing.T)) + + if !assert.NotPanics(func() { + }) { + t.Error("NotPanics should return true") + } + + if assert.NotPanics(func() { + panic("Panic!") + }) { + t.Error("NotPanics should return false") + } + +} + +func TestNoErrorWrapper(t *testing.T) { + assert := New(t) + mockAssert := New(new(testing.T)) + + // start with a nil error + var err error + + assert.True(mockAssert.NoError(err), "NoError should return True for nil arg") + + // now set an error + err = errors.New("Some error") + + assert.False(mockAssert.NoError(err), "NoError with error should return False") + +} + +func TestErrorWrapper(t *testing.T) { + assert := New(t) + mockAssert := New(new(testing.T)) + + // start with a nil error + var err error + + assert.False(mockAssert.Error(err), "Error should return False for nil arg") + + // now set an error + err = errors.New("Some error") + + assert.True(mockAssert.Error(err), "Error with error should return True") + +} + +func TestEqualErrorWrapper(t *testing.T) { + assert := New(t) + mockAssert := New(new(testing.T)) + + // start with a nil error + var err error + assert.False(mockAssert.EqualError(err, ""), + "EqualError should return false for nil arg") + + // now set an error + err = errors.New("some error") + assert.False(mockAssert.EqualError(err, "Not some error"), + "EqualError should return false for different error string") + assert.True(mockAssert.EqualError(err, "some error"), + "EqualError should return true") +} + +func TestEmptyWrapper(t *testing.T) { + assert := New(t) + mockAssert := New(new(testing.T)) + + assert.True(mockAssert.Empty(""), "Empty string is empty") + assert.True(mockAssert.Empty(nil), "Nil is empty") + assert.True(mockAssert.Empty([]string{}), "Empty string array is empty") + assert.True(mockAssert.Empty(0), "Zero int value is empty") + assert.True(mockAssert.Empty(false), "False value is empty") + + assert.False(mockAssert.Empty("something"), "Non Empty string is not empty") + assert.False(mockAssert.Empty(errors.New("something")), "Non nil object is not empty") + assert.False(mockAssert.Empty([]string{"something"}), "Non empty string array is not empty") + assert.False(mockAssert.Empty(1), "Non-zero int value is not empty") + assert.False(mockAssert.Empty(true), "True value is not empty") + +} + +func TestNotEmptyWrapper(t *testing.T) { + assert := New(t) + mockAssert := New(new(testing.T)) + + assert.False(mockAssert.NotEmpty(""), "Empty string is empty") + assert.False(mockAssert.NotEmpty(nil), "Nil is empty") + assert.False(mockAssert.NotEmpty([]string{}), "Empty string array is empty") + assert.False(mockAssert.NotEmpty(0), "Zero int value is empty") + assert.False(mockAssert.NotEmpty(false), "False value is empty") + + assert.True(mockAssert.NotEmpty("something"), "Non Empty string is not empty") + assert.True(mockAssert.NotEmpty(errors.New("something")), "Non nil object is not empty") + assert.True(mockAssert.NotEmpty([]string{"something"}), "Non empty string array is not empty") + assert.True(mockAssert.NotEmpty(1), "Non-zero int value is not empty") + assert.True(mockAssert.NotEmpty(true), "True value is not empty") + +} + +func TestLenWrapper(t *testing.T) { + assert := New(t) + mockAssert := New(new(testing.T)) + + assert.False(mockAssert.Len(nil, 0), "nil does not have length") + assert.False(mockAssert.Len(0, 0), "int does not have length") + assert.False(mockAssert.Len(true, 0), "true does not have length") + assert.False(mockAssert.Len(false, 0), "false does not have length") + assert.False(mockAssert.Len('A', 0), "Rune does not have length") + assert.False(mockAssert.Len(struct{}{}, 0), "Struct does not have length") + + ch := make(chan int, 5) + ch <- 1 + ch <- 2 + ch <- 3 + + cases := []struct { + v interface{} + l int + }{ + {[]int{1, 2, 3}, 3}, + {[...]int{1, 2, 3}, 3}, + {"ABC", 3}, + {map[int]int{1: 2, 2: 4, 3: 6}, 3}, + {ch, 3}, + + {[]int{}, 0}, + {map[int]int{}, 0}, + {make(chan int), 0}, + + {[]int(nil), 0}, + {map[int]int(nil), 0}, + {(chan int)(nil), 0}, + } + + for _, c := range cases { + assert.True(mockAssert.Len(c.v, c.l), "%#v have %d items", c.v, c.l) + } +} + +func TestWithinDurationWrapper(t *testing.T) { + assert := New(t) + mockAssert := New(new(testing.T)) + a := time.Now() + b := a.Add(10 * time.Second) + + assert.True(mockAssert.WithinDuration(a, b, 10*time.Second), "A 10s difference is within a 10s time difference") + assert.True(mockAssert.WithinDuration(b, a, 10*time.Second), "A 10s difference is within a 10s time difference") + + assert.False(mockAssert.WithinDuration(a, b, 9*time.Second), "A 10s difference is not within a 9s time difference") + assert.False(mockAssert.WithinDuration(b, a, 9*time.Second), "A 10s difference is not within a 9s time difference") + + assert.False(mockAssert.WithinDuration(a, b, -9*time.Second), "A 10s difference is not within a 9s time difference") + assert.False(mockAssert.WithinDuration(b, a, -9*time.Second), "A 10s difference is not within a 9s time difference") + + assert.False(mockAssert.WithinDuration(a, b, -11*time.Second), "A 10s difference is not within a 9s time difference") + assert.False(mockAssert.WithinDuration(b, a, -11*time.Second), "A 10s difference is not within a 9s time difference") +} + +func TestInDeltaWrapper(t *testing.T) { + assert := New(new(testing.T)) + + True(t, assert.InDelta(1.001, 1, 0.01), "|1.001 - 1| <= 0.01") + True(t, assert.InDelta(1, 1.001, 0.01), "|1 - 1.001| <= 0.01") + True(t, assert.InDelta(1, 2, 1), "|1 - 2| <= 1") + False(t, assert.InDelta(1, 2, 0.5), "Expected |1 - 2| <= 0.5 to fail") + False(t, assert.InDelta(2, 1, 0.5), "Expected |2 - 1| <= 0.5 to fail") + False(t, assert.InDelta("", nil, 1), "Expected non numerals to fail") + + cases := []struct { + a, b interface{} + delta float64 + }{ + {uint8(2), uint8(1), 1}, + {uint16(2), uint16(1), 1}, + {uint32(2), uint32(1), 1}, + {uint64(2), uint64(1), 1}, + + {int(2), int(1), 1}, + {int8(2), int8(1), 1}, + {int16(2), int16(1), 1}, + {int32(2), int32(1), 1}, + {int64(2), int64(1), 1}, + + {float32(2), float32(1), 1}, + {float64(2), float64(1), 1}, + } + + for _, tc := range cases { + True(t, assert.InDelta(tc.a, tc.b, tc.delta), "Expected |%V - %V| <= %v", tc.a, tc.b, tc.delta) + } +} + +func TestInEpsilonWrapper(t *testing.T) { + assert := New(new(testing.T)) + + cases := []struct { + a, b interface{} + epsilon float64 + }{ + {uint8(2), uint16(2), .001}, + {2.1, 2.2, 0.1}, + {2.2, 2.1, 0.1}, + {-2.1, -2.2, 0.1}, + {-2.2, -2.1, 0.1}, + {uint64(100), uint8(101), 0.01}, + {0.1, -0.1, 2}, + } + + for _, tc := range cases { + True(t, assert.InEpsilon(tc.a, tc.b, tc.epsilon, "Expected %V and %V to have a relative difference of %v", tc.a, tc.b, tc.epsilon)) + } + + cases = []struct { + a, b interface{} + epsilon float64 + }{ + {uint8(2), int16(-2), .001}, + {uint64(100), uint8(102), 0.01}, + {2.1, 2.2, 0.001}, + {2.2, 2.1, 0.001}, + {2.1, -2.2, 1}, + {2.1, "bla-bla", 0}, + {0.1, -0.1, 1.99}, + } + + for _, tc := range cases { + False(t, assert.InEpsilon(tc.a, tc.b, tc.epsilon, "Expected %V and %V to have a relative difference of %v", tc.a, tc.b, tc.epsilon)) + } +} + +func TestRegexpWrapper(t *testing.T) { + + assert := New(new(testing.T)) + + cases := []struct { + rx, str string + }{ + {"^start", "start of the line"}, + {"end$", "in the end"}, + {"[0-9]{3}[.-]?[0-9]{2}[.-]?[0-9]{2}", "My phone number is 650.12.34"}, + } + + for _, tc := range cases { + True(t, assert.Regexp(tc.rx, tc.str)) + True(t, assert.Regexp(regexp.MustCompile(tc.rx), tc.str)) + False(t, assert.NotRegexp(tc.rx, tc.str)) + False(t, assert.NotRegexp(regexp.MustCompile(tc.rx), tc.str)) + } + + cases = []struct { + rx, str string + }{ + {"^asdfastart", "Not the start of the line"}, + {"end$", "in the end."}, + {"[0-9]{3}[.-]?[0-9]{2}[.-]?[0-9]{2}", "My phone number is 650.12a.34"}, + } + + for _, tc := range cases { + False(t, assert.Regexp(tc.rx, tc.str), "Expected \"%s\" to not match \"%s\"", tc.rx, tc.str) + False(t, assert.Regexp(regexp.MustCompile(tc.rx), tc.str)) + True(t, assert.NotRegexp(tc.rx, tc.str)) + True(t, assert.NotRegexp(regexp.MustCompile(tc.rx), tc.str)) + } +} + +func TestZeroWrapper(t *testing.T) { + assert := New(t) + mockAssert := New(new(testing.T)) + + for _, test := range zeros { + assert.True(mockAssert.Zero(test), "Zero should return true for %v", test) + } + + for _, test := range nonZeros { + assert.False(mockAssert.Zero(test), "Zero should return false for %v", test) + } +} + +func TestNotZeroWrapper(t *testing.T) { + assert := New(t) + mockAssert := New(new(testing.T)) + + for _, test := range zeros { + assert.False(mockAssert.NotZero(test), "Zero should return true for %v", test) + } + + for _, test := range nonZeros { + assert.True(mockAssert.NotZero(test), "Zero should return false for %v", test) + } +} + +func TestJSONEqWrapper_EqualSONString(t *testing.T) { + assert := New(new(testing.T)) + if !assert.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"hello": "world", "foo": "bar"}`) { + t.Error("JSONEq should return true") + } + +} + +func TestJSONEqWrapper_EquivalentButNotEqual(t *testing.T) { + assert := New(new(testing.T)) + if !assert.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) { + t.Error("JSONEq should return true") + } + +} + +func TestJSONEqWrapper_HashOfArraysAndHashes(t *testing.T) { + assert := New(new(testing.T)) + if !assert.JSONEq("{\r\n\t\"numeric\": 1.5,\r\n\t\"array\": [{\"foo\": \"bar\"}, 1, \"string\", [\"nested\", \"array\", 5.5]],\r\n\t\"hash\": {\"nested\": \"hash\", \"nested_slice\": [\"this\", \"is\", \"nested\"]},\r\n\t\"string\": \"foo\"\r\n}", + "{\r\n\t\"numeric\": 1.5,\r\n\t\"hash\": {\"nested\": \"hash\", \"nested_slice\": [\"this\", \"is\", \"nested\"]},\r\n\t\"string\": \"foo\",\r\n\t\"array\": [{\"foo\": \"bar\"}, 1, \"string\", [\"nested\", \"array\", 5.5]]\r\n}") { + t.Error("JSONEq should return true") + } +} + +func TestJSONEqWrapper_Array(t *testing.T) { + assert := New(new(testing.T)) + if !assert.JSONEq(`["foo", {"hello": "world", "nested": "hash"}]`, `["foo", {"nested": "hash", "hello": "world"}]`) { + t.Error("JSONEq should return true") + } + +} + +func TestJSONEqWrapper_HashAndArrayNotEquivalent(t *testing.T) { + assert := New(new(testing.T)) + if assert.JSONEq(`["foo", {"hello": "world", "nested": "hash"}]`, `{"foo": "bar", {"nested": "hash", "hello": "world"}}`) { + t.Error("JSONEq should return false") + } +} + +func TestJSONEqWrapper_HashesNotEquivalent(t *testing.T) { + assert := New(new(testing.T)) + if assert.JSONEq(`{"foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) { + t.Error("JSONEq should return false") + } +} + +func TestJSONEqWrapper_ActualIsNotJSON(t *testing.T) { + assert := New(new(testing.T)) + if assert.JSONEq(`{"foo": "bar"}`, "Not JSON") { + t.Error("JSONEq should return false") + } +} + +func TestJSONEqWrapper_ExpectedIsNotJSON(t *testing.T) { + assert := New(new(testing.T)) + if assert.JSONEq("Not JSON", `{"foo": "bar", "hello": "world"}`) { + t.Error("JSONEq should return false") + } +} + +func TestJSONEqWrapper_ExpectedAndActualNotJSON(t *testing.T) { + assert := New(new(testing.T)) + if assert.JSONEq("Not JSON", "Not JSON") { + t.Error("JSONEq should return false") + } +} + +func TestJSONEqWrapper_ArraysOfDifferentOrder(t *testing.T) { + assert := New(new(testing.T)) + if assert.JSONEq(`["foo", {"hello": "world", "nested": "hash"}]`, `[{ "hello": "world", "nested": "hash"}, "foo"]`) { + t.Error("JSONEq should return false") + } +} diff --git a/vendor/github.com/stretchr/testify/assert/http_assertions.go b/vendor/github.com/stretchr/testify/assert/http_assertions.go new file mode 100644 index 000000000..fa7ab89b1 --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/http_assertions.go @@ -0,0 +1,106 @@ +package assert + +import ( + "fmt" + "net/http" + "net/http/httptest" + "net/url" + "strings" +) + +// httpCode is a helper that returns HTTP code of the response. It returns -1 +// if building a new request fails. +func httpCode(handler http.HandlerFunc, method, url string, values url.Values) int { + w := httptest.NewRecorder() + req, err := http.NewRequest(method, url+"?"+values.Encode(), nil) + if err != nil { + return -1 + } + handler(w, req) + return w.Code +} + +// HTTPSuccess asserts that a specified handler returns a success status code. +// +// assert.HTTPSuccess(t, myHandler, "POST", "http://www.google.com", nil) +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPSuccess(t TestingT, handler http.HandlerFunc, method, url string, values url.Values) bool { + code := httpCode(handler, method, url, values) + if code == -1 { + return false + } + return code >= http.StatusOK && code <= http.StatusPartialContent +} + +// HTTPRedirect asserts that a specified handler returns a redirect status code. +// +// assert.HTTPRedirect(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPRedirect(t TestingT, handler http.HandlerFunc, method, url string, values url.Values) bool { + code := httpCode(handler, method, url, values) + if code == -1 { + return false + } + return code >= http.StatusMultipleChoices && code <= http.StatusTemporaryRedirect +} + +// HTTPError asserts that a specified handler returns an error status code. +// +// assert.HTTPError(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPError(t TestingT, handler http.HandlerFunc, method, url string, values url.Values) bool { + code := httpCode(handler, method, url, values) + if code == -1 { + return false + } + return code >= http.StatusBadRequest +} + +// HTTPBody is a helper that returns HTTP body of the response. It returns +// empty string if building a new request fails. +func HTTPBody(handler http.HandlerFunc, method, url string, values url.Values) string { + w := httptest.NewRecorder() + req, err := http.NewRequest(method, url+"?"+values.Encode(), nil) + if err != nil { + return "" + } + handler(w, req) + return w.Body.String() +} + +// HTTPBodyContains asserts that a specified handler returns a +// body that contains a string. +// +// assert.HTTPBodyContains(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky") +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}) bool { + body := HTTPBody(handler, method, url, values) + + contains := strings.Contains(body, fmt.Sprint(str)) + if !contains { + Fail(t, fmt.Sprintf("Expected response body for \"%s\" to contain \"%s\" but found \"%s\"", url+"?"+values.Encode(), str, body)) + } + + return contains +} + +// HTTPBodyNotContains asserts that a specified handler returns a +// body that does not contain a string. +// +// assert.HTTPBodyNotContains(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky") +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method, url string, values url.Values, str interface{}) bool { + body := HTTPBody(handler, method, url, values) + + contains := strings.Contains(body, fmt.Sprint(str)) + if contains { + Fail(t, fmt.Sprintf("Expected response body for \"%s\" to NOT contain \"%s\" but found \"%s\"", url+"?"+values.Encode(), str, body)) + } + + return !contains +} diff --git a/vendor/github.com/stretchr/testify/assert/http_assertions_test.go b/vendor/github.com/stretchr/testify/assert/http_assertions_test.go new file mode 100644 index 000000000..684c2d5d1 --- /dev/null +++ b/vendor/github.com/stretchr/testify/assert/http_assertions_test.go @@ -0,0 +1,86 @@ +package assert + +import ( + "fmt" + "net/http" + "net/url" + "testing" +) + +func httpOK(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusOK) +} + +func httpRedirect(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusTemporaryRedirect) +} + +func httpError(w http.ResponseWriter, r *http.Request) { + w.WriteHeader(http.StatusInternalServerError) +} + +func TestHTTPStatuses(t *testing.T) { + assert := New(t) + mockT := new(testing.T) + + assert.Equal(HTTPSuccess(mockT, httpOK, "GET", "/", nil), true) + assert.Equal(HTTPSuccess(mockT, httpRedirect, "GET", "/", nil), false) + assert.Equal(HTTPSuccess(mockT, httpError, "GET", "/", nil), false) + + assert.Equal(HTTPRedirect(mockT, httpOK, "GET", "/", nil), false) + assert.Equal(HTTPRedirect(mockT, httpRedirect, "GET", "/", nil), true) + assert.Equal(HTTPRedirect(mockT, httpError, "GET", "/", nil), false) + + assert.Equal(HTTPError(mockT, httpOK, "GET", "/", nil), false) + assert.Equal(HTTPError(mockT, httpRedirect, "GET", "/", nil), false) + assert.Equal(HTTPError(mockT, httpError, "GET", "/", nil), true) +} + +func TestHTTPStatusesWrapper(t *testing.T) { + assert := New(t) + mockAssert := New(new(testing.T)) + + assert.Equal(mockAssert.HTTPSuccess(httpOK, "GET", "/", nil), true) + assert.Equal(mockAssert.HTTPSuccess(httpRedirect, "GET", "/", nil), false) + assert.Equal(mockAssert.HTTPSuccess(httpError, "GET", "/", nil), false) + + assert.Equal(mockAssert.HTTPRedirect(httpOK, "GET", "/", nil), false) + assert.Equal(mockAssert.HTTPRedirect(httpRedirect, "GET", "/", nil), true) + assert.Equal(mockAssert.HTTPRedirect(httpError, "GET", "/", nil), false) + + assert.Equal(mockAssert.HTTPError(httpOK, "GET", "/", nil), false) + assert.Equal(mockAssert.HTTPError(httpRedirect, "GET", "/", nil), false) + assert.Equal(mockAssert.HTTPError(httpError, "GET", "/", nil), true) +} + +func httpHelloName(w http.ResponseWriter, r *http.Request) { + name := r.FormValue("name") + w.Write([]byte(fmt.Sprintf("Hello, %s!", name))) +} + +func TestHttpBody(t *testing.T) { + assert := New(t) + mockT := new(testing.T) + + assert.True(HTTPBodyContains(mockT, httpHelloName, "GET", "/", url.Values{"name": []string{"World"}}, "Hello, World!")) + assert.True(HTTPBodyContains(mockT, httpHelloName, "GET", "/", url.Values{"name": []string{"World"}}, "World")) + assert.False(HTTPBodyContains(mockT, httpHelloName, "GET", "/", url.Values{"name": []string{"World"}}, "world")) + + assert.False(HTTPBodyNotContains(mockT, httpHelloName, "GET", "/", url.Values{"name": []string{"World"}}, "Hello, World!")) + assert.False(HTTPBodyNotContains(mockT, httpHelloName, "GET", "/", url.Values{"name": []string{"World"}}, "World")) + assert.True(HTTPBodyNotContains(mockT, httpHelloName, "GET", "/", url.Values{"name": []string{"World"}}, "world")) +} + +func TestHttpBodyWrappers(t *testing.T) { + assert := New(t) + mockAssert := New(new(testing.T)) + + assert.True(mockAssert.HTTPBodyContains(httpHelloName, "GET", "/", url.Values{"name": []string{"World"}}, "Hello, World!")) + assert.True(mockAssert.HTTPBodyContains(httpHelloName, "GET", "/", url.Values{"name": []string{"World"}}, "World")) + assert.False(mockAssert.HTTPBodyContains(httpHelloName, "GET", "/", url.Values{"name": []string{"World"}}, "world")) + + assert.False(mockAssert.HTTPBodyNotContains(httpHelloName, "GET", "/", url.Values{"name": []string{"World"}}, "Hello, World!")) + assert.False(mockAssert.HTTPBodyNotContains(httpHelloName, "GET", "/", url.Values{"name": []string{"World"}}, "World")) + assert.True(mockAssert.HTTPBodyNotContains(httpHelloName, "GET", "/", url.Values{"name": []string{"World"}}, "world")) + +} diff --git a/vendor/github.com/stretchr/testify/doc.go b/vendor/github.com/stretchr/testify/doc.go new file mode 100644 index 000000000..377d5cc56 --- /dev/null +++ b/vendor/github.com/stretchr/testify/doc.go @@ -0,0 +1,22 @@ +// Package testify is a set of packages that provide many tools for testifying that your code will behave as you intend. +// +// testify contains the following packages: +// +// The assert package provides a comprehensive set of assertion functions that tie in to the Go testing system. +// +// The http package contains tools to make it easier to test http activity using the Go testing system. +// +// The mock package provides a system by which it is possible to mock your objects and verify calls are happening as expected. +// +// The suite package provides a basic structure for using structs as testing suites, and methods on those structs as tests. It includes setup/teardown functionality in the way of interfaces. +package testify + +// blank imports help docs. +import ( + // assert package + _ "github.com/stretchr/testify/assert" + // http package + _ "github.com/stretchr/testify/http" + // mock package + _ "github.com/stretchr/testify/mock" +) diff --git a/vendor/github.com/stretchr/testify/http/doc.go b/vendor/github.com/stretchr/testify/http/doc.go new file mode 100644 index 000000000..695167c6d --- /dev/null +++ b/vendor/github.com/stretchr/testify/http/doc.go @@ -0,0 +1,2 @@ +// Package http DEPRECATED USE net/http/httptest +package http diff --git a/vendor/github.com/stretchr/testify/http/test_response_writer.go b/vendor/github.com/stretchr/testify/http/test_response_writer.go new file mode 100644 index 000000000..5c3f813fa --- /dev/null +++ b/vendor/github.com/stretchr/testify/http/test_response_writer.go @@ -0,0 +1,49 @@ +package http + +import ( + "net/http" +) + +// TestResponseWriter DEPRECATED: We recommend you use http://golang.org/pkg/net/http/httptest instead. +type TestResponseWriter struct { + + // StatusCode is the last int written by the call to WriteHeader(int) + StatusCode int + + // Output is a string containing the written bytes using the Write([]byte) func. + Output string + + // header is the internal storage of the http.Header object + header http.Header +} + +// Header DEPRECATED: We recommend you use http://golang.org/pkg/net/http/httptest instead. +func (rw *TestResponseWriter) Header() http.Header { + + if rw.header == nil { + rw.header = make(http.Header) + } + + return rw.header +} + +// Write DEPRECATED: We recommend you use http://golang.org/pkg/net/http/httptest instead. +func (rw *TestResponseWriter) Write(bytes []byte) (int, error) { + + // assume 200 success if no header has been set + if rw.StatusCode == 0 { + rw.WriteHeader(200) + } + + // add these bytes to the output string + rw.Output = rw.Output + string(bytes) + + // return normal values + return 0, nil + +} + +// WriteHeader DEPRECATED: We recommend you use http://golang.org/pkg/net/http/httptest instead. +func (rw *TestResponseWriter) WriteHeader(i int) { + rw.StatusCode = i +} diff --git a/vendor/github.com/stretchr/testify/http/test_round_tripper.go b/vendor/github.com/stretchr/testify/http/test_round_tripper.go new file mode 100644 index 000000000..b1e32f1d8 --- /dev/null +++ b/vendor/github.com/stretchr/testify/http/test_round_tripper.go @@ -0,0 +1,17 @@ +package http + +import ( + "github.com/stretchr/testify/mock" + "net/http" +) + +// TestRoundTripper DEPRECATED USE net/http/httptest +type TestRoundTripper struct { + mock.Mock +} + +// RoundTrip DEPRECATED USE net/http/httptest +func (t *TestRoundTripper) RoundTrip(req *http.Request) (*http.Response, error) { + args := t.Called(req) + return args.Get(0).(*http.Response), args.Error(1) +} diff --git a/vendor/github.com/stretchr/testify/mock/doc.go b/vendor/github.com/stretchr/testify/mock/doc.go new file mode 100644 index 000000000..7324128ef --- /dev/null +++ b/vendor/github.com/stretchr/testify/mock/doc.go @@ -0,0 +1,44 @@ +// Package mock provides a system by which it is possible to mock your objects +// and verify calls are happening as expected. +// +// Example Usage +// +// The mock package provides an object, Mock, that tracks activity on another object. It is usually +// embedded into a test object as shown below: +// +// type MyTestObject struct { +// // add a Mock object instance +// mock.Mock +// +// // other fields go here as normal +// } +// +// When implementing the methods of an interface, you wire your functions up +// to call the Mock.Called(args...) method, and return the appropriate values. +// +// For example, to mock a method that saves the name and age of a person and returns +// the year of their birth or an error, you might write this: +// +// func (o *MyTestObject) SavePersonDetails(firstname, lastname string, age int) (int, error) { +// args := o.Called(firstname, lastname, age) +// return args.Int(0), args.Error(1) +// } +// +// The Int, Error and Bool methods are examples of strongly typed getters that take the argument +// index position. Given this argument list: +// +// (12, true, "Something") +// +// You could read them out strongly typed like this: +// +// args.Int(0) +// args.Bool(1) +// args.String(2) +// +// For objects of your own type, use the generic Arguments.Get(index) method and make a type assertion: +// +// return args.Get(0).(*MyObject), args.Get(1).(*AnotherObjectOfMine) +// +// This may cause a panic if the object you are getting is nil (the type assertion will fail), in those +// cases you should check for nil first. +package mock diff --git a/vendor/github.com/stretchr/testify/mock/mock.go b/vendor/github.com/stretchr/testify/mock/mock.go new file mode 100644 index 000000000..20d7b8b1f --- /dev/null +++ b/vendor/github.com/stretchr/testify/mock/mock.go @@ -0,0 +1,763 @@ +package mock + +import ( + "fmt" + "reflect" + "regexp" + "runtime" + "strings" + "sync" + "time" + + "github.com/davecgh/go-spew/spew" + "github.com/pmezard/go-difflib/difflib" + "github.com/stretchr/objx" + "github.com/stretchr/testify/assert" +) + +func inin() { + spew.Config.SortKeys = true +} + +// TestingT is an interface wrapper around *testing.T +type TestingT interface { + Logf(format string, args ...interface{}) + Errorf(format string, args ...interface{}) + FailNow() +} + +/* + Call +*/ + +// Call represents a method call and is used for setting expectations, +// as well as recording activity. +type Call struct { + Parent *Mock + + // The name of the method that was or will be called. + Method string + + // Holds the arguments of the method. + Arguments Arguments + + // Holds the arguments that should be returned when + // this method is called. + ReturnArguments Arguments + + // The number of times to return the return arguments when setting + // expectations. 0 means to always return the value. + Repeatability int + + // Amount of times this call has been called + totalCalls int + + // Holds a channel that will be used to block the Return until it either + // receives a message or is closed. nil means it returns immediately. + WaitFor <-chan time.Time + + // Holds a handler used to manipulate arguments content that are passed by + // reference. It's useful when mocking methods such as unmarshalers or + // decoders. + RunFn func(Arguments) +} + +func newCall(parent *Mock, methodName string, methodArguments ...interface{}) *Call { + return &Call{ + Parent: parent, + Method: methodName, + Arguments: methodArguments, + ReturnArguments: make([]interface{}, 0), + Repeatability: 0, + WaitFor: nil, + RunFn: nil, + } +} + +func (c *Call) lock() { + c.Parent.mutex.Lock() +} + +func (c *Call) unlock() { + c.Parent.mutex.Unlock() +} + +// Return specifies the return arguments for the expectation. +// +// Mock.On("DoSomething").Return(errors.New("failed")) +func (c *Call) Return(returnArguments ...interface{}) *Call { + c.lock() + defer c.unlock() + + c.ReturnArguments = returnArguments + + return c +} + +// Once indicates that that the mock should only return the value once. +// +// Mock.On("MyMethod", arg1, arg2).Return(returnArg1, returnArg2).Once() +func (c *Call) Once() *Call { + return c.Times(1) +} + +// Twice indicates that that the mock should only return the value twice. +// +// Mock.On("MyMethod", arg1, arg2).Return(returnArg1, returnArg2).Twice() +func (c *Call) Twice() *Call { + return c.Times(2) +} + +// Times indicates that that the mock should only return the indicated number +// of times. +// +// Mock.On("MyMethod", arg1, arg2).Return(returnArg1, returnArg2).Times(5) +func (c *Call) Times(i int) *Call { + c.lock() + defer c.unlock() + c.Repeatability = i + return c +} + +// WaitUntil sets the channel that will block the mock's return until its closed +// or a message is received. +// +// Mock.On("MyMethod", arg1, arg2).WaitUntil(time.After(time.Second)) +func (c *Call) WaitUntil(w <-chan time.Time) *Call { + c.lock() + defer c.unlock() + c.WaitFor = w + return c +} + +// After sets how long to block until the call returns +// +// Mock.On("MyMethod", arg1, arg2).After(time.Second) +func (c *Call) After(d time.Duration) *Call { + return c.WaitUntil(time.After(d)) +} + +// Run sets a handler to be called before returning. It can be used when +// mocking a method such as unmarshalers that takes a pointer to a struct and +// sets properties in such struct +// +// Mock.On("Unmarshal", AnythingOfType("*map[string]interface{}").Return().Run(func(args Arguments) { +// arg := args.Get(0).(*map[string]interface{}) +// arg["foo"] = "bar" +// }) +func (c *Call) Run(fn func(Arguments)) *Call { + c.lock() + defer c.unlock() + c.RunFn = fn + return c +} + +// On chains a new expectation description onto the mocked interface. This +// allows syntax like. +// +// Mock. +// On("MyMethod", 1).Return(nil). +// On("MyOtherMethod", 'a', 'b', 'c').Return(errors.New("Some Error")) +func (c *Call) On(methodName string, arguments ...interface{}) *Call { + return c.Parent.On(methodName, arguments...) +} + +// Mock is the workhorse used to track activity on another object. +// For an example of its usage, refer to the "Example Usage" section at the top +// of this document. +type Mock struct { + // Represents the calls that are expected of + // an object. + ExpectedCalls []*Call + + // Holds the calls that were made to this mocked object. + Calls []Call + + // TestData holds any data that might be useful for testing. Testify ignores + // this data completely allowing you to do whatever you like with it. + testData objx.Map + + mutex sync.Mutex +} + +// TestData holds any data that might be useful for testing. Testify ignores +// this data completely allowing you to do whatever you like with it. +func (m *Mock) TestData() objx.Map { + + if m.testData == nil { + m.testData = make(objx.Map) + } + + return m.testData +} + +/* + Setting expectations +*/ + +// On starts a description of an expectation of the specified method +// being called. +// +// Mock.On("MyMethod", arg1, arg2) +func (m *Mock) On(methodName string, arguments ...interface{}) *Call { + for _, arg := range arguments { + if v := reflect.ValueOf(arg); v.Kind() == reflect.Func { + panic(fmt.Sprintf("cannot use Func in expectations. Use mock.AnythingOfType(\"%T\")", arg)) + } + } + + m.mutex.Lock() + defer m.mutex.Unlock() + c := newCall(m, methodName, arguments...) + m.ExpectedCalls = append(m.ExpectedCalls, c) + return c +} + +// /* +// Recording and responding to activity +// */ + +func (m *Mock) findExpectedCall(method string, arguments ...interface{}) (int, *Call) { + m.mutex.Lock() + defer m.mutex.Unlock() + for i, call := range m.ExpectedCalls { + if call.Method == method && call.Repeatability > -1 { + + _, diffCount := call.Arguments.Diff(arguments) + if diffCount == 0 { + return i, call + } + + } + } + return -1, nil +} + +func (m *Mock) findClosestCall(method string, arguments ...interface{}) (bool, *Call) { + diffCount := 0 + var closestCall *Call + + for _, call := range m.expectedCalls() { + if call.Method == method { + + _, tempDiffCount := call.Arguments.Diff(arguments) + if tempDiffCount < diffCount || diffCount == 0 { + diffCount = tempDiffCount + closestCall = call + } + + } + } + + if closestCall == nil { + return false, nil + } + + return true, closestCall +} + +func callString(method string, arguments Arguments, includeArgumentValues bool) string { + + var argValsString string + if includeArgumentValues { + var argVals []string + for argIndex, arg := range arguments { + argVals = append(argVals, fmt.Sprintf("%d: %#v", argIndex, arg)) + } + argValsString = fmt.Sprintf("\n\t\t%s", strings.Join(argVals, "\n\t\t")) + } + + return fmt.Sprintf("%s(%s)%s", method, arguments.String(), argValsString) +} + +// Called tells the mock object that a method has been called, and gets an array +// of arguments to return. Panics if the call is unexpected (i.e. not preceded by +// appropriate .On .Return() calls) +// If Call.WaitFor is set, blocks until the channel is closed or receives a message. +func (m *Mock) Called(arguments ...interface{}) Arguments { + // get the calling function's name + pc, _, _, ok := runtime.Caller(1) + if !ok { + panic("Couldn't get the caller information") + } + functionPath := runtime.FuncForPC(pc).Name() + //Next four lines are required to use GCCGO function naming conventions. + //For Ex: github_com_docker_libkv_store_mock.WatchTree.pN39_github_com_docker_libkv_store_mock.Mock + //uses inteface information unlike golang github.com/docker/libkv/store/mock.(*Mock).WatchTree + //With GCCGO we need to remove interface information starting from pN
. + re := regexp.MustCompile("\\.pN\\d+_") + if re.MatchString(functionPath) { + functionPath = re.Split(functionPath, -1)[0] + } + parts := strings.Split(functionPath, ".") + functionName := parts[len(parts)-1] + + found, call := m.findExpectedCall(functionName, arguments...) + + if found < 0 { + // we have to fail here - because we don't know what to do + // as the return arguments. This is because: + // + // a) this is a totally unexpected call to this method, + // b) the arguments are not what was expected, or + // c) the developer has forgotten to add an accompanying On...Return pair. + + closestFound, closestCall := m.findClosestCall(functionName, arguments...) + + if closestFound { + panic(fmt.Sprintf("\n\nmock: Unexpected Method Call\n-----------------------------\n\n%s\n\nThe closest call I have is: \n\n%s\n\n%s\n", callString(functionName, arguments, true), callString(functionName, closestCall.Arguments, true), diffArguments(arguments, closestCall.Arguments))) + } else { + panic(fmt.Sprintf("\nassert: mock: I don't know what to return because the method call was unexpected.\n\tEither do Mock.On(\"%s\").Return(...) first, or remove the %s() call.\n\tThis method was unexpected:\n\t\t%s\n\tat: %s", functionName, functionName, callString(functionName, arguments, true), assert.CallerInfo())) + } + } else { + m.mutex.Lock() + switch { + case call.Repeatability == 1: + call.Repeatability = -1 + call.totalCalls++ + + case call.Repeatability > 1: + call.Repeatability-- + call.totalCalls++ + + case call.Repeatability == 0: + call.totalCalls++ + } + m.mutex.Unlock() + } + + // add the call + m.mutex.Lock() + m.Calls = append(m.Calls, *newCall(m, functionName, arguments...)) + m.mutex.Unlock() + + // block if specified + if call.WaitFor != nil { + <-call.WaitFor + } + + if call.RunFn != nil { + call.RunFn(arguments) + } + + return call.ReturnArguments +} + +/* + Assertions +*/ + +type assertExpectationser interface { + AssertExpectations(TestingT) bool +} + +// AssertExpectationsForObjects asserts that everything specified with On and Return +// of the specified objects was in fact called as expected. +// +// Calls may have occurred in any order. +func AssertExpectationsForObjects(t TestingT, testObjects ...interface{}) bool { + for _, obj := range testObjects { + if m, ok := obj.(Mock); ok { + t.Logf("Deprecated mock.AssertExpectationsForObjects(myMock.Mock) use mock.AssertExpectationsForObjects(myMock)") + obj = &m + } + m := obj.(assertExpectationser) + if !m.AssertExpectations(t) { + return false + } + } + return true +} + +// AssertExpectations asserts that everything specified with On and Return was +// in fact called as expected. Calls may have occurred in any order. +func (m *Mock) AssertExpectations(t TestingT) bool { + var somethingMissing bool + var failedExpectations int + + // iterate through each expectation + expectedCalls := m.expectedCalls() + for _, expectedCall := range expectedCalls { + if !m.methodWasCalled(expectedCall.Method, expectedCall.Arguments) && expectedCall.totalCalls == 0 { + somethingMissing = true + failedExpectations++ + t.Logf("\u274C\t%s(%s)", expectedCall.Method, expectedCall.Arguments.String()) + } else { + m.mutex.Lock() + if expectedCall.Repeatability > 0 { + somethingMissing = true + failedExpectations++ + } else { + t.Logf("\u2705\t%s(%s)", expectedCall.Method, expectedCall.Arguments.String()) + } + m.mutex.Unlock() + } + } + + if somethingMissing { + t.Errorf("FAIL: %d out of %d expectation(s) were met.\n\tThe code you are testing needs to make %d more call(s).\n\tat: %s", len(expectedCalls)-failedExpectations, len(expectedCalls), failedExpectations, assert.CallerInfo()) + } + + return !somethingMissing +} + +// AssertNumberOfCalls asserts that the method was called expectedCalls times. +func (m *Mock) AssertNumberOfCalls(t TestingT, methodName string, expectedCalls int) bool { + var actualCalls int + for _, call := range m.calls() { + if call.Method == methodName { + actualCalls++ + } + } + return assert.Equal(t, expectedCalls, actualCalls, fmt.Sprintf("Expected number of calls (%d) does not match the actual number of calls (%d).", expectedCalls, actualCalls)) +} + +// AssertCalled asserts that the method was called. +// It can produce a false result when an argument is a pointer type and the underlying value changed after calling the mocked method. +func (m *Mock) AssertCalled(t TestingT, methodName string, arguments ...interface{}) bool { + if !assert.True(t, m.methodWasCalled(methodName, arguments), fmt.Sprintf("The \"%s\" method should have been called with %d argument(s), but was not.", methodName, len(arguments))) { + t.Logf("%v", m.expectedCalls()) + return false + } + return true +} + +// AssertNotCalled asserts that the method was not called. +// It can produce a false result when an argument is a pointer type and the underlying value changed after calling the mocked method. +func (m *Mock) AssertNotCalled(t TestingT, methodName string, arguments ...interface{}) bool { + if !assert.False(t, m.methodWasCalled(methodName, arguments), fmt.Sprintf("The \"%s\" method was called with %d argument(s), but should NOT have been.", methodName, len(arguments))) { + t.Logf("%v", m.expectedCalls()) + return false + } + return true +} + +func (m *Mock) methodWasCalled(methodName string, expected []interface{}) bool { + for _, call := range m.calls() { + if call.Method == methodName { + + _, differences := Arguments(expected).Diff(call.Arguments) + + if differences == 0 { + // found the expected call + return true + } + + } + } + // we didn't find the expected call + return false +} + +func (m *Mock) expectedCalls() []*Call { + m.mutex.Lock() + defer m.mutex.Unlock() + return append([]*Call{}, m.ExpectedCalls...) +} + +func (m *Mock) calls() []Call { + m.mutex.Lock() + defer m.mutex.Unlock() + return append([]Call{}, m.Calls...) +} + +/* + Arguments +*/ + +// Arguments holds an array of method arguments or return values. +type Arguments []interface{} + +const ( + // Anything is used in Diff and Assert when the argument being tested + // shouldn't be taken into consideration. + Anything string = "mock.Anything" +) + +// AnythingOfTypeArgument is a string that contains the type of an argument +// for use when type checking. Used in Diff and Assert. +type AnythingOfTypeArgument string + +// AnythingOfType returns an AnythingOfTypeArgument object containing the +// name of the type to check for. Used in Diff and Assert. +// +// For example: +// Assert(t, AnythingOfType("string"), AnythingOfType("int")) +func AnythingOfType(t string) AnythingOfTypeArgument { + return AnythingOfTypeArgument(t) +} + +// argumentMatcher performs custom argument matching, returning whether or +// not the argument is matched by the expectation fixture function. +type argumentMatcher struct { + // fn is a function which accepts one argument, and returns a bool. + fn reflect.Value +} + +func (f argumentMatcher) Matches(argument interface{}) bool { + expectType := f.fn.Type().In(0) + + if reflect.TypeOf(argument).AssignableTo(expectType) { + result := f.fn.Call([]reflect.Value{reflect.ValueOf(argument)}) + return result[0].Bool() + } + return false +} + +func (f argumentMatcher) String() string { + return fmt.Sprintf("func(%s) bool", f.fn.Type().In(0).Name()) +} + +// MatchedBy can be used to match a mock call based on only certain properties +// from a complex struct or some calculation. It takes a function that will be +// evaluated with the called argument and will return true when there's a match +// and false otherwise. +// +// Example: +// m.On("Do", MatchedBy(func(req *http.Request) bool { return req.Host == "example.com" })) +// +// |fn|, must be a function accepting a single argument (of the expected type) +// which returns a bool. If |fn| doesn't match the required signature, +// MathedBy() panics. +func MatchedBy(fn interface{}) argumentMatcher { + fnType := reflect.TypeOf(fn) + + if fnType.Kind() != reflect.Func { + panic(fmt.Sprintf("assert: arguments: %s is not a func", fn)) + } + if fnType.NumIn() != 1 { + panic(fmt.Sprintf("assert: arguments: %s does not take exactly one argument", fn)) + } + if fnType.NumOut() != 1 || fnType.Out(0).Kind() != reflect.Bool { + panic(fmt.Sprintf("assert: arguments: %s does not return a bool", fn)) + } + + return argumentMatcher{fn: reflect.ValueOf(fn)} +} + +// Get Returns the argument at the specified index. +func (args Arguments) Get(index int) interface{} { + if index+1 > len(args) { + panic(fmt.Sprintf("assert: arguments: Cannot call Get(%d) because there are %d argument(s).", index, len(args))) + } + return args[index] +} + +// Is gets whether the objects match the arguments specified. +func (args Arguments) Is(objects ...interface{}) bool { + for i, obj := range args { + if obj != objects[i] { + return false + } + } + return true +} + +// Diff gets a string describing the differences between the arguments +// and the specified objects. +// +// Returns the diff string and number of differences found. +func (args Arguments) Diff(objects []interface{}) (string, int) { + + var output = "\n" + var differences int + + var maxArgCount = len(args) + if len(objects) > maxArgCount { + maxArgCount = len(objects) + } + + for i := 0; i < maxArgCount; i++ { + var actual, expected interface{} + + if len(objects) <= i { + actual = "(Missing)" + } else { + actual = objects[i] + } + + if len(args) <= i { + expected = "(Missing)" + } else { + expected = args[i] + } + + if matcher, ok := expected.(argumentMatcher); ok { + if matcher.Matches(actual) { + output = fmt.Sprintf("%s\t%d: \u2705 %s matched by %s\n", output, i, actual, matcher) + } else { + differences++ + output = fmt.Sprintf("%s\t%d: \u2705 %s not matched by %s\n", output, i, actual, matcher) + } + } else if reflect.TypeOf(expected) == reflect.TypeOf((*AnythingOfTypeArgument)(nil)).Elem() { + + // type checking + if reflect.TypeOf(actual).Name() != string(expected.(AnythingOfTypeArgument)) && reflect.TypeOf(actual).String() != string(expected.(AnythingOfTypeArgument)) { + // not match + differences++ + output = fmt.Sprintf("%s\t%d: \u274C type %s != type %s - %s\n", output, i, expected, reflect.TypeOf(actual).Name(), actual) + } + + } else { + + // normal checking + + if assert.ObjectsAreEqual(expected, Anything) || assert.ObjectsAreEqual(actual, Anything) || assert.ObjectsAreEqual(actual, expected) { + // match + output = fmt.Sprintf("%s\t%d: \u2705 %s == %s\n", output, i, actual, expected) + } else { + // not match + differences++ + output = fmt.Sprintf("%s\t%d: \u274C %s != %s\n", output, i, actual, expected) + } + } + + } + + if differences == 0 { + return "No differences.", differences + } + + return output, differences + +} + +// Assert compares the arguments with the specified objects and fails if +// they do not exactly match. +func (args Arguments) Assert(t TestingT, objects ...interface{}) bool { + + // get the differences + diff, diffCount := args.Diff(objects) + + if diffCount == 0 { + return true + } + + // there are differences... report them... + t.Logf(diff) + t.Errorf("%sArguments do not match.", assert.CallerInfo()) + + return false + +} + +// String gets the argument at the specified index. Panics if there is no argument, or +// if the argument is of the wrong type. +// +// If no index is provided, String() returns a complete string representation +// of the arguments. +func (args Arguments) String(indexOrNil ...int) string { + + if len(indexOrNil) == 0 { + // normal String() method - return a string representation of the args + var argsStr []string + for _, arg := range args { + argsStr = append(argsStr, fmt.Sprintf("%s", reflect.TypeOf(arg))) + } + return strings.Join(argsStr, ",") + } else if len(indexOrNil) == 1 { + // Index has been specified - get the argument at that index + var index = indexOrNil[0] + var s string + var ok bool + if s, ok = args.Get(index).(string); !ok { + panic(fmt.Sprintf("assert: arguments: String(%d) failed because object wasn't correct type: %s", index, args.Get(index))) + } + return s + } + + panic(fmt.Sprintf("assert: arguments: Wrong number of arguments passed to String. Must be 0 or 1, not %d", len(indexOrNil))) + +} + +// Int gets the argument at the specified index. Panics if there is no argument, or +// if the argument is of the wrong type. +func (args Arguments) Int(index int) int { + var s int + var ok bool + if s, ok = args.Get(index).(int); !ok { + panic(fmt.Sprintf("assert: arguments: Int(%d) failed because object wasn't correct type: %v", index, args.Get(index))) + } + return s +} + +// Error gets the argument at the specified index. Panics if there is no argument, or +// if the argument is of the wrong type. +func (args Arguments) Error(index int) error { + obj := args.Get(index) + var s error + var ok bool + if obj == nil { + return nil + } + if s, ok = obj.(error); !ok { + panic(fmt.Sprintf("assert: arguments: Error(%d) failed because object wasn't correct type: %v", index, args.Get(index))) + } + return s +} + +// Bool gets the argument at the specified index. Panics if there is no argument, or +// if the argument is of the wrong type. +func (args Arguments) Bool(index int) bool { + var s bool + var ok bool + if s, ok = args.Get(index).(bool); !ok { + panic(fmt.Sprintf("assert: arguments: Bool(%d) failed because object wasn't correct type: %v", index, args.Get(index))) + } + return s +} + +func typeAndKind(v interface{}) (reflect.Type, reflect.Kind) { + t := reflect.TypeOf(v) + k := t.Kind() + + if k == reflect.Ptr { + t = t.Elem() + k = t.Kind() + } + return t, k +} + +func diffArguments(expected Arguments, actual Arguments) string { + for x := range expected { + if diffString := diff(expected[x], actual[x]); diffString != "" { + return fmt.Sprintf("Difference found in argument %v:\n\n%s", x, diffString) + } + } + + return "" +} + +// diff returns a diff of both values as long as both are of the same type and +// are a struct, map, slice or array. Otherwise it returns an empty string. +func diff(expected interface{}, actual interface{}) string { + if expected == nil || actual == nil { + return "" + } + + et, ek := typeAndKind(expected) + at, _ := typeAndKind(actual) + + if et != at { + return "" + } + + if ek != reflect.Struct && ek != reflect.Map && ek != reflect.Slice && ek != reflect.Array { + return "" + } + + e := spew.Sdump(expected) + a := spew.Sdump(actual) + + diff, _ := difflib.GetUnifiedDiffString(difflib.UnifiedDiff{ + A: difflib.SplitLines(e), + B: difflib.SplitLines(a), + FromFile: "Expected", + FromDate: "", + ToFile: "Actual", + ToDate: "", + Context: 1, + }) + + return diff +} diff --git a/vendor/github.com/stretchr/testify/mock/mock_test.go b/vendor/github.com/stretchr/testify/mock/mock_test.go new file mode 100644 index 000000000..8cb4615db --- /dev/null +++ b/vendor/github.com/stretchr/testify/mock/mock_test.go @@ -0,0 +1,1132 @@ +package mock + +import ( + "errors" + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" + "testing" + "time" +) + +/* + Test objects +*/ + +// ExampleInterface represents an example interface. +type ExampleInterface interface { + TheExampleMethod(a, b, c int) (int, error) +} + +// TestExampleImplementation is a test implementation of ExampleInterface +type TestExampleImplementation struct { + Mock +} + +func (i *TestExampleImplementation) TheExampleMethod(a, b, c int) (int, error) { + args := i.Called(a, b, c) + return args.Int(0), errors.New("Whoops") +} + +func (i *TestExampleImplementation) TheExampleMethod2(yesorno bool) { + i.Called(yesorno) +} + +type ExampleType struct { + ran bool +} + +func (i *TestExampleImplementation) TheExampleMethod3(et *ExampleType) error { + args := i.Called(et) + return args.Error(0) +} + +func (i *TestExampleImplementation) TheExampleMethodFunc(fn func(string) error) error { + args := i.Called(fn) + return args.Error(0) +} + +func (i *TestExampleImplementation) TheExampleMethodVariadic(a ...int) error { + args := i.Called(a) + return args.Error(0) +} + +func (i *TestExampleImplementation) TheExampleMethodVariadicInterface(a ...interface{}) error { + args := i.Called(a) + return args.Error(0) +} + +type ExampleFuncType func(string) error + +func (i *TestExampleImplementation) TheExampleMethodFuncType(fn ExampleFuncType) error { + args := i.Called(fn) + return args.Error(0) +} + +/* + Mock +*/ + +func Test_Mock_TestData(t *testing.T) { + + var mockedService = new(TestExampleImplementation) + + if assert.NotNil(t, mockedService.TestData()) { + + mockedService.TestData().Set("something", 123) + assert.Equal(t, 123, mockedService.TestData().Get("something").Data()) + } +} + +func Test_Mock_On(t *testing.T) { + + // make a test impl object + var mockedService = new(TestExampleImplementation) + + c := mockedService.On("TheExampleMethod") + assert.Equal(t, []*Call{c}, mockedService.ExpectedCalls) + assert.Equal(t, "TheExampleMethod", c.Method) +} + +func Test_Mock_Chained_On(t *testing.T) { + // make a test impl object + var mockedService = new(TestExampleImplementation) + + mockedService. + On("TheExampleMethod", 1, 2, 3). + Return(0). + On("TheExampleMethod3", AnythingOfType("*mock.ExampleType")). + Return(nil) + + expectedCalls := []*Call{ + &Call{ + Parent: &mockedService.Mock, + Method: "TheExampleMethod", + Arguments: []interface{}{1, 2, 3}, + ReturnArguments: []interface{}{0}, + }, + &Call{ + Parent: &mockedService.Mock, + Method: "TheExampleMethod3", + Arguments: []interface{}{AnythingOfType("*mock.ExampleType")}, + ReturnArguments: []interface{}{nil}, + }, + } + assert.Equal(t, expectedCalls, mockedService.ExpectedCalls) +} + +func Test_Mock_On_WithArgs(t *testing.T) { + + // make a test impl object + var mockedService = new(TestExampleImplementation) + + c := mockedService.On("TheExampleMethod", 1, 2, 3, 4) + + assert.Equal(t, []*Call{c}, mockedService.ExpectedCalls) + assert.Equal(t, "TheExampleMethod", c.Method) + assert.Equal(t, Arguments{1, 2, 3, 4}, c.Arguments) +} + +func Test_Mock_On_WithFuncArg(t *testing.T) { + + // make a test impl object + var mockedService = new(TestExampleImplementation) + + c := mockedService. + On("TheExampleMethodFunc", AnythingOfType("func(string) error")). + Return(nil) + + assert.Equal(t, []*Call{c}, mockedService.ExpectedCalls) + assert.Equal(t, "TheExampleMethodFunc", c.Method) + assert.Equal(t, 1, len(c.Arguments)) + assert.Equal(t, AnythingOfType("func(string) error"), c.Arguments[0]) + + fn := func(string) error { return nil } + + assert.NotPanics(t, func() { + mockedService.TheExampleMethodFunc(fn) + }) +} + +func Test_Mock_On_WithIntArgMatcher(t *testing.T) { + var mockedService TestExampleImplementation + + mockedService.On("TheExampleMethod", + MatchedBy(func(a int) bool { + return a == 1 + }), MatchedBy(func(b int) bool { + return b == 2 + }), MatchedBy(func(c int) bool { + return c == 3 + })).Return(0, nil) + + assert.Panics(t, func() { + mockedService.TheExampleMethod(1, 2, 4) + }) + assert.Panics(t, func() { + mockedService.TheExampleMethod(2, 2, 3) + }) + assert.NotPanics(t, func() { + mockedService.TheExampleMethod(1, 2, 3) + }) +} + +func Test_Mock_On_WithPtrArgMatcher(t *testing.T) { + var mockedService TestExampleImplementation + + mockedService.On("TheExampleMethod3", + MatchedBy(func(a *ExampleType) bool { return a.ran == true }), + ).Return(nil) + + mockedService.On("TheExampleMethod3", + MatchedBy(func(a *ExampleType) bool { return a.ran == false }), + ).Return(errors.New("error")) + + assert.Equal(t, mockedService.TheExampleMethod3(&ExampleType{true}), nil) + assert.EqualError(t, mockedService.TheExampleMethod3(&ExampleType{false}), "error") +} + +func Test_Mock_On_WithFuncArgMatcher(t *testing.T) { + var mockedService TestExampleImplementation + + fixture1, fixture2 := errors.New("fixture1"), errors.New("fixture2") + + mockedService.On("TheExampleMethodFunc", + MatchedBy(func(a func(string) error) bool { return a("string") == fixture1 }), + ).Return(errors.New("fixture1")) + + mockedService.On("TheExampleMethodFunc", + MatchedBy(func(a func(string) error) bool { return a("string") == fixture2 }), + ).Return(errors.New("fixture2")) + + assert.EqualError(t, mockedService.TheExampleMethodFunc( + func(string) error { return fixture1 }), "fixture1") + assert.EqualError(t, mockedService.TheExampleMethodFunc( + func(string) error { return fixture2 }), "fixture2") +} + +func Test_Mock_On_WithVariadicFunc(t *testing.T) { + + // make a test impl object + var mockedService = new(TestExampleImplementation) + + c := mockedService. + On("TheExampleMethodVariadic", []int{1, 2, 3}). + Return(nil) + + assert.Equal(t, []*Call{c}, mockedService.ExpectedCalls) + assert.Equal(t, 1, len(c.Arguments)) + assert.Equal(t, []int{1, 2, 3}, c.Arguments[0]) + + assert.NotPanics(t, func() { + mockedService.TheExampleMethodVariadic(1, 2, 3) + }) + assert.Panics(t, func() { + mockedService.TheExampleMethodVariadic(1, 2) + }) + +} + +func Test_Mock_On_WithVariadicFuncWithInterface(t *testing.T) { + + // make a test impl object + var mockedService = new(TestExampleImplementation) + + c := mockedService.On("TheExampleMethodVariadicInterface", []interface{}{1, 2, 3}). + Return(nil) + + assert.Equal(t, []*Call{c}, mockedService.ExpectedCalls) + assert.Equal(t, 1, len(c.Arguments)) + assert.Equal(t, []interface{}{1, 2, 3}, c.Arguments[0]) + + assert.NotPanics(t, func() { + mockedService.TheExampleMethodVariadicInterface(1, 2, 3) + }) + assert.Panics(t, func() { + mockedService.TheExampleMethodVariadicInterface(1, 2) + }) + +} + +func Test_Mock_On_WithVariadicFuncWithEmptyInterfaceArray(t *testing.T) { + + // make a test impl object + var mockedService = new(TestExampleImplementation) + + var expected []interface{} + c := mockedService. + On("TheExampleMethodVariadicInterface", expected). + Return(nil) + + assert.Equal(t, []*Call{c}, mockedService.ExpectedCalls) + assert.Equal(t, 1, len(c.Arguments)) + assert.Equal(t, expected, c.Arguments[0]) + + assert.NotPanics(t, func() { + mockedService.TheExampleMethodVariadicInterface() + }) + assert.Panics(t, func() { + mockedService.TheExampleMethodVariadicInterface(1, 2) + }) + +} + +func Test_Mock_On_WithFuncPanics(t *testing.T) { + // make a test impl object + var mockedService = new(TestExampleImplementation) + + assert.Panics(t, func() { + mockedService.On("TheExampleMethodFunc", func(string) error { return nil }) + }) +} + +func Test_Mock_On_WithFuncTypeArg(t *testing.T) { + + // make a test impl object + var mockedService = new(TestExampleImplementation) + + c := mockedService. + On("TheExampleMethodFuncType", AnythingOfType("mock.ExampleFuncType")). + Return(nil) + + assert.Equal(t, []*Call{c}, mockedService.ExpectedCalls) + assert.Equal(t, 1, len(c.Arguments)) + assert.Equal(t, AnythingOfType("mock.ExampleFuncType"), c.Arguments[0]) + + fn := func(string) error { return nil } + assert.NotPanics(t, func() { + mockedService.TheExampleMethodFuncType(fn) + }) +} + +func Test_Mock_Return(t *testing.T) { + + // make a test impl object + var mockedService = new(TestExampleImplementation) + + c := mockedService. + On("TheExampleMethod", "A", "B", true). + Return(1, "two", true) + + require.Equal(t, []*Call{c}, mockedService.ExpectedCalls) + + call := mockedService.ExpectedCalls[0] + + assert.Equal(t, "TheExampleMethod", call.Method) + assert.Equal(t, "A", call.Arguments[0]) + assert.Equal(t, "B", call.Arguments[1]) + assert.Equal(t, true, call.Arguments[2]) + assert.Equal(t, 1, call.ReturnArguments[0]) + assert.Equal(t, "two", call.ReturnArguments[1]) + assert.Equal(t, true, call.ReturnArguments[2]) + assert.Equal(t, 0, call.Repeatability) + assert.Nil(t, call.WaitFor) +} + +func Test_Mock_Return_WaitUntil(t *testing.T) { + + // make a test impl object + var mockedService = new(TestExampleImplementation) + ch := time.After(time.Second) + + c := mockedService.Mock. + On("TheExampleMethod", "A", "B", true). + WaitUntil(ch). + Return(1, "two", true) + + // assert that the call was created + require.Equal(t, []*Call{c}, mockedService.ExpectedCalls) + + call := mockedService.ExpectedCalls[0] + + assert.Equal(t, "TheExampleMethod", call.Method) + assert.Equal(t, "A", call.Arguments[0]) + assert.Equal(t, "B", call.Arguments[1]) + assert.Equal(t, true, call.Arguments[2]) + assert.Equal(t, 1, call.ReturnArguments[0]) + assert.Equal(t, "two", call.ReturnArguments[1]) + assert.Equal(t, true, call.ReturnArguments[2]) + assert.Equal(t, 0, call.Repeatability) + assert.Equal(t, ch, call.WaitFor) +} + +func Test_Mock_Return_After(t *testing.T) { + + // make a test impl object + var mockedService = new(TestExampleImplementation) + + c := mockedService.Mock. + On("TheExampleMethod", "A", "B", true). + Return(1, "two", true). + After(time.Second) + + require.Equal(t, []*Call{c}, mockedService.ExpectedCalls) + + call := mockedService.Mock.ExpectedCalls[0] + + assert.Equal(t, "TheExampleMethod", call.Method) + assert.Equal(t, "A", call.Arguments[0]) + assert.Equal(t, "B", call.Arguments[1]) + assert.Equal(t, true, call.Arguments[2]) + assert.Equal(t, 1, call.ReturnArguments[0]) + assert.Equal(t, "two", call.ReturnArguments[1]) + assert.Equal(t, true, call.ReturnArguments[2]) + assert.Equal(t, 0, call.Repeatability) + assert.NotEqual(t, nil, call.WaitFor) + +} + +func Test_Mock_Return_Run(t *testing.T) { + + // make a test impl object + var mockedService = new(TestExampleImplementation) + + fn := func(args Arguments) { + arg := args.Get(0).(*ExampleType) + arg.ran = true + } + + c := mockedService.Mock. + On("TheExampleMethod3", AnythingOfType("*mock.ExampleType")). + Return(nil). + Run(fn) + + require.Equal(t, []*Call{c}, mockedService.ExpectedCalls) + + call := mockedService.Mock.ExpectedCalls[0] + + assert.Equal(t, "TheExampleMethod3", call.Method) + assert.Equal(t, AnythingOfType("*mock.ExampleType"), call.Arguments[0]) + assert.Equal(t, nil, call.ReturnArguments[0]) + assert.Equal(t, 0, call.Repeatability) + assert.NotEqual(t, nil, call.WaitFor) + assert.NotNil(t, call.Run) + + et := ExampleType{} + assert.Equal(t, false, et.ran) + mockedService.TheExampleMethod3(&et) + assert.Equal(t, true, et.ran) +} + +func Test_Mock_Return_Run_Out_Of_Order(t *testing.T) { + // make a test impl object + var mockedService = new(TestExampleImplementation) + f := func(args Arguments) { + arg := args.Get(0).(*ExampleType) + arg.ran = true + } + + c := mockedService.Mock. + On("TheExampleMethod3", AnythingOfType("*mock.ExampleType")). + Run(f). + Return(nil) + + require.Equal(t, []*Call{c}, mockedService.ExpectedCalls) + + call := mockedService.Mock.ExpectedCalls[0] + + assert.Equal(t, "TheExampleMethod3", call.Method) + assert.Equal(t, AnythingOfType("*mock.ExampleType"), call.Arguments[0]) + assert.Equal(t, nil, call.ReturnArguments[0]) + assert.Equal(t, 0, call.Repeatability) + assert.NotEqual(t, nil, call.WaitFor) + assert.NotNil(t, call.Run) +} + +func Test_Mock_Return_Once(t *testing.T) { + + // make a test impl object + var mockedService = new(TestExampleImplementation) + + c := mockedService.On("TheExampleMethod", "A", "B", true). + Return(1, "two", true). + Once() + + require.Equal(t, []*Call{c}, mockedService.ExpectedCalls) + + call := mockedService.ExpectedCalls[0] + + assert.Equal(t, "TheExampleMethod", call.Method) + assert.Equal(t, "A", call.Arguments[0]) + assert.Equal(t, "B", call.Arguments[1]) + assert.Equal(t, true, call.Arguments[2]) + assert.Equal(t, 1, call.ReturnArguments[0]) + assert.Equal(t, "two", call.ReturnArguments[1]) + assert.Equal(t, true, call.ReturnArguments[2]) + assert.Equal(t, 1, call.Repeatability) + assert.Nil(t, call.WaitFor) +} + +func Test_Mock_Return_Twice(t *testing.T) { + + // make a test impl object + var mockedService = new(TestExampleImplementation) + + c := mockedService. + On("TheExampleMethod", "A", "B", true). + Return(1, "two", true). + Twice() + + require.Equal(t, []*Call{c}, mockedService.ExpectedCalls) + + call := mockedService.ExpectedCalls[0] + + assert.Equal(t, "TheExampleMethod", call.Method) + assert.Equal(t, "A", call.Arguments[0]) + assert.Equal(t, "B", call.Arguments[1]) + assert.Equal(t, true, call.Arguments[2]) + assert.Equal(t, 1, call.ReturnArguments[0]) + assert.Equal(t, "two", call.ReturnArguments[1]) + assert.Equal(t, true, call.ReturnArguments[2]) + assert.Equal(t, 2, call.Repeatability) + assert.Nil(t, call.WaitFor) +} + +func Test_Mock_Return_Times(t *testing.T) { + + // make a test impl object + var mockedService = new(TestExampleImplementation) + + c := mockedService. + On("TheExampleMethod", "A", "B", true). + Return(1, "two", true). + Times(5) + + require.Equal(t, []*Call{c}, mockedService.ExpectedCalls) + + call := mockedService.ExpectedCalls[0] + + assert.Equal(t, "TheExampleMethod", call.Method) + assert.Equal(t, "A", call.Arguments[0]) + assert.Equal(t, "B", call.Arguments[1]) + assert.Equal(t, true, call.Arguments[2]) + assert.Equal(t, 1, call.ReturnArguments[0]) + assert.Equal(t, "two", call.ReturnArguments[1]) + assert.Equal(t, true, call.ReturnArguments[2]) + assert.Equal(t, 5, call.Repeatability) + assert.Nil(t, call.WaitFor) +} + +func Test_Mock_Return_Nothing(t *testing.T) { + + // make a test impl object + var mockedService = new(TestExampleImplementation) + + c := mockedService. + On("TheExampleMethod", "A", "B", true). + Return() + + require.Equal(t, []*Call{c}, mockedService.ExpectedCalls) + + call := mockedService.ExpectedCalls[0] + + assert.Equal(t, "TheExampleMethod", call.Method) + assert.Equal(t, "A", call.Arguments[0]) + assert.Equal(t, "B", call.Arguments[1]) + assert.Equal(t, true, call.Arguments[2]) + assert.Equal(t, 0, len(call.ReturnArguments)) +} + +func Test_Mock_findExpectedCall(t *testing.T) { + + m := new(Mock) + m.On("One", 1).Return("one") + m.On("Two", 2).Return("two") + m.On("Two", 3).Return("three") + + f, c := m.findExpectedCall("Two", 3) + + if assert.Equal(t, 2, f) { + if assert.NotNil(t, c) { + assert.Equal(t, "Two", c.Method) + assert.Equal(t, 3, c.Arguments[0]) + assert.Equal(t, "three", c.ReturnArguments[0]) + } + } + +} + +func Test_Mock_findExpectedCall_For_Unknown_Method(t *testing.T) { + + m := new(Mock) + m.On("One", 1).Return("one") + m.On("Two", 2).Return("two") + m.On("Two", 3).Return("three") + + f, _ := m.findExpectedCall("Two") + + assert.Equal(t, -1, f) + +} + +func Test_Mock_findExpectedCall_Respects_Repeatability(t *testing.T) { + + m := new(Mock) + m.On("One", 1).Return("one") + m.On("Two", 2).Return("two").Once() + m.On("Two", 3).Return("three").Twice() + m.On("Two", 3).Return("three").Times(8) + + f, c := m.findExpectedCall("Two", 3) + + if assert.Equal(t, 2, f) { + if assert.NotNil(t, c) { + assert.Equal(t, "Two", c.Method) + assert.Equal(t, 3, c.Arguments[0]) + assert.Equal(t, "three", c.ReturnArguments[0]) + } + } + +} + +func Test_callString(t *testing.T) { + + assert.Equal(t, `Method(int,bool,string)`, callString("Method", []interface{}{1, true, "something"}, false)) + +} + +func Test_Mock_Called(t *testing.T) { + + var mockedService = new(TestExampleImplementation) + + mockedService.On("Test_Mock_Called", 1, 2, 3).Return(5, "6", true) + + returnArguments := mockedService.Called(1, 2, 3) + + if assert.Equal(t, 1, len(mockedService.Calls)) { + assert.Equal(t, "Test_Mock_Called", mockedService.Calls[0].Method) + assert.Equal(t, 1, mockedService.Calls[0].Arguments[0]) + assert.Equal(t, 2, mockedService.Calls[0].Arguments[1]) + assert.Equal(t, 3, mockedService.Calls[0].Arguments[2]) + } + + if assert.Equal(t, 3, len(returnArguments)) { + assert.Equal(t, 5, returnArguments[0]) + assert.Equal(t, "6", returnArguments[1]) + assert.Equal(t, true, returnArguments[2]) + } + +} + +func asyncCall(m *Mock, ch chan Arguments) { + ch <- m.Called(1, 2, 3) +} + +func Test_Mock_Called_blocks(t *testing.T) { + + var mockedService = new(TestExampleImplementation) + + mockedService.Mock.On("asyncCall", 1, 2, 3).Return(5, "6", true).After(2 * time.Millisecond) + + ch := make(chan Arguments) + + go asyncCall(&mockedService.Mock, ch) + + select { + case <-ch: + t.Fatal("should have waited") + case <-time.After(1 * time.Millisecond): + } + + returnArguments := <-ch + + if assert.Equal(t, 1, len(mockedService.Mock.Calls)) { + assert.Equal(t, "asyncCall", mockedService.Mock.Calls[0].Method) + assert.Equal(t, 1, mockedService.Mock.Calls[0].Arguments[0]) + assert.Equal(t, 2, mockedService.Mock.Calls[0].Arguments[1]) + assert.Equal(t, 3, mockedService.Mock.Calls[0].Arguments[2]) + } + + if assert.Equal(t, 3, len(returnArguments)) { + assert.Equal(t, 5, returnArguments[0]) + assert.Equal(t, "6", returnArguments[1]) + assert.Equal(t, true, returnArguments[2]) + } + +} + +func Test_Mock_Called_For_Bounded_Repeatability(t *testing.T) { + + var mockedService = new(TestExampleImplementation) + + mockedService. + On("Test_Mock_Called_For_Bounded_Repeatability", 1, 2, 3). + Return(5, "6", true). + Once() + mockedService. + On("Test_Mock_Called_For_Bounded_Repeatability", 1, 2, 3). + Return(-1, "hi", false) + + returnArguments1 := mockedService.Called(1, 2, 3) + returnArguments2 := mockedService.Called(1, 2, 3) + + if assert.Equal(t, 2, len(mockedService.Calls)) { + assert.Equal(t, "Test_Mock_Called_For_Bounded_Repeatability", mockedService.Calls[0].Method) + assert.Equal(t, 1, mockedService.Calls[0].Arguments[0]) + assert.Equal(t, 2, mockedService.Calls[0].Arguments[1]) + assert.Equal(t, 3, mockedService.Calls[0].Arguments[2]) + + assert.Equal(t, "Test_Mock_Called_For_Bounded_Repeatability", mockedService.Calls[1].Method) + assert.Equal(t, 1, mockedService.Calls[1].Arguments[0]) + assert.Equal(t, 2, mockedService.Calls[1].Arguments[1]) + assert.Equal(t, 3, mockedService.Calls[1].Arguments[2]) + } + + if assert.Equal(t, 3, len(returnArguments1)) { + assert.Equal(t, 5, returnArguments1[0]) + assert.Equal(t, "6", returnArguments1[1]) + assert.Equal(t, true, returnArguments1[2]) + } + + if assert.Equal(t, 3, len(returnArguments2)) { + assert.Equal(t, -1, returnArguments2[0]) + assert.Equal(t, "hi", returnArguments2[1]) + assert.Equal(t, false, returnArguments2[2]) + } + +} + +func Test_Mock_Called_For_SetTime_Expectation(t *testing.T) { + + var mockedService = new(TestExampleImplementation) + + mockedService.On("TheExampleMethod", 1, 2, 3).Return(5, "6", true).Times(4) + + mockedService.TheExampleMethod(1, 2, 3) + mockedService.TheExampleMethod(1, 2, 3) + mockedService.TheExampleMethod(1, 2, 3) + mockedService.TheExampleMethod(1, 2, 3) + assert.Panics(t, func() { + mockedService.TheExampleMethod(1, 2, 3) + }) + +} + +func Test_Mock_Called_Unexpected(t *testing.T) { + + var mockedService = new(TestExampleImplementation) + + // make sure it panics if no expectation was made + assert.Panics(t, func() { + mockedService.Called(1, 2, 3) + }, "Calling unexpected method should panic") + +} + +func Test_AssertExpectationsForObjects_Helper(t *testing.T) { + + var mockedService1 = new(TestExampleImplementation) + var mockedService2 = new(TestExampleImplementation) + var mockedService3 = new(TestExampleImplementation) + + mockedService1.On("Test_AssertExpectationsForObjects_Helper", 1).Return() + mockedService2.On("Test_AssertExpectationsForObjects_Helper", 2).Return() + mockedService3.On("Test_AssertExpectationsForObjects_Helper", 3).Return() + + mockedService1.Called(1) + mockedService2.Called(2) + mockedService3.Called(3) + + assert.True(t, AssertExpectationsForObjects(t, mockedService1.Mock, mockedService2.Mock, mockedService3.Mock)) + assert.True(t, AssertExpectationsForObjects(t, mockedService1, mockedService2, mockedService3)) + +} + +func Test_AssertExpectationsForObjects_Helper_Failed(t *testing.T) { + + var mockedService1 = new(TestExampleImplementation) + var mockedService2 = new(TestExampleImplementation) + var mockedService3 = new(TestExampleImplementation) + + mockedService1.On("Test_AssertExpectationsForObjects_Helper_Failed", 1).Return() + mockedService2.On("Test_AssertExpectationsForObjects_Helper_Failed", 2).Return() + mockedService3.On("Test_AssertExpectationsForObjects_Helper_Failed", 3).Return() + + mockedService1.Called(1) + mockedService3.Called(3) + + tt := new(testing.T) + assert.False(t, AssertExpectationsForObjects(tt, mockedService1.Mock, mockedService2.Mock, mockedService3.Mock)) + assert.False(t, AssertExpectationsForObjects(tt, mockedService1, mockedService2, mockedService3)) + +} + +func Test_Mock_AssertExpectations(t *testing.T) { + + var mockedService = new(TestExampleImplementation) + + mockedService.On("Test_Mock_AssertExpectations", 1, 2, 3).Return(5, 6, 7) + + tt := new(testing.T) + assert.False(t, mockedService.AssertExpectations(tt)) + + // make the call now + mockedService.Called(1, 2, 3) + + // now assert expectations + assert.True(t, mockedService.AssertExpectations(tt)) + +} + +func Test_Mock_AssertExpectations_Placeholder_NoArgs(t *testing.T) { + + var mockedService = new(TestExampleImplementation) + + mockedService.On("Test_Mock_AssertExpectations_Placeholder_NoArgs").Return(5, 6, 7).Once() + mockedService.On("Test_Mock_AssertExpectations_Placeholder_NoArgs").Return(7, 6, 5) + + tt := new(testing.T) + assert.False(t, mockedService.AssertExpectations(tt)) + + // make the call now + mockedService.Called() + + // now assert expectations + assert.True(t, mockedService.AssertExpectations(tt)) + +} + +func Test_Mock_AssertExpectations_Placeholder(t *testing.T) { + + var mockedService = new(TestExampleImplementation) + + mockedService.On("Test_Mock_AssertExpectations_Placeholder", 1, 2, 3).Return(5, 6, 7).Once() + mockedService.On("Test_Mock_AssertExpectations_Placeholder", 3, 2, 1).Return(7, 6, 5) + + tt := new(testing.T) + assert.False(t, mockedService.AssertExpectations(tt)) + + // make the call now + mockedService.Called(1, 2, 3) + + // now assert expectations + assert.False(t, mockedService.AssertExpectations(tt)) + + // make call to the second expectation + mockedService.Called(3, 2, 1) + + // now assert expectations again + assert.True(t, mockedService.AssertExpectations(tt)) +} + +func Test_Mock_AssertExpectations_With_Pointers(t *testing.T) { + + var mockedService = new(TestExampleImplementation) + + mockedService.On("Test_Mock_AssertExpectations_With_Pointers", &struct{ Foo int }{1}).Return(1) + mockedService.On("Test_Mock_AssertExpectations_With_Pointers", &struct{ Foo int }{2}).Return(2) + + tt := new(testing.T) + assert.False(t, mockedService.AssertExpectations(tt)) + + s := struct{ Foo int }{1} + // make the calls now + mockedService.Called(&s) + s.Foo = 2 + mockedService.Called(&s) + + // now assert expectations + assert.True(t, mockedService.AssertExpectations(tt)) + +} + +func Test_Mock_AssertExpectationsCustomType(t *testing.T) { + + var mockedService = new(TestExampleImplementation) + + mockedService.On("TheExampleMethod3", AnythingOfType("*mock.ExampleType")).Return(nil).Once() + + tt := new(testing.T) + assert.False(t, mockedService.AssertExpectations(tt)) + + // make the call now + mockedService.TheExampleMethod3(&ExampleType{}) + + // now assert expectations + assert.True(t, mockedService.AssertExpectations(tt)) + +} + +func Test_Mock_AssertExpectations_With_Repeatability(t *testing.T) { + + var mockedService = new(TestExampleImplementation) + + mockedService.On("Test_Mock_AssertExpectations_With_Repeatability", 1, 2, 3).Return(5, 6, 7).Twice() + + tt := new(testing.T) + assert.False(t, mockedService.AssertExpectations(tt)) + + // make the call now + mockedService.Called(1, 2, 3) + + assert.False(t, mockedService.AssertExpectations(tt)) + + mockedService.Called(1, 2, 3) + + // now assert expectations + assert.True(t, mockedService.AssertExpectations(tt)) + +} + +func Test_Mock_TwoCallsWithDifferentArguments(t *testing.T) { + + var mockedService = new(TestExampleImplementation) + + mockedService.On("Test_Mock_TwoCallsWithDifferentArguments", 1, 2, 3).Return(5, 6, 7) + mockedService.On("Test_Mock_TwoCallsWithDifferentArguments", 4, 5, 6).Return(5, 6, 7) + + args1 := mockedService.Called(1, 2, 3) + assert.Equal(t, 5, args1.Int(0)) + assert.Equal(t, 6, args1.Int(1)) + assert.Equal(t, 7, args1.Int(2)) + + args2 := mockedService.Called(4, 5, 6) + assert.Equal(t, 5, args2.Int(0)) + assert.Equal(t, 6, args2.Int(1)) + assert.Equal(t, 7, args2.Int(2)) + +} + +func Test_Mock_AssertNumberOfCalls(t *testing.T) { + + var mockedService = new(TestExampleImplementation) + + mockedService.On("Test_Mock_AssertNumberOfCalls", 1, 2, 3).Return(5, 6, 7) + + mockedService.Called(1, 2, 3) + assert.True(t, mockedService.AssertNumberOfCalls(t, "Test_Mock_AssertNumberOfCalls", 1)) + + mockedService.Called(1, 2, 3) + assert.True(t, mockedService.AssertNumberOfCalls(t, "Test_Mock_AssertNumberOfCalls", 2)) + +} + +func Test_Mock_AssertCalled(t *testing.T) { + + var mockedService = new(TestExampleImplementation) + + mockedService.On("Test_Mock_AssertCalled", 1, 2, 3).Return(5, 6, 7) + + mockedService.Called(1, 2, 3) + + assert.True(t, mockedService.AssertCalled(t, "Test_Mock_AssertCalled", 1, 2, 3)) + +} + +func Test_Mock_AssertCalled_WithAnythingOfTypeArgument(t *testing.T) { + + var mockedService = new(TestExampleImplementation) + + mockedService. + On("Test_Mock_AssertCalled_WithAnythingOfTypeArgument", Anything, Anything, Anything). + Return() + + mockedService.Called(1, "two", []uint8("three")) + + assert.True(t, mockedService.AssertCalled(t, "Test_Mock_AssertCalled_WithAnythingOfTypeArgument", AnythingOfType("int"), AnythingOfType("string"), AnythingOfType("[]uint8"))) + +} + +func Test_Mock_AssertCalled_WithArguments(t *testing.T) { + + var mockedService = new(TestExampleImplementation) + + mockedService.On("Test_Mock_AssertCalled_WithArguments", 1, 2, 3).Return(5, 6, 7) + + mockedService.Called(1, 2, 3) + + tt := new(testing.T) + assert.True(t, mockedService.AssertCalled(tt, "Test_Mock_AssertCalled_WithArguments", 1, 2, 3)) + assert.False(t, mockedService.AssertCalled(tt, "Test_Mock_AssertCalled_WithArguments", 2, 3, 4)) + +} + +func Test_Mock_AssertCalled_WithArguments_With_Repeatability(t *testing.T) { + + var mockedService = new(TestExampleImplementation) + + mockedService.On("Test_Mock_AssertCalled_WithArguments_With_Repeatability", 1, 2, 3).Return(5, 6, 7).Once() + mockedService.On("Test_Mock_AssertCalled_WithArguments_With_Repeatability", 2, 3, 4).Return(5, 6, 7).Once() + + mockedService.Called(1, 2, 3) + mockedService.Called(2, 3, 4) + + tt := new(testing.T) + assert.True(t, mockedService.AssertCalled(tt, "Test_Mock_AssertCalled_WithArguments_With_Repeatability", 1, 2, 3)) + assert.True(t, mockedService.AssertCalled(tt, "Test_Mock_AssertCalled_WithArguments_With_Repeatability", 2, 3, 4)) + assert.False(t, mockedService.AssertCalled(tt, "Test_Mock_AssertCalled_WithArguments_With_Repeatability", 3, 4, 5)) + +} + +func Test_Mock_AssertNotCalled(t *testing.T) { + + var mockedService = new(TestExampleImplementation) + + mockedService.On("Test_Mock_AssertNotCalled", 1, 2, 3).Return(5, 6, 7) + + mockedService.Called(1, 2, 3) + + assert.True(t, mockedService.AssertNotCalled(t, "Test_Mock_NotCalled")) + +} + +/* + Arguments helper methods +*/ +func Test_Arguments_Get(t *testing.T) { + + var args = Arguments([]interface{}{"string", 123, true}) + + assert.Equal(t, "string", args.Get(0).(string)) + assert.Equal(t, 123, args.Get(1).(int)) + assert.Equal(t, true, args.Get(2).(bool)) + +} + +func Test_Arguments_Is(t *testing.T) { + + var args = Arguments([]interface{}{"string", 123, true}) + + assert.True(t, args.Is("string", 123, true)) + assert.False(t, args.Is("wrong", 456, false)) + +} + +func Test_Arguments_Diff(t *testing.T) { + + var args = Arguments([]interface{}{"Hello World", 123, true}) + var diff string + var count int + diff, count = args.Diff([]interface{}{"Hello World", 456, "false"}) + + assert.Equal(t, 2, count) + assert.Contains(t, diff, `%!s(int=456) != %!s(int=123)`) + assert.Contains(t, diff, `false != %!s(bool=true)`) + +} + +func Test_Arguments_Diff_DifferentNumberOfArgs(t *testing.T) { + + var args = Arguments([]interface{}{"string", 123, true}) + var diff string + var count int + diff, count = args.Diff([]interface{}{"string", 456, "false", "extra"}) + + assert.Equal(t, 3, count) + assert.Contains(t, diff, `extra != (Missing)`) + +} + +func Test_Arguments_Diff_WithAnythingArgument(t *testing.T) { + + var args = Arguments([]interface{}{"string", 123, true}) + var count int + _, count = args.Diff([]interface{}{"string", Anything, true}) + + assert.Equal(t, 0, count) + +} + +func Test_Arguments_Diff_WithAnythingArgument_InActualToo(t *testing.T) { + + var args = Arguments([]interface{}{"string", Anything, true}) + var count int + _, count = args.Diff([]interface{}{"string", 123, true}) + + assert.Equal(t, 0, count) + +} + +func Test_Arguments_Diff_WithAnythingOfTypeArgument(t *testing.T) { + + var args = Arguments([]interface{}{"string", AnythingOfType("int"), true}) + var count int + _, count = args.Diff([]interface{}{"string", 123, true}) + + assert.Equal(t, 0, count) + +} + +func Test_Arguments_Diff_WithAnythingOfTypeArgument_Failing(t *testing.T) { + + var args = Arguments([]interface{}{"string", AnythingOfType("string"), true}) + var count int + var diff string + diff, count = args.Diff([]interface{}{"string", 123, true}) + + assert.Equal(t, 1, count) + assert.Contains(t, diff, `string != type int - %!s(int=123)`) + +} + +func Test_Arguments_Diff_WithArgMatcher(t *testing.T) { + matchFn := func(a int) bool { + return a == 123 + } + var args = Arguments([]interface{}{"string", MatchedBy(matchFn), true}) + + diff, count := args.Diff([]interface{}{"string", 124, true}) + assert.Equal(t, 1, count) + assert.Contains(t, diff, `%!s(int=124) not matched by func(int) bool`) + + diff, count = args.Diff([]interface{}{"string", false, true}) + assert.Equal(t, 1, count) + assert.Contains(t, diff, `%!s(bool=false) not matched by func(int) bool`) + + diff, count = args.Diff([]interface{}{"string", 123, false}) + assert.Contains(t, diff, `%!s(int=123) matched by func(int) bool`) + + diff, count = args.Diff([]interface{}{"string", 123, true}) + assert.Equal(t, 0, count) + assert.Contains(t, diff, `No differences.`) +} + +func Test_Arguments_Assert(t *testing.T) { + + var args = Arguments([]interface{}{"string", 123, true}) + + assert.True(t, args.Assert(t, "string", 123, true)) + +} + +func Test_Arguments_String_Representation(t *testing.T) { + + var args = Arguments([]interface{}{"string", 123, true}) + assert.Equal(t, `string,int,bool`, args.String()) + +} + +func Test_Arguments_String(t *testing.T) { + + var args = Arguments([]interface{}{"string", 123, true}) + assert.Equal(t, "string", args.String(0)) + +} + +func Test_Arguments_Error(t *testing.T) { + + var err = errors.New("An Error") + var args = Arguments([]interface{}{"string", 123, true, err}) + assert.Equal(t, err, args.Error(3)) + +} + +func Test_Arguments_Error_Nil(t *testing.T) { + + var args = Arguments([]interface{}{"string", 123, true, nil}) + assert.Equal(t, nil, args.Error(3)) + +} + +func Test_Arguments_Int(t *testing.T) { + + var args = Arguments([]interface{}{"string", 123, true}) + assert.Equal(t, 123, args.Int(1)) + +} + +func Test_Arguments_Bool(t *testing.T) { + + var args = Arguments([]interface{}{"string", 123, true}) + assert.Equal(t, true, args.Bool(2)) + +} diff --git a/vendor/github.com/stretchr/testify/package_test.go b/vendor/github.com/stretchr/testify/package_test.go new file mode 100644 index 000000000..7ac5d6d8e --- /dev/null +++ b/vendor/github.com/stretchr/testify/package_test.go @@ -0,0 +1,12 @@ +package testify + +import ( + "github.com/stretchr/testify/assert" + "testing" +) + +func TestImports(t *testing.T) { + if assert.Equal(t, 1, 1) != true { + t.Error("Something is wrong.") + } +} diff --git a/vendor/github.com/stretchr/testify/require/doc.go b/vendor/github.com/stretchr/testify/require/doc.go new file mode 100644 index 000000000..169de3922 --- /dev/null +++ b/vendor/github.com/stretchr/testify/require/doc.go @@ -0,0 +1,28 @@ +// Package require implements the same assertions as the `assert` package but +// stops test execution when a test fails. +// +// Example Usage +// +// The following is a complete example using require in a standard test function: +// import ( +// "testing" +// "github.com/stretchr/testify/require" +// ) +// +// func TestSomething(t *testing.T) { +// +// var a string = "Hello" +// var b string = "Hello" +// +// require.Equal(t, a, b, "The two words should be the same.") +// +// } +// +// Assertions +// +// The `require` package have same global functions as in the `assert` package, +// but instead of returning a boolean result they call `t.FailNow()`. +// +// Every assertion function also takes an optional string message as the final argument, +// allowing custom error messages to be appended to the message the assertion method outputs. +package require diff --git a/vendor/github.com/stretchr/testify/require/forward_requirements.go b/vendor/github.com/stretchr/testify/require/forward_requirements.go new file mode 100644 index 000000000..d3c2ab9bc --- /dev/null +++ b/vendor/github.com/stretchr/testify/require/forward_requirements.go @@ -0,0 +1,16 @@ +package require + +// Assertions provides assertion methods around the +// TestingT interface. +type Assertions struct { + t TestingT +} + +// New makes a new Assertions object for the specified TestingT. +func New(t TestingT) *Assertions { + return &Assertions{ + t: t, + } +} + +//go:generate go run ../_codegen/main.go -output-package=require -template=require_forward.go.tmpl diff --git a/vendor/github.com/stretchr/testify/require/forward_requirements_test.go b/vendor/github.com/stretchr/testify/require/forward_requirements_test.go new file mode 100644 index 000000000..b120ae3b8 --- /dev/null +++ b/vendor/github.com/stretchr/testify/require/forward_requirements_test.go @@ -0,0 +1,385 @@ +package require + +import ( + "errors" + "testing" + "time" +) + +func TestImplementsWrapper(t *testing.T) { + require := New(t) + + require.Implements((*AssertionTesterInterface)(nil), new(AssertionTesterConformingObject)) + + mockT := new(MockT) + mockRequire := New(mockT) + mockRequire.Implements((*AssertionTesterInterface)(nil), new(AssertionTesterNonConformingObject)) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestIsTypeWrapper(t *testing.T) { + require := New(t) + require.IsType(new(AssertionTesterConformingObject), new(AssertionTesterConformingObject)) + + mockT := new(MockT) + mockRequire := New(mockT) + mockRequire.IsType(new(AssertionTesterConformingObject), new(AssertionTesterNonConformingObject)) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestEqualWrapper(t *testing.T) { + require := New(t) + require.Equal(1, 1) + + mockT := new(MockT) + mockRequire := New(mockT) + mockRequire.Equal(1, 2) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestNotEqualWrapper(t *testing.T) { + require := New(t) + require.NotEqual(1, 2) + + mockT := new(MockT) + mockRequire := New(mockT) + mockRequire.NotEqual(2, 2) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestExactlyWrapper(t *testing.T) { + require := New(t) + + a := float32(1) + b := float32(1) + c := float64(1) + + require.Exactly(a, b) + + mockT := new(MockT) + mockRequire := New(mockT) + mockRequire.Exactly(a, c) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestNotNilWrapper(t *testing.T) { + require := New(t) + require.NotNil(t, new(AssertionTesterConformingObject)) + + mockT := new(MockT) + mockRequire := New(mockT) + mockRequire.NotNil(nil) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestNilWrapper(t *testing.T) { + require := New(t) + require.Nil(nil) + + mockT := new(MockT) + mockRequire := New(mockT) + mockRequire.Nil(new(AssertionTesterConformingObject)) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestTrueWrapper(t *testing.T) { + require := New(t) + require.True(true) + + mockT := new(MockT) + mockRequire := New(mockT) + mockRequire.True(false) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestFalseWrapper(t *testing.T) { + require := New(t) + require.False(false) + + mockT := new(MockT) + mockRequire := New(mockT) + mockRequire.False(true) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestContainsWrapper(t *testing.T) { + require := New(t) + require.Contains("Hello World", "Hello") + + mockT := new(MockT) + mockRequire := New(mockT) + mockRequire.Contains("Hello World", "Salut") + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestNotContainsWrapper(t *testing.T) { + require := New(t) + require.NotContains("Hello World", "Hello!") + + mockT := new(MockT) + mockRequire := New(mockT) + mockRequire.NotContains("Hello World", "Hello") + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestPanicsWrapper(t *testing.T) { + require := New(t) + require.Panics(func() { + panic("Panic!") + }) + + mockT := new(MockT) + mockRequire := New(mockT) + mockRequire.Panics(func() {}) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestNotPanicsWrapper(t *testing.T) { + require := New(t) + require.NotPanics(func() {}) + + mockT := new(MockT) + mockRequire := New(mockT) + mockRequire.NotPanics(func() { + panic("Panic!") + }) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestNoErrorWrapper(t *testing.T) { + require := New(t) + require.NoError(nil) + + mockT := new(MockT) + mockRequire := New(mockT) + mockRequire.NoError(errors.New("some error")) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestErrorWrapper(t *testing.T) { + require := New(t) + require.Error(errors.New("some error")) + + mockT := new(MockT) + mockRequire := New(mockT) + mockRequire.Error(nil) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestEqualErrorWrapper(t *testing.T) { + require := New(t) + require.EqualError(errors.New("some error"), "some error") + + mockT := new(MockT) + mockRequire := New(mockT) + mockRequire.EqualError(errors.New("some error"), "Not some error") + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestEmptyWrapper(t *testing.T) { + require := New(t) + require.Empty("") + + mockT := new(MockT) + mockRequire := New(mockT) + mockRequire.Empty("x") + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestNotEmptyWrapper(t *testing.T) { + require := New(t) + require.NotEmpty("x") + + mockT := new(MockT) + mockRequire := New(mockT) + mockRequire.NotEmpty("") + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestWithinDurationWrapper(t *testing.T) { + require := New(t) + a := time.Now() + b := a.Add(10 * time.Second) + + require.WithinDuration(a, b, 15*time.Second) + + mockT := new(MockT) + mockRequire := New(mockT) + mockRequire.WithinDuration(a, b, 5*time.Second) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestInDeltaWrapper(t *testing.T) { + require := New(t) + require.InDelta(1.001, 1, 0.01) + + mockT := new(MockT) + mockRequire := New(mockT) + mockRequire.InDelta(1, 2, 0.5) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestZeroWrapper(t *testing.T) { + require := New(t) + require.Zero(0) + + mockT := new(MockT) + mockRequire := New(mockT) + mockRequire.Zero(1) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestNotZeroWrapper(t *testing.T) { + require := New(t) + require.NotZero(1) + + mockT := new(MockT) + mockRequire := New(mockT) + mockRequire.NotZero(0) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestJSONEqWrapper_EqualSONString(t *testing.T) { + mockT := new(MockT) + mockRequire := New(mockT) + + mockRequire.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"hello": "world", "foo": "bar"}`) + if mockT.Failed { + t.Error("Check should pass") + } +} + +func TestJSONEqWrapper_EquivalentButNotEqual(t *testing.T) { + mockT := new(MockT) + mockRequire := New(mockT) + + mockRequire.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) + if mockT.Failed { + t.Error("Check should pass") + } +} + +func TestJSONEqWrapper_HashOfArraysAndHashes(t *testing.T) { + mockT := new(MockT) + mockRequire := New(mockT) + + mockRequire.JSONEq("{\r\n\t\"numeric\": 1.5,\r\n\t\"array\": [{\"foo\": \"bar\"}, 1, \"string\", [\"nested\", \"array\", 5.5]],\r\n\t\"hash\": {\"nested\": \"hash\", \"nested_slice\": [\"this\", \"is\", \"nested\"]},\r\n\t\"string\": \"foo\"\r\n}", + "{\r\n\t\"numeric\": 1.5,\r\n\t\"hash\": {\"nested\": \"hash\", \"nested_slice\": [\"this\", \"is\", \"nested\"]},\r\n\t\"string\": \"foo\",\r\n\t\"array\": [{\"foo\": \"bar\"}, 1, \"string\", [\"nested\", \"array\", 5.5]]\r\n}") + if mockT.Failed { + t.Error("Check should pass") + } +} + +func TestJSONEqWrapper_Array(t *testing.T) { + mockT := new(MockT) + mockRequire := New(mockT) + + mockRequire.JSONEq(`["foo", {"hello": "world", "nested": "hash"}]`, `["foo", {"nested": "hash", "hello": "world"}]`) + if mockT.Failed { + t.Error("Check should pass") + } +} + +func TestJSONEqWrapper_HashAndArrayNotEquivalent(t *testing.T) { + mockT := new(MockT) + mockRequire := New(mockT) + + mockRequire.JSONEq(`["foo", {"hello": "world", "nested": "hash"}]`, `{"foo": "bar", {"nested": "hash", "hello": "world"}}`) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestJSONEqWrapper_HashesNotEquivalent(t *testing.T) { + mockT := new(MockT) + mockRequire := New(mockT) + + mockRequire.JSONEq(`{"foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestJSONEqWrapper_ActualIsNotJSON(t *testing.T) { + mockT := new(MockT) + mockRequire := New(mockT) + + mockRequire.JSONEq(`{"foo": "bar"}`, "Not JSON") + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestJSONEqWrapper_ExpectedIsNotJSON(t *testing.T) { + mockT := new(MockT) + mockRequire := New(mockT) + + mockRequire.JSONEq("Not JSON", `{"foo": "bar", "hello": "world"}`) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestJSONEqWrapper_ExpectedAndActualNotJSON(t *testing.T) { + mockT := new(MockT) + mockRequire := New(mockT) + + mockRequire.JSONEq("Not JSON", "Not JSON") + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestJSONEqWrapper_ArraysOfDifferentOrder(t *testing.T) { + mockT := new(MockT) + mockRequire := New(mockT) + + mockRequire.JSONEq(`["foo", {"hello": "world", "nested": "hash"}]`, `[{ "hello": "world", "nested": "hash"}, "foo"]`) + if !mockT.Failed { + t.Error("Check should fail") + } +} diff --git a/vendor/github.com/stretchr/testify/require/require.go b/vendor/github.com/stretchr/testify/require/require.go new file mode 100644 index 000000000..1bcfcb0d9 --- /dev/null +++ b/vendor/github.com/stretchr/testify/require/require.go @@ -0,0 +1,464 @@ +/* +* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen +* THIS FILE MUST NOT BE EDITED BY HAND +*/ + +package require + +import ( + + assert "github.com/stretchr/testify/assert" + http "net/http" + url "net/url" + time "time" +) + + +// Condition uses a Comparison to assert a complex condition. +func Condition(t TestingT, comp assert.Comparison, msgAndArgs ...interface{}) { + if !assert.Condition(t, comp, msgAndArgs...) { + t.FailNow() + } +} + + +// Contains asserts that the specified string, list(array, slice...) or map contains the +// specified substring or element. +// +// assert.Contains(t, "Hello World", "World", "But 'Hello World' does contain 'World'") +// assert.Contains(t, ["Hello", "World"], "World", "But ["Hello", "World"] does contain 'World'") +// assert.Contains(t, {"Hello": "World"}, "Hello", "But {'Hello': 'World'} does contain 'Hello'") +// +// Returns whether the assertion was successful (true) or not (false). +func Contains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) { + if !assert.Contains(t, s, contains, msgAndArgs...) { + t.FailNow() + } +} + + +// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// assert.Empty(t, obj) +// +// Returns whether the assertion was successful (true) or not (false). +func Empty(t TestingT, object interface{}, msgAndArgs ...interface{}) { + if !assert.Empty(t, object, msgAndArgs...) { + t.FailNow() + } +} + + +// Equal asserts that two objects are equal. +// +// assert.Equal(t, 123, 123, "123 and 123 should be equal") +// +// Returns whether the assertion was successful (true) or not (false). +func Equal(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if !assert.Equal(t, expected, actual, msgAndArgs...) { + t.FailNow() + } +} + + +// EqualError asserts that a function returned an error (i.e. not `nil`) +// and that it is equal to the provided error. +// +// actualObj, err := SomeFunction() +// if assert.Error(t, err, "An error was expected") { +// assert.Equal(t, err, expectedError) +// } +// +// Returns whether the assertion was successful (true) or not (false). +func EqualError(t TestingT, theError error, errString string, msgAndArgs ...interface{}) { + if !assert.EqualError(t, theError, errString, msgAndArgs...) { + t.FailNow() + } +} + + +// EqualValues asserts that two objects are equal or convertable to the same types +// and equal. +// +// assert.EqualValues(t, uint32(123), int32(123), "123 and 123 should be equal") +// +// Returns whether the assertion was successful (true) or not (false). +func EqualValues(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if !assert.EqualValues(t, expected, actual, msgAndArgs...) { + t.FailNow() + } +} + + +// Error asserts that a function returned an error (i.e. not `nil`). +// +// actualObj, err := SomeFunction() +// if assert.Error(t, err, "An error was expected") { +// assert.Equal(t, err, expectedError) +// } +// +// Returns whether the assertion was successful (true) or not (false). +func Error(t TestingT, err error, msgAndArgs ...interface{}) { + if !assert.Error(t, err, msgAndArgs...) { + t.FailNow() + } +} + + +// Exactly asserts that two objects are equal is value and type. +// +// assert.Exactly(t, int32(123), int64(123), "123 and 123 should NOT be equal") +// +// Returns whether the assertion was successful (true) or not (false). +func Exactly(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if !assert.Exactly(t, expected, actual, msgAndArgs...) { + t.FailNow() + } +} + + +// Fail reports a failure through +func Fail(t TestingT, failureMessage string, msgAndArgs ...interface{}) { + if !assert.Fail(t, failureMessage, msgAndArgs...) { + t.FailNow() + } +} + + +// FailNow fails test +func FailNow(t TestingT, failureMessage string, msgAndArgs ...interface{}) { + if !assert.FailNow(t, failureMessage, msgAndArgs...) { + t.FailNow() + } +} + + +// False asserts that the specified value is false. +// +// assert.False(t, myBool, "myBool should be false") +// +// Returns whether the assertion was successful (true) or not (false). +func False(t TestingT, value bool, msgAndArgs ...interface{}) { + if !assert.False(t, value, msgAndArgs...) { + t.FailNow() + } +} + + +// HTTPBodyContains asserts that a specified handler returns a +// body that contains a string. +// +// assert.HTTPBodyContains(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky") +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPBodyContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) { + if !assert.HTTPBodyContains(t, handler, method, url, values, str) { + t.FailNow() + } +} + + +// HTTPBodyNotContains asserts that a specified handler returns a +// body that does not contain a string. +// +// assert.HTTPBodyNotContains(t, myHandler, "www.google.com", nil, "I'm Feeling Lucky") +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPBodyNotContains(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) { + if !assert.HTTPBodyNotContains(t, handler, method, url, values, str) { + t.FailNow() + } +} + + +// HTTPError asserts that a specified handler returns an error status code. +// +// assert.HTTPError(t, myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPError(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values) { + if !assert.HTTPError(t, handler, method, url, values) { + t.FailNow() + } +} + + +// HTTPRedirect asserts that a specified handler returns a redirect status code. +// +// assert.HTTPRedirect(t, myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPRedirect(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values) { + if !assert.HTTPRedirect(t, handler, method, url, values) { + t.FailNow() + } +} + + +// HTTPSuccess asserts that a specified handler returns a success status code. +// +// assert.HTTPSuccess(t, myHandler, "POST", "http://www.google.com", nil) +// +// Returns whether the assertion was successful (true) or not (false). +func HTTPSuccess(t TestingT, handler http.HandlerFunc, method string, url string, values url.Values) { + if !assert.HTTPSuccess(t, handler, method, url, values) { + t.FailNow() + } +} + + +// Implements asserts that an object is implemented by the specified interface. +// +// assert.Implements(t, (*MyInterface)(nil), new(MyObject), "MyObject") +func Implements(t TestingT, interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) { + if !assert.Implements(t, interfaceObject, object, msgAndArgs...) { + t.FailNow() + } +} + + +// InDelta asserts that the two numerals are within delta of each other. +// +// assert.InDelta(t, math.Pi, (22 / 7.0), 0.01) +// +// Returns whether the assertion was successful (true) or not (false). +func InDelta(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { + if !assert.InDelta(t, expected, actual, delta, msgAndArgs...) { + t.FailNow() + } +} + + +// InDeltaSlice is the same as InDelta, except it compares two slices. +func InDeltaSlice(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { + if !assert.InDeltaSlice(t, expected, actual, delta, msgAndArgs...) { + t.FailNow() + } +} + + +// InEpsilon asserts that expected and actual have a relative error less than epsilon +// +// Returns whether the assertion was successful (true) or not (false). +func InEpsilon(t TestingT, expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) { + if !assert.InEpsilon(t, expected, actual, epsilon, msgAndArgs...) { + t.FailNow() + } +} + + +// InEpsilonSlice is the same as InEpsilon, except it compares two slices. +func InEpsilonSlice(t TestingT, expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { + if !assert.InEpsilonSlice(t, expected, actual, delta, msgAndArgs...) { + t.FailNow() + } +} + + +// IsType asserts that the specified objects are of the same type. +func IsType(t TestingT, expectedType interface{}, object interface{}, msgAndArgs ...interface{}) { + if !assert.IsType(t, expectedType, object, msgAndArgs...) { + t.FailNow() + } +} + + +// JSONEq asserts that two JSON strings are equivalent. +// +// assert.JSONEq(t, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) +// +// Returns whether the assertion was successful (true) or not (false). +func JSONEq(t TestingT, expected string, actual string, msgAndArgs ...interface{}) { + if !assert.JSONEq(t, expected, actual, msgAndArgs...) { + t.FailNow() + } +} + + +// Len asserts that the specified object has specific length. +// Len also fails if the object has a type that len() not accept. +// +// assert.Len(t, mySlice, 3, "The size of slice is not 3") +// +// Returns whether the assertion was successful (true) or not (false). +func Len(t TestingT, object interface{}, length int, msgAndArgs ...interface{}) { + if !assert.Len(t, object, length, msgAndArgs...) { + t.FailNow() + } +} + + +// Nil asserts that the specified object is nil. +// +// assert.Nil(t, err, "err should be nothing") +// +// Returns whether the assertion was successful (true) or not (false). +func Nil(t TestingT, object interface{}, msgAndArgs ...interface{}) { + if !assert.Nil(t, object, msgAndArgs...) { + t.FailNow() + } +} + + +// NoError asserts that a function returned no error (i.e. `nil`). +// +// actualObj, err := SomeFunction() +// if assert.NoError(t, err) { +// assert.Equal(t, actualObj, expectedObj) +// } +// +// Returns whether the assertion was successful (true) or not (false). +func NoError(t TestingT, err error, msgAndArgs ...interface{}) { + if !assert.NoError(t, err, msgAndArgs...) { + t.FailNow() + } +} + + +// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the +// specified substring or element. +// +// assert.NotContains(t, "Hello World", "Earth", "But 'Hello World' does NOT contain 'Earth'") +// assert.NotContains(t, ["Hello", "World"], "Earth", "But ['Hello', 'World'] does NOT contain 'Earth'") +// assert.NotContains(t, {"Hello": "World"}, "Earth", "But {'Hello': 'World'} does NOT contain 'Earth'") +// +// Returns whether the assertion was successful (true) or not (false). +func NotContains(t TestingT, s interface{}, contains interface{}, msgAndArgs ...interface{}) { + if !assert.NotContains(t, s, contains, msgAndArgs...) { + t.FailNow() + } +} + + +// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// if assert.NotEmpty(t, obj) { +// assert.Equal(t, "two", obj[1]) +// } +// +// Returns whether the assertion was successful (true) or not (false). +func NotEmpty(t TestingT, object interface{}, msgAndArgs ...interface{}) { + if !assert.NotEmpty(t, object, msgAndArgs...) { + t.FailNow() + } +} + + +// NotEqual asserts that the specified values are NOT equal. +// +// assert.NotEqual(t, obj1, obj2, "two objects shouldn't be equal") +// +// Returns whether the assertion was successful (true) or not (false). +func NotEqual(t TestingT, expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + if !assert.NotEqual(t, expected, actual, msgAndArgs...) { + t.FailNow() + } +} + + +// NotNil asserts that the specified object is not nil. +// +// assert.NotNil(t, err, "err should be something") +// +// Returns whether the assertion was successful (true) or not (false). +func NotNil(t TestingT, object interface{}, msgAndArgs ...interface{}) { + if !assert.NotNil(t, object, msgAndArgs...) { + t.FailNow() + } +} + + +// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. +// +// assert.NotPanics(t, func(){ +// RemainCalm() +// }, "Calling RemainCalm() should NOT panic") +// +// Returns whether the assertion was successful (true) or not (false). +func NotPanics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) { + if !assert.NotPanics(t, f, msgAndArgs...) { + t.FailNow() + } +} + + +// NotRegexp asserts that a specified regexp does not match a string. +// +// assert.NotRegexp(t, regexp.MustCompile("starts"), "it's starting") +// assert.NotRegexp(t, "^start", "it's not starting") +// +// Returns whether the assertion was successful (true) or not (false). +func NotRegexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) { + if !assert.NotRegexp(t, rx, str, msgAndArgs...) { + t.FailNow() + } +} + + +// NotZero asserts that i is not the zero value for its type and returns the truth. +func NotZero(t TestingT, i interface{}, msgAndArgs ...interface{}) { + if !assert.NotZero(t, i, msgAndArgs...) { + t.FailNow() + } +} + + +// Panics asserts that the code inside the specified PanicTestFunc panics. +// +// assert.Panics(t, func(){ +// GoCrazy() +// }, "Calling GoCrazy() should panic") +// +// Returns whether the assertion was successful (true) or not (false). +func Panics(t TestingT, f assert.PanicTestFunc, msgAndArgs ...interface{}) { + if !assert.Panics(t, f, msgAndArgs...) { + t.FailNow() + } +} + + +// Regexp asserts that a specified regexp matches a string. +// +// assert.Regexp(t, regexp.MustCompile("start"), "it's starting") +// assert.Regexp(t, "start...$", "it's not starting") +// +// Returns whether the assertion was successful (true) or not (false). +func Regexp(t TestingT, rx interface{}, str interface{}, msgAndArgs ...interface{}) { + if !assert.Regexp(t, rx, str, msgAndArgs...) { + t.FailNow() + } +} + + +// True asserts that the specified value is true. +// +// assert.True(t, myBool, "myBool should be true") +// +// Returns whether the assertion was successful (true) or not (false). +func True(t TestingT, value bool, msgAndArgs ...interface{}) { + if !assert.True(t, value, msgAndArgs...) { + t.FailNow() + } +} + + +// WithinDuration asserts that the two times are within duration delta of each other. +// +// assert.WithinDuration(t, time.Now(), time.Now(), 10*time.Second, "The difference should not be more than 10s") +// +// Returns whether the assertion was successful (true) or not (false). +func WithinDuration(t TestingT, expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) { + if !assert.WithinDuration(t, expected, actual, delta, msgAndArgs...) { + t.FailNow() + } +} + + +// Zero asserts that i is the zero value for its type and returns the truth. +func Zero(t TestingT, i interface{}, msgAndArgs ...interface{}) { + if !assert.Zero(t, i, msgAndArgs...) { + t.FailNow() + } +} diff --git a/vendor/github.com/stretchr/testify/require/require.go.tmpl b/vendor/github.com/stretchr/testify/require/require.go.tmpl new file mode 100644 index 000000000..ab1b1e9fd --- /dev/null +++ b/vendor/github.com/stretchr/testify/require/require.go.tmpl @@ -0,0 +1,6 @@ +{{.Comment}} +func {{.DocInfo.Name}}(t TestingT, {{.Params}}) { + if !assert.{{.DocInfo.Name}}(t, {{.ForwardedParams}}) { + t.FailNow() + } +} diff --git a/vendor/github.com/stretchr/testify/require/require_forward.go b/vendor/github.com/stretchr/testify/require/require_forward.go new file mode 100644 index 000000000..58324f105 --- /dev/null +++ b/vendor/github.com/stretchr/testify/require/require_forward.go @@ -0,0 +1,388 @@ +/* +* CODE GENERATED AUTOMATICALLY WITH github.com/stretchr/testify/_codegen +* THIS FILE MUST NOT BE EDITED BY HAND +*/ + +package require + +import ( + + assert "github.com/stretchr/testify/assert" + http "net/http" + url "net/url" + time "time" +) + + +// Condition uses a Comparison to assert a complex condition. +func (a *Assertions) Condition(comp assert.Comparison, msgAndArgs ...interface{}) { + Condition(a.t, comp, msgAndArgs...) +} + + +// Contains asserts that the specified string, list(array, slice...) or map contains the +// specified substring or element. +// +// a.Contains("Hello World", "World", "But 'Hello World' does contain 'World'") +// a.Contains(["Hello", "World"], "World", "But ["Hello", "World"] does contain 'World'") +// a.Contains({"Hello": "World"}, "Hello", "But {'Hello': 'World'} does contain 'Hello'") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Contains(s interface{}, contains interface{}, msgAndArgs ...interface{}) { + Contains(a.t, s, contains, msgAndArgs...) +} + + +// Empty asserts that the specified object is empty. I.e. nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// a.Empty(obj) +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Empty(object interface{}, msgAndArgs ...interface{}) { + Empty(a.t, object, msgAndArgs...) +} + + +// Equal asserts that two objects are equal. +// +// a.Equal(123, 123, "123 and 123 should be equal") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Equal(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + Equal(a.t, expected, actual, msgAndArgs...) +} + + +// EqualError asserts that a function returned an error (i.e. not `nil`) +// and that it is equal to the provided error. +// +// actualObj, err := SomeFunction() +// if assert.Error(t, err, "An error was expected") { +// assert.Equal(t, err, expectedError) +// } +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) EqualError(theError error, errString string, msgAndArgs ...interface{}) { + EqualError(a.t, theError, errString, msgAndArgs...) +} + + +// EqualValues asserts that two objects are equal or convertable to the same types +// and equal. +// +// a.EqualValues(uint32(123), int32(123), "123 and 123 should be equal") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) EqualValues(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + EqualValues(a.t, expected, actual, msgAndArgs...) +} + + +// Error asserts that a function returned an error (i.e. not `nil`). +// +// actualObj, err := SomeFunction() +// if a.Error(err, "An error was expected") { +// assert.Equal(t, err, expectedError) +// } +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Error(err error, msgAndArgs ...interface{}) { + Error(a.t, err, msgAndArgs...) +} + + +// Exactly asserts that two objects are equal is value and type. +// +// a.Exactly(int32(123), int64(123), "123 and 123 should NOT be equal") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Exactly(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + Exactly(a.t, expected, actual, msgAndArgs...) +} + + +// Fail reports a failure through +func (a *Assertions) Fail(failureMessage string, msgAndArgs ...interface{}) { + Fail(a.t, failureMessage, msgAndArgs...) +} + + +// FailNow fails test +func (a *Assertions) FailNow(failureMessage string, msgAndArgs ...interface{}) { + FailNow(a.t, failureMessage, msgAndArgs...) +} + + +// False asserts that the specified value is false. +// +// a.False(myBool, "myBool should be false") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) False(value bool, msgAndArgs ...interface{}) { + False(a.t, value, msgAndArgs...) +} + + +// HTTPBodyContains asserts that a specified handler returns a +// body that contains a string. +// +// a.HTTPBodyContains(myHandler, "www.google.com", nil, "I'm Feeling Lucky") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPBodyContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) { + HTTPBodyContains(a.t, handler, method, url, values, str) +} + + +// HTTPBodyNotContains asserts that a specified handler returns a +// body that does not contain a string. +// +// a.HTTPBodyNotContains(myHandler, "www.google.com", nil, "I'm Feeling Lucky") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPBodyNotContains(handler http.HandlerFunc, method string, url string, values url.Values, str interface{}) { + HTTPBodyNotContains(a.t, handler, method, url, values, str) +} + + +// HTTPError asserts that a specified handler returns an error status code. +// +// a.HTTPError(myHandler, "POST", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPError(handler http.HandlerFunc, method string, url string, values url.Values) { + HTTPError(a.t, handler, method, url, values) +} + + +// HTTPRedirect asserts that a specified handler returns a redirect status code. +// +// a.HTTPRedirect(myHandler, "GET", "/a/b/c", url.Values{"a": []string{"b", "c"}} +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPRedirect(handler http.HandlerFunc, method string, url string, values url.Values) { + HTTPRedirect(a.t, handler, method, url, values) +} + + +// HTTPSuccess asserts that a specified handler returns a success status code. +// +// a.HTTPSuccess(myHandler, "POST", "http://www.google.com", nil) +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) HTTPSuccess(handler http.HandlerFunc, method string, url string, values url.Values) { + HTTPSuccess(a.t, handler, method, url, values) +} + + +// Implements asserts that an object is implemented by the specified interface. +// +// a.Implements((*MyInterface)(nil), new(MyObject), "MyObject") +func (a *Assertions) Implements(interfaceObject interface{}, object interface{}, msgAndArgs ...interface{}) { + Implements(a.t, interfaceObject, object, msgAndArgs...) +} + + +// InDelta asserts that the two numerals are within delta of each other. +// +// a.InDelta(math.Pi, (22 / 7.0), 0.01) +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) InDelta(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { + InDelta(a.t, expected, actual, delta, msgAndArgs...) +} + + +// InDeltaSlice is the same as InDelta, except it compares two slices. +func (a *Assertions) InDeltaSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { + InDeltaSlice(a.t, expected, actual, delta, msgAndArgs...) +} + + +// InEpsilon asserts that expected and actual have a relative error less than epsilon +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) InEpsilon(expected interface{}, actual interface{}, epsilon float64, msgAndArgs ...interface{}) { + InEpsilon(a.t, expected, actual, epsilon, msgAndArgs...) +} + + +// InEpsilonSlice is the same as InEpsilon, except it compares two slices. +func (a *Assertions) InEpsilonSlice(expected interface{}, actual interface{}, delta float64, msgAndArgs ...interface{}) { + InEpsilonSlice(a.t, expected, actual, delta, msgAndArgs...) +} + + +// IsType asserts that the specified objects are of the same type. +func (a *Assertions) IsType(expectedType interface{}, object interface{}, msgAndArgs ...interface{}) { + IsType(a.t, expectedType, object, msgAndArgs...) +} + + +// JSONEq asserts that two JSON strings are equivalent. +// +// a.JSONEq(`{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) JSONEq(expected string, actual string, msgAndArgs ...interface{}) { + JSONEq(a.t, expected, actual, msgAndArgs...) +} + + +// Len asserts that the specified object has specific length. +// Len also fails if the object has a type that len() not accept. +// +// a.Len(mySlice, 3, "The size of slice is not 3") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Len(object interface{}, length int, msgAndArgs ...interface{}) { + Len(a.t, object, length, msgAndArgs...) +} + + +// Nil asserts that the specified object is nil. +// +// a.Nil(err, "err should be nothing") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Nil(object interface{}, msgAndArgs ...interface{}) { + Nil(a.t, object, msgAndArgs...) +} + + +// NoError asserts that a function returned no error (i.e. `nil`). +// +// actualObj, err := SomeFunction() +// if a.NoError(err) { +// assert.Equal(t, actualObj, expectedObj) +// } +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) NoError(err error, msgAndArgs ...interface{}) { + NoError(a.t, err, msgAndArgs...) +} + + +// NotContains asserts that the specified string, list(array, slice...) or map does NOT contain the +// specified substring or element. +// +// a.NotContains("Hello World", "Earth", "But 'Hello World' does NOT contain 'Earth'") +// a.NotContains(["Hello", "World"], "Earth", "But ['Hello', 'World'] does NOT contain 'Earth'") +// a.NotContains({"Hello": "World"}, "Earth", "But {'Hello': 'World'} does NOT contain 'Earth'") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) NotContains(s interface{}, contains interface{}, msgAndArgs ...interface{}) { + NotContains(a.t, s, contains, msgAndArgs...) +} + + +// NotEmpty asserts that the specified object is NOT empty. I.e. not nil, "", false, 0 or either +// a slice or a channel with len == 0. +// +// if a.NotEmpty(obj) { +// assert.Equal(t, "two", obj[1]) +// } +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) NotEmpty(object interface{}, msgAndArgs ...interface{}) { + NotEmpty(a.t, object, msgAndArgs...) +} + + +// NotEqual asserts that the specified values are NOT equal. +// +// a.NotEqual(obj1, obj2, "two objects shouldn't be equal") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) NotEqual(expected interface{}, actual interface{}, msgAndArgs ...interface{}) { + NotEqual(a.t, expected, actual, msgAndArgs...) +} + + +// NotNil asserts that the specified object is not nil. +// +// a.NotNil(err, "err should be something") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) NotNil(object interface{}, msgAndArgs ...interface{}) { + NotNil(a.t, object, msgAndArgs...) +} + + +// NotPanics asserts that the code inside the specified PanicTestFunc does NOT panic. +// +// a.NotPanics(func(){ +// RemainCalm() +// }, "Calling RemainCalm() should NOT panic") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) NotPanics(f assert.PanicTestFunc, msgAndArgs ...interface{}) { + NotPanics(a.t, f, msgAndArgs...) +} + + +// NotRegexp asserts that a specified regexp does not match a string. +// +// a.NotRegexp(regexp.MustCompile("starts"), "it's starting") +// a.NotRegexp("^start", "it's not starting") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) NotRegexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) { + NotRegexp(a.t, rx, str, msgAndArgs...) +} + + +// NotZero asserts that i is not the zero value for its type and returns the truth. +func (a *Assertions) NotZero(i interface{}, msgAndArgs ...interface{}) { + NotZero(a.t, i, msgAndArgs...) +} + + +// Panics asserts that the code inside the specified PanicTestFunc panics. +// +// a.Panics(func(){ +// GoCrazy() +// }, "Calling GoCrazy() should panic") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Panics(f assert.PanicTestFunc, msgAndArgs ...interface{}) { + Panics(a.t, f, msgAndArgs...) +} + + +// Regexp asserts that a specified regexp matches a string. +// +// a.Regexp(regexp.MustCompile("start"), "it's starting") +// a.Regexp("start...$", "it's not starting") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) Regexp(rx interface{}, str interface{}, msgAndArgs ...interface{}) { + Regexp(a.t, rx, str, msgAndArgs...) +} + + +// True asserts that the specified value is true. +// +// a.True(myBool, "myBool should be true") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) True(value bool, msgAndArgs ...interface{}) { + True(a.t, value, msgAndArgs...) +} + + +// WithinDuration asserts that the two times are within duration delta of each other. +// +// a.WithinDuration(time.Now(), time.Now(), 10*time.Second, "The difference should not be more than 10s") +// +// Returns whether the assertion was successful (true) or not (false). +func (a *Assertions) WithinDuration(expected time.Time, actual time.Time, delta time.Duration, msgAndArgs ...interface{}) { + WithinDuration(a.t, expected, actual, delta, msgAndArgs...) +} + + +// Zero asserts that i is the zero value for its type and returns the truth. +func (a *Assertions) Zero(i interface{}, msgAndArgs ...interface{}) { + Zero(a.t, i, msgAndArgs...) +} diff --git a/vendor/github.com/stretchr/testify/require/require_forward.go.tmpl b/vendor/github.com/stretchr/testify/require/require_forward.go.tmpl new file mode 100644 index 000000000..b93569e0a --- /dev/null +++ b/vendor/github.com/stretchr/testify/require/require_forward.go.tmpl @@ -0,0 +1,4 @@ +{{.CommentWithoutT "a"}} +func (a *Assertions) {{.DocInfo.Name}}({{.Params}}) { + {{.DocInfo.Name}}(a.t, {{.ForwardedParams}}) +} diff --git a/vendor/github.com/stretchr/testify/require/requirements.go b/vendor/github.com/stretchr/testify/require/requirements.go new file mode 100644 index 000000000..41147562d --- /dev/null +++ b/vendor/github.com/stretchr/testify/require/requirements.go @@ -0,0 +1,9 @@ +package require + +// TestingT is an interface wrapper around *testing.T +type TestingT interface { + Errorf(format string, args ...interface{}) + FailNow() +} + +//go:generate go run ../_codegen/main.go -output-package=require -template=require.go.tmpl diff --git a/vendor/github.com/stretchr/testify/require/requirements_test.go b/vendor/github.com/stretchr/testify/require/requirements_test.go new file mode 100644 index 000000000..d2ccc99c9 --- /dev/null +++ b/vendor/github.com/stretchr/testify/require/requirements_test.go @@ -0,0 +1,369 @@ +package require + +import ( + "errors" + "testing" + "time" +) + +// AssertionTesterInterface defines an interface to be used for testing assertion methods +type AssertionTesterInterface interface { + TestMethod() +} + +// AssertionTesterConformingObject is an object that conforms to the AssertionTesterInterface interface +type AssertionTesterConformingObject struct { +} + +func (a *AssertionTesterConformingObject) TestMethod() { +} + +// AssertionTesterNonConformingObject is an object that does not conform to the AssertionTesterInterface interface +type AssertionTesterNonConformingObject struct { +} + +type MockT struct { + Failed bool +} + +func (t *MockT) FailNow() { + t.Failed = true +} + +func (t *MockT) Errorf(format string, args ...interface{}) { + _, _ = format, args +} + +func TestImplements(t *testing.T) { + + Implements(t, (*AssertionTesterInterface)(nil), new(AssertionTesterConformingObject)) + + mockT := new(MockT) + Implements(mockT, (*AssertionTesterInterface)(nil), new(AssertionTesterNonConformingObject)) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestIsType(t *testing.T) { + + IsType(t, new(AssertionTesterConformingObject), new(AssertionTesterConformingObject)) + + mockT := new(MockT) + IsType(mockT, new(AssertionTesterConformingObject), new(AssertionTesterNonConformingObject)) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestEqual(t *testing.T) { + + Equal(t, 1, 1) + + mockT := new(MockT) + Equal(mockT, 1, 2) + if !mockT.Failed { + t.Error("Check should fail") + } + +} + +func TestNotEqual(t *testing.T) { + + NotEqual(t, 1, 2) + mockT := new(MockT) + NotEqual(mockT, 2, 2) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestExactly(t *testing.T) { + + a := float32(1) + b := float32(1) + c := float64(1) + + Exactly(t, a, b) + + mockT := new(MockT) + Exactly(mockT, a, c) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestNotNil(t *testing.T) { + + NotNil(t, new(AssertionTesterConformingObject)) + + mockT := new(MockT) + NotNil(mockT, nil) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestNil(t *testing.T) { + + Nil(t, nil) + + mockT := new(MockT) + Nil(mockT, new(AssertionTesterConformingObject)) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestTrue(t *testing.T) { + + True(t, true) + + mockT := new(MockT) + True(mockT, false) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestFalse(t *testing.T) { + + False(t, false) + + mockT := new(MockT) + False(mockT, true) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestContains(t *testing.T) { + + Contains(t, "Hello World", "Hello") + + mockT := new(MockT) + Contains(mockT, "Hello World", "Salut") + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestNotContains(t *testing.T) { + + NotContains(t, "Hello World", "Hello!") + + mockT := new(MockT) + NotContains(mockT, "Hello World", "Hello") + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestPanics(t *testing.T) { + + Panics(t, func() { + panic("Panic!") + }) + + mockT := new(MockT) + Panics(mockT, func() {}) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestNotPanics(t *testing.T) { + + NotPanics(t, func() {}) + + mockT := new(MockT) + NotPanics(mockT, func() { + panic("Panic!") + }) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestNoError(t *testing.T) { + + NoError(t, nil) + + mockT := new(MockT) + NoError(mockT, errors.New("some error")) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestError(t *testing.T) { + + Error(t, errors.New("some error")) + + mockT := new(MockT) + Error(mockT, nil) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestEqualError(t *testing.T) { + + EqualError(t, errors.New("some error"), "some error") + + mockT := new(MockT) + EqualError(mockT, errors.New("some error"), "Not some error") + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestEmpty(t *testing.T) { + + Empty(t, "") + + mockT := new(MockT) + Empty(mockT, "x") + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestNotEmpty(t *testing.T) { + + NotEmpty(t, "x") + + mockT := new(MockT) + NotEmpty(mockT, "") + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestWithinDuration(t *testing.T) { + + a := time.Now() + b := a.Add(10 * time.Second) + + WithinDuration(t, a, b, 15*time.Second) + + mockT := new(MockT) + WithinDuration(mockT, a, b, 5*time.Second) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestInDelta(t *testing.T) { + + InDelta(t, 1.001, 1, 0.01) + + mockT := new(MockT) + InDelta(mockT, 1, 2, 0.5) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestZero(t *testing.T) { + + Zero(t, "") + + mockT := new(MockT) + Zero(mockT, "x") + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestNotZero(t *testing.T) { + + NotZero(t, "x") + + mockT := new(MockT) + NotZero(mockT, "") + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestJSONEq_EqualSONString(t *testing.T) { + mockT := new(MockT) + JSONEq(mockT, `{"hello": "world", "foo": "bar"}`, `{"hello": "world", "foo": "bar"}`) + if mockT.Failed { + t.Error("Check should pass") + } +} + +func TestJSONEq_EquivalentButNotEqual(t *testing.T) { + mockT := new(MockT) + JSONEq(mockT, `{"hello": "world", "foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) + if mockT.Failed { + t.Error("Check should pass") + } +} + +func TestJSONEq_HashOfArraysAndHashes(t *testing.T) { + mockT := new(MockT) + JSONEq(mockT, "{\r\n\t\"numeric\": 1.5,\r\n\t\"array\": [{\"foo\": \"bar\"}, 1, \"string\", [\"nested\", \"array\", 5.5]],\r\n\t\"hash\": {\"nested\": \"hash\", \"nested_slice\": [\"this\", \"is\", \"nested\"]},\r\n\t\"string\": \"foo\"\r\n}", + "{\r\n\t\"numeric\": 1.5,\r\n\t\"hash\": {\"nested\": \"hash\", \"nested_slice\": [\"this\", \"is\", \"nested\"]},\r\n\t\"string\": \"foo\",\r\n\t\"array\": [{\"foo\": \"bar\"}, 1, \"string\", [\"nested\", \"array\", 5.5]]\r\n}") + if mockT.Failed { + t.Error("Check should pass") + } +} + +func TestJSONEq_Array(t *testing.T) { + mockT := new(MockT) + JSONEq(mockT, `["foo", {"hello": "world", "nested": "hash"}]`, `["foo", {"nested": "hash", "hello": "world"}]`) + if mockT.Failed { + t.Error("Check should pass") + } +} + +func TestJSONEq_HashAndArrayNotEquivalent(t *testing.T) { + mockT := new(MockT) + JSONEq(mockT, `["foo", {"hello": "world", "nested": "hash"}]`, `{"foo": "bar", {"nested": "hash", "hello": "world"}}`) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestJSONEq_HashesNotEquivalent(t *testing.T) { + mockT := new(MockT) + JSONEq(mockT, `{"foo": "bar"}`, `{"foo": "bar", "hello": "world"}`) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestJSONEq_ActualIsNotJSON(t *testing.T) { + mockT := new(MockT) + JSONEq(mockT, `{"foo": "bar"}`, "Not JSON") + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestJSONEq_ExpectedIsNotJSON(t *testing.T) { + mockT := new(MockT) + JSONEq(mockT, "Not JSON", `{"foo": "bar", "hello": "world"}`) + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestJSONEq_ExpectedAndActualNotJSON(t *testing.T) { + mockT := new(MockT) + JSONEq(mockT, "Not JSON", "Not JSON") + if !mockT.Failed { + t.Error("Check should fail") + } +} + +func TestJSONEq_ArraysOfDifferentOrder(t *testing.T) { + mockT := new(MockT) + JSONEq(mockT, `["foo", {"hello": "world", "nested": "hash"}]`, `[{ "hello": "world", "nested": "hash"}, "foo"]`) + if !mockT.Failed { + t.Error("Check should fail") + } +} diff --git a/vendor/github.com/stretchr/testify/suite/doc.go b/vendor/github.com/stretchr/testify/suite/doc.go new file mode 100644 index 000000000..f91a245d3 --- /dev/null +++ b/vendor/github.com/stretchr/testify/suite/doc.go @@ -0,0 +1,65 @@ +// Package suite contains logic for creating testing suite structs +// and running the methods on those structs as tests. The most useful +// piece of this package is that you can create setup/teardown methods +// on your testing suites, which will run before/after the whole suite +// or individual tests (depending on which interface(s) you +// implement). +// +// A testing suite is usually built by first extending the built-in +// suite functionality from suite.Suite in testify. Alternatively, +// you could reproduce that logic on your own if you wanted (you +// just need to implement the TestingSuite interface from +// suite/interfaces.go). +// +// After that, you can implement any of the interfaces in +// suite/interfaces.go to add setup/teardown functionality to your +// suite, and add any methods that start with "Test" to add tests. +// Methods that do not match any suite interfaces and do not begin +// with "Test" will not be run by testify, and can safely be used as +// helper methods. +// +// Once you've built your testing suite, you need to run the suite +// (using suite.Run from testify) inside any function that matches the +// identity that "go test" is already looking for (i.e. +// func(*testing.T)). +// +// Regular expression to select test suites specified command-line +// argument "-run". Regular expression to select the methods +// of test suites specified command-line argument "-m". +// Suite object has assertion methods. +// +// A crude example: +// // Basic imports +// import ( +// "testing" +// "github.com/stretchr/testify/assert" +// "github.com/stretchr/testify/suite" +// ) +// +// // Define the suite, and absorb the built-in basic suite +// // functionality from testify - including a T() method which +// // returns the current testing context +// type ExampleTestSuite struct { +// suite.Suite +// VariableThatShouldStartAtFive int +// } +// +// // Make sure that VariableThatShouldStartAtFive is set to five +// // before each test +// func (suite *ExampleTestSuite) SetupTest() { +// suite.VariableThatShouldStartAtFive = 5 +// } +// +// // All methods that begin with "Test" are run as tests within a +// // suite. +// func (suite *ExampleTestSuite) TestExample() { +// assert.Equal(suite.T(), 5, suite.VariableThatShouldStartAtFive) +// suite.Equal(5, suite.VariableThatShouldStartAtFive) +// } +// +// // In order for 'go test' to run this suite, we need to create +// // a normal test function and pass our suite to suite.Run +// func TestExampleTestSuite(t *testing.T) { +// suite.Run(t, new(ExampleTestSuite)) +// } +package suite diff --git a/vendor/github.com/stretchr/testify/suite/interfaces.go b/vendor/github.com/stretchr/testify/suite/interfaces.go new file mode 100644 index 000000000..20969472c --- /dev/null +++ b/vendor/github.com/stretchr/testify/suite/interfaces.go @@ -0,0 +1,34 @@ +package suite + +import "testing" + +// TestingSuite can store and return the current *testing.T context +// generated by 'go test'. +type TestingSuite interface { + T() *testing.T + SetT(*testing.T) +} + +// SetupAllSuite has a SetupSuite method, which will run before the +// tests in the suite are run. +type SetupAllSuite interface { + SetupSuite() +} + +// SetupTestSuite has a SetupTest method, which will run before each +// test in the suite. +type SetupTestSuite interface { + SetupTest() +} + +// TearDownAllSuite has a TearDownSuite method, which will run after +// all the tests in the suite have been run. +type TearDownAllSuite interface { + TearDownSuite() +} + +// TearDownTestSuite has a TearDownTest method, which will run after +// each test in the suite. +type TearDownTestSuite interface { + TearDownTest() +} diff --git a/vendor/github.com/stretchr/testify/suite/suite.go b/vendor/github.com/stretchr/testify/suite/suite.go new file mode 100644 index 000000000..db7413000 --- /dev/null +++ b/vendor/github.com/stretchr/testify/suite/suite.go @@ -0,0 +1,115 @@ +package suite + +import ( + "flag" + "fmt" + "os" + "reflect" + "regexp" + "testing" + + "github.com/stretchr/testify/assert" + "github.com/stretchr/testify/require" +) + +var matchMethod = flag.String("testify.m", "", "regular expression to select tests of the testify suite to run") + +// Suite is a basic testing suite with methods for storing and +// retrieving the current *testing.T context. +type Suite struct { + *assert.Assertions + require *require.Assertions + t *testing.T +} + +// T retrieves the current *testing.T context. +func (suite *Suite) T() *testing.T { + return suite.t +} + +// SetT sets the current *testing.T context. +func (suite *Suite) SetT(t *testing.T) { + suite.t = t + suite.Assertions = assert.New(t) + suite.require = require.New(t) +} + +// Require returns a require context for suite. +func (suite *Suite) Require() *require.Assertions { + if suite.require == nil { + suite.require = require.New(suite.T()) + } + return suite.require +} + +// Assert returns an assert context for suite. Normally, you can call +// `suite.NoError(expected, actual)`, but for situations where the embedded +// methods are overridden (for example, you might want to override +// assert.Assertions with require.Assertions), this method is provided so you +// can call `suite.Assert().NoError()`. +func (suite *Suite) Assert() *assert.Assertions { + if suite.Assertions == nil { + suite.Assertions = assert.New(suite.T()) + } + return suite.Assertions +} + +// Run takes a testing suite and runs all of the tests attached +// to it. +func Run(t *testing.T, suite TestingSuite) { + suite.SetT(t) + + if setupAllSuite, ok := suite.(SetupAllSuite); ok { + setupAllSuite.SetupSuite() + } + defer func() { + if tearDownAllSuite, ok := suite.(TearDownAllSuite); ok { + tearDownAllSuite.TearDownSuite() + } + }() + + methodFinder := reflect.TypeOf(suite) + tests := []testing.InternalTest{} + for index := 0; index < methodFinder.NumMethod(); index++ { + method := methodFinder.Method(index) + ok, err := methodFilter(method.Name) + if err != nil { + fmt.Fprintf(os.Stderr, "testify: invalid regexp for -m: %s\n", err) + os.Exit(1) + } + if ok { + test := testing.InternalTest{ + Name: method.Name, + F: func(t *testing.T) { + parentT := suite.T() + suite.SetT(t) + if setupTestSuite, ok := suite.(SetupTestSuite); ok { + setupTestSuite.SetupTest() + } + defer func() { + if tearDownTestSuite, ok := suite.(TearDownTestSuite); ok { + tearDownTestSuite.TearDownTest() + } + suite.SetT(parentT) + }() + method.Func.Call([]reflect.Value{reflect.ValueOf(suite)}) + }, + } + tests = append(tests, test) + } + } + + if !testing.RunTests(func(_, _ string) (bool, error) { return true, nil }, + tests) { + t.Fail() + } +} + +// Filtering method according to set regular expression +// specified command-line argument -m +func methodFilter(name string) (bool, error) { + if ok, _ := regexp.MatchString("^Test", name); !ok { + return false, nil + } + return regexp.MatchString(*matchMethod, name) +} diff --git a/vendor/github.com/stretchr/testify/suite/suite_test.go b/vendor/github.com/stretchr/testify/suite/suite_test.go new file mode 100644 index 000000000..c7c4e88f7 --- /dev/null +++ b/vendor/github.com/stretchr/testify/suite/suite_test.go @@ -0,0 +1,239 @@ +package suite + +import ( + "errors" + "io/ioutil" + "os" + "testing" + + "github.com/stretchr/testify/assert" +) + +// SuiteRequireTwice is intended to test the usage of suite.Require in two +// different tests +type SuiteRequireTwice struct{ Suite } + +// TestSuiteRequireTwice checks for regressions of issue #149 where +// suite.requirements was not initialised in suite.SetT() +// A regression would result on these tests panicking rather than failing. +func TestSuiteRequireTwice(t *testing.T) { + ok := testing.RunTests( + func(_, _ string) (bool, error) { return true, nil }, + []testing.InternalTest{{ + Name: "TestSuiteRequireTwice", + F: func(t *testing.T) { + suite := new(SuiteRequireTwice) + Run(t, suite) + }, + }}, + ) + assert.Equal(t, false, ok) +} + +func (s *SuiteRequireTwice) TestRequireOne() { + r := s.Require() + r.Equal(1, 2) +} + +func (s *SuiteRequireTwice) TestRequireTwo() { + r := s.Require() + r.Equal(1, 2) +} + +// This suite is intended to store values to make sure that only +// testing-suite-related methods are run. It's also a fully +// functional example of a testing suite, using setup/teardown methods +// and a helper method that is ignored by testify. To make this look +// more like a real world example, all tests in the suite perform some +// type of assertion. +type SuiteTester struct { + // Include our basic suite logic. + Suite + + // Keep counts of how many times each method is run. + SetupSuiteRunCount int + TearDownSuiteRunCount int + SetupTestRunCount int + TearDownTestRunCount int + TestOneRunCount int + TestTwoRunCount int + NonTestMethodRunCount int +} + +type SuiteSkipTester struct { + // Include our basic suite logic. + Suite + + // Keep counts of how many times each method is run. + SetupSuiteRunCount int + TearDownSuiteRunCount int +} + +// The SetupSuite method will be run by testify once, at the very +// start of the testing suite, before any tests are run. +func (suite *SuiteTester) SetupSuite() { + suite.SetupSuiteRunCount++ +} + +func (suite *SuiteSkipTester) SetupSuite() { + suite.SetupSuiteRunCount++ + suite.T().Skip() +} + +// The TearDownSuite method will be run by testify once, at the very +// end of the testing suite, after all tests have been run. +func (suite *SuiteTester) TearDownSuite() { + suite.TearDownSuiteRunCount++ +} + +func (suite *SuiteSkipTester) TearDownSuite() { + suite.TearDownSuiteRunCount++ +} + +// The SetupTest method will be run before every test in the suite. +func (suite *SuiteTester) SetupTest() { + suite.SetupTestRunCount++ +} + +// The TearDownTest method will be run after every test in the suite. +func (suite *SuiteTester) TearDownTest() { + suite.TearDownTestRunCount++ +} + +// Every method in a testing suite that begins with "Test" will be run +// as a test. TestOne is an example of a test. For the purposes of +// this example, we've included assertions in the tests, since most +// tests will issue assertions. +func (suite *SuiteTester) TestOne() { + beforeCount := suite.TestOneRunCount + suite.TestOneRunCount++ + assert.Equal(suite.T(), suite.TestOneRunCount, beforeCount+1) + suite.Equal(suite.TestOneRunCount, beforeCount+1) +} + +// TestTwo is another example of a test. +func (suite *SuiteTester) TestTwo() { + beforeCount := suite.TestTwoRunCount + suite.TestTwoRunCount++ + assert.NotEqual(suite.T(), suite.TestTwoRunCount, beforeCount) + suite.NotEqual(suite.TestTwoRunCount, beforeCount) +} + +func (suite *SuiteTester) TestSkip() { + suite.T().Skip() +} + +// NonTestMethod does not begin with "Test", so it will not be run by +// testify as a test in the suite. This is useful for creating helper +// methods for your tests. +func (suite *SuiteTester) NonTestMethod() { + suite.NonTestMethodRunCount++ +} + +// TestRunSuite will be run by the 'go test' command, so within it, we +// can run our suite using the Run(*testing.T, TestingSuite) function. +func TestRunSuite(t *testing.T) { + suiteTester := new(SuiteTester) + Run(t, suiteTester) + + // Normally, the test would end here. The following are simply + // some assertions to ensure that the Run function is working as + // intended - they are not part of the example. + + // The suite was only run once, so the SetupSuite and TearDownSuite + // methods should have each been run only once. + assert.Equal(t, suiteTester.SetupSuiteRunCount, 1) + assert.Equal(t, suiteTester.TearDownSuiteRunCount, 1) + + // There are three test methods (TestOne, TestTwo, and TestSkip), so + // the SetupTest and TearDownTest methods (which should be run once for + // each test) should have been run three times. + assert.Equal(t, suiteTester.SetupTestRunCount, 3) + assert.Equal(t, suiteTester.TearDownTestRunCount, 3) + + // Each test should have been run once. + assert.Equal(t, suiteTester.TestOneRunCount, 1) + assert.Equal(t, suiteTester.TestTwoRunCount, 1) + + // Methods that don't match the test method identifier shouldn't + // have been run at all. + assert.Equal(t, suiteTester.NonTestMethodRunCount, 0) + + suiteSkipTester := new(SuiteSkipTester) + Run(t, suiteSkipTester) + + // The suite was only run once, so the SetupSuite and TearDownSuite + // methods should have each been run only once, even though SetupSuite + // called Skip() + assert.Equal(t, suiteSkipTester.SetupSuiteRunCount, 1) + assert.Equal(t, suiteSkipTester.TearDownSuiteRunCount, 1) + +} + +func TestSuiteGetters(t *testing.T) { + suite := new(SuiteTester) + suite.SetT(t) + assert.NotNil(t, suite.Assert()) + assert.Equal(t, suite.Assertions, suite.Assert()) + assert.NotNil(t, suite.Require()) + assert.Equal(t, suite.require, suite.Require()) +} + +type SuiteLoggingTester struct { + Suite +} + +func (s *SuiteLoggingTester) TestLoggingPass() { + s.T().Log("TESTLOGPASS") +} + +func (s *SuiteLoggingTester) TestLoggingFail() { + s.T().Log("TESTLOGFAIL") + assert.NotNil(s.T(), nil) // expected to fail +} + +type StdoutCapture struct { + oldStdout *os.File + readPipe *os.File +} + +func (sc *StdoutCapture) StartCapture() { + sc.oldStdout = os.Stdout + sc.readPipe, os.Stdout, _ = os.Pipe() +} + +func (sc *StdoutCapture) StopCapture() (string, error) { + if sc.oldStdout == nil || sc.readPipe == nil { + return "", errors.New("StartCapture not called before StopCapture") + } + os.Stdout.Close() + os.Stdout = sc.oldStdout + bytes, err := ioutil.ReadAll(sc.readPipe) + if err != nil { + return "", err + } + return string(bytes), nil +} + +func TestSuiteLogging(t *testing.T) { + testT := testing.T{} + + suiteLoggingTester := new(SuiteLoggingTester) + + capture := StdoutCapture{} + capture.StartCapture() + Run(&testT, suiteLoggingTester) + output, err := capture.StopCapture() + + assert.Nil(t, err, "Got an error trying to capture stdout!") + + // Failed tests' output is always printed + assert.Contains(t, output, "TESTLOGFAIL") + + if testing.Verbose() { + // In verbose mode, output from successful tests is also printed + assert.Contains(t, output, "TESTLOGPASS") + } else { + assert.NotContains(t, output, "TESTLOGPASS") + } +}