handler

package
v0.1.0-main4 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

handler package that handles AOD request.

handler package that handles AOD request.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ConditionTitle of IAM bindings added by AOD.
	ConditionTitle = "abcxyz-aod-expiry"
)

Functions

This section is empty.

Types

type CLIHandler

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

CLIHandler runs cli commands in the CLIRequest.

func NewCLIHandler

func NewCLIHandler(ctx context.Context, opts ...CLIHandlerOption) *CLIHandler

NewCLIHandler creates a new CLIHandler with provided options.

func (*CLIHandler) Cleanup

func (h *CLIHandler) Cleanup(ctx context.Context, r *v1alpha1.CLIRequest) error

Cleanup runs the cleanup commands.

func (*CLIHandler) Do

Do runs the do commands.

type CLIHandlerOption

type CLIHandlerOption func(h *CLIHandler) *CLIHandler

CLIHandlerOption is the option to set up an CLIHandler.

func WithDebugMode

func WithDebugMode(w io.Writer) CLIHandlerOption

WithDebugMode sets the handler's stdout to w.

func WithDefaultDebugMode

func WithDefaultDebugMode() CLIHandlerOption

WithDefaultDebugMode sets the handler's stdout to os.Stdout.

func WithStderr

func WithStderr(w io.Writer) CLIHandlerOption

WithStderr sets the handler's stderr.

type IAMClient

type IAMClient interface {
	GetIamPolicy(context.Context, *iampb.GetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error)
	SetIamPolicy(context.Context, *iampb.SetIamPolicyRequest, ...gax.CallOption) (*iampb.Policy, error)
}

IAMClient is the interface to get and set IAM policies for GCP organizations, folders, and projects.

type IAMHandler

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

IAMHandler updates IAM policies of GCP organizations, folders, and projects based on the IAM request received.

func NewIAMHandler

func NewIAMHandler(ctx context.Context, organizationsClient, foldersClient, projectsClient IAMClient, opts ...Option) (*IAMHandler, error)

NewIAMHandler creates a new IAMHandler with provided clients and options.

func (*IAMHandler) Cleanup

func (h *IAMHandler) Cleanup(ctx context.Context, r *v1alpha1.IAMRequestWrapper) (nps []*v1alpha1.IAMResponse, retErr error)

Do removes expired or duplicative IAM bindings added by AOD and adds requested IAM bindings to current IAM policy.

func (*IAMHandler) Do

Do removes expired or duplicative IAM bindings added by AOD and adds requested IAM bindings to current IAM policy.

type Option

type Option func(h *IAMHandler) (*IAMHandler, error)

Option is the option to set up an IAMHandler.

func WithRetry

func WithRetry(b retry.Backoff) Option

WithRetry provides retry strategy to the handler.

Jump to

Keyboard shortcuts

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