awsini

package
v0.14.4 Latest Latest
Warning

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

Go to latest
Published: Sep 17, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func LoadProfile

func LoadProfile[P Profile, D DataSource](dataSource D, profileName string, profile P) error

LoadProfile parses an AWS profile configuration the given data source (either file name string or file content as []byte) for given profile name. Effectively unmarshals the result into a struct.

Types

type DataSource

type DataSource interface {
	string | []byte
}

DataSource represents the source where to load ini-configuration. Can be either file name with string type or raw data in []byte. https://pkg.go.dev/gopkg.in/ini.v1@v1.66.4#Load

type Profile

type Profile interface {
	*User | *Role
}

Profile represents a type constraint of which structs the Load function can actually load out from ~/.aws/config ini.

type Role

type Role struct {
	SourceProfile   string `ini:"vegas_source_profile"`
	RoleArn         string `ini:"vegas_role_arn"`
	DurationSeconds int    `ini:"duration_seconds"`
	RoleSessionName string `ini:"role_session_name"`
	ExternalID      string `ini:"external_id"`
	Region          string `ini:"region"`
}

Role models the ~/.aws/confg profile configuration for target profile which is used to assume an IAM Role.

type User

type User struct {
	MfaSerial     string `ini:"mfa_serial"`
	YubikeySerial string `ini:"vegas_yubikey_serial"`
	YubikeyLabel  string `ini:"vegas_yubikey_label"`
	Region        string `ini:"region"`
}

User models the ~/.aws/confg profile configuration for source profile. Essentially it matches IAM User.

Jump to

Keyboard shortcuts

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