Documentation
¶
Index ¶
- type Client
- func (c Client) CreatePolicy(ownerID string, policy CreationRequest) (interface{}, error)
- func (c Client) DeletePolicy(ownerID string, policyID string) error
- func (c Client) GetDecisionLogs(ownerID string, request DecisionQueryRequest) ([]interface{}, error)
- func (c Client) GetPolicy(ownerID string, policyID string) (interface{}, error)
- func (c Client) ListPolicies(ownerID string) (interface{}, error)
- func (c Client) MakeDecision(ownerID string, req DecisionRequest) (interface{}, error)
- func (c Client) UpdatePolicy(ownerID string, policyID string, policy UpdateRequest) (interface{}, error)
- type CreationRequest
- type DecisionQueryRequest
- type DecisionRequest
- type UpdateRequest
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) CreatePolicy ¶
func (c Client) CreatePolicy(ownerID string, policy CreationRequest) (interface{}, error)
CreatePolicy call the Create Policy API in the Policy-Service. It creates a policy for the specified owner and returns the created policy response as an interface{}.
func (Client) DeletePolicy ¶
DeletePolicy calls the DELETE Policy API in the policy-service. It attempts to delete the policy matching the given policy-id and belonging to the given ownerID. It returns an error if the call fails or the policy could not be deleted.
func (Client) GetDecisionLogs ¶ added in v0.1.18980
func (c Client) GetDecisionLogs(ownerID 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) GetPolicy ¶
GetPolicy calls the GET policy API in the policy-service.It fetches the policy from policy-service matching the given owner-id and policy-id. It returns an error if the call fails or the policy could not be found.
func (Client) ListPolicies ¶
ListPolicies calls the view policy-service list policy API
func (Client) MakeDecision ¶ added in v0.1.19183
func (c Client) MakeDecision(ownerID string, req DecisionRequest) (interface{}, error)
MakeDecision sends a requests to Policy-Service public decision endpoint and returns the decision response
func (Client) UpdatePolicy ¶
func (c Client) UpdatePolicy(ownerID string, policyID string, policy UpdateRequest) (interface{}, error)
UpdatePolicy calls the UPDATE policy API in the policy-service. It updates a policy in the policy-service matching the given owner-id and policy-id.
type CreationRequest ¶
CreationRequest represents the json payload to create a Policy in the Policy-Service
type DecisionQueryRequest ¶ added in v0.1.18980
type DecisionRequest ¶ added in v0.1.19183
type DecisionRequest struct { Input string `json:"input"` Context string `json:"context"` 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.