Documentation
¶
Overview ¶
Package device_policy owns daemon-local Device policy persistence and watches.
Index ¶
- Constants
- func FilePath(stateRoot string) string
- func Validate(policy *DevicePolicy) error
- func WriteFile(stateRoot string, policy *DevicePolicy) error
- type CheckoutRootPolicy
- func (m *CheckoutRootPolicy) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *CheckoutRootPolicy) CloneVT() *CheckoutRootPolicy
- func (this *CheckoutRootPolicy) EqualMessageVT(thatMsg any) bool
- func (this *CheckoutRootPolicy) EqualVT(that *CheckoutRootPolicy) bool
- func (x *CheckoutRootPolicy) GetAccess() device.DeviceCheckoutRootAccess
- func (x *CheckoutRootPolicy) GetLocalPath() string
- func (x *CheckoutRootPolicy) GetName() string
- func (x *CheckoutRootPolicy) MarshalJSON() ([]byte, error)
- func (x *CheckoutRootPolicy) MarshalProtoJSON(s *json.MarshalState)
- func (x *CheckoutRootPolicy) MarshalProtoText() string
- func (m *CheckoutRootPolicy) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *CheckoutRootPolicy) MarshalToVT(dAtA []byte) (int, error)
- func (m *CheckoutRootPolicy) MarshalVT() (dAtA []byte, err error)
- func (*CheckoutRootPolicy) ProtoMessage()
- func (x *CheckoutRootPolicy) Reset()
- func (m *CheckoutRootPolicy) SizeVT() (n int)
- func (x *CheckoutRootPolicy) String() string
- func (x *CheckoutRootPolicy) UnmarshalJSON(b []byte) error
- func (x *CheckoutRootPolicy) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *CheckoutRootPolicy) UnmarshalVT(dAtA []byte) error
- type DevicePolicy
- func (m *DevicePolicy) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *DevicePolicy) CloneVT() *DevicePolicy
- func (this *DevicePolicy) EqualMessageVT(thatMsg any) bool
- func (this *DevicePolicy) EqualVT(that *DevicePolicy) bool
- func (x *DevicePolicy) GetCheckoutRoot() []*CheckoutRootPolicy
- func (x *DevicePolicy) GetRemoteShell() *RemoteShellPolicy
- func (x *DevicePolicy) GetRevision() uint64
- func (x *DevicePolicy) MarshalJSON() ([]byte, error)
- func (x *DevicePolicy) MarshalProtoJSON(s *json.MarshalState)
- func (x *DevicePolicy) MarshalProtoText() string
- func (m *DevicePolicy) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *DevicePolicy) MarshalToVT(dAtA []byte) (int, error)
- func (m *DevicePolicy) MarshalVT() (dAtA []byte, err error)
- func (*DevicePolicy) ProtoMessage()
- func (x *DevicePolicy) Reset()
- func (m *DevicePolicy) SizeVT() (n int)
- func (x *DevicePolicy) String() string
- func (x *DevicePolicy) UnmarshalJSON(b []byte) error
- func (x *DevicePolicy) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *DevicePolicy) UnmarshalVT(dAtA []byte) error
- type PolicyStore
- type RemoteShellPolicy
- func (m *RemoteShellPolicy) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *RemoteShellPolicy) CloneVT() *RemoteShellPolicy
- func (this *RemoteShellPolicy) EqualMessageVT(thatMsg any) bool
- func (this *RemoteShellPolicy) EqualVT(that *RemoteShellPolicy) bool
- func (x *RemoteShellPolicy) GetDetail() string
- func (x *RemoteShellPolicy) GetEnabled() bool
- func (x *RemoteShellPolicy) MarshalJSON() ([]byte, error)
- func (x *RemoteShellPolicy) MarshalProtoJSON(s *json.MarshalState)
- func (x *RemoteShellPolicy) MarshalProtoText() string
- func (m *RemoteShellPolicy) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *RemoteShellPolicy) MarshalToVT(dAtA []byte) (int, error)
- func (m *RemoteShellPolicy) MarshalVT() (dAtA []byte, err error)
- func (*RemoteShellPolicy) ProtoMessage()
- func (x *RemoteShellPolicy) Reset()
- func (m *RemoteShellPolicy) SizeVT() (n int)
- func (x *RemoteShellPolicy) String() string
- func (x *RemoteShellPolicy) UnmarshalJSON(b []byte) error
- func (x *RemoteShellPolicy) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *RemoteShellPolicy) UnmarshalVT(dAtA []byte) error
Constants ¶
const ( // StateDir is the daemon state-root directory containing Device-local files. StateDir = "device" // StateFile is the generated-JSON policy file name under StateDir. StateFile = "policy.json" )
Variables ¶
This section is empty.
Functions ¶
func Validate ¶
func Validate(policy *DevicePolicy) error
Validate checks the persisted Device policy shape.
func WriteFile ¶
func WriteFile(stateRoot string, policy *DevicePolicy) error
WriteFile writes the Device policy file under stateRoot.
Types ¶
type CheckoutRootPolicy ¶
type CheckoutRootPolicy struct {
// Name is the stable checkout-root selector.
Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
// LocalPath is the daemon-local filesystem path.
LocalPath string `protobuf:"bytes,2,opt,name=local_path,json=localPath,proto3" json:"localPath,omitempty"`
// Access is the read/write mode exposed by the Device.
Access device.DeviceCheckoutRootAccess `protobuf:"varint,3,opt,name=access,proto3" json:"access,omitempty"`
// contains filtered or unexported fields
}
CheckoutRootPolicy declares one local checkout root exposed by this Device.
func (*CheckoutRootPolicy) CloneMessageVT ¶
func (m *CheckoutRootPolicy) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*CheckoutRootPolicy) CloneVT ¶
func (m *CheckoutRootPolicy) CloneVT() *CheckoutRootPolicy
func (*CheckoutRootPolicy) EqualMessageVT ¶
func (this *CheckoutRootPolicy) EqualMessageVT(thatMsg any) bool
func (*CheckoutRootPolicy) EqualVT ¶
func (this *CheckoutRootPolicy) EqualVT(that *CheckoutRootPolicy) bool
func (*CheckoutRootPolicy) GetAccess ¶
func (x *CheckoutRootPolicy) GetAccess() device.DeviceCheckoutRootAccess
func (*CheckoutRootPolicy) GetLocalPath ¶
func (x *CheckoutRootPolicy) GetLocalPath() string
func (*CheckoutRootPolicy) GetName ¶
func (x *CheckoutRootPolicy) GetName() string
func (*CheckoutRootPolicy) MarshalJSON ¶
func (x *CheckoutRootPolicy) MarshalJSON() ([]byte, error)
MarshalJSON marshals the CheckoutRootPolicy to JSON.
func (*CheckoutRootPolicy) MarshalProtoJSON ¶
func (x *CheckoutRootPolicy) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the CheckoutRootPolicy message to JSON.
func (*CheckoutRootPolicy) MarshalProtoText ¶
func (x *CheckoutRootPolicy) MarshalProtoText() string
func (*CheckoutRootPolicy) MarshalToSizedBufferVT ¶
func (m *CheckoutRootPolicy) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*CheckoutRootPolicy) MarshalToVT ¶
func (m *CheckoutRootPolicy) MarshalToVT(dAtA []byte) (int, error)
func (*CheckoutRootPolicy) MarshalVT ¶
func (m *CheckoutRootPolicy) MarshalVT() (dAtA []byte, err error)
func (*CheckoutRootPolicy) ProtoMessage ¶
func (*CheckoutRootPolicy) ProtoMessage()
func (*CheckoutRootPolicy) Reset ¶
func (x *CheckoutRootPolicy) Reset()
func (*CheckoutRootPolicy) SizeVT ¶
func (m *CheckoutRootPolicy) SizeVT() (n int)
func (*CheckoutRootPolicy) String ¶
func (x *CheckoutRootPolicy) String() string
func (*CheckoutRootPolicy) UnmarshalJSON ¶
func (x *CheckoutRootPolicy) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the CheckoutRootPolicy from JSON.
func (*CheckoutRootPolicy) UnmarshalProtoJSON ¶
func (x *CheckoutRootPolicy) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the CheckoutRootPolicy message from JSON.
func (*CheckoutRootPolicy) UnmarshalVT ¶
func (m *CheckoutRootPolicy) UnmarshalVT(dAtA []byte) error
type DevicePolicy ¶
type DevicePolicy struct {
// Revision increments on every policy mutation.
Revision uint64 `protobuf:"varint,1,opt,name=revision,proto3" json:"revision,omitempty"`
// RemoteShell controls remote-shell OPEN authorization.
RemoteShell *RemoteShellPolicy `protobuf:"bytes,2,opt,name=remote_shell,json=remoteShell,proto3" json:"remoteShell,omitempty"`
// CheckoutRoot declares locally available checkout roots.
CheckoutRoot []*CheckoutRootPolicy `protobuf:"bytes,3,rep,name=checkout_root,json=checkoutRoot,proto3" json:"checkoutRoot,omitempty"`
// contains filtered or unexported fields
}
DevicePolicy is the daemon-local policy that controls Device capabilities.
func ReadFile ¶
func ReadFile(stateRoot string) (*DevicePolicy, error)
ReadFile reads the Device policy file under stateRoot.
func (*DevicePolicy) CloneMessageVT ¶
func (m *DevicePolicy) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*DevicePolicy) CloneVT ¶
func (m *DevicePolicy) CloneVT() *DevicePolicy
func (*DevicePolicy) EqualMessageVT ¶
func (this *DevicePolicy) EqualMessageVT(thatMsg any) bool
func (*DevicePolicy) EqualVT ¶
func (this *DevicePolicy) EqualVT(that *DevicePolicy) bool
func (*DevicePolicy) GetCheckoutRoot ¶
func (x *DevicePolicy) GetCheckoutRoot() []*CheckoutRootPolicy
func (*DevicePolicy) GetRemoteShell ¶
func (x *DevicePolicy) GetRemoteShell() *RemoteShellPolicy
func (*DevicePolicy) GetRevision ¶
func (x *DevicePolicy) GetRevision() uint64
func (*DevicePolicy) MarshalJSON ¶
func (x *DevicePolicy) MarshalJSON() ([]byte, error)
MarshalJSON marshals the DevicePolicy to JSON.
func (*DevicePolicy) MarshalProtoJSON ¶
func (x *DevicePolicy) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the DevicePolicy message to JSON.
func (*DevicePolicy) MarshalProtoText ¶
func (x *DevicePolicy) MarshalProtoText() string
func (*DevicePolicy) MarshalToSizedBufferVT ¶
func (m *DevicePolicy) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*DevicePolicy) MarshalToVT ¶
func (m *DevicePolicy) MarshalToVT(dAtA []byte) (int, error)
func (*DevicePolicy) MarshalVT ¶
func (m *DevicePolicy) MarshalVT() (dAtA []byte, err error)
func (*DevicePolicy) ProtoMessage ¶
func (*DevicePolicy) ProtoMessage()
func (*DevicePolicy) Reset ¶
func (x *DevicePolicy) Reset()
func (*DevicePolicy) SizeVT ¶
func (m *DevicePolicy) SizeVT() (n int)
func (*DevicePolicy) String ¶
func (x *DevicePolicy) String() string
func (*DevicePolicy) UnmarshalJSON ¶
func (x *DevicePolicy) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the DevicePolicy from JSON.
func (*DevicePolicy) UnmarshalProtoJSON ¶
func (x *DevicePolicy) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the DevicePolicy message from JSON.
func (*DevicePolicy) UnmarshalVT ¶
func (m *DevicePolicy) UnmarshalVT(dAtA []byte) error
type PolicyStore ¶
type PolicyStore struct {
// contains filtered or unexported fields
}
PolicyStore stores the current daemon-local Device policy and broadcasts reloads.
func NewPolicyStore ¶
func NewPolicyStore(stateRoot string) (*PolicyStore, error)
NewPolicyStore constructs a PolicyStore by loading the policy file once.
func (*PolicyStore) Reload ¶
func (s *PolicyStore) Reload() error
Reload loads the policy file and broadcasts the new current value.
func (*PolicyStore) Snapshot ¶
func (s *PolicyStore) Snapshot() *DevicePolicy
Snapshot returns the current policy value.
func (*PolicyStore) WaitChange ¶
func (s *PolicyStore) WaitChange(ctx context.Context, last *DevicePolicy) (*DevicePolicy, error)
WaitChange returns the current policy when it differs from last.
type RemoteShellPolicy ¶
type RemoteShellPolicy struct {
// Enabled allows remote shell OPEN frames when true.
Enabled bool `protobuf:"varint,1,opt,name=enabled,proto3" json:"enabled,omitempty"`
// Detail is an operator-visible policy note.
Detail string `protobuf:"bytes,2,opt,name=detail,proto3" json:"detail,omitempty"`
// contains filtered or unexported fields
}
RemoteShellPolicy controls whether remote shell OPEN frames may start a PTY.
func (*RemoteShellPolicy) CloneMessageVT ¶
func (m *RemoteShellPolicy) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*RemoteShellPolicy) CloneVT ¶
func (m *RemoteShellPolicy) CloneVT() *RemoteShellPolicy
func (*RemoteShellPolicy) EqualMessageVT ¶
func (this *RemoteShellPolicy) EqualMessageVT(thatMsg any) bool
func (*RemoteShellPolicy) EqualVT ¶
func (this *RemoteShellPolicy) EqualVT(that *RemoteShellPolicy) bool
func (*RemoteShellPolicy) GetDetail ¶
func (x *RemoteShellPolicy) GetDetail() string
func (*RemoteShellPolicy) GetEnabled ¶
func (x *RemoteShellPolicy) GetEnabled() bool
func (*RemoteShellPolicy) MarshalJSON ¶
func (x *RemoteShellPolicy) MarshalJSON() ([]byte, error)
MarshalJSON marshals the RemoteShellPolicy to JSON.
func (*RemoteShellPolicy) MarshalProtoJSON ¶
func (x *RemoteShellPolicy) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the RemoteShellPolicy message to JSON.
func (*RemoteShellPolicy) MarshalProtoText ¶
func (x *RemoteShellPolicy) MarshalProtoText() string
func (*RemoteShellPolicy) MarshalToSizedBufferVT ¶
func (m *RemoteShellPolicy) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*RemoteShellPolicy) MarshalToVT ¶
func (m *RemoteShellPolicy) MarshalToVT(dAtA []byte) (int, error)
func (*RemoteShellPolicy) MarshalVT ¶
func (m *RemoteShellPolicy) MarshalVT() (dAtA []byte, err error)
func (*RemoteShellPolicy) ProtoMessage ¶
func (*RemoteShellPolicy) ProtoMessage()
func (*RemoteShellPolicy) Reset ¶
func (x *RemoteShellPolicy) Reset()
func (*RemoteShellPolicy) SizeVT ¶
func (m *RemoteShellPolicy) SizeVT() (n int)
func (*RemoteShellPolicy) String ¶
func (x *RemoteShellPolicy) String() string
func (*RemoteShellPolicy) UnmarshalJSON ¶
func (x *RemoteShellPolicy) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the RemoteShellPolicy from JSON.
func (*RemoteShellPolicy) UnmarshalProtoJSON ¶
func (x *RemoteShellPolicy) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the RemoteShellPolicy message from JSON.
func (*RemoteShellPolicy) UnmarshalVT ¶
func (m *RemoteShellPolicy) UnmarshalVT(dAtA []byte) error