Documentation ¶
Overview ¶
Package auth provides Google oauth2 and Azure credential bindings for mantle.
Index ¶
- Constants
- func GoogleClientFromJSONKey(jsonKey []byte, scope ...string) (*http.Client, error)
- func GoogleClientFromKeyFile(path string, scope ...string) (*http.Client, error)
- func GoogleServiceClient() *http.Client
- func GoogleServiceTokenSource() oauth2.TokenSource
- func GoogleTokenSourceFromJSONKey(jsonKey []byte, scope ...string) (oauth2.TokenSource, error)
- func ReadAliyunConfig(path string) (map[string]AliyunProfile, error)
- func ReadDOConfig(path string) (map[string]DOProfile, error)
- func ReadESXConfig(path string) (map[string]ESXProfile, error)
- func ReadPacketConfig(path string) (map[string]PacketProfile, error)
- type AliyunConfig
- type AliyunProfile
- type AzureCredentials
- type DOProfile
- type ESXProfile
- type PacketProfile
Constants ¶
const AliyunConfigPath = ".aliyun/config.json"
const (
AzureCredentialsPath = ".azure/azureCreds.json"
)
const DOConfigPath = ".config/digitalocean.json"
const ESXConfigPath = ".config/esx.json"
const GCPConfigPath = ".config/gcp.json"
const PacketConfigPath = ".config/packet.json"
Variables ¶
This section is empty.
Functions ¶
func GoogleClientFromJSONKey ¶
GoogleClientFromJSONKey provides an http.Client authorized with an oauth2 token retrieved using a Google Developers service account's private JSON key file.
func GoogleClientFromKeyFile ¶
func GoogleServiceClient ¶
GoogleServiceClient fetchs a token from Google Compute Engine's metadata service. This should be used on GCP vms. The Default account is used.
func GoogleServiceTokenSource ¶
func GoogleServiceTokenSource() oauth2.TokenSource
GoogleServiceTokenSource provides an oauth2.TokenSource authorized in the same manner as GoogleServiceClient().
func GoogleTokenSourceFromJSONKey ¶
func GoogleTokenSourceFromJSONKey(jsonKey []byte, scope ...string) (oauth2.TokenSource, error)
GoogleTokenSourceFromJSONKey provides an oauth2.TokenSource authorized in the same manner as GoogleClientFromJSONKey.
func ReadAliyunConfig ¶
func ReadAliyunConfig(path string) (map[string]AliyunProfile, error)
ReadAliyunConfig decodes an aliyun config file
If path is empty, $HOME/.aliyun/config.json is read.
func ReadDOConfig ¶
ReadDOConfig decodes a DigitalOcean config file, which is a custom format used by Mantle to hold personal access tokens.
If path is empty, $HOME/.config/digitalocean.json is read.
func ReadESXConfig ¶
func ReadESXConfig(path string) (map[string]ESXProfile, error)
ReadESXConfig decodes a ESX config file, which is a custom format used by Mantle to hold ESX server information.
If path is empty, $HOME/.config/esx.json is read.
func ReadPacketConfig ¶
func ReadPacketConfig(path string) (map[string]PacketProfile, error)
ReadPacketConfig decodes a Packet config file, which is a custom format used by Mantle to hold API keys.
If path is empty, $HOME/.config/packet.json is read.
Types ¶
type AliyunConfig ¶
type AliyunConfig struct {
Profiles []AliyunProfile `json:"profiles"`
}
type AliyunProfile ¶
type AzureCredentials ¶
type AzureCredentials struct { ClientID string `json:"appId"` ClientSecret string `json:"password"` SubscriptionID string `json:"subscription"` TenantID string `json:"tenant"` }
func ReadAzureCredentials ¶
func ReadAzureCredentials(path string) (AzureCredentials, error)
ReadAzureCredentials picks up the credentials as described in the docs.
If path is empty, $AZURE_CREDENTIALS or $HOME/.azure/azureCreds.json is read.
type DOProfile ¶
type DOProfile struct {
AccessToken string `json:"token"`
}
DOProfile represents a parsed DigitalOcean profile. This is a custom format specific to Mantle.
type ESXProfile ¶
type ESXProfile struct { Server string `json:"server"` User string `json:"user"` Password string `json:"password"` }
ESXProfile represents a parsed ESX profile. This is a custom format specific to Mantle.
type PacketProfile ¶
PacketProfile represents a parsed Packet profile. This is a custom format specific to Mantle.