awssession

package
v0.0.11 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 7, 2024 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

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

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewConfigWithTicket added in v0.0.10

func NewConfigWithTicket(ctx *context.T, ticketPath string) *aws.Config

NewConfigWithTicket creates an AWS configuration using a GRAIL ticket. The returned configuration uses a Provider with a timeout of 10 seconds. The region will be set to 'us-west-2'.

func NewWithTicket

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

NewWithTicket creates an AWS session using a GRAIL ticket. The returned session uses 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.

Types

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

	// Rationale indicates the reason for accessing a ticket
	Rationale string
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL