Documentation
¶
Overview ¶
Package gcpiampolicy holds the google.iam.v1 policy semantics shared by GCP service emulators: etag compare-and-set, policy versions with conditional bindings, and permission filtering.
Index ¶
- Constants
- func Apply(current, in *iampb.Policy, etag func() []byte) (*iampb.Policy, error)
- func Empty() *iampb.Policy
- func EmptyEtag() []byte
- func Granted(requested []string, prefix string) []string
- func HasConditions(p *iampb.Policy) bool
- func SetView(stored *iampb.Policy) *iampb.Policy
- func Validate(p *iampb.Policy) error
- func View(stored *iampb.Policy, requestedVersion int32) *iampb.Policy
- type Store
- func (s *Store) Drop(name string)
- func (s *Store) Get(name string, requestedVersion int32) *iampb.Policy
- func (s *Store) Reset()
- func (s *Store) Restore(policies map[string]*iampb.Policy, seq uint64)
- func (s *Store) Set(name string, in *iampb.Policy) (*iampb.Policy, error)
- func (s *Store) Snapshot() (map[string]*iampb.Policy, uint64)
Constants ¶
const ConditionalVersion = conditionalVer
ConditionalVersion is the policy version required to read or write conditional bindings.
Variables ¶
This section is empty.
Functions ¶
func Apply ¶
Apply validates in and builds the policy to store in place of current (nil when unset). A non-empty etag in in must match current's. etag mints the new etag.
func EmptyEtag ¶
func EmptyEtag() []byte
EmptyEtag is the etag of a resource that has no policy yet.
func Granted ¶
Granted returns the requested permissions that start with prefix: the emulator performs no authorization, so every permission that applies to the resource type counts as granted.
func HasConditions ¶
HasConditions reports whether any binding of p carries a condition.
func SetView ¶
SetView is the response to a successful SetIamPolicy: the stored policy at version 3.
Types ¶
type Store ¶
type Store struct {
// contains filtered or unexported fields
}
Store keeps policies by resource name; callers serialise access with their own lock.
func (*Store) Reset ¶
func (s *Store) Reset()
Reset drops every policy and restarts the etag sequence.