Skip to content

Commit def33ae

Browse files
Add v3 method for fetching PrismCentral info (#170)
The new method returns result of /prism_central GET call.
1 parent f9d980d commit def33ae

20 files changed

+92172
-194
lines changed

Makefile

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,6 @@ build: ## Build your project and put the output binary in bin/
1717
mkdir -p bin
1818
$(GOCMD) build -o bin/$(BINARY_NAME) .
1919

20-
TOOLS_BIN_DIR := hack/tools/bin
21-
22-
$(TOOLS_BIN_DIR):
23-
mkdir -p $(TOOLS_BIN_DIR)
24-
2520
# CRD_OPTIONS define options to add to the CONTROLLER_GEN
2621
CRD_OPTIONS ?= "crd:crdVersions=v1"
2722

@@ -34,7 +29,23 @@ stop-keploy:
3429
@-pkill "server"
3530

3631
generate: $(CONTROLLER_GEN) ## Generate zz_generated.deepcopy.go
37-
$(CONTROLLER_GEN) paths="./..." object:headerFile="hack/boilerplate.go.txt"
32+
controller-gen paths="./..." object:headerFile="hack/boilerplate.go.txt"
33+
34+
generate-v3-models: ## Generate V3 models using go-swagger
35+
swagger generate model \
36+
--spec=v3/swagger.json \
37+
--target=v3 \
38+
--skip-validation \
39+
--model=prism_central \
40+
--model=pc_vm \
41+
--model=mcm_config \
42+
--model=cmsp_config \
43+
--model=cmsp_network_config \
44+
--model=deployment_settings \
45+
--model=my_ntnx_token \
46+
--model=cluster_reference \
47+
--model=pc_vm_nic_configuration \
48+
--model=network_config
3849

3950
clean: ## Remove build related file
4051
rm -fr ./bin vendor hack/tools/bin
@@ -77,3 +88,4 @@ help: ## Show this help.
7788
if (/^[a-zA-Z_-]+:.*?##.*$$/) {printf " ${YELLOW}%-20s${GREEN}%s${RESET}\n", $$1, $$2} \
7889
else if (/^## .*$$/) {printf " ${CYAN}%s${RESET}\n", substr($$1,4)} \
7990
}' $(MAKEFILE_LIST)
91+

devbox.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
"gnumake@4.4.1",
77
"go@1.22.1",
88
"ginkgo@2.17.0",
9+
"go-swagger@0.31.0",
910
"kubernetes-code-generator@0.25.4",
1011
"kubernetes-controller-tools@0.13.0",
1112
"yamllint@1.35.1",

devbox.lock

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -337,6 +337,54 @@
337337
}
338338
}
339339
},
340+
"go-swagger@0.31.0": {
341+
"last_modified": "2024-07-07T07:43:47Z",
342+
"resolved": "github:NixOS/nixpkgs/b60793b86201040d9dee019a05089a9150d08b5b#go-swagger",
343+
"source": "devbox-search",
344+
"version": "0.31.0",
345+
"systems": {
346+
"aarch64-darwin": {
347+
"outputs": [
348+
{
349+
"name": "out",
350+
"path": "/nix/store/2hgdipfam6qzbik0idip7y3gksi90isq-go-swagger-0.31.0",
351+
"default": true
352+
}
353+
],
354+
"store_path": "/nix/store/2hgdipfam6qzbik0idip7y3gksi90isq-go-swagger-0.31.0"
355+
},
356+
"aarch64-linux": {
357+
"outputs": [
358+
{
359+
"name": "out",
360+
"path": "/nix/store/bnpbh9qaswwbbapqik3w1q72xv49627p-go-swagger-0.31.0",
361+
"default": true
362+
}
363+
],
364+
"store_path": "/nix/store/bnpbh9qaswwbbapqik3w1q72xv49627p-go-swagger-0.31.0"
365+
},
366+
"x86_64-darwin": {
367+
"outputs": [
368+
{
369+
"name": "out",
370+
"path": "/nix/store/9vzdfxv7gyx0pqzc5jvc48ycqahgyr6r-go-swagger-0.31.0",
371+
"default": true
372+
}
373+
],
374+
"store_path": "/nix/store/9vzdfxv7gyx0pqzc5jvc48ycqahgyr6r-go-swagger-0.31.0"
375+
},
376+
"x86_64-linux": {
377+
"outputs": [
378+
{
379+
"name": "out",
380+
"path": "/nix/store/rbim3gwp9kcywxdpl7vpl8hqj3vw9jjg-go-swagger-0.31.0",
381+
"default": true
382+
}
383+
],
384+
"store_path": "/nix/store/rbim3gwp9kcywxdpl7vpl8hqj3vw9jjg-go-swagger-0.31.0"
385+
}
386+
}
387+
},
340388
"go@1.22.1": {
341389
"last_modified": "2024-03-22T11:26:23Z",
342390
"resolved": "github:NixOS/nixpkgs/a3ed7406349a9335cb4c2a71369b697cecd9d351#go",

environment/credentials/zz_generated.deepcopy.go

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

go.mod

Lines changed: 50 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@ module github.com/nutanix-cloud-native/prism-go-client
22

33
go 1.21
44

5+
toolchain go1.22.2
6+
57
require (
68
github.com/PaesslerAG/jsonpath v0.1.1
7-
github.com/go-logr/logr v1.2.3
9+
github.com/go-logr/logr v1.4.1
810
github.com/go-logr/zapr v1.2.3
9-
github.com/google/uuid v1.3.0
11+
github.com/go-openapi/errors v0.22.0
12+
github.com/go-openapi/strfmt v0.23.0
13+
github.com/go-openapi/swag v0.23.0
14+
github.com/go-openapi/validate v0.24.0
15+
github.com/google/uuid v1.6.0
1016
github.com/hashicorp/go-cleanhttp v0.5.2
1117
github.com/keploy/go-sdk v0.9.0
1218
github.com/nutanix/ntnx-api-golang-clients/clustermgmt-go-client/v4 v4.0.1-beta.2
@@ -15,71 +21,80 @@ require (
1521
github.com/nutanix/ntnx-api-golang-clients/storage-go-client/v4 v4.0.2-alpha.3
1622
github.com/nutanix/ntnx-api-golang-clients/vmm-go-client/v4 v4.0.1-beta.1
1723
github.com/nutanix/ntnx-api-golang-clients/volumes-go-client/v4 v4.0.1-beta.1
18-
github.com/onsi/ginkgo/v2 v2.7.0
19-
github.com/onsi/gomega v1.26.0
20-
github.com/stretchr/testify v1.8.1
24+
github.com/onsi/ginkgo/v2 v2.19.0
25+
github.com/onsi/gomega v1.33.1
26+
github.com/stretchr/testify v1.9.0
2127
go.uber.org/zap v1.24.0
2228
gopkg.in/yaml.v3 v3.0.1
23-
k8s.io/api v0.26.1
24-
k8s.io/apimachinery v0.26.1
25-
k8s.io/client-go v0.26.1
29+
k8s.io/api v0.29.7
30+
k8s.io/apimachinery v0.29.7
31+
k8s.io/client-go v0.29.7
2632
)
2733

2834
require (
2935
github.com/PaesslerAG/gval v1.0.0 // indirect
3036
github.com/araddon/dateparse v0.0.0-20210429162001-6b43995a97de // indirect
37+
github.com/asaskevich/govalidator v0.0.0-20230301143203-a9d515a09cc2 // indirect
3138
github.com/creasty/defaults v1.6.0 // indirect
3239
github.com/davecgh/go-spew v1.1.1 // indirect
33-
github.com/emicklei/go-restful/v3 v3.9.0 // indirect
40+
github.com/emicklei/go-restful/v3 v3.11.0 // indirect
3441
github.com/evanphx/json-patch v4.12.0+incompatible // indirect
3542
github.com/fullstorydev/grpcurl v1.8.7 // indirect
36-
github.com/go-openapi/jsonpointer v0.19.5 // indirect
37-
github.com/go-openapi/jsonreference v0.20.0 // indirect
38-
github.com/go-openapi/swag v0.19.14 // indirect
43+
github.com/go-openapi/analysis v0.23.0 // indirect
44+
github.com/go-openapi/jsonpointer v0.21.0 // indirect
45+
github.com/go-openapi/jsonreference v0.21.0 // indirect
46+
github.com/go-openapi/loads v0.22.0 // indirect
47+
github.com/go-openapi/spec v0.21.0 // indirect
3948
github.com/go-playground/locales v0.14.0 // indirect
4049
github.com/go-playground/universal-translator v0.18.0 // indirect
4150
github.com/go-playground/validator/v10 v10.10.1 // indirect
51+
github.com/go-task/slim-sprig/v3 v3.0.0 // indirect
4252
github.com/go-test/deep v1.0.8 // indirect
4353
github.com/gogo/protobuf v1.3.2 // indirect
44-
github.com/golang/protobuf v1.5.2 // indirect
45-
github.com/google/gnostic v0.5.7-v3refs // indirect
46-
github.com/google/go-cmp v0.5.9 // indirect
47-
github.com/google/gofuzz v1.1.0 // indirect
54+
github.com/golang/protobuf v1.5.4 // indirect
55+
github.com/google/gnostic-models v0.6.8 // indirect
56+
github.com/google/go-cmp v0.6.0 // indirect
57+
github.com/google/gofuzz v1.2.0 // indirect
58+
github.com/google/pprof v0.0.0-20240424215950-a892ee059fd6 // indirect
4859
github.com/hashicorp/go-retryablehttp v0.7.1 // indirect
4960
github.com/jhump/protoreflect v1.14.0 // indirect
5061
github.com/josharian/intern v1.0.0 // indirect
5162
github.com/json-iterator/go v1.1.12 // indirect
5263
github.com/k0kubun/pp/v3 v3.1.0 // indirect
5364
github.com/leodido/go-urn v1.2.1 // indirect
54-
github.com/mailru/easyjson v0.7.6 // indirect
55-
github.com/mattn/go-colorable v0.1.13 // indirect
56-
github.com/mattn/go-isatty v0.0.17 // indirect
65+
github.com/mailru/easyjson v0.7.7 // indirect
66+
github.com/mattn/go-colorable v0.1.12 // indirect
67+
github.com/mattn/go-isatty v0.0.14 // indirect
68+
github.com/mitchellh/mapstructure v1.5.0 // indirect
5769
github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect
5870
github.com/modern-go/reflect2 v1.0.2 // indirect
5971
github.com/munnerz/goautoneg v0.0.0-20191010083416-a7dc8b61c822 // indirect
72+
github.com/oklog/ulid v1.3.1 // indirect
6073
github.com/pkg/errors v0.9.1 // indirect
6174
github.com/pmezard/go-difflib v1.0.0 // indirect
6275
github.com/sirupsen/logrus v1.9.0 // indirect
63-
go.keploy.io/server v0.9.1 // indirect
76+
go.keploy.io/server v0.8.6 // indirect
77+
go.mongodb.org/mongo-driver v1.14.0 // indirect
6478
go.uber.org/atomic v1.9.0 // indirect
6579
go.uber.org/multierr v1.7.0 // indirect
66-
golang.org/x/crypto v0.7.0 // indirect
67-
golang.org/x/net v0.8.0 // indirect
68-
golang.org/x/oauth2 v0.4.0 // indirect
69-
golang.org/x/sys v0.6.0 // indirect
70-
golang.org/x/term v0.6.0 // indirect
71-
golang.org/x/text v0.8.0 // indirect
72-
golang.org/x/time v0.0.0-20220210224613-90d013bbcef8 // indirect
80+
golang.org/x/crypto v0.23.0 // indirect
81+
golang.org/x/net v0.25.0 // indirect
82+
golang.org/x/oauth2 v0.10.0 // indirect
83+
golang.org/x/sys v0.20.0 // indirect
84+
golang.org/x/term v0.20.0 // indirect
85+
golang.org/x/text v0.15.0 // indirect
86+
golang.org/x/time v0.3.0 // indirect
87+
golang.org/x/tools v0.21.0 // indirect
7388
google.golang.org/appengine v1.6.7 // indirect
74-
google.golang.org/genproto v0.0.0-20230110181048-76db0878b65f // indirect
75-
google.golang.org/grpc v1.53.0 // indirect
76-
google.golang.org/protobuf v1.28.1 // indirect
89+
google.golang.org/genproto v0.0.0-20200526211855-cb27e3aa2013 // indirect
90+
google.golang.org/grpc v1.48.0 // indirect
91+
google.golang.org/protobuf v1.33.0 // indirect
7792
gopkg.in/inf.v0 v0.9.1 // indirect
7893
gopkg.in/yaml.v2 v2.4.0 // indirect
79-
k8s.io/klog/v2 v2.80.1 // indirect
80-
k8s.io/kube-openapi v0.0.0-20221012153701-172d655c2280 // indirect
81-
k8s.io/utils v0.0.0-20221107191617-1a15be271d1d // indirect
82-
sigs.k8s.io/json v0.0.0-20220713155537-f223a00ba0e2 // indirect
83-
sigs.k8s.io/structured-merge-diff/v4 v4.2.3 // indirect
94+
k8s.io/klog/v2 v2.110.1 // indirect
95+
k8s.io/kube-openapi v0.0.0-20231010175941-2dd684a91f00 // indirect
96+
k8s.io/utils v0.0.0-20230726121419-3b25d923346b // indirect
97+
sigs.k8s.io/json v0.0.0-20221116044647-bc3834ca7abd // indirect
98+
sigs.k8s.io/structured-merge-diff/v4 v4.4.1 // indirect
8499
sigs.k8s.io/yaml v1.3.0 // indirect
85100
)

0 commit comments

Comments
 (0)