policy

package
v0.1.20500 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 11, 2022 License: MIT Imports: 11 Imported by: 0

Documentation

Index

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

func NewClient(baseURL string, config *settings.Config) *Client

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

func (c Client) FetchPolicyBundle(ownerID, context, policyName string) (interface{}, error)

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

type CreatePolicyBundleRequest struct {
	Policies map[string]string `json:"policies"`
}

CreatePolicyBundleRequest defines the fields for the Create-Policy-Bundle endpoint as defined in Policy Service

type DecisionQueryRequest added in v0.1.18980

type DecisionQueryRequest struct {
	Status    string
	After     *time.Time
	Before    *time.Time
	Branch    string
	ProjectID string
	Offset    int
}

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL