iam

package
v0.1.0-beta2 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

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

Config is the config values for the IAM client.

type IAM

type IAM interface {
	// OrganizationIAM returns the IAM set on the Organization.
	OrganizationIAM(ctx context.Context, organizationID string) ([]*assetinventory.AssetIAM, error)

	// FolderIAM returns the IAM set on the Folder.
	FolderIAM(ctx context.Context, folderID string) ([]*assetinventory.AssetIAM, error)

	// ProjectIAM returns the IAM set on the Project.
	ProjectIAM(ctx context.Context, projectID string) ([]*assetinventory.AssetIAM, error)

	// RemoveOrganizationIAM removes the given IAM policy membership.
	RemoveOrganizationIAM(ctx context.Context, projectIAMMember *assetinventory.AssetIAM) error

	// RemoveFolderIAM removes the given IAM policy membership.
	RemoveFolderIAM(ctx context.Context, projectIAMMember *assetinventory.AssetIAM) error

	// RemoveProjectIAM removes the given IAM policy membership.
	RemoveProjectIAM(ctx context.Context, projectIAMMember *assetinventory.AssetIAM) error
}

IAM defines the common gcp iam functionality.

type IAMClient

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

IAMClient exposes GCP IAM functionality.

func NewClient

func NewClient(ctx context.Context, opts ...Option) (*IAMClient, error)

NewClient creates a new iam client.

func (*IAMClient) FolderIAM

func (c *IAMClient) FolderIAM(ctx context.Context, folderID string) ([]*assetinventory.AssetIAM, error)

FolderIAM returns all IAM memberships, bindings, and policies for the given folder.

func (*IAMClient) OrganizationIAM

func (c *IAMClient) OrganizationIAM(ctx context.Context, organizationID string) ([]*assetinventory.AssetIAM, error)

OrganizationIAM returns all IAM memberships, bindings, and policies for the given organization.

func (*IAMClient) ProjectIAM

func (c *IAMClient) ProjectIAM(ctx context.Context, projectID string) ([]*assetinventory.AssetIAM, error)

ProjectIAM returns all IAM memberships, bindings, and policies for the given project.

func (*IAMClient) RemoveFolderIAM

func (c *IAMClient) RemoveFolderIAM(ctx context.Context, iamMember *assetinventory.AssetIAM) error

RemoveFolderIAM removes the given IAM policy membership.

func (*IAMClient) RemoveOrganizationIAM

func (c *IAMClient) RemoveOrganizationIAM(ctx context.Context, iamMember *assetinventory.AssetIAM) error

RemoveOrganizationIAM removes the given IAM policy membership.

func (*IAMClient) RemoveProjectIAM

func (c *IAMClient) RemoveProjectIAM(ctx context.Context, iamMember *assetinventory.AssetIAM) error

RemoveProjectIAM removes the given IAM policy membership.

type MockIAMClient

type MockIAMClient struct {
	OrgErr           error
	OrgData          []*assetinventory.AssetIAM
	FolderErr        error
	FolderData       []*assetinventory.AssetIAM
	ProjectErr       error
	ProjectData      []*assetinventory.AssetIAM
	RemoveOrgErr     error
	RemoveFolderErr  error
	RemoveProjectErr error
}

func (*MockIAMClient) FolderIAM

func (m *MockIAMClient) FolderIAM(ctx context.Context, folderID string) ([]*assetinventory.AssetIAM, error)

func (*MockIAMClient) OrganizationIAM

func (m *MockIAMClient) OrganizationIAM(ctx context.Context, organizationID string) ([]*assetinventory.AssetIAM, error)

func (*MockIAMClient) ProjectIAM

func (m *MockIAMClient) ProjectIAM(ctx context.Context, projectID string) ([]*assetinventory.AssetIAM, error)

func (*MockIAMClient) RemoveFolderIAM

func (m *MockIAMClient) RemoveFolderIAM(ctx context.Context, iamMember *assetinventory.AssetIAM) error

func (*MockIAMClient) RemoveOrganizationIAM

func (m *MockIAMClient) RemoveOrganizationIAM(ctx context.Context, iamMember *assetinventory.AssetIAM) error

func (*MockIAMClient) RemoveProjectIAM

func (m *MockIAMClient) RemoveProjectIAM(ctx context.Context, iamMember *assetinventory.AssetIAM) error

type Option

type Option func(*Config) *Config

Option is an optional config value for the IAMClient.

func WithRetryInitialDelay

func WithRetryInitialDelay(initialRetryDelay time.Duration) Option

WithRetryInitialDelay configures the initial delay time before sending a retry for the IAM Client.

func WithRetryMaxAttempts

func WithRetryMaxAttempts(maxRetries uint64) Option

WithRetryMaxAttempts configures the maximum number of retry attempts for the IAM Client.

func WithRetryMaxDelay

func WithRetryMaxDelay(maxRetryDelay time.Duration) Option

WithRetryMaxDelay configures the maximum delay time before sending a retry for the IAM Client.

type Request

type Request struct {
	Name   string
	Params []any
}

Jump to

Keyboard shortcuts

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