Skip to content

Commit

Permalink
Merge pull request #21 from symbiosis-cloud/03-20-Add_region_to_cluster
Browse files Browse the repository at this point in the history
Add region to cluster
  • Loading branch information
Styren authored Mar 20, 2023
2 parents 9d55a9c + 96ed91c commit 3d697cc
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 26 deletions.
6 changes: 6 additions & 0 deletions cluster.go
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,18 @@ type Cluster struct {
KubeVersion string `json:"kubeVersion"`
APIServerEndpoint string `json:"apiServerEndpoint"`
State string `json:"state"`
Region *Region `json:"region"`
Nodes []*Node `json:"nodes"`
NodePools []*NodePool `json:"nodePools"`
CreatedAt time.Time `json:"createdAt"`
IsHighlyAvailable bool `json:"isHighlyAvailable"`
}

type Region struct {
ID string `json:"id"`
Name string `json:"name"`
}

type ClusterList struct {
Clusters []*Cluster `json:"content"`
*SortAndPageable
Expand Down
44 changes: 23 additions & 21 deletions cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -17,32 +17,33 @@ const clusterJSON = `
"apiServerEndpoint": "does.not.matter",
"state": "ACTIVE",
"isHighlyAvailable": true,
"nodes": [
{
"region": {
"id": "9d420d32-31f8-4a4a-b790-d75ea58ffc08",
"name": "netherlands-1"
},
"nodes": [{
"id": "19fc97a5-30de-4f35-8b28-a14bf640b557",
"name": "random-0",
"nodeType": {
"id": "2f8d2c39-23cd-4623-b816-9489a26c1b8d",
"name": "general-int-1",
"memoryMi": 1024,
"storageGi": 1,
"vcpu": 1,
"product": {
"productCosts": [
{
"currency": "USD",
"unitCost": 5
}
]
}
},
"region": {
"id": "9d420d32-31f8-4a4a-b790-d75ea58ffc08",
"name": "netherlands-1"
"id": "9d420d32-31f8-4a4a-b790-d75ea58ffc08",
"name": "netherlands-1"
},
"privateIPv4Address": "10.0.0.1",
"state": "ACTIVE"
}]
"state": "ACTIVE",
"nodeType": {
"id": "2f8d2c39-23cd-4623-b816-9489a26c1b8d",
"name": "general-int-1",
"memoryMi": 1024,
"storageGi": 1,
"vcpu": 1,
"product": {
"productCosts": [{
"currency": "USD",
"unitCost": 5
}]
}
}
}]
}
`

Expand Down Expand Up @@ -149,6 +150,7 @@ func TestDescribeClusterById(t *testing.T) {

assert.Nil(t, err)
assert.Equal(t, fakeCluster, cluster)
assert.Equal(t, fakeCluster.Region.ID, cluster.Region.ID)

responder = httpmock.NewErrorResponder(assert.AnError)
httpmock.RegisterResponder("GET", fakeURL, responder)
Expand Down
5 changes: 0 additions & 5 deletions node.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,11 +20,6 @@ type Product struct {
ProductCosts []*ProductCost `json:"productCosts"`
}

type Region struct {
ID string `json:"id"`
Name string `json:"name"`
}

type NodeType struct {
ID string `json:"id"`
Name string `json:"name"`
Expand Down

0 comments on commit 3d697cc

Please sign in to comment.