Skip to content

Commit

Permalink
syncing from tip
Browse files Browse the repository at this point in the history
  • Loading branch information
xibz committed Oct 15, 2018
2 parents 0bda570 + 6e42625 commit ad96c19
Show file tree
Hide file tree
Showing 69 changed files with 8,637 additions and 3,536 deletions.
5 changes: 5 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,9 @@ matrix:
- os: linux
sudo: required
go: 1.10.x
- os: linux
sudo: required
go: 1.11.x
- os: linux
sudo: required
go: tip
Expand All @@ -37,6 +40,8 @@ matrix:
go: 1.9.x
- os: osx
go: 1.10.x
- os: osx
go: 1.11.x
- os: osx
go: tip

Expand Down
45 changes: 45 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,48 @@
Release v1.15.55 (2018-10-15)
===

### Service Client Updates
* `service/lambda`: Updates service API and documentation
* Documentation updates for lambda
* `service/rds`: Updates service API and documentation
* This release adds a new parameter to specify the DB instance or cluster parameter group for restore from DB snapshot and restore to point int time operations. For more information, see Amazon RDS Documentation.
* `service/servicecatalog`: Updates service API, documentation, and paginators
* AWS Service Catalog enables you to reduce administrative maintenance and end-user training while adhering to compliance and security measures. With service actions, you as the administrator can enable end users to perform operational tasks, troubleshoot issues, run approved commands, or request permissions within Service Catalog. Service actions are defined using AWS Systems Manager documents, where you have access to pre-defined actions that implement AWS best practices, such asEC2 stop and reboot, as well as the ability to define custom actions.

Release v1.15.54 (2018-10-12)
===

### Service Client Updates
* `service/cloudtrail`: Updates service API and documentation
* The LookupEvents API now supports two new attribute keys: ReadOnly and AccessKeyId

### SDK Enhancements
* `aws/session`: Add support for credential source(#2201)
* Allows for shared config file to contain `credential_source` with any of the given values `EcsContainer`, `Environment` or `Ec2InstanceMetadata`

Release v1.15.53 (2018-10-11)
===

### Service Client Updates
* `service/athena`: Updates service API and documentation
* 1. GetQueryExecution API changes to return statementType of a submitted Athena query. 2. GetQueryResults API changes to return the number of rows added to a table when a CTAS query is executed.
* `service/directconnect`: Updates service API and documentation
* This release adds support for Jumbo Frames over AWS Direct Connect. You can now set MTU value when creating new virtual interfaces. This release also includes a new API to modify MTU value of existing virtual interfaces.
* `service/ec2`: Updates service API
* You can now launch the smaller-sized G3 instance called g3s.xlarge. G3s.xlarge provides 4 vCPU, 30.5 GB RAM and a NVIDIA Tesla M60 GPU. It is ideal for remote workstations, engineering and architectural applications, and 3D visualizations and rendering for visual effects.
* `service/mediaconvert`: Updates service paginators
* Added Paginators for all the MediaConvert list operations
* `service/transcribe`: Updates service API and documentation

Release v1.15.52 (2018-10-10)
===

### Service Client Updates
* `service/comprehend`: Updates service API
* `service/es`: Updates service API and documentation
* Amazon Elasticsearch Service now supports customer-scheduled service software updates. When new service software becomes available, you can request an update to your domain and benefit from new features more quickly. If you take no action, we update the service software automatically after a certain time frame.
* `service/transcribe`: Updates service API and documentation

Release v1.15.51 (2018-10-09)
===

Expand Down
15 changes: 11 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ ci-test-generate-validate:
integration: get-deps-tests integ-custom smoke-tests performance

integ-custom:
go test -tags "integration" ./awstesting/integration/customizations/...
go test -tags "integration" -v ./awstesting/integration/customizations/...

cleanup-integ:
go run -tags "integration" ./awstesting/cmd/bucket_cleanup/main.go "aws-sdk-go-integration"
Expand Down Expand Up @@ -134,19 +134,26 @@ sandbox-test-go18: sandbox-build-go18
docker run -t aws-sdk-go-1.8

sandbox-build-go19:
docker build -f ./awstesting/sandbox/Dockerfile.test.go1.8 -t "aws-sdk-go-1.9" .
docker build -f ./awstesting/sandbox/Dockerfile.test.go1.9 -t "aws-sdk-go-1.9" .
sandbox-go19: sandbox-build-go19
docker run -i -t aws-sdk-go-1.9 bash
sandbox-test-go19: sandbox-build-go19
docker run -t aws-sdk-go-1.9

sandbox-build-go110:
docker build -f ./awstesting/sandbox/Dockerfile.test.go1.8 -t "aws-sdk-go-1.10" .
docker build -f ./awstesting/sandbox/Dockerfile.test.go1.10 -t "aws-sdk-go-1.10" .
sandbox-go110: sandbox-build-go110
docker run -i -t aws-sdk-go-1.10 bash
sandbox-test-go110: sandbox-build-go110
docker run -t aws-sdk-go-1.10

sandbox-build-go111:
docker build -f ./awstesting/sandbox/Dockerfile.test.go1.11 -t "aws-sdk-go-1.11" .
sandbox-go111: sandbox-build-go111
docker run -i -t aws-sdk-go-1.11 bash
sandbox-test-go111: sandbox-build-go111
docker run -t aws-sdk-go-1.11

sandbox-build-gotip:
@echo "Run make update-aws-golang-tip, if this test fails because missing aws-golang:tip container"
docker build -f ./awstesting/sandbox/Dockerfile.test.gotip -t "aws-sdk-go-tip" .
Expand Down Expand Up @@ -193,7 +200,7 @@ get-deps-tests:

get-deps-verify:
@echo "go get SDK verification utilities"
@if [ \( -z "${SDK_GO_1_4}" \) -a \( -z "${SDK_GO_1_5}" \) ]; then go get github.com/golang/lint/golint; else echo "skipped getting golint"; fi
@if [ \( -z "${SDK_GO_1_4}" \) -a \( -z "${SDK_GO_1_5}" \) ]; then go get golang.org/x/lint/golint; else echo "skipped getting golint"; fi

bench:
@echo "go bench SDK packages"
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[![API Reference](http://img.shields.io/badge/api-reference-blue.svg)](http://docs.aws.amazon.com/sdk-for-go/api) [![Join the chat at https://gitter.im/aws/aws-sdk-go](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/aws/aws-sdk-go?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://img.shields.io/travis/aws/aws-sdk-go.svg)](https://travis-ci.org/aws/aws-sdk-go) [![Apache V2 License](http://img.shields.io/badge/license-Apache%20V2-blue.svg)](https://github.com/aws/aws-sdk-go/blob/master/LICENSE.txt)
[![API Reference](https://img.shields.io/badge/api-reference-blue.svg)](https://docs.aws.amazon.com/sdk-for-go/api) [![Join the chat at https://gitter.im/aws/aws-sdk-go](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/aws/aws-sdk-go?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Build Status](https://img.shields.io/travis/aws/aws-sdk-go.svg)](https://travis-ci.org/aws/aws-sdk-go) [![Apache V2 License](https://img.shields.io/badge/license-Apache%20V2-blue.svg)](https://github.com/aws/aws-sdk-go/blob/master/LICENSE.txt)

# AWS SDK for Go

Expand Down
2 changes: 2 additions & 0 deletions aws/csm/metric.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,4 +48,6 @@ type metric struct {
DNSLatency *int `json:"DnsLatency,omitempty"`
TCPLatency *int `json:"TcpLatency,omitempty"`
SSLLatency *int `json:"SslLatency,omitempty"`

MaxRetriesExceeded *int `json:"MaxRetriesExceeded,omitempty"`
}
28 changes: 19 additions & 9 deletions aws/csm/reporter.go
Original file line number Diff line number Diff line change
Expand Up @@ -112,15 +112,16 @@ func (rep *Reporter) sendAPICallMetric(r *request.Request) {

now := time.Now()
m := metric{
ClientID: aws.String(rep.clientID),
API: aws.String(r.Operation.Name),
Service: aws.String(r.ClientInfo.ServiceID),
Timestamp: (*metricTime)(&now),
Type: aws.String("ApiCall"),
AttemptCount: aws.Int(r.RetryCount + 1),
Region: r.Config.Region,
Latency: aws.Int(int(time.Now().Sub(r.Time) / time.Millisecond)),
XAmzRequestID: aws.String(r.RequestID),
ClientID: aws.String(rep.clientID),
API: aws.String(r.Operation.Name),
Service: aws.String(r.ClientInfo.ServiceID),
Timestamp: (*metricTime)(&now),
Type: aws.String("ApiCall"),
AttemptCount: aws.Int(r.RetryCount + 1),
Region: r.Config.Region,
Latency: aws.Int(int(time.Now().Sub(r.Time) / time.Millisecond)),
XAmzRequestID: aws.String(r.RequestID),
MaxRetriesExceeded: aws.Int(boolIntValue(r.RetryCount >= r.MaxRetries())),
}

// TODO: Probably want to figure something out for logging dropped
Expand Down Expand Up @@ -230,3 +231,12 @@ func (rep *Reporter) InjectHandlers(handlers *request.Handlers) {

handlers.AfterRetry.PushFrontNamed(apiCallAttemptHandler)
}

// boolIntValue return 1 for true and 0 for false.
func boolIntValue(b bool) int {
if b {
return 1
}

return 0
}
72 changes: 72 additions & 0 deletions aws/csm/reporter_internal_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
package csm

import (
"net/http"
"testing"

"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/credentials"
"github.com/aws/aws-sdk-go/aws/defaults"
"github.com/aws/aws-sdk-go/aws/request"
)

func TestMaxRetriesExceeded(t *testing.T) {
md := metadata.ClientInfo{
Endpoint: "http://127.0.0.1",
}

cfg := aws.Config{
Region: aws.String("foo"),
Credentials: credentials.NewStaticCredentials("", "", ""),
}

op := &request.Operation{}
cases := []struct {
name string
httpStatusCode int
expectedMaxRetriesValue int
expectedMetrics int
}{
{
name: "max retry reached",
httpStatusCode: http.StatusBadGateway,
expectedMaxRetriesValue: 1,
},
{
name: "status ok",
httpStatusCode: http.StatusOK,
expectedMaxRetriesValue: 0,
},
}

for _, c := range cases {
r := request.New(cfg, md, defaults.Handlers(), client.DefaultRetryer{NumMaxRetries: 2}, op, nil, nil)
reporter := newReporter("", "")
r.Handlers.Send.Clear()
reporter.InjectHandlers(&r.Handlers)

r.Handlers.Send.PushBack(func(r *request.Request) {
r.HTTPResponse = &http.Response{
StatusCode: c.httpStatusCode,
}
})
r.Send()

for {
m := <-reporter.metricsCh.ch

if *m.Type != "ApiCall" {
// ignore non-ApiCall metrics since MaxRetriesExceeded is only on ApiCall events
continue
}

if val := *m.MaxRetriesExceeded; val != c.expectedMaxRetriesValue {
t.Errorf("%s: expected %d, but received %d", c.name, c.expectedMaxRetriesValue, val)
}

break
}
}
}
36 changes: 0 additions & 36 deletions aws/csm/reporter_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ package csm_test

import (
"fmt"
"net"
"net/http"
"net/http/httptest"
"strings"
Expand All @@ -18,41 +17,6 @@ import (
"github.com/aws/aws-sdk-go/private/protocol/jsonrpc"
)

func startUDPServer(done chan struct{}, fn func([]byte)) (string, error) {
addr, err := net.ResolveUDPAddr("udp", "127.0.0.1:0")
if err != nil {
return "", err
}

conn, err := net.ListenUDP("udp", addr)
if err != nil {
return "", err
}

buf := make([]byte, 1024)
i := 0
go func() {
defer conn.Close()
for {
i++
select {
case <-done:
return
default:
}

n, _, err := conn.ReadFromUDP(buf)
fn(buf[:n])

if err != nil {
panic(err)
}
}
}()

return conn.LocalAddr().String(), nil
}

func TestReportingMetrics(t *testing.T) {
reporter := csm.Get()
if reporter == nil {
Expand Down
6 changes: 3 additions & 3 deletions aws/defaults/defaults.go
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ import (
"github.com/aws/aws-sdk-go/aws/ec2metadata"
"github.com/aws/aws-sdk-go/aws/endpoints"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/internal/shareddefaults"
)

// A Defaults provides a collection of default values for SDK clients.
Expand Down Expand Up @@ -114,7 +115,6 @@ func CredProviders(cfg *aws.Config, handlers request.Handlers) []credentials.Pro
const (
httpProviderAuthorizationEnvVar = "AWS_CONTAINER_AUTHORIZATION_TOKEN"
httpProviderEnvVar = "AWS_CONTAINER_CREDENTIALS_FULL_URI"
ecsCredsProviderEnvVar = "AWS_CONTAINER_CREDENTIALS_RELATIVE_URI"
)

// RemoteCredProvider returns a credentials provider for the default remote
Expand All @@ -124,8 +124,8 @@ func RemoteCredProvider(cfg aws.Config, handlers request.Handlers) credentials.P
return localHTTPCredProvider(cfg, handlers, u)
}

if uri := os.Getenv(ecsCredsProviderEnvVar); len(uri) > 0 {
u := fmt.Sprintf("http://169.254.170.2%s", uri)
if uri := os.Getenv(shareddefaults.ECSCredsProviderEnvVar); len(uri) > 0 {
u := fmt.Sprintf("%s%s", shareddefaults.ECSContainerCredentialsURI, uri)
return httpCredProvider(cfg, handlers, u)
}

Expand Down
3 changes: 2 additions & 1 deletion aws/defaults/defaults_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import (
"github.com/aws/aws-sdk-go/aws/credentials/ec2rolecreds"
"github.com/aws/aws-sdk-go/aws/credentials/endpointcreds"
"github.com/aws/aws-sdk-go/aws/request"
"github.com/aws/aws-sdk-go/internal/shareddefaults"
)

func TestHTTPCredProvider(t *testing.T) {
Expand Down Expand Up @@ -90,7 +91,7 @@ func TestHTTPCredProvider(t *testing.T) {

func TestECSCredProvider(t *testing.T) {
defer os.Clearenv()
os.Setenv(ecsCredsProviderEnvVar, "/abc/123")
os.Setenv(shareddefaults.ECSCredsProviderEnvVar, "/abc/123")

provider := RemoteCredProvider(aws.Config{}, request.Handlers{})
if provider == nil {
Expand Down
Loading

0 comments on commit ad96c19

Please sign in to comment.