Skip to content

Commit a70b00f

Browse files
authored
Merge pull request #752 from hashicorp/mr/pprv_policyset_api
Changes to Policy set API for PPRV
2 parents c5d529a + ccddd5b commit a70b00f

8 files changed

+500
-766
lines changed

helper_test.go

+10-6
Original file line numberDiff line numberDiff line change
@@ -697,7 +697,7 @@ func createPolicySet(t *testing.T, client *Client, org *Organization, policies [
697697
}
698698
}
699699

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

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

707707
ctx := context.Background()
708708
ps, err := client.PolicySets.Create(ctx, org.Name, PolicySetCreateOptions{
709-
Name: String(randomString(t)),
710-
Policies: policies,
711-
Workspaces: workspaces,
712-
Kind: opts.Kind,
713-
Overridable: opts.Overridable,
709+
Name: String(randomString(t)),
710+
Policies: policies,
711+
Workspaces: workspaces,
712+
WorkspaceExclusions: excludedWorkspace,
713+
Projects: projects,
714+
Kind: opts.Kind,
715+
Overridable: opts.Overridable,
716+
AgentEnabled: opts.AgentEnabled,
717+
PolicyToolVersion: opts.PolicyToolVersion,
714718
})
715719
if err != nil {
716720
t.Fatal(err)

policy.go

-4
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ type PolicyListOptions struct {
9797
// Optional: A search string (partial policy name) used to filter the results.
9898
Search string `url:"search[name],omitempty"`
9999

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

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

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

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

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

0 commit comments

Comments
 (0)