Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pkg/fixtures/kubernetes_clusters/move_nodes_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"id": "node-group-id",
"name": "workers",
"description": "worker node group",
"node_count": 3,
"type": "static",
"created_at": "2024-11-11T09:57:56Z",
"updated_at": "2024-11-11T09:57:56Z"
},
Expand Down
2 changes: 1 addition & 1 deletion pkg/fixtures/kubernetes_clusters/update_node_response.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"id": "node-group-id",
"name": "workers",
"description": "worker node group",
"node_count": 3,
"type": "static",
"created_at": "2024-11-11T09:57:56Z",
"updated_at": "2024-11-11T09:57:56Z"
},
Expand Down
2 changes: 2 additions & 0 deletions pkg/kubernetes_clusters_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -284,6 +284,7 @@ func TestKubernetesClusterMoveNodes(t *testing.T) {
g.Expect(nodes[0].ID).To(Equal(nodeID))
g.Expect(nodes[0].NodeGroup.ID).To(Equal(nodeGroupID))
g.Expect(nodes[0].NodeGroup.Name).To(Equal("workers"))
g.Expect(nodes[0].NodeGroup.Type).To(Equal("static"))
}

func TestKubernetesClusterUpdateNode(t *testing.T) {
Expand All @@ -309,4 +310,5 @@ func TestKubernetesClusterUpdateNode(t *testing.T) {
g.Expect(node.ID).To(Equal(nodeID))
g.Expect(node.NodeGroup.ID).To(Equal(nodeGroupID))
g.Expect(node.NodeGroup.Name).To(Equal("workers"))
g.Expect(node.NodeGroup.Type).To(Equal("static"))
}
11 changes: 5 additions & 6 deletions pkg/test.go
Original file line number Diff line number Diff line change
Expand Up @@ -160,20 +160,19 @@ func (fs *fakeServer) Build() (*fakeServer, *Client) {
if currentRequest.RequestPath == "" || r.URL.Path == finalURL {
if currentRequest.RequestMethod != "" && currentRequest.RequestMethod != r.Method {
w.WriteHeader(http.StatusTeapot)
_, err := w.Write([]byte(fmt.Sprintf(
_, err := fmt.Fprintf(w,
"Unexpected request method, expected: %s %s, but got: %s %s",
currentRequest.RequestMethod,
finalURL,
r.Method,
r.URL.Path,
)))
r.URL.Path)
crashIfErrorPresent(err)
return
}

if currentRequest.RequestParams != "" && currentRequest.RequestParams != r.URL.Query().Encode() {
w.WriteHeader(http.StatusTeapot)
_, err := w.Write([]byte(fmt.Sprintf("Unexpected query params, expected: %s, but got: %s", currentRequest.RequestParams, r.URL.Query().Encode())))
_, err := fmt.Fprintf(w, "Unexpected query params, expected: %s, but got: %s", currentRequest.RequestParams, r.URL.Query().Encode())
crashIfErrorPresent(err)
return
}
Expand All @@ -188,7 +187,7 @@ func (fs *fakeServer) Build() (*fakeServer, *Client) {

if currentRequest.RequestBody != string(b) {
w.WriteHeader(http.StatusTeapot)
_, err := w.Write([]byte(fmt.Sprintf("Unexpected request body: %s", string(b))))
_, err := fmt.Fprintf(w, "Unexpected request body: %s", string(b))
crashIfErrorPresent(err)
return
}
Expand All @@ -209,7 +208,7 @@ func (fs *fakeServer) Build() (*fakeServer, *Client) {
crashIfErrorPresent(err)
} else {
w.WriteHeader(http.StatusTeapot)
_, err := w.Write([]byte(fmt.Sprintf("Unhandled route: %s %s, expected: %s %s", r.Method, r.URL.String(), currentRequest.RequestMethod, finalURL)))
_, err := fmt.Fprintf(w, "Unhandled route: %s %s, expected: %s %s", r.Method, r.URL.String(), currentRequest.RequestMethod, finalURL)
crashIfErrorPresent(err)
}
}))
Expand Down
54 changes: 32 additions & 22 deletions pkg/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -1054,7 +1054,7 @@ type L7UpstreamZoneInput struct {
type L7LoadBalancerUpdateInput struct {
Name string `json:"name,omitempty"`
StoreLogs *bool `json:"store_logs,omitempty"`
StoreLogsRegionID *int `json:"store_logs_region_id,,omitempty"`
StoreLogsRegionID *int `json:"store_logs_region_id,omitempty"`
Geoip *bool `json:"geoip,omitempty"`
NewExternalIpsCount *int `json:"new_external_ips_count,omitempty"`
DeleteExternalIps []string `json:"delete_external_ips,omitempty"`
Expand All @@ -1070,7 +1070,7 @@ type L7LoadBalancerCreateInput struct {
Name string `json:"name"`
LocationID int64 `json:"location_id"`
StoreLogs *bool `json:"store_logs,omitempty"`
StoreLogsRegionID *int `json:"store_logs_region_id,,omitempty"`
StoreLogsRegionID *int `json:"store_logs_region_id,omitempty"`
Geoip *bool `json:"geoip,omitempty"`
ClusterID *string `json:"cluster_id,omitempty"`
VHostZones []L7VHostZoneInput `json:"vhost_zones"`
Expand Down Expand Up @@ -1237,26 +1237,26 @@ type KubernetesCluster struct {

// KubernetesClusterNode represents Kubernetes cluster node
type KubernetesClusterNode struct {
ID string `json:"id"`
Number int64 `json:"number"`
Hostname string `json:"hostname"`
Configuration string `json:"configuration"`
Type string `json:"type"`
Role string `json:"role"`
Status string `json:"status"`
PrivateIPv4Address string `json:"private_ipv4_address"`
PublicIPv4Address string `json:"public_ipv4_address"`
RefID string `json:"ref_id"`
ClusterID string `json:"cluster_id"`
LocationID int64 `json:"location_id"`
LocationCode string `json:"location_code"`
NodeGroup KubernetesClusterNodeGroup `json:"node_group"`
Labels map[string]string `json:"labels"`
Created time.Time `json:"created_at"`
Updated time.Time `json:"updated_at"`
}

// KubernetesClusterNodeGroup represents the node group a kubernetes cluster node belongs to
ID string `json:"id"`
Number int64 `json:"number"`
Hostname string `json:"hostname"`
Configuration string `json:"configuration"`
Type string `json:"type"`
Role string `json:"role"`
Status string `json:"status"`
PrivateIPv4Address string `json:"private_ipv4_address"`
PublicIPv4Address string `json:"public_ipv4_address"`
RefID string `json:"ref_id"`
ClusterID string `json:"cluster_id"`
LocationID int64 `json:"location_id"`
LocationCode string `json:"location_code"`
NodeGroup KubernetesClusterNodeGroupInfo `json:"node_group"`
Labels map[string]string `json:"labels"`
Created time.Time `json:"created_at"`
Updated time.Time `json:"updated_at"`
}

// KubernetesClusterNodeGroup represents Kubernetes cluster node group
type KubernetesClusterNodeGroup struct {
ID string `json:"id"`
Name string `json:"name"`
Expand All @@ -1266,6 +1266,16 @@ type KubernetesClusterNodeGroup struct {
Updated time.Time `json:"updated_at"`
}

// KubernetesClusterNodeGroupInfo represents the node group info embedded in a kubernetes cluster node
type KubernetesClusterNodeGroupInfo struct {
ID string `json:"id"`
Name string `json:"name"`
Description *string `json:"description"`
Type string `json:"type"`
Created time.Time `json:"created_at"`
Updated time.Time `json:"updated_at"`
}

// KubernetesClusterUpdateInput represents Kubernetes cluster update input
type KubernetesClusterUpdateInput struct {
Labels map[string]string `json:"labels,omitempty"`
Expand Down
Loading