roles

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: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func NewService

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

Types

type BindingNotFoundError

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

func (*BindingNotFoundError) Error

func (e *BindingNotFoundError) Error() string

type CRM

type CRM interface {
	GetPolicy(projectname string, getiampolicyrequest *cloudresourcemanager.GetIamPolicyRequest) (*cloudresourcemanager.Policy, error)
	SetPolicy(projectname string, setiampolicyrequest *cloudresourcemanager.SetIamPolicyRequest) (*cloudresourcemanager.Policy, error)
}

type Client

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

TODO: Add handling of policy version according to the comments in Policy type, see: https://godoc.org/google.golang.org/api/cloudresourcemanager/v1#Policy projects management object.

func New

func New(crmservice CRM) (*Client, error)

New return new Client and error object. Error is not used at present. Added it for future use and to support common error handling.

func (*Client) AddSAtoRole

func (client *Client) AddSAtoRole(saname string, roles []string, projectname string, condition *cloudresourcemanager.Expr) (*cloudresourcemanager.Policy, error)

TODO: Change method signature to accept condition expression string instead *cloudresourcemanager.Expr object. Align cmd main.go code to pass expression string. AddSAtoRole will fetch policy from GCP, assign serviceaccount to roles and send policy back to GCP. If role binding doesn't exist it will be added to the policy. Check in caller if returned error is PolicyModifiedError. If yes, GCP policy was changed by other caller in the meantime.

func (*Client) MakeSafqdn

func (client *Client) MakeSafqdn(saname string, projectname string) string

TODO: This should be renamed to make sa resource string. It should not be exported. Revert it to client private method. makeSafqdn will create serviceaccount fully qualified valid name, accepted by GCP API.

func (*Client) RemoveSaRole

func (client *Client) RemoveSaRole(saname string, roles []string, projectname string, condition *cloudresourcemanager.Expr) (*cloudresourcemanager.Policy, error)

TODO: Change method signature to accept condition expression string instead *cloudresourcemanager.Expr object. Align cmd main.go code to pass expression string. AddSAtoRole will fetch policy from GCP, assign serviceaccount to roles and send policy back to GCP. If role binding doesn't exist it will be added to the policy. Check in caller if returned error is PolicyModifiedError. If yes, GCP policy was changed by other caller in the meantime.

type PolicyModifiedError

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

Custom Errors

func (*PolicyModifiedError) Error

func (e *PolicyModifiedError) Error() string

Implementation of Error interface.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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