Documentation
¶
Index ¶
- Constants
- Variables
- func NewDeletePolicyAutoImportEndpoint(s Service) goa.Endpoint
- func NewEvaluateEndpoint(s Service) goa.Endpoint
- func NewExportBundleEndpoint(s Service) goa.Endpoint
- func NewImportBundleEndpoint(s Service) goa.Endpoint
- func NewListPoliciesEndpoint(s Service) goa.Endpoint
- func NewLockEndpoint(s Service) goa.Endpoint
- func NewPolicyAutoImportEndpoint(s Service) goa.Endpoint
- func NewPolicyPublicKeyEndpoint(s Service) goa.Endpoint
- func NewSetPolicyAutoImportEndpoint(s Service) goa.Endpoint
- func NewSubscribeForPolicyChangeEndpoint(s Service) goa.Endpoint
- func NewUnlockEndpoint(s Service) goa.Endpoint
- func NewValidateEndpoint(s Service) goa.Endpoint
- type Client
- func (c *Client) DeletePolicyAutoImport(ctx context.Context, p *DeletePolicyAutoImportRequest) (res any, err error)
- func (c *Client) Evaluate(ctx context.Context, p *EvaluateRequest) (res *EvaluateResult, err error)
- func (c *Client) ExportBundle(ctx context.Context, p *ExportBundleRequest) (res *ExportBundleResult, resp io.ReadCloser, err error)
- func (c *Client) ImportBundle(ctx context.Context, p *ImportBundlePayload, req io.ReadCloser) (res any, err error)
- func (c *Client) ListPolicies(ctx context.Context, p *PoliciesRequest) (res *PoliciesResult, err error)
- func (c *Client) Lock(ctx context.Context, p *LockRequest) (err error)
- func (c *Client) PolicyAutoImport(ctx context.Context) (res any, err error)
- func (c *Client) PolicyPublicKey(ctx context.Context, p *PolicyPublicKeyRequest) (res any, err error)
- func (c *Client) SetPolicyAutoImport(ctx context.Context, p *SetPolicyAutoImportRequest) (res any, err error)
- func (c *Client) SubscribeForPolicyChange(ctx context.Context, p *SubscribeRequest) (res any, err error)
- func (c *Client) Unlock(ctx context.Context, p *UnlockRequest) (err error)
- func (c *Client) Validate(ctx context.Context, p *EvaluateRequest) (res *EvaluateResult, err error)
- type DeletePolicyAutoImportRequest
- type Endpoints
- type EvaluateRequest
- type EvaluateResult
- type ExportBundleRequest
- type ExportBundleResponseData
- type ExportBundleResult
- type ImportBundlePayload
- type ImportBundleRequestData
- type LockRequest
- type PoliciesRequest
- type PoliciesResult
- type Policy
- type PolicyPublicKeyRequest
- type Service
- type SetPolicyAutoImportRequest
- type SubscribeRequest
- type UnlockRequest
Constants ¶
const ServiceName = "policy"
ServiceName is the name of the service as defined in the design. This is the same value that is set in the endpoint request contexts under the ServiceKey key.
Variables ¶
var MethodNames = [12]string{"Evaluate", "Validate", "Lock", "Unlock", "ExportBundle", "PolicyPublicKey", "ImportBundle", "ListPolicies", "SetPolicyAutoImport", "PolicyAutoImport", "DeletePolicyAutoImport", "SubscribeForPolicyChange"}
MethodNames lists the service method names as defined in the design. These are the same values that are set in the endpoint request contexts under the MethodKey key.
Functions ¶
func NewDeletePolicyAutoImportEndpoint ¶ added in v1.2.0
NewDeletePolicyAutoImportEndpoint returns an endpoint function that calls the method "DeletePolicyAutoImport" of service "policy".
func NewEvaluateEndpoint ¶
NewEvaluateEndpoint returns an endpoint function that calls the method "Evaluate" of service "policy".
func NewExportBundleEndpoint ¶
NewExportBundleEndpoint returns an endpoint function that calls the method "ExportBundle" of service "policy".
func NewImportBundleEndpoint ¶
NewImportBundleEndpoint returns an endpoint function that calls the method "ImportBundle" of service "policy".
func NewListPoliciesEndpoint ¶
NewListPoliciesEndpoint returns an endpoint function that calls the method "ListPolicies" of service "policy".
func NewLockEndpoint ¶
NewLockEndpoint returns an endpoint function that calls the method "Lock" of service "policy".
func NewPolicyAutoImportEndpoint ¶ added in v1.2.0
NewPolicyAutoImportEndpoint returns an endpoint function that calls the method "PolicyAutoImport" of service "policy".
func NewPolicyPublicKeyEndpoint ¶
NewPolicyPublicKeyEndpoint returns an endpoint function that calls the method "PolicyPublicKey" of service "policy".
func NewSetPolicyAutoImportEndpoint ¶ added in v1.2.0
NewSetPolicyAutoImportEndpoint returns an endpoint function that calls the method "SetPolicyAutoImport" of service "policy".
func NewSubscribeForPolicyChangeEndpoint ¶
NewSubscribeForPolicyChangeEndpoint returns an endpoint function that calls the method "SubscribeForPolicyChange" of service "policy".
func NewUnlockEndpoint ¶
NewUnlockEndpoint returns an endpoint function that calls the method "Unlock" of service "policy".
func NewValidateEndpoint ¶
NewValidateEndpoint returns an endpoint function that calls the method "Validate" of service "policy".
Types ¶
type Client ¶
type Client struct { EvaluateEndpoint goa.Endpoint ValidateEndpoint goa.Endpoint LockEndpoint goa.Endpoint UnlockEndpoint goa.Endpoint ExportBundleEndpoint goa.Endpoint PolicyPublicKeyEndpoint goa.Endpoint ImportBundleEndpoint goa.Endpoint ListPoliciesEndpoint goa.Endpoint SetPolicyAutoImportEndpoint goa.Endpoint PolicyAutoImportEndpoint goa.Endpoint DeletePolicyAutoImportEndpoint goa.Endpoint SubscribeForPolicyChangeEndpoint goa.Endpoint }
Client is the "policy" service client.
func NewClient ¶
func NewClient(evaluate, validate, lock, unlock, exportBundle, policyPublicKey, importBundle, listPolicies, setPolicyAutoImport, policyAutoImport, deletePolicyAutoImport, subscribeForPolicyChange goa.Endpoint) *Client
NewClient initializes a "policy" service client given the endpoints.
func (*Client) DeletePolicyAutoImport ¶ added in v1.2.0
func (c *Client) DeletePolicyAutoImport(ctx context.Context, p *DeletePolicyAutoImportRequest) (res any, err error)
DeletePolicyAutoImport calls the "DeletePolicyAutoImport" endpoint of the "policy" service.
func (*Client) Evaluate ¶
func (c *Client) Evaluate(ctx context.Context, p *EvaluateRequest) (res *EvaluateResult, err error)
Evaluate calls the "Evaluate" endpoint of the "policy" service.
func (*Client) ExportBundle ¶
func (c *Client) ExportBundle(ctx context.Context, p *ExportBundleRequest) (res *ExportBundleResult, resp io.ReadCloser, err error)
ExportBundle calls the "ExportBundle" endpoint of the "policy" service.
func (*Client) ImportBundle ¶
func (c *Client) ImportBundle(ctx context.Context, p *ImportBundlePayload, req io.ReadCloser) (res any, err error)
ImportBundle calls the "ImportBundle" endpoint of the "policy" service.
func (*Client) ListPolicies ¶
func (c *Client) ListPolicies(ctx context.Context, p *PoliciesRequest) (res *PoliciesResult, err error)
ListPolicies calls the "ListPolicies" endpoint of the "policy" service.
func (*Client) Lock ¶
func (c *Client) Lock(ctx context.Context, p *LockRequest) (err error)
Lock calls the "Lock" endpoint of the "policy" service.
func (*Client) PolicyAutoImport ¶ added in v1.2.0
PolicyAutoImport calls the "PolicyAutoImport" endpoint of the "policy" service.
func (*Client) PolicyPublicKey ¶
func (c *Client) PolicyPublicKey(ctx context.Context, p *PolicyPublicKeyRequest) (res any, err error)
PolicyPublicKey calls the "PolicyPublicKey" endpoint of the "policy" service.
func (*Client) SetPolicyAutoImport ¶ added in v1.2.0
func (c *Client) SetPolicyAutoImport(ctx context.Context, p *SetPolicyAutoImportRequest) (res any, err error)
SetPolicyAutoImport calls the "SetPolicyAutoImport" endpoint of the "policy" service.
func (*Client) SubscribeForPolicyChange ¶
func (c *Client) SubscribeForPolicyChange(ctx context.Context, p *SubscribeRequest) (res any, err error)
SubscribeForPolicyChange calls the "SubscribeForPolicyChange" endpoint of the "policy" service.
func (*Client) Unlock ¶
func (c *Client) Unlock(ctx context.Context, p *UnlockRequest) (err error)
Unlock calls the "Unlock" endpoint of the "policy" service.
func (*Client) Validate ¶
func (c *Client) Validate(ctx context.Context, p *EvaluateRequest) (res *EvaluateResult, err error)
Validate calls the "Validate" endpoint of the "policy" service.
type DeletePolicyAutoImportRequest ¶ added in v1.2.0
type DeletePolicyAutoImportRequest struct { // PolicyURL defines the address from where a policy bundle will be taken. PolicyURL string }
DeletePolicyAutoImportRequest is the payload type of the policy service DeletePolicyAutoImport method.
type Endpoints ¶
type Endpoints struct { Evaluate goa.Endpoint Validate goa.Endpoint Lock goa.Endpoint Unlock goa.Endpoint ExportBundle goa.Endpoint PolicyPublicKey goa.Endpoint ImportBundle goa.Endpoint ListPolicies goa.Endpoint SetPolicyAutoImport goa.Endpoint PolicyAutoImport goa.Endpoint DeletePolicyAutoImport goa.Endpoint SubscribeForPolicyChange goa.Endpoint }
Endpoints wraps the "policy" service endpoints.
func NewEndpoints ¶
NewEndpoints wraps the methods of the "policy" service with endpoints.
type EvaluateRequest ¶
type EvaluateRequest struct { // Policy repository. Repository string // Policy group. Group string // Policy name. PolicyName string // Policy version. Version string // Input data passed to the policy execution runtime. Input any // Identifier created by external system and passed as parameter to overwrite // the randomly generated evaluationID. EvaluationID *string // TTL for storing policy result in cache TTL *int }
EvaluateRequest is the payload type of the policy service Evaluate method.
type EvaluateResult ¶
type EvaluateResult struct { // Arbitrary JSON response. Result any // ETag contains unique identifier of the policy evaluation and can be used to // later retrieve the results from Cache. ETag string }
EvaluateResult is the result type of the policy service Evaluate method.
type ExportBundleRequest ¶
type ExportBundleRequest struct { // Policy repository. Repository string // Policy group. Group string // Policy name. PolicyName string // Policy version. Version string }
ExportBundleRequest is the payload type of the policy service ExportBundle method.
type ExportBundleResponseData ¶
type ExportBundleResponseData struct { // Result is the method result. Result *ExportBundleResult // Body streams the HTTP response body. Body io.ReadCloser }
ExportBundleResponseData holds both the result and the HTTP response body reader of the "ExportBundle" method.
type ExportBundleResult ¶
type ExportBundleResult struct { // Content-Type response header. ContentType string // Content-Length response header. ContentLength int // Content-Disposition response header containing the name of the file. ContentDisposition string }
ExportBundleResult is the result type of the policy service ExportBundle method.
type ImportBundlePayload ¶
type ImportBundlePayload struct {
Length *int
}
ImportBundlePayload is the payload type of the policy service ImportBundle method.
type ImportBundleRequestData ¶
type ImportBundleRequestData struct { // Payload is the method payload. Payload *ImportBundlePayload // Body streams the HTTP request body. Body io.ReadCloser }
ImportBundleRequestData holds both the payload and the HTTP request body reader of the "ImportBundle" method.
type LockRequest ¶
type LockRequest struct { // Policy repository. Repository string // Policy group. Group string // Policy name. PolicyName string // Policy version. Version string }
LockRequest is the payload type of the policy service Lock method.
type PoliciesRequest ¶
type PoliciesRequest struct { Locked *bool PolicyName *string Rego *bool Data *bool DataConfig *bool }
PoliciesRequest is the payload type of the policy service ListPolicies method.
type PoliciesResult ¶
type PoliciesResult struct { // JSON array of policies. Policies []*Policy }
PoliciesResult is the result type of the policy service ListPolicies method.
type Policy ¶
type Policy struct { // Policy repository. Repository string // Policy name. PolicyName string // Policy group. Group string // Policy version. Version string // Policy rego source code. Rego *string // Policy static data. Data *string // Policy static data optional configuration. DataConfig *string // Locked specifies if the policy is locked or allowed to execute. Locked bool // Last update (Unix timestamp). LastUpdate int64 }
type PolicyPublicKeyRequest ¶
type PolicyPublicKeyRequest struct { // Policy repository. Repository string // Policy group. Group string // Policy name. PolicyName string // Policy version. Version string }
PolicyPublicKeyRequest is the payload type of the policy service PolicyPublicKey method.
type Service ¶
type Service interface { // Evaluate executes a policy with the given 'data' as input. Evaluate(context.Context, *EvaluateRequest) (res *EvaluateResult, err error) // Validate executes a policy with the given 'data' as input and validates the // output schema. Validate(context.Context, *EvaluateRequest) (res *EvaluateResult, err error) // Lock a policy so that it cannot be evaluated. Lock(context.Context, *LockRequest) (err error) // Unlock a policy so it can be evaluated again. Unlock(context.Context, *UnlockRequest) (err error) // Export a signed policy bundle. ExportBundle(context.Context, *ExportBundleRequest) (res *ExportBundleResult, body io.ReadCloser, err error) // PolicyPublicKey returns the public key in JWK format which must be used to // verify a signed policy bundle. PolicyPublicKey(context.Context, *PolicyPublicKeyRequest) (res any, err error) // Import a signed policy bundle. ImportBundle(context.Context, *ImportBundlePayload, io.ReadCloser) (res any, err error) // List policies from storage with optional filters. ListPolicies(context.Context, *PoliciesRequest) (res *PoliciesResult, err error) // SetPolicyAutoImport enables automatic import of policy bundle on a given // time interval. SetPolicyAutoImport(context.Context, *SetPolicyAutoImportRequest) (res any, err error) // PolicyAutoImport returns all automatic import configurations. PolicyAutoImport(context.Context) (res any, err error) // DeletePolicyAutoImport removes a single automatic import configuration. DeletePolicyAutoImport(context.Context, *DeletePolicyAutoImportRequest) (res any, err error) // Subscribe for policy change notifications by registering webhook callbacks // which the policy service will call. SubscribeForPolicyChange(context.Context, *SubscribeRequest) (res any, err error) }
Policy Service provides evaluation of policies through Open Policy Agent.
type SetPolicyAutoImportRequest ¶ added in v1.2.0
type SetPolicyAutoImportRequest struct { // PolicyURL defines the address from where a policy bundle will be taken. PolicyURL string // Interval defines the period for automatic bundle import. Interval string }
SetPolicyAutoImportRequest is the payload type of the policy service SetPolicyAutoImport method.
type SubscribeRequest ¶
type SubscribeRequest struct { // Subscriber webhook url. WebhookURL string // Name of the subscriber for policy. Subscriber string // Policy repository. Repository string // Policy name. PolicyName string // Policy group. Group string // Policy version. Version string }
SubscribeRequest is the payload type of the policy service SubscribeForPolicyChange method.