geography

package
v0.11.0 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2025 License: MPL-2.0 Imports: 7 Imported by: 0

Documentation

Overview

Package geography provides helpers for working with HCP geographies using the HCP SDK.

Index

Constants

View Source
const (
	// US is the united states geography
	US = string(geography.US)

	// EU is the europe geography
	EU = string(geography.EU)
)

Variables

This section is empty.

Functions

func GetCachedGeography

func GetCachedGeography(configDir string) (string, error)

GetCachedGeography reads the geography from the SDK's credential cache file. This returns the geography that the user actually authenticated against during browser login.

func GetDefaultGeography

func GetDefaultGeography() string

GetDefaultGeography returns the default geography as a string. This leverages the HCP SDK's Default constant.

func GetSupportedGeographies

func GetSupportedGeographies() []string

GetSupportedGeographies returns a slice of all supported geography strings. This leverages the HCP SDK's Geographies slice to ensure consistency.

func IsValidGeography

func IsValidGeography(geo string) bool

IsValidGeography checks if the provided geography string is valid. This leverages the HCP SDK's ValidateGeo function.

Types

type CredentialCache

type CredentialCache struct {
	Login CredentialCacheLogin `json:"login"`
}

CredentialCache represents the structure of the SDK credential cache file

type CredentialCacheLogin

type CredentialCacheLogin struct {
	AccessToken       string `json:"access_token"`
	RefreshToken      string `json:"refresh_token"`
	AccessTokenExpiry string `json:"access_token_expiry"`
	Geography         string `json:"geography"`
}

CredentialCacheLogin represents the login section of the SDK credential cache

Jump to

Keyboard shortcuts

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