Skip to content

Commit 4755757

Browse files
add domain to project cluster
1 parent b149be3 commit 4755757

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed

project_clusters.go

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ type ProjectClustersService struct {
3737
type ProjectCluster struct {
3838
ID int `json:"id"`
3939
Name string `json:"name"`
40+
Domain string `json:"domain"`
4041
CreatedAt *time.Time `json:"created_at"`
4142
ProviderType string `json:"provider_type"`
4243
PlatformType string `json:"platform_type"`
@@ -116,6 +117,7 @@ func (s *ProjectClustersService) GetCluster(pid interface{}, cluster int, option
116117
// https://docs.gitlab.com/ee/api/project_clusters.html#add-existing-cluster-to-project
117118
type AddClusterOptions struct {
118119
Name *string `url:"name,omitempty" json:"name,omitempty"`
120+
Domain *string `url:"domain,omitempty" json:"domain,omitempty"`
119121
Enabled *bool `url:"enabled,omitempty" json:"enabled,omitempty"`
120122
EnvironmentScope *string `url:"environment_scope,omitempty" json:"environment_scope,omitempty"`
121123
PlatformKubernetes *AddPlatformKubernetesOptions `url:"platform_kubernetes_attributes,omitempty" json:"platform_kubernetes_attributes,omitempty"`
@@ -161,6 +163,7 @@ func (s *ProjectClustersService) AddCluster(pid interface{}, opt *AddClusterOpti
161163
// https://docs.gitlab.com/ee/api/project_clusters.html#edit-project-cluster
162164
type EditClusterOptions struct {
163165
Name *string `url:"name,omitempty" json:"name,omitempty"`
166+
Domain *string `url:"domain,omitempty" json:"domain,omitempty"`
164167
EnvironmentScope *string `url:"environment_scope,omitempty" json:"environment_scope,omitempty"`
165168
PlatformKubernetes *EditPlatformKubernetesOptions `url:"platform_kubernetes_attributes,omitempty" json:"platform_kubernetes_attributes,omitempty"`
166169
}

project_clusters_test.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@ func TestListClusters(t *testing.T) {
1717
{
1818
"id":18,
1919
"name":"cluster-1",
20+
"domain":"example.com",
2021
"created_at":"2019-01-02T20:18:12.563Z",
2122
"provider_type":"user",
2223
"platform_type":"kubernetes",
@@ -56,6 +57,10 @@ func TestListClusters(t *testing.T) {
5657
if clusters[0].ID != 18 {
5758
t.Errorf("expected clusterID 1; got %d", clusters[0].ID)
5859
}
60+
61+
if clusters[0].Domain != "example.com" {
62+
t.Errorf("expected cluster domain example.com; got %q", clusters[0].Domain)
63+
}
5964
}
6065

6166
func TestGetCluster(t *testing.T) {
@@ -68,6 +73,7 @@ func TestGetCluster(t *testing.T) {
6873
response := `{
6974
"id":18,
7075
"name":"cluster-1",
76+
"domain":"example.com",
7177
"created_at":"2019-01-02T20:18:12.563Z",
7278
"provider_type":"user",
7379
"platform_type":"kubernetes",
@@ -131,6 +137,10 @@ func TestGetCluster(t *testing.T) {
131137
if cluster.ID != 18 {
132138
t.Errorf("expected clusterID 18; got %d", cluster.ID)
133139
}
140+
141+
if cluster.Domain != "example.com" {
142+
t.Errorf("expected cluster domain example.com; got %q", cluster.Domain)
143+
}
134144
}
135145

136146
func TestAddCluster(t *testing.T) {
@@ -143,6 +153,7 @@ func TestAddCluster(t *testing.T) {
143153
response := `{
144154
"id":24,
145155
"name":"cluster-5",
156+
"domain":"example.com",
146157
"created_at":"2019-01-03T21:53:40.610Z",
147158
"provider_type":"user",
148159
"platform_type":"kubernetes",
@@ -218,6 +229,7 @@ func TestEditCluster(t *testing.T) {
218229
response := `{
219230
"id":24,
220231
"name":"new-cluster-name",
232+
"domain":"example.com",
221233
"created_at":"2019-01-03T21:53:40.610Z",
222234
"provider_type":"user",
223235
"platform_type":"kubernetes",

0 commit comments

Comments
 (0)