Documentation
¶
Index ¶
- type Client
- func (c Client) CreatePolicyBundle(ownerID string, context string, policy CreatePolicyBundleRequest) error
- func (c Client) FetchPolicyBundle(ownerID, context, policyName string) (interface{}, error)
- func (c Client) GetDecisionLogs(ownerID string, context string, request DecisionQueryRequest) ([]interface{}, error)
- func (c Client) MakeDecision(ownerID string, context string, req DecisionRequest) (interface{}, error)
- type CreatePolicyBundleRequest
- type DecisionQueryRequest
- type DecisionRequest
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
Client communicates with the CircleCI policy-service to ask questions about policies. It satisfies policy.ClientInterface.
func NewClient ¶
NewClient returns a new policy client that will use the provided settings.Config to automatically inject appropriate Circle-Token authentication and other relevant CLI headers.
func (Client) CreatePolicyBundle ¶ added in v0.1.20500
func (c Client) CreatePolicyBundle(ownerID string, context string, policy CreatePolicyBundleRequest) error
CreatePolicyBundle calls the Create Policy Bundle API in the Policy-Service. It creates a policy bundle for the specified owner+context and returns the http status code as response
func (Client) FetchPolicyBundle ¶ added in v0.1.20500
FetchPolicyBundle calls the GET policy-bundle API in the policy-service If policyName is empty, the full policy bundle would be fetched for given ownerID+context If a policyName is provided, only that matching policy would be fetched for given ownerID+context+policyName
func (Client) GetDecisionLogs ¶ added in v0.1.18980
func (c Client) GetDecisionLogs(ownerID string, context string, request DecisionQueryRequest) ([]interface{}, error)
GetDecisionLogs calls the GET decision query API of policy-service. The endpoint accepts multiple filter values as path query parameters (start-time, end-time, branch-name, project-id and offset).
func (Client) MakeDecision ¶ added in v0.1.19183
func (c Client) MakeDecision(ownerID string, context string, req DecisionRequest) (interface{}, error)
MakeDecision sends a requests to Policy-Service public decision endpoint and returns the decision response
type CreatePolicyBundleRequest ¶ added in v0.1.20500
CreatePolicyBundleRequest defines the fields for the Create-Policy-Bundle endpoint as defined in Policy Service
type DecisionQueryRequest ¶ added in v0.1.18980
type DecisionRequest ¶ added in v0.1.19183
type DecisionRequest struct { Input string `json:"input"` Metadata map[string]interface{} `json:"metadata,omitempty"` }
DecisionRequest represents a request to Policy-Service to evaluate a given input against an organization's policies. The context determines which policies to apply.