gcp

package
v0.0.0-...-e5f9212 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func BindIAMPolicy

func BindIAMPolicy(ctx context.Context, r *EscalationApproval, g Googler) error

Attaches specific iam roles to a given user conditionally. Notably, this policy overwrites any existing policies. If you do not append your policy changes to an existing policy, it is very easy to get the gcp organization into a bad state. Please take a look at the comment in the critical section before making changes Can pass in a Service to satisfy IAMer

func ListGoogleGroups

func ListGoogleGroups(ctx context.Context, requestor Requestor, domain string, g Grouper) (Groups, error)

Pass in a Service from NewService() that fulfils the Grouper interface

Types

type Clock

type Clock interface {
	// contains filtered or unexported methods
}

type Googler

type Googler interface {
	IAMer
	Grouper
	Clock
}

type Grouper

type Grouper interface {
	// contains filtered or unexported methods
}

type IAMer

type IAMer interface {
	// contains filtered or unexported methods
}

type MockGoogler

type MockGoogler struct {
	ListF         func(domain, requestor string) (*admin.Groups, error)
	GetIamPolicyF func(ctx context.Context, resource Resource, getiampolicyrequest *cloudresourcemanager.GetIamPolicyRequest) (*cloudresourcemanager.Policy, error)
	SetIamPolicyF func(ctx context.Context, resource Resource, setiampolicyrequest *cloudresourcemanager.SetIamPolicyRequest) (*cloudresourcemanager.Policy, error)
	NowF          func() time.Time
}

func NewMockGoogler

func NewMockGoogler() *MockGoogler

type ResourceType

type ResourceType string
const (
	Projects      ResourceType = "projects"
	Organizations ResourceType = "organizations"
)

type Service

type Service struct {
	Googler
}

func NewGoogleService

func NewGoogleService() (*Service, error)

func NewService

func NewService(g Googler) *Service

Useful for tests to pass in a mock googler

Jump to

Keyboard shortcuts

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