management

package
v0.4.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 27, 2026 License: Apache-2.0 Imports: 8 Imported by: 1

Documentation

Index

Constants

View Source
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

func NewTLSService(uri string, a auth.IAuthenticator, certPaths []string) (*Service, error)

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

func (o *Service) ActivatePolicy(scheme string, policyID uuid.UUID) error

ActivatePolicy activates a previously created policy with the policyID UUID, associated with the specified scheme. This deactivates any previously-active policy.

func (*Service) CreateOPAPolicy

func (o *Service) CreateOPAPolicy(scheme string, rules []byte, name string) (*Policy, error)

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

func (o *Service) DeactivateAllPolicies(scheme string) error

DeactivateAllPolicies deactivates all policies associated with the specified scheme.

func (*Service) GetActivePolicy

func (o *Service) GetActivePolicy(scheme string) (*Policy, error)

GetActivePolicy returns the currently active policy for the specified scheme. If no such policy exists, an error is returned.

func (*Service) GetPolicies

func (o *Service) GetPolicies(scheme string, name string) ([]*Policy, error)

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

func (o *Service) GetPolicy(scheme string, policyID uuid.UUID) (*Policy, error)

GetPolicy returns the policy with the specified UUID associated with the specified scheme.

func (*Service) GetSupportedSchemes

func (o *Service) GetSupportedSchemes() ([]string, error)

GetSupportedSchemes returns a []string with the names of schemes supported by the service.

func (*Service) SetClient

func (o *Service) SetClient(client *common.Client) error

SetClient sets the HTTP(s) client connection configuration

func (*Service) SetEndpointURI

func (o *Service) SetEndpointURI(uri string) error

SetEndpointURI sets the URI if the Veraison services management endpoint.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL