Skip to content
This repository was archived by the owner on Dec 10, 2024. It is now read-only.

Commit 2a04814

Browse files
committed
Add Hidden field to GroupVariable struct
1 parent 912f9bf commit 2a04814

File tree

2 files changed

+11
-7
lines changed

2 files changed

+11
-7
lines changed

group_variables.go

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ type GroupVariable struct {
4141
VariableType VariableTypeValue `json:"variable_type"`
4242
Protected bool `json:"protected"`
4343
Masked bool `json:"masked"`
44+
Hidden bool `json:"hidden"`
4445
Raw bool `json:"raw"`
4546
EnvironmentScope string `json:"environment_scope"`
4647
Description string `json:"description"`
@@ -127,6 +128,7 @@ type CreateGroupVariableOptions struct {
127128
Description *string `url:"description,omitempty" json:"description,omitempty"`
128129
EnvironmentScope *string `url:"environment_scope,omitempty" json:"environment_scope,omitempty"`
129130
Masked *bool `url:"masked,omitempty" json:"masked,omitempty"`
131+
Hidden *bool `url:"hidden,omitempty" json:"hidden,omitempty"`
130132
Protected *bool `url:"protected,omitempty" json:"protected,omitempty"`
131133
Raw *bool `url:"raw,omitempty" json:"raw,omitempty"`
132134
VariableType *VariableTypeValue `url:"variable_type,omitempty" json:"variable_type,omitempty"`

group_variables_test.go

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ func TestListGroupVariabless(t *testing.T) {
2929
mux.HandleFunc("/api/v4/groups/1/variables",
3030
func(w http.ResponseWriter, r *http.Request) {
3131
testMethod(t, r, http.MethodGet)
32-
fmt.Fprint(w, `[{"key": "TEST_VARIABLE_1","value": "test1","protected": false,"masked": true}]`)
32+
fmt.Fprint(w, `[{"key": "TEST_VARIABLE_1","value": "test1","protected": false,"masked": true,"hidden": true}]`)
3333
})
3434

3535
variables, _, err := client.GroupVariables.ListVariables(1, &ListGroupVariablesOptions{})
@@ -43,6 +43,7 @@ func TestListGroupVariabless(t *testing.T) {
4343
Value: "test1",
4444
Protected: false,
4545
Masked: true,
46+
Hidden: true,
4647
},
4748
}
4849

@@ -58,15 +59,15 @@ func TestGetGroupVariable(t *testing.T) {
5859
func(w http.ResponseWriter, r *http.Request) {
5960
testMethod(t, r, http.MethodGet)
6061
testParams(t, r, "filter%5Benvironment_scope%5D=prod")
61-
fmt.Fprint(w, `{"key": "TEST_VARIABLE_1","value": "test1","protected": false,"masked": true}`)
62+
fmt.Fprint(w, `{"key": "TEST_VARIABLE_1","value": "test1","protected": false,"masked": true,"hidden": true}`)
6263
})
6364

6465
variable, _, err := client.GroupVariables.GetVariable(1, "TEST_VARIABLE_1", &GetGroupVariableOptions{Filter: &VariableFilter{EnvironmentScope: "prod"}})
6566
if err != nil {
6667
t.Errorf("GroupVariables.GetVariable returned error: %v", err)
6768
}
6869

69-
want := &GroupVariable{Key: "TEST_VARIABLE_1", Value: "test1", Protected: false, Masked: true}
70+
want := &GroupVariable{Key: "TEST_VARIABLE_1", Value: "test1", Protected: false, Masked: true, Hidden: true}
7071
if !reflect.DeepEqual(want, variable) {
7172
t.Errorf("GroupVariables.GetVariable returned %+v, want %+v", variable, want)
7273
}
@@ -78,22 +79,23 @@ func TestCreateGroupVariable(t *testing.T) {
7879
mux.HandleFunc("/api/v4/groups/1/variables",
7980
func(w http.ResponseWriter, r *http.Request) {
8081
testMethod(t, r, http.MethodPost)
81-
fmt.Fprint(w, `{"key": "TEST_VARIABLE_1","value": "test1","protected": false,"masked": true}`)
82+
fmt.Fprint(w, `{"key": "TEST_VARIABLE_1","value": "test1","protected": false,"masked": true,"hidden": true}`)
8283
})
8384

8485
opt := &CreateGroupVariableOptions{
8586
Key: Ptr("TEST_VARIABLE_1"),
8687
Value: Ptr("test1"),
8788
Protected: Ptr(false),
8889
Masked: Ptr(true),
90+
Hidden: Ptr(true),
8991
}
9092

9193
variable, _, err := client.GroupVariables.CreateVariable(1, opt, nil)
9294
if err != nil {
9395
t.Errorf("GroupVariables.CreateVariable returned error: %v", err)
9496
}
9597

96-
want := &GroupVariable{Key: "TEST_VARIABLE_1", Value: "test1", Protected: false, Masked: true}
98+
want := &GroupVariable{Key: "TEST_VARIABLE_1", Value: "test1", Protected: false, Masked: true, Hidden: true}
9799
if !reflect.DeepEqual(want, variable) {
98100
t.Errorf("GroupVariables.CreateVariable returned %+v, want %+v", variable, want)
99101
}
@@ -126,15 +128,15 @@ func TestUpdateGroupVariable(t *testing.T) {
126128
mux.HandleFunc("/api/v4/groups/1/variables/TEST_VARIABLE_1",
127129
func(w http.ResponseWriter, r *http.Request) {
128130
testMethod(t, r, http.MethodPut)
129-
fmt.Fprint(w, `{"key": "TEST_VARIABLE_1","value": "test1","protected": false,"masked": true}`)
131+
fmt.Fprint(w, `{"key": "TEST_VARIABLE_1","value": "test1","protected": false,"masked": true,"hidden": false}`)
130132
})
131133

132134
variable, _, err := client.GroupVariables.UpdateVariable(1, "TEST_VARIABLE_1", &UpdateGroupVariableOptions{})
133135
if err != nil {
134136
t.Errorf("GroupVariables.UpdateVariable returned error: %v", err)
135137
}
136138

137-
want := &GroupVariable{Key: "TEST_VARIABLE_1", Value: "test1", Protected: false, Masked: true}
139+
want := &GroupVariable{Key: "TEST_VARIABLE_1", Value: "test1", Protected: false, Masked: true, Hidden: false}
138140
if !reflect.DeepEqual(want, variable) {
139141
t.Errorf("Groups.UpdatedGroup returned %+v, want %+v", variable, want)
140142
}

0 commit comments

Comments
 (0)