gcpclient

package
v0.0.23 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2022 License: Apache-2.0 Imports: 23 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// DefaultTokenDuration is the default duration for tokens.
	DefaultTokenDuration = 10 * time.Minute
)

Variables

This section is empty.

Functions

func CanImpersonate

func CanImpersonate(project, serviceAccountEmail string) (bool, error)

CanImpersonate checks if a given service account can be impersonated by the authenticated user.

func CheckActiveAccountSet

func CheckActiveAccountSet() (string, error)

CheckActiveAccountSet ensures that the current gcloud config has an active account value and if an account is set, it returns the value.

func ClientWithReason

func ClientWithReason(reason string) (*credentials.IamCredentialsClient, error)

ClientWithReason creates a client SDK with the provided reason field.

func ConfigureGcloudProxy

func ConfigureGcloudProxy(project string) error

ConfigureGcloudProxy configures the current gcloud configuration to use the auth proxy.

func FetchAvailableServiceAccounts

func FetchAvailableServiceAccounts(project string) ([]*iam.ServiceAccount, error)

FetchAvailableServiceAccounts gets a list of service accounts that the user can impersonate.

func GenerateTemporaryAccessToken

func GenerateTemporaryAccessToken(svcAcct, reason string, tokenDuration time.Duration) (*credentialspb.GenerateAccessTokenResponse, error)

GenerateTemporaryAccessToken generates short-lived credentials for the given service account.

func GetClusters

func GetClusters(project, reason string) ([]map[string]string, error)

GetClusters gets the list of clusters in the current project.

func GetCurrentProject

func GetCurrentProject() (string, error)

GetCurrentProject get the active project from the gcloud config.

func GetCurrentRegion

func GetCurrentRegion() (string, error)

GetCurrentRegion get the active region from the gcloud config.

func GetCurrentZone

func GetCurrentZone() (string, error)

GetCurrentZone get the active zone from the gcloud config.

func UnsetGcloudProxy

func UnsetGcloudProxy() error

UnsetGcloudProxy restores the auth proxy changes made to the gcloud config.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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