serviceaccount

package
v0.3.6 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2024 License: MPL-2.0 Imports: 6 Imported by: 3

Documentation

Overview

Package serviceaccount contains service accounts related logic.

Index

Constants

View Source
const (
	// SideroServiceAccountKeyEnvVar is the name of the environment variable
	// that contains the base64-encoded service account key JSON.
	SideroServiceAccountKeyEnvVar = "SIDERO_SERVICE_ACCOUNT_KEY"

	// OmniServiceAccountKeyEnvVar is the name of the environment variable
	// that contains the base64-encoded service account key JSON.
	OmniServiceAccountKeyEnvVar = "OMNI_SERVICE_ACCOUNT_KEY"
)

Variables

This section is empty.

Functions

func Encode

func Encode(name string, key *pgp.Key) (string, error)

Encode encodes the given service account name and pgp key into a base64 encoded JSON string.

func GetFromEnv

func GetFromEnv() (envKey, valueBase64 string)

GetFromEnv checks if a service account is available in the environment variables. If a known environment variable is found, its name and value are returned.

Types

type JSON

type JSON struct {
	// Name is the name (identity) of the service account.
	Name string `json:"name"`

	// PGPKey is the armored PGP private key of the service account.
	PGPKey string `json:"pgp_key"`
}

JSON is the JSON representation of a service account.

type ServiceAccount

type ServiceAccount struct {
	Key  *pgp.Key
	Name string
}

ServiceAccount represents a service account with an identity and a pgp key.

func Decode

func Decode(valueBase64 string) (*ServiceAccount, error)

Decode parses and decodes a service account from a base64 encoded JSON string.

Jump to

Keyboard shortcuts

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