Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DX: omit empty fields like 'private_network' which have an empty valu… #32

Merged
merged 2 commits into from
May 15, 2024
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
5 changes: 5 additions & 0 deletions bonsai/bonsai_impl_test.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
package bonsai

func Pointer[T any](d T) *T {
return &d
}
4 changes: 2 additions & 2 deletions bonsai/cluster_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -493,7 +493,7 @@ func (s *ClientVCRTestSuite) TestClusterClient_Create() {
func (s *ClientVCRTestSuite) TestClusterClient_Update() {
ctx := context.Background()

plan, err := s.client.Cluster.Update(ctx, "bonsai-api-go-2471463249", bonsai.ClusterUpdateOpts{
plan, err := s.client.Cluster.Update(ctx, "bonsai-api-go-5431547241", bonsai.ClusterUpdateOpts{
Name: "bonsai-api-go-test-cluster-updated",
Plan: "standard-nano-comped",
})
Expand All @@ -504,7 +504,7 @@ func (s *ClientVCRTestSuite) TestClusterClient_Update() {
func (s *ClientVCRTestSuite) TestClusterClient_Delete() {
ctx := context.Background()

plan, err := s.client.Cluster.Destroy(ctx, "bonsai-api-go-9994392953")
plan, err := s.client.Cluster.Destroy(ctx, "bonsai-api-go-5431547241")
s.NoError(err, "successfully get cluster")
assertGolden(s, plan)
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,34 @@
[
{
"slug": "bonsai-api-go-3216591042",
"name": "bonsai-api-go-test-cluster-updated",
"uri": "https://api.bonsai.io/clusters/bonsai-api-go-3216591042",
"plan": {
"slug": "standard-nano-comped",
"available_releases": [],
"available_spaces": [],
"uri": "https://api.bonsai.io/plans/standard-nano-comped"
},
"release": {
"slug": "opensearch-2.6.0-mt",
"service_type": "opensearch",
"version": "2.6.0",
"uri": "https://api.bonsai.io/releases/opensearch-2.6.0-mt",
"package_name": "2.6.0-mt"
},
"space": {
"path": "omc/bonsai/us-east-1/common",
"region": "aws-us-east-1",
"uri": "https://api.bonsai.io/spaces/omc/bonsai/us-east-1/common"
},
"stats": {},
"access": {
"host": "bonsai-api-go-3216591042.us-east-1.bonsaisearch.net",
"port": 443,
"scheme": "https"
},
"state": "PROVISIONED"
},
{
"slug": "dcek-group-llc-5240651189",
"name": "DCEK Group, LLC search",
Expand All @@ -18,11 +48,6 @@
},
"space": {
"path": "omc/bonsai/us-east-1/common",
"private_network": false,
"cloud": {
"provider": "",
"region": ""
},
"region": "aws-us-east-1",
"uri": "https://api.bonsai.io/spaces/omc/bonsai/us-east-1/common"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
{
"message": "Your cluster is being provisioned.",
"monitor": "https://api.bonsai.io/clusters/bonsai-api-go-2471463249",
"monitor": "https://api.bonsai.io/clusters/bonsai-api-go-5431547241",
"access": {
"host": "bonsai-api-go-2471463249",
"host": "bonsai-api-go-5431547241",
"port": 443,
"scheme": "https",
"user": "REDACTED",
"pass": "REDACTED",
"url": "://REDACTED:REDACTED"
"url": "://REDACTED:REDACTED@"
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"message": "Your cluster is being deprovisioned.",
"monitor": "https://api.bonsai.io/clusters/bonsai-api-go-9994392953"
"monitor": "https://api.bonsai.io/clusters/bonsai-api-go-5431547241"
}
Original file line number Diff line number Diff line change
Expand Up @@ -17,11 +17,6 @@
},
"space": {
"path": "omc/bonsai/us-east-1/common",
"private_network": false,
"cloud": {
"provider": "",
"region": ""
},
"region": "aws-us-east-1",
"uri": "https://api.bonsai.io/spaces/omc/bonsai/us-east-1/common"
},
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{
"message": "Your cluster is being updated.",
"monitor": "https://api.bonsai.io/clusters/bonsai-api-go-2471463249"
"monitor": "https://api.bonsai.io/clusters/bonsai-api-go-5431547241"
}
Loading
Loading