robotauth

package
v0.0.0-...-9c93095 Latest Latest
Warning

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

Go to latest
Published: Apr 22, 2024 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

The robotauth package contains the class for reading and writing the robot-id.json file. This file contains the id & private key of a robot that's connected to a Cloud project.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type RobotAuth

type RobotAuth struct {
	RobotName           string `json:"id"`
	ProjectId           string `json:"project_id"`
	PublicKeyRegistryId string `json:"public_key_registry_id"`
	PrivateKey          []byte `json:"private_key"`
	Domain              string `json:"domain"`
}

Object containing ID, as stored in robot-id.json.

func LoadFromFile

func LoadFromFile(keyfile string) (*RobotAuth, error)

LoadFromFile loads key from json file. If keyfile is "", it tries to load from the default location.

func (*RobotAuth) CreatePrivateKey

func (r *RobotAuth) CreatePrivateKey() error

CreatePrivateKey creates a private key. The private key is written to the RobotAuth struct.

func (*RobotAuth) CreateRobotTokenSource

func (r *RobotAuth) CreateRobotTokenSource(ctx context.Context) oauth2.TokenSource

CreateRobotTokenSource creates an OAuth2 token source for the token vendor. This token source returns Google Cloud access token minted for the robot-service@ service account.

func (*RobotAuth) StoreInFile

func (r *RobotAuth) StoreInFile() error

StoreInFile writes a newly-chosen ID to disk.

func (*RobotAuth) StoreInK8sSecret

func (r *RobotAuth) StoreInK8sSecret(ctx context.Context, clientset *kubernetes.Clientset, namespace string) error

StoreInK8sSecret writes new robot-id to kubernetes secret.

Jump to

Keyboard shortcuts

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