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, activeFilter *bool) (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. If the active filter is nil, all policies are returned. If activeFilter is not nil it will only return active or inactive policies based on the value of *activeFilter.
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 ¶
type CreationRequest struct { Name string `json:"name"` Context string `json:"context"` Content string `json:"content"` }
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
DecisionRequest represents a request to Policy-Service to evaluate a given input against an organization's policies. The context determines which policies to apply.