func NewEC2RoleCredentials(client *http.Client, endpoint string, window time.Duration) *Credentials {
	return NewCredentials(&EC2RoleProvider{
		Endpoint:     endpoint,
		Client:       client,
		ExpiryWindow: window,
	})
}
NewEC2RoleCredentials returns a pointer to a new Credentials object
wrapping the EC2RoleProvider.

Takes a custom http.Client which can be configured for custom handling of
things such as timeout.

Endpoint is the URL that the EC2RoleProvider will connect to when retrieving
role and credentials.

Window is the expiry window that will be subtracted from the expiry returned
by the role credential request. This is done so that the credentials will
expire sooner than their actual lifespan.
package credentials
import (
	"bufio"
	"encoding/json"
	"fmt"
	"net/http"
	"time"
	"github.com/ks3sdklib/aws-sdk-go/internal/apierr"
)
const metadataCredentialsEndpoint = "http://169.254.169.254/latest/meta-data/iam/security-credentials/"
type EC2RoleProvider struct {
	Endpoint string
	Client *http.Client
	ExpiryWindow time.Duration
	expiresOn time.Time
}