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 ¶
- type RobotAuth
- func (r *RobotAuth) CreateJWT(ctx context.Context, lifetime time.Duration) (string, error)
- func (r *RobotAuth) CreatePrivateKey() error
- func (r *RobotAuth) CreateRobotTokenSource(ctx context.Context) oauth2.TokenSource
- func (r *RobotAuth) StoreInFile() error
- func (r *RobotAuth) StoreInK8sSecret(ctx context.Context, clientset kubernetes.Interface, namespace string) error
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 ¶
LoadFromFile loads key from json file. If keyfile is "", it tries to load from the default location.
func LoadFromK8sSecret ¶
func (*RobotAuth) CreateJWT ¶
CreateJWT allows to create a JWT for authentication against the token vendor. This does not grant Google Cloud access, but can be used for for explicit authentication with the token vendor.
func (*RobotAuth) CreatePrivateKey ¶
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 ¶
StoreInFile writes a newly-chosen ID to disk.
func (*RobotAuth) StoreInK8sSecret ¶
func (r *RobotAuth) StoreInK8sSecret(ctx context.Context, clientset kubernetes.Interface, namespace string) error
StoreInK8sSecret writes new robot-id to kubernetes secret.