Skip to content

Commit 424c1c1

Browse files
committed
make optional fields pointers type
1 parent 0634384 commit 424c1c1

File tree

2 files changed

+14
-14
lines changed

2 files changed

+14
-14
lines changed

policy_set.go

+4-4
Original file line numberDiff line numberDiff line change
@@ -183,10 +183,10 @@ type PolicySetCreateOptions struct {
183183
Overridable *bool `jsonapi:"attr,overridable,omitempty"`
184184

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

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

191191
// Optional: The sub-path within the attached VCS repository to ingress. All
192192
// files and directories outside of this sub-path will be ignored.
@@ -234,10 +234,10 @@ type PolicySetUpdateOptions struct {
234234
Overridable *bool `jsonapi:"attr,overridable,omitempty"`
235235

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

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

242242
// Optional: The sub-path within the attached VCS repository to ingress. All
243243
// files and directories outside of this sub-path will be ignored.

policy_set_integration_test.go

+10-10
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,8 @@ func TestPolicySetsList(t *testing.T) {
4545

4646
options := PolicySetCreateOptions{
4747
Kind: Sentinel,
48-
AgentEnabled: true,
49-
PolicyToolVersion: sv.Version,
48+
AgentEnabled: Bool(true),
49+
PolicyToolVersion: String(sv.Version),
5050
Overridable: Bool(true),
5151
}
5252

@@ -170,7 +170,7 @@ func TestPolicySetsCreate(t *testing.T) {
170170
t.Run("with valid attributes", func(t *testing.T) {
171171
options := PolicySetCreateOptions{
172172
Name: String(randomString(t)),
173-
PolicyToolVersion: sv.Version,
173+
PolicyToolVersion: String(sv.Version),
174174
}
175175

176176
ps, err := client.PolicySets.Create(ctx, orgTest.Name, options)
@@ -200,8 +200,8 @@ func TestPolicySetsCreate(t *testing.T) {
200200
options := PolicySetCreateOptions{
201201
Name: String(randomString(t)),
202202
Kind: Sentinel,
203-
AgentEnabled: true,
204-
PolicyToolVersion: sv.Version,
203+
AgentEnabled: Bool(true),
204+
PolicyToolVersion: String(sv.Version),
205205
}
206206

207207
ps, err := client.PolicySets.Create(ctx, orgTest.Name, options)
@@ -218,8 +218,8 @@ func TestPolicySetsCreate(t *testing.T) {
218218
t.Run("with pinned policy runtime version and missing kind", func(t *testing.T) {
219219
options := PolicySetCreateOptions{
220220
Name: String(randomString(t)),
221-
AgentEnabled: true,
222-
PolicyToolVersion: sv.Version,
221+
AgentEnabled: Bool(true),
222+
PolicyToolVersion: String(sv.Version),
223223
Overridable: Bool(true),
224224
}
225225
ps, err := client.PolicySets.Create(ctx, orgTest.Name, options)
@@ -683,8 +683,8 @@ func TestPolicySetsUpdate(t *testing.T) {
683683

684684
options := PolicySetCreateOptions{
685685
Kind: Sentinel,
686-
AgentEnabled: true,
687-
PolicyToolVersion: sv.Version,
686+
AgentEnabled: Bool(true),
687+
PolicyToolVersion: String(sv.Version),
688688
Overridable: Bool(true),
689689
}
690690

@@ -695,7 +695,7 @@ func TestPolicySetsUpdate(t *testing.T) {
695695

696696
t.Run("with valid attributes", func(t *testing.T) {
697697
options := PolicySetUpdateOptions{
698-
AgentEnabled: false,
698+
AgentEnabled: Bool(false),
699699
Name: String("global"),
700700
Description: String("Policies in this set will be checked in ALL workspaces!"),
701701
Global: Bool(true),

0 commit comments

Comments
 (0)