Documentation
¶
Index ¶
- Variables
- type NewRegistryConfig
- type PolicyProvider
- func (p *PolicyProvider) Resolve(policyName, policyOrgName string, authOpts ProviderAuthOpts, ...) (*schemaapi.Policy, *PolicyReference, error)
- func (p *PolicyProvider) ResolveGroup(groupName, groupOrgName string, authOpts ProviderAuthOpts, ...) (*schemaapi.PolicyGroup, *PolicyReference, error)
- func (p *PolicyProvider) ValidateAttachment(att *schemaapi.PolicyAttachment, authOpts ProviderAuthOpts) error
- type PolicyReference
- type ProviderAuthOpts
- type ProviderResponse
- type RawMessage
- type Registry
- type ResolveOption
- type UnexpectedStatusError
- type ValidateRequest
- type ValidateResponse
Constants ¶
This section is empty.
Variables ¶
var ( ErrNotFound = fmt.Errorf("policy not found") )
Functions ¶
This section is empty.
Types ¶
type NewRegistryConfig ¶
type PolicyProvider ¶
type PolicyProvider struct {
// contains filtered or unexported fields
}
PolicyProvider represents an external policy provider
func (*PolicyProvider) Resolve ¶
func (p *PolicyProvider) Resolve(policyName, policyOrgName string, authOpts ProviderAuthOpts, opts ...ResolveOption) (*schemaapi.Policy, *PolicyReference, error)
Resolve calls the remote provider for retrieving a policy. See WithIgnoreCLICompatibility for the available resolution options.
func (*PolicyProvider) ResolveGroup ¶ added in v0.96.14
func (p *PolicyProvider) ResolveGroup(groupName, groupOrgName string, authOpts ProviderAuthOpts, opts ...ResolveOption) (*schemaapi.PolicyGroup, *PolicyReference, error)
ResolveGroup calls remote provider for retrieving a policy group definition. See WithIgnoreCLICompatibility for the available resolution options.
func (*PolicyProvider) ValidateAttachment ¶ added in v0.144.0
func (p *PolicyProvider) ValidateAttachment(att *schemaapi.PolicyAttachment, authOpts ProviderAuthOpts) error
type PolicyReference ¶ added in v0.96.5
type ProviderAuthOpts ¶ added in v0.166.0
type ProviderResponse ¶
type ProviderResponse struct {
// Deprecated: Raw is the preferred approach
Data map[string]any `json:"data"`
Digest string `json:"digest"`
Raw *RawMessage `json:"raw"`
OrganizationName string `json:"organizationName"`
}
type RawMessage ¶ added in v0.97.7
type Registry ¶
type Registry struct {
// contains filtered or unexported fields
}
Registry manages policy providers
func NewRegistry ¶
func NewRegistry(logger log.Logger, conf ...*NewRegistryConfig) (*Registry, error)
func (*Registry) DefaultProvider ¶
func (r *Registry) DefaultProvider() *PolicyProvider
func (*Registry) GetProvider ¶
func (r *Registry) GetProvider(name string) *PolicyProvider
func (*Registry) GetProviderNames ¶ added in v0.96.5
type ResolveOption ¶ added in v1.102.1
type ResolveOption func(*resolveOptions)
ResolveOption configures a policy or policy-group resolution request.
func WithIgnoreCLICompatibility ¶ added in v1.102.1
func WithIgnoreCLICompatibility() ResolveOption
WithIgnoreCLICompatibility makes the provider skip CLI-version compatibility resolution and return the true latest revision instead of the latest revision compatible with the requesting CLI version. It is meant for non-CLI callers such as the web UI or the control plane. On the wire this sets the include_all_versions query parameter.
type UnexpectedStatusError ¶ added in v1.132.0
type UnexpectedStatusError struct {
// StatusCode is the HTTP status code of the response.
StatusCode int
}
UnexpectedStatusError is returned when the policy provider answers with an HTTP status that the client does not handle. It has its own type so that Sentry does not group it with transport or decode failures.
func (*UnexpectedStatusError) Error ¶ added in v1.132.0
func (e *UnexpectedStatusError) Error() string
type ValidateRequest ¶ added in v0.144.0
type ValidateRequest struct {
PolicyAttachment string `json:"policy_attachment"`
}