serviceaccount

package
v0.0.0-...-fbcd7f5 Latest Latest
Warning

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

Go to latest
Published: Jul 27, 2023 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

Client provides data and methods for serviceaccount package.

func NewClient

func NewClient(prefix string, iamservice IAM) *Client

func (*Client) CreateSA

func (client *Client) CreateSA(name string, project string) (*iam.ServiceAccount, error)

Creates GKE Service Account. SA name is trimed to 30 characters per GCP limits.

func (*Client) CreateSAKey

func (client *Client) CreateSAKey(safqdn string) (*iam.ServiceAccountKey, error)

safqdn should be serviceaccount mail. Pass here iam.ServiceAccount.Email returned by Client.CreateSA().

func (*Client) Delete

func (client *Client) Delete(name string) (*iam.Empty, error)

type IAM

type IAM interface {
	//TODO: Swap arguments order to match iam service method arguments order.
	CreateSA(request *iam.CreateServiceAccountRequest, projectname string) (*iam.ServiceAccount, error)
	CreateSAKey(sa string, request *iam.CreateServiceAccountKeyRequest) (*iam.ServiceAccountKey, error)
	DeleteSA(sa string) (*iam.Empty, error)
}

IAM is a mockable interface for GCP IAM API.

type IAMService

type IAMService struct {
	// contains filtered or unexported fields
}

func NewService

func NewService(credentials string) (*IAMService, error)

func (*IAMService) CreateSA

func (iams *IAMService) CreateSA(request *iam.CreateServiceAccountRequest, projectname string) (*iam.ServiceAccount, error)

func (*IAMService) CreateSAKey

func (iams *IAMService) CreateSAKey(sa string, request *iam.CreateServiceAccountKeyRequest) (*iam.ServiceAccountKey, error)

func (*IAMService) DeleteSA

func (iams *IAMService) DeleteSA(sa string) (*iam.Empty, error)

type ServiceAccount

type ServiceAccount struct {
	Name  string                 `yaml:"name"`
	Roles []string               `yaml:"roles,omitempty"`
	Key   *iam.ServiceAccountKey `yaml:"key,omitempty"`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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