Back to godoc.org

Package awssession

v0.0.9
Latest Go to latest
Published: Jun 24, 2020 | License: Apache-2.0 | Module: github.com/grailbio/base

Overview

Package awssession provides a simple way to obtain AWS session.Session using GRAIL tickets.

Index

Package Files

func NewWithTicket

func NewWithTicket(ctx *context.T, ticketPath string, cfgs ...*aws.Config) (*session.Session, error)

NewWithTicket creates a AWS session using a GRAIL ticket. This is helper that uses inside a Provider with a timeout of 10 seconds. The region will be set to 'us-west-2' and can be overridden by passing an appropriate *aws.Config.

type Provider

type Provider struct {
	// Ctx contains the Vanadium context used to make the call to ticket-server
	// in response to calls to Retrieve(). Canceling the context will cause the
	// calls to Retrieve() to fail and IsExpire() to always return true.
	Ctx *context.T

	// Timeout indicates what timeout to set for the Vanadium calls.
	Timeout time.Duration

	// Ticket contains the last GRAIL ticket retrieved by a call to Retrieve().
	Ticket ticket.Ticket

	// Expiration indicates when the AWS credentials will expire.
	Expiration time.Time

	// TicketPath indicates what Vanadium object name to use to retrieve the
	// ticket.
	TicketPath string

	// ExpiryWindow allows triggering a refresh before the AWS credentials
	// actually expire.
	ExpiryWindow time.Duration
}

Provider implements the aws/credentials.Provider interface using a GRAIL ticket.

func (*Provider) IsExpired

func (p *Provider) IsExpired() bool

IsExpired implements the github.com/aws/aws-sdk-go/aws/credentials.Provider interface.

func (*Provider) Retrieve

func (p *Provider) Retrieve() (credentials.Value, error)

Retrieve implements the github.com/aws/aws-sdk-go/aws/credentials.Provider interface.

Documentation was rendered with GOOS=linux and GOARCH=amd64.

Jump to identifier

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to identifier