profile

package
v0.0.3 Latest Latest
Warning

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

Go to latest
Published: Feb 16, 2026 License: MIT Imports: 3 Imported by: 0

Documentation

Overview

Package profile defines SSO profile data types and validation.

Index

Constants

This section is empty.

Variables

View Source
var AWSRegions = []string{
	"us-east-1", "us-east-2", "us-west-1", "us-west-2",
	"af-south-1",
	"ap-east-1", "ap-south-1", "ap-south-2", "ap-southeast-1", "ap-southeast-2",
	"ap-southeast-3", "ap-northeast-1", "ap-northeast-2", "ap-northeast-3",
	"ca-central-1",
	"eu-central-1", "eu-central-2", "eu-west-1", "eu-west-2", "eu-west-3",
	"eu-south-1", "eu-south-2", "eu-north-1",
	"me-south-1", "me-central-1",
	"sa-east-1",
}

AWSRegions is the list of valid AWS regions for selection.

Functions

func ValidateAccountID

func ValidateAccountID(id string) error

ValidateAccountID checks that the account ID is a 12-digit number.

func ValidateProfileName

func ValidateProfileName(name string) error

ValidateProfileName checks that the profile name is non-empty and safe for INI sections.

func ValidateRegion

func ValidateRegion(region string) error

ValidateRegion checks that the region is in the known list.

func ValidateRoleName

func ValidateRoleName(name string) error

ValidateRoleName checks that the role name is non-empty.

func ValidateStartURL

func ValidateStartURL(url string) error

ValidateStartURL checks that the SSO start URL is a valid HTTPS URL.

Types

type AccountGroup

type AccountGroup struct {
	AccountID   string
	AccountName string
	StartURL    string
	Region      string
	Roles       []SSOProfile // all profiles sharing this account
}

AccountGroup represents an AWS account with one or more SSO roles.

func GroupByAccount

func GroupByAccount(profiles []SSOProfile) []AccountGroup

GroupByAccount groups profiles by their SSO start URL + account ID. Profiles with the same start URL and account ID are grouped together, differing only by role name.

func (*AccountGroup) DisplayName

func (g *AccountGroup) DisplayName() string

DisplayName returns a formatted string for the account group.

type SSOProfile

type SSOProfile struct {
	Name        string `ini:"-"` // profile name (used as section key)
	StartURL    string `ini:"sso_start_url"`
	Region      string `ini:"sso_region"`
	AccountID   string `ini:"sso_account_id"`
	AccountName string `ini:"sso_account_name"` // human-friendly account alias
	RoleName    string `ini:"sso_role_name"`
}

SSOProfile holds all configuration needed for an AWS SSO login.

func (*SSOProfile) DisplayName

func (p *SSOProfile) DisplayName() string

DisplayName returns a formatted string for UI display.

func (*SSOProfile) Validate

func (p *SSOProfile) Validate() error

Validate checks all fields of the profile.

Jump to

Keyboard shortcuts

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