Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changes to Policy set API for PPRV #752

Merged
merged 7 commits into from
Jan 24, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions helper_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -697,7 +697,7 @@ func createPolicySet(t *testing.T, client *Client, org *Organization, policies [
}
}

func createPolicySetWithOptions(t *testing.T, client *Client, org *Organization, policies []*Policy, workspaces []*Workspace, opts PolicySetCreateOptions) (*PolicySet, func()) {
func createPolicySetWithOptions(t *testing.T, client *Client, org *Organization, policies []*Policy, workspaces, excludedWorkspace []*Workspace, projects []*Project, opts PolicySetCreateOptions) (*PolicySet, func()) {
var orgCleanup func()

if org == nil {
Expand All @@ -706,11 +706,15 @@ func createPolicySetWithOptions(t *testing.T, client *Client, org *Organization,

ctx := context.Background()
ps, err := client.PolicySets.Create(ctx, org.Name, PolicySetCreateOptions{
Name: String(randomString(t)),
Policies: policies,
Workspaces: workspaces,
Kind: opts.Kind,
Overridable: opts.Overridable,
Name: String(randomString(t)),
Policies: policies,
Workspaces: workspaces,
WorkspaceExclusions: excludedWorkspace,
Projects: projects,
Kind: opts.Kind,
Overridable: opts.Overridable,
AgentEnabled: opts.AgentEnabled,
PolicyToolVersion: opts.PolicyToolVersion,
})
if err != nil {
t.Fatal(err)
Expand Down
4 changes: 0 additions & 4 deletions policy.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,6 @@ type PolicyListOptions struct {
// Optional: A search string (partial policy name) used to filter the results.
Search string `url:"search[name],omitempty"`

// **Note: This field is still in BETA and subject to change.**
// Optional: A kind string used to filter the results by the policy kind.
Kind PolicyKind `url:"filter[kind],omitempty"`
}
Expand All @@ -113,11 +112,9 @@ type PolicyCreateOptions struct {
// Required: The name of the policy.
Name *string `jsonapi:"attr,name"`

// **Note: This field is still in BETA and subject to change.**
// Optional: The underlying technology that the policy supports. Defaults to Sentinel if not specified for PolicyCreate.
Kind PolicyKind `jsonapi:"attr,kind,omitempty"`

// **Note: This field is still in BETA and subject to change.**
// Optional: The query passed to policy evaluation to determine the result of the policy. Only valid for OPA.
Query *string `jsonapi:"attr,query,omitempty"`

Expand All @@ -139,7 +136,6 @@ type PolicyUpdateOptions struct {
// Optional: A description of the policy's purpose.
Description *string `jsonapi:"attr,description,omitempty"`

// **Note: This field is still in BETA and subject to change.**
// Optional: The query passed to policy evaluation to determine the result of the policy. Only valid for OPA.
Query *string `jsonapi:"attr,query,omitempty"`

Expand Down
Loading
Loading