Skip to content

Commit

Permalink
minor changes as per feedback
Browse files Browse the repository at this point in the history
  • Loading branch information
mrinalirao committed Jan 24, 2024
1 parent e90f6c0 commit ccddd5b
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 30 deletions.
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
5 changes: 3 additions & 2 deletions policy_set.go
Original file line number Diff line number Diff line change
Expand Up @@ -178,8 +178,8 @@ type PolicySetCreateOptions struct {
// Optional: The underlying technology that the policy set supports
Kind PolicyKind `jsonapi:"attr,kind,omitempty"`

// **Note: This field is still in BETA and subject to change.**
// Optional: Whether or not users can override this policy when it fails during a run. Only valid for policy evaluations.
// https://developer.hashicorp.com/terraform/cloud-docs/policy-enforcement/manage-policy-sets#policy-checks-versus-policy-evaluations
Overridable *bool `jsonapi:"attr,overridable,omitempty"`

// Optional: Whether or not the policy is run as an evaluation inside the agent.
Expand Down Expand Up @@ -231,13 +231,14 @@ type PolicySetUpdateOptions struct {
Global *bool `jsonapi:"attr,global,omitempty"`

// Optional: Whether or not users can override this policy when it fails during a run. Only valid for policy evaluations.
// https://developer.hashicorp.com/terraform/cloud-docs/policy-enforcement/manage-policy-sets#policy-checks-versus-policy-evaluations
Overridable *bool `jsonapi:"attr,overridable,omitempty"`

// Optional: Whether or not the policy is run as an evaluation inside the agent.
AgentEnabled *bool `jsonapi:"attr,agent-enabled,omitempty"`

// Optional: The policy tool version to run the evaluation against.
PolicyToolVersion *string `jsonapi:"attr,policy-tool-version"`
PolicyToolVersion *string `jsonapi:"attr,policy-tool-version,omitempty"`

// Optional: The sub-path within the attached VCS repository to ingress. All
// files and directories outside of this sub-path will be ignored.
Expand Down
45 changes: 21 additions & 24 deletions policy_set_integration_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,13 @@ func TestPolicySetsList(t *testing.T) {

version := createAdminSentinelVersion()
opts := AdminSentinelVersionCreateOptions{
Version: version,
URL: "https://www.hashicorp.com",
SHA: genSha(t),
Official: Bool(false),
Deprecated: Bool(false),
DeprecatedReason: String("Test Reason"),
Enabled: Bool(true),
Beta: Bool(false),
Version: version,
URL: "https://www.hashicorp.com",
SHA: genSha(t),
Official: Bool(false),
Deprecated: Bool(false),
Enabled: Bool(true),
Beta: Bool(false),
}
sv, err := client.Admin.SentinelVersions.Create(ctx, opts)
require.NoError(t, err)
Expand Down Expand Up @@ -149,14 +148,13 @@ func TestPolicySetsCreate(t *testing.T) {

version := createAdminSentinelVersion()
opts := AdminSentinelVersionCreateOptions{
Version: version,
URL: "https://www.hashicorp.com",
SHA: genSha(t),
Official: Bool(false),
Deprecated: Bool(false),
DeprecatedReason: String("Test Reason"),
Enabled: Bool(true),
Beta: Bool(false),
Version: version,
URL: "https://www.hashicorp.com",
SHA: genSha(t),
Official: Bool(false),
Deprecated: Bool(false),
Enabled: Bool(true),
Beta: Bool(false),
}
sv, err := client.Admin.SentinelVersions.Create(ctx, opts)
defer func() {
Expand Down Expand Up @@ -665,14 +663,13 @@ func TestPolicySetsUpdate(t *testing.T) {

version := createAdminSentinelVersion()
opts := AdminSentinelVersionCreateOptions{
Version: version,
URL: "https://www.hashicorp.com",
SHA: genSha(t),
Official: Bool(false),
Deprecated: Bool(false),
DeprecatedReason: String("Test Reason"),
Enabled: Bool(true),
Beta: Bool(false),
Version: version,
URL: "https://www.hashicorp.com",
SHA: genSha(t),
Official: Bool(false),
Deprecated: Bool(false),
Enabled: Bool(true),
Beta: Bool(false),
}
sv, err := client.Admin.SentinelVersions.Create(ctx, opts)
defer func() {
Expand Down

0 comments on commit ccddd5b

Please sign in to comment.