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) GetPolicy(ownerID string, policyID string) (interface{}, error)
- func (c Client) ListPolicies(ownerID string, activeFilter *bool) (interface{}, error)
- func (c Client) UpdatePolicy(ownerID string, policyID string, policy UpdateRequest) (interface{}, error)
- type CreationRequest
- 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 resonse 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) 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) 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