gcp

package
v11.3.3 Latest Latest
Warning

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

Go to latest
Published: Dec 13, 2022 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ClusterDetails

type ClusterDetails struct {
	// ProjectID is the GCP project ID to which the cluster belongs.
	ProjectID string
	// Locations are the cluster locations.
	Location string
	// Name is the cluster name.
	Name string
}

ClusterDetails is the cluster identification properties.

func (*ClusterDetails) CheckAndSetDefaults

func (c *ClusterDetails) CheckAndSetDefaults() error

CheckAndSetDefaults check and set defaults for ClusterDetails.

type GKEClient

type GKEClient interface {
	// ListClusters lists the GCP GKE clusters that belong to the projectID and are
	// located in location.
	// location supports wildcard "*".
	ListClusters(ctx context.Context, projectID string, location string) ([]GKECluster, error)
	// GetClusterRestConfig returns the Kubernetes client config to connect to the
	// specified cluster. The access token is based on the default credentials configured
	// for the current GCP Service Account and must include the following permissions:
	// - container.clusters.get
	// - container.clusters.impersonate
	// - container.clusters.list
	// - container.pods.get
	// - container.selfSubjectAccessReviews.create
	// - container.selfSubjectRulesReviews.create
	// It also returns the token expiration time from which the token is no longer valid.
	GetClusterRestConfig(ctx context.Context, cfg ClusterDetails) (*rest.Config, time.Time, error)
}

GKEClient is an interface to interact with GCP Clusters.

func NewGKEClient

func NewGKEClient(ctx context.Context) (GKEClient, error)

NewGKEClient returns a GKEClient interface wrapping container.ClusterManagerClient and oauth2.TokenSource for interacting with GCP Kubernetes Service.

func NewGKEClientWithConfig

func NewGKEClientWithConfig(ctx context.Context, cfg GKEClientConfig) (GKEClient, error)

NewGKEClientWithConfig returns a GKEClient interface wrapping container.ClusterManagerClient and oauth2.TokenSource for interacting with GCP Kubernetes Service.

type GKEClientConfig

type GKEClientConfig struct {
	// ClusterClient is the GCP client for container service.
	ClusterClient gcpGKEClient
	// TokenSource is the OAuth2 token generator for Google auth.
	// The scope must include the kubernetesEngineScope.
	TokenSource oauth2.TokenSource
}

GKEClientConfig is the client configuration for GKEClient.

func (*GKEClientConfig) CheckAndSetDefaults

func (c *GKEClientConfig) CheckAndSetDefaults(ctx context.Context) (err error)

CheckAndSetDefaults check and set defaults for GKEClientConfig.

type GKECluster

type GKECluster struct {
	// Name is the cluster name.
	Name string
	// Description is the cluster description field in GCP.
	Description string
	// Location is the cluster location.
	Location string
	// ProjectID is the GCP project ID to which the cluster belongs.
	ProjectID string
	// Status is the cluster current status.
	Status containerpb.Cluster_Status
	// Labels are the cluster labels in GCP.
	Labels map[string]string
}

GKECluster represents a GKE cluster and contains the information necessary for Teleport Discovery to decide whether or not to import the cluster.

type SQLAdminClient

type SQLAdminClient interface {
	// UpdateUser updates an existing user for the project/instance configured in a session.
	UpdateUser(ctx context.Context, db types.Database, dbUser string, user *sqladmin.User) error
	// GetDatabaseInstance returns database instance details for the project/instance
	// configured in a session.
	GetDatabaseInstance(ctx context.Context, db types.Database) (*sqladmin.DatabaseInstance, error)
	// GenerateEphemeralCert returns a new client certificate with RSA key for the
	// project/instance configured in a session.
	GenerateEphemeralCert(ctx context.Context, db types.Database, identity tlsca.Identity) (*tls.Certificate, error)
}

SQLAdminClient defines an interface providing access to the GCP Cloud SQL API.

func NewSQLAdminClient

func NewSQLAdminClient(ctx context.Context) (SQLAdminClient, error)

NewGCPSQLAdminClient returns a GCPSQLAdminClient interface wrapping sqladmin.Service.

Jump to

Keyboard shortcuts

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