Documentation
¶
Index ¶
- Constants
- type Policy
- type Service
- func (o *Service) ActivatePolicy(scheme string, policyID uuid.UUID) error
- func (o *Service) CreateOPAPolicy(scheme string, rules []byte, name string) (*Policy, error)
- func (o *Service) CreatePolicy(scheme string, ct string, rules []byte, name string) (*Policy, error)
- func (o *Service) DeactivateAllPolicies(scheme string) error
- func (o *Service) GetActivePolicy(scheme string) (*Policy, error)
- func (o *Service) GetPolicies(scheme string, name string) ([]*Policy, error)
- func (o *Service) GetPolicy(scheme string, policyID uuid.UUID) (*Policy, error)
- func (o *Service) GetSupportedSchemes() ([]string, error)
- func (o *Service) SetClient(client *common.Client) error
- func (o *Service) SetEndpointURI(uri string) error
Constants ¶
const ( OPARulesMediaType = "application/vnd.veraison.policy.opa" PolicyMediaType = "application/vnd.veraison.policy+json" PoliciesMediaType = "application/vnd.veraison.policies+json" WellKnownMediaType = "application/vnd.veraison.discovery+json" WellKnownPath = "/.well-known/veraison/management" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Policy ¶
type Policy struct {
// UUID is the unque identifier associated with this specific instance
// of a policy.
UUID uuid.UUID `json:"uuid"`
// CTime is the creationg time of this policy.
CTime time.Time `json:"ctime"`
// Name is the name of this policy. It's a short descritor for the
// rules in this policy.
Name string `json:"name"`
// Type identifies the policy engine used to evaluate the policy, and
// therfore dictates how the Rules should be interpreted.
Type string `json:"type"`
// Rules of the policy to be interpreted and execute by the policy
// agent.
Rules string `json:"rules"`
// Active indicates whether this policy instance is currently active
// for the associated key.
Active bool `json:"active"`
}
Policy allows enforcing additional constraints on top of the regular attestation schemes.
type Service ¶
type Service struct {
// Client is the underlying client used for HTTP requests.
Client *common.Client
// EndPointURI is the top-level service API URL. Individual operations
// endpoints are relative to this.
EndPointURI *url.URL
}
Service is the primary interface to the management service API.
func NewInsecureTLSService ¶ added in v0.3.0
func NewInsecureTLSService(uri string, a auth.IAuthenticator) (*Service, error)
NewInsecureTLSService creates a new Service instance using the provided endpoint URI and an HTTPS client that does not verify certs. If the supplied IAuthenticator is not nil, that will be used to set the Authorization header in the service requests.
func NewService ¶
func NewService(uri string, a auth.IAuthenticator) (*Service, error)
NewService creates a new Service instance using the provided endpoint URI and the default HTTP client. If the supplied IAuthenticator is not nil, that will be used to set the Authorization header in the service requests.
func NewTLSService ¶ added in v0.3.0
NewTLSService creates a new Service instance using the provided endpoint URI and an HTTPS client configured with the specified certs (in addition to the system certs). If the supplied IAuthenticator is not nil, that will be used to set the Authorization header in the service requests.
func (*Service) ActivatePolicy ¶
ActivatePolicy activates a previously created policy with the policyID UUID, associated with the specified scheme. This deactivates any previously-active policy.
func (*Service) CreateOPAPolicy ¶
CreateOPAPolicy is a wrapper around CreatePolicy that assumes the OPA media type.
func (*Service) CreatePolicy ¶
func (o *Service) CreatePolicy( scheme string, ct string, rules []byte, name string, ) (*Policy, error)
CreatePolicy creates a new policy associated with the specified scheme based on the specified content type and rules, with the specified name.
func (*Service) DeactivateAllPolicies ¶
DeactivateAllPolicies deactivates all policies associated with the specified scheme.
func (*Service) GetActivePolicy ¶
GetActivePolicy returns the currently active policy for the specified scheme. If no such policy exists, an error is returned.
func (*Service) GetPolicies ¶
GetPolicies returns all policies associated with the specified scheme. If the name is specified as something other than "", only policies with that name are returned.
func (*Service) GetPolicy ¶
GetPolicy returns the policy with the specified UUID associated with the specified scheme.
func (*Service) GetSupportedSchemes ¶
GetSupportedSchemes returns a []string with the names of schemes supported by the service.
func (*Service) SetEndpointURI ¶
SetEndpointURI sets the URI if the Veraison services management endpoint.