Documentation
¶
Overview ¶
Package gcpiam provides an in-memory mock implementation of GCP IAM.
Index ¶
- type Mock
- func (m *Mock) AddUserToGroup(_ context.Context, userName, groupName string) error
- func (m *Mock) AttachRolePolicy(_ context.Context, roleName, policyARN string) error
- func (m *Mock) AttachUserPolicy(_ context.Context, userName, policyARN string) error
- func (m *Mock) CheckPermission(_ context.Context, principal, action, resource string) (bool, error)
- func (m *Mock) CreateAccessKey(_ context.Context, cfg driver.AccessKeyConfig) (*driver.AccessKeyInfo, error)
- func (m *Mock) CreateGroup(_ context.Context, cfg driver.GroupConfig) (*driver.GroupInfo, error)
- func (m *Mock) CreatePolicy(_ context.Context, cfg driver.PolicyConfig) (*driver.PolicyInfo, error)
- func (m *Mock) CreateRole(_ context.Context, cfg driver.RoleConfig) (*driver.RoleInfo, error)
- func (m *Mock) CreateUser(_ context.Context, cfg driver.UserConfig) (*driver.UserInfo, error)
- func (m *Mock) DeleteAccessKey(_ context.Context, userName, accessKeyID string) error
- func (m *Mock) DeleteGroup(_ context.Context, name string) error
- func (m *Mock) DeletePolicy(_ context.Context, arn string) error
- func (m *Mock) DeleteRole(_ context.Context, name string) error
- func (m *Mock) DeleteUser(_ context.Context, name string) error
- func (m *Mock) DetachRolePolicy(_ context.Context, roleName, policyARN string) error
- func (m *Mock) DetachUserPolicy(_ context.Context, userName, policyARN string) error
- func (m *Mock) GetGroup(_ context.Context, name string) (*driver.GroupInfo, error)
- func (m *Mock) GetPolicy(_ context.Context, arn string) (*driver.PolicyInfo, error)
- func (m *Mock) GetRole(_ context.Context, name string) (*driver.RoleInfo, error)
- func (m *Mock) GetUser(_ context.Context, name string) (*driver.UserInfo, error)
- func (m *Mock) ListAccessKeys(_ context.Context, userName string) ([]driver.AccessKeyInfo, error)
- func (m *Mock) ListAttachedRolePolicies(_ context.Context, roleName string) ([]string, error)
- func (m *Mock) ListAttachedUserPolicies(_ context.Context, userName string) ([]string, error)
- func (m *Mock) ListGroups(_ context.Context) ([]driver.GroupInfo, error)
- func (m *Mock) ListGroupsForUser(_ context.Context, userName string) ([]driver.GroupInfo, error)
- func (m *Mock) ListPolicies(_ context.Context) ([]driver.PolicyInfo, error)
- func (m *Mock) ListRoles(_ context.Context) ([]driver.RoleInfo, error)
- func (m *Mock) ListUsers(_ context.Context) ([]driver.UserInfo, error)
- func (m *Mock) RemoveUserFromGroup(_ context.Context, userName, groupName string) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Mock ¶
type Mock struct {
// contains filtered or unexported fields
}
Mock is an in-memory mock implementation of the GCP IAM service.
func (*Mock) AddUserToGroup ¶ added in v1.3.2
AddUserToGroup adds a user to a group.
func (*Mock) AttachRolePolicy ¶
AttachRolePolicy binds a policy to a custom role.
func (*Mock) AttachUserPolicy ¶
AttachUserPolicy binds a policy to a service account (user).
func (*Mock) CheckPermission ¶
CheckPermission evaluates attached policies to determine if a principal is allowed to perform the given action on the given resource. Explicit Deny wins over Allow.
func (*Mock) CreateAccessKey ¶ added in v1.3.2
func (m *Mock) CreateAccessKey( _ context.Context, cfg driver.AccessKeyConfig, ) (*driver.AccessKeyInfo, error)
CreateAccessKey creates a new service account key.
func (*Mock) CreateGroup ¶ added in v1.3.2
CreateGroup creates a new GCP IAM group.
func (*Mock) CreatePolicy ¶
func (m *Mock) CreatePolicy(_ context.Context, cfg driver.PolicyConfig) (*driver.PolicyInfo, error)
CreatePolicy creates a new IAM policy binding.
func (*Mock) CreateRole ¶
CreateRole creates a new IAM custom role.
func (*Mock) CreateUser ¶
CreateUser creates a new IAM service account (user).
func (*Mock) DeleteAccessKey ¶ added in v1.3.2
DeleteAccessKey deletes a service account key.
func (*Mock) DeleteGroup ¶ added in v1.3.2
DeleteGroup deletes the GCP IAM group with the given name.
func (*Mock) DeletePolicy ¶
DeletePolicy deletes the IAM policy with the given resource name (ARN).
func (*Mock) DeleteRole ¶
DeleteRole deletes the IAM custom role with the given name.
func (*Mock) DeleteUser ¶
DeleteUser deletes the IAM service account with the given name.
func (*Mock) DetachRolePolicy ¶
DetachRolePolicy removes a policy binding from a custom role.
func (*Mock) DetachUserPolicy ¶
DetachUserPolicy removes a policy binding from a service account (user).
func (*Mock) ListAccessKeys ¶ added in v1.3.2
func (m *Mock) ListAccessKeys( _ context.Context, userName string, ) ([]driver.AccessKeyInfo, error)
ListAccessKeys returns all keys for the given service account.
func (*Mock) ListAttachedRolePolicies ¶
ListAttachedRolePolicies returns the resource names of policies attached to the given role.
func (*Mock) ListAttachedUserPolicies ¶
ListAttachedUserPolicies returns the resource names of policies attached to the given service account.
func (*Mock) ListGroups ¶ added in v1.3.2
ListGroups returns all GCP IAM groups.
func (*Mock) ListGroupsForUser ¶ added in v1.3.2
ListGroupsForUser returns all groups a user belongs to.
func (*Mock) ListPolicies ¶
ListPolicies returns all IAM policies.