fakeiam

package
v0.9.13 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2021 License: Apache-2.0 Imports: 16 Imported by: 0

Documentation

Overview

Package fakeiam provides a fake implementation for IAM services: IAM Admin IAM Credendtials

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HashProto

func HashProto(msg proto.Message) []byte

HashProto computes a hash of a proto.

func SAEmail added in v0.8.6

func SAEmail(proj string, accountID string) string

SAEmail returns the service account email for a given project and account id.

func SAKName added in v0.8.6

func SAKName(proj string, accountID string, keyID string) string

SAKName returns the service account key resource name.

func SAName added in v0.8.6

func SAName(proj string, accountID string) string

SAName returns the service account resource name.

Types

type Admin

type Admin struct {
	State chan AdminState

	iamgrpcpb.IAMServer
}

Admin is a fake implementation of IAM Admin service.

func NewAdmin

func NewAdmin() *Admin

NewAdmin creates a new fake Admin server.

func (*Admin) CreateServiceAccount

func (f *Admin) CreateServiceAccount(ctx context.Context, req *iampb.CreateServiceAccountRequest) (*iampb.ServiceAccount, error)

func (*Admin) CreateServiceAccountKey

func (f *Admin) CreateServiceAccountKey(ctx context.Context, req *iampb.CreateServiceAccountKeyRequest) (*iampb.ServiceAccountKey, error)

func (*Admin) DeleteServiceAccount

func (f *Admin) DeleteServiceAccount(ctx context.Context, req *iampb.DeleteServiceAccountRequest) (*epb.Empty, error)

func (*Admin) DeleteServiceAccountKey

func (f *Admin) DeleteServiceAccountKey(ctx context.Context, req *iampb.DeleteServiceAccountKeyRequest) (*epb.Empty, error)

func (*Admin) GetServiceAccount

func (f *Admin) GetServiceAccount(ctx context.Context, req *iampb.GetServiceAccountRequest) (*iampb.ServiceAccount, error)

func (*Admin) GetServiceAccountKey

func (f *Admin) GetServiceAccountKey(ctx context.Context, req *iampb.GetServiceAccountKeyRequest) (*iampb.ServiceAccountKey, error)

type AdminState

type AdminState struct {
	Accounts []*iampb.ServiceAccount
	Keys     []*iampb.ServiceAccountKey
}

AdminState stores the data of Admin.

type Creds

type Creds struct {
	State chan CredsState
	iamcredsgrpcpb.IAMCredentialsServer
}

Creds is a fake implementation of IAMCredentialsServer.

func NewCreds

func NewCreds() *Creds

NewCreds creates a new Creds server.

type CredsState

type CredsState struct {
	// Tokens is the list of tokens issued.
	Tokens []*iamcredscpb.GenerateAccessTokenResponse
}

CredsState contains the state of the Creds

Jump to

Keyboard shortcuts

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