policy

package
v0.1.27660 Latest Latest
Warning

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

Go to latest
Published: Jul 17, 2023 License: MIT Imports: 12 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, request CreatePolicyBundleRequest) (interface{}, 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) GetDecisionLog added in v0.1.21041

func (c Client) GetDecisionLog(ownerID string, context string, decisionID string, policyBundle bool) (interface{}, error)

GetDecisionLog calls the GET decision query API of policy-service for a DecisionID. It also accepts a policyBundle bool param; If set to true will return only the policy bundle corresponding to that decision log.

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) GetSettings added in v0.1.22050

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

GetSettings calls the GET decision-settings API of policy-service.

func (Client) MakeDecision added in v0.1.19183

func (c Client) MakeDecision(ownerID string, context string, req DecisionRequest) (*cpa.Decision, error)

MakeDecision sends a requests to Policy-Service public decision endpoint and returns the decision response

func (Client) SetSettings added in v0.1.22050

func (c Client) SetSettings(ownerID string, context string, request DecisionSettings) (interface{}, error)

SetSettings calls the PATCH decision-settings API of policy-service.

type CreatePolicyBundleRequest added in v0.1.20500

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

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.

type DecisionSettings added in v0.1.22050

type DecisionSettings struct {
	Enabled *bool `json:"enabled,omitempty"`
}

DecisionSettings represents a request to Policy-Service to configure decision settings.

Jump to

Keyboard shortcuts

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