Skip to content

Commit

Permalink
Update APIs to vRA 8.9.0 (#45)
Browse files Browse the repository at this point in the history
* Update swagger files to vRA v8.9.0
* Upgrade go-swagger to v0.30.3
* Upgrade golang dependencies
* Add Relocation (Onboarding)e API swagger
* Cleanup hack scripts
* Renames client.MulticloudIaaS to client.API

Signed-off-by: Ferran Rodenas <[email protected]>

Signed-off-by: Ferran Rodenas <[email protected]>
  • Loading branch information
frodenas committed Oct 11, 2022
1 parent f8f241c commit 0667cd7
Show file tree
Hide file tree
Showing 1,614 changed files with 113,628 additions and 19,834 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ swagger/vra-catalog-deployment-fixed.json
swagger/vra-pipeline-fixed.json
swagger/vra-project-fixed.json
swagger/vra-cmx-fixed.json
swagger/vra-relocation-fixed.json
sdk-test
tokens
examples/cloud_account/cloud_account
22 changes: 13 additions & 9 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,19 +1,20 @@
.PHONY: all swagger modified update update-blueprint update-catalog-deployment update-iaas update-content update-pipeline update-project update-cmx clean
SWAGGER_VERSION=0.29.0
SWAGGER_VERSION=0.30.3
SWAGGER_ENDPOINT ?= api.mgmt.cloud.vmware.com

all:
go build -o sdk-test

swagger: check-swagger
rm -rf pkg/client pkg/models
./hack/fix_iaas_swagger
./hack/fix_blueprint_swagger
./hack/fix_catalog_deployment_swagger
./hack/fix_cmx_swagger
./hack/fix_iaas_swagger
./hack/fix_pipeline_swagger
./hack/fix_project_swagger
./hack/fix_cmx_swagger
swagger mixin -c=1 swagger/vra-iaas-fixed.json swagger/vra-blueprint-fixed.json swagger/vra-catalog-deployment-fixed.json swagger/vra-content.json swagger/vra-pipeline-fixed.json swagger/vra-project-fixed.json swagger/vra-cmx-fixed.json | python3 -mjson.tool > swagger/vra-combined.json
./hack/fix_relocation_swagger
swagger mixin -c=1 swagger/vra-blueprint-fixed.json swagger/vra-catalog-deployment-fixed.json swagger/vra-cmx-fixed.json swagger/vra-content.json swagger/vra-iaas-fixed.json swagger/vra-pipeline-fixed.json swagger/vra-project-fixed.json swagger/vra-relocation-fixed.json | python3 -mjson.tool > swagger/vra-combined.json
./hack/fix_vra_swagger --omit-security
swagger generate client -f swagger/vra-combined.json -t pkg
./hack/fixup.sh
Expand All @@ -24,28 +25,31 @@ check-swagger:
modified:
git ls-files --modified | xargs git add

update: update-blueprint update-catalog-deployment update-iaas update-content update-pipeline update-project update-cmx
update: update-blueprint update-catalog-deployment update-cmx update-content update-iaas update-pipeline update-project update-relocation

update-blueprint:
curl --insecure 'https://${SWAGGER_ENDPOINT}/blueprint/api/swagger/swagger-api-docs?group=2019-09-12' | python3 -mjson.tool > swagger/vra-blueprint.json

update-catalog-deployment:
curl --insecure 'https://${SWAGGER_ENDPOINT}/deployment/api/swagger/swagger/v2/api-docs?group=2020-08-25' | python3 -mjson.tool > swagger/vra-catalog-deployment.json

update-iaas:
curl --insecure 'https://${SWAGGER_ENDPOINT}/iaas/api/swagger?apiVersion=2021-07-15' | python3 -mjson.tool > swagger/vra-iaas.json
update-cmx:
curl --insecure 'https://${SWAGGER_ENDPOINT}/cmx/v2/api-docs' | python3 -mjson.tool > swagger/vra-cmx.json

update-content:
curl --insecure 'https://${SWAGGER_ENDPOINT}/content/api/swagger/v2/api-docs?group=2019-01-15' | python3 -mjson.tool > swagger/vra-content.json

update-iaas:
curl --insecure 'https://${SWAGGER_ENDPOINT}/iaas/api/swagger?apiVersion=2021-07-15' | python3 -mjson.tool > swagger/vra-iaas.json

update-pipeline:
curl --insecure 'https://${SWAGGER_ENDPOINT}/pipeline/api/swagger/v2/api-docs?group=2019-10-17' | python3 -mjson.tool > swagger/vra-pipeline.json

update-project:
curl --insecure 'https://${SWAGGER_ENDPOINT}/project/api/swagger/v2/api-docs?group=2019-01-15' | python3 -mjson.tool > swagger/vra-project.json

update-cmx:
curl --insecure 'https://${SWAGGER_ENDPOINT}/cmx/v2/api-docs' | python3 -mjson.tool > swagger/vra-cmx.json
update-relocation:
curl --insecure 'https://${SWAGGER_ENDPOINT}/relocation/api/swagger/ui/swagger.json' | python3 -mjson.tool > swagger/vra-relocation.json

test:
go build -o sdk-test
Expand Down
15 changes: 10 additions & 5 deletions examples/cloud_account/cloud_account.go
Original file line number Diff line number Diff line change
Expand Up @@ -102,19 +102,24 @@ func main() {
apiclient := client.New(transport, strfmt.Default)

fmt.Printf("Creating cloud account %s\n", *cloudAccountNamePtr)
createResp, err := apiclient.CloudAccount.CreateAwsCloudAccount(cloud_account.NewCreateAwsCloudAccountParams().WithBody(&models.CloudAccountAwsSpecification{
createResp, err := apiclient.CloudAccount.CreateAwsCloudAccountAsync(cloud_account.NewCreateAwsCloudAccountAsyncParams().WithBody(&models.CloudAccountAwsSpecification{
Name: cloudAccountNamePtr,
AccessKeyID: withString(accessKeyID),
SecretAccessKey: withString(secretAccessKey),
RegionIds: []string{"us-west-2"},
Regions: []*models.RegionSpecification{
&models.RegionSpecification{
ExternalRegionID: withString("us-west-2"),
Name: withString("us-west-2"),
},
},
/* Tags: []*models.Tag{&models.Tag{
Key: withString("key"),
Value: withString("value"),
},}, */
}))

if err != nil {
if _, ok := err.(*cloud_account.CreateAwsCloudAccountBadRequest); ok {
if _, ok := err.(*cloud_account.CreateAwsCloudAccountAsyncBadRequest); ok {
fmt.Printf("Cloud account '%s' already exists\n", *cloudAccountNamePtr)
} else {
fmt.Printf("Unknown error: %+v\n", err)
Expand All @@ -135,9 +140,9 @@ func main() {
}

if *deletePtr && id != "" {
resp, err := apiclient.CloudAccount.DeleteAwsCloudAccount(cloud_account.NewDeleteAwsCloudAccountParams().WithID(id))
_, _, err := apiclient.CloudAccount.DeleteAwsCloudAccount(cloud_account.NewDeleteAwsCloudAccountParams().WithID(id))
if err != nil {
fmt.Printf("Error with delete: %s %+v %+v\n", *cloudAccountNamePtr, resp, err)
fmt.Printf("Error with delete: %s %+v\n", *cloudAccountNamePtr, err)
} else {
fmt.Printf("Deleted cloud account: %s\n", *cloudAccountNamePtr)
}
Expand Down
21 changes: 9 additions & 12 deletions go.mod
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
module github.com/vmware/vra-sdk-go

require (
github.com/asaskevich/govalidator v0.0.0-20210307081110-f21760c49a8d // indirect
github.com/go-openapi/analysis v0.21.1 // indirect
github.com/go-openapi/errors v0.20.1
github.com/go-openapi/runtime v0.21.0
github.com/go-openapi/strfmt v0.21.1
github.com/go-openapi/swag v0.19.15
github.com/go-openapi/validate v0.20.3
github.com/go-stack/stack v1.8.1 // indirect
github.com/mailru/easyjson v0.7.7 // indirect
github.com/mitchellh/mapstructure v1.4.3 // indirect
go.mongodb.org/mongo-driver v1.8.2 // indirect
golang.org/x/net v0.0.0-20220111093109-d55c255bac03 // indirect
github.com/go-openapi/errors v0.20.3
github.com/go-openapi/loads v0.21.2 // indirect
github.com/go-openapi/runtime v0.24.1
github.com/go-openapi/spec v0.20.7 // indirect
github.com/go-openapi/strfmt v0.21.3
github.com/go-openapi/swag v0.22.3
github.com/go-openapi/validate v0.22.0
github.com/mitchellh/mapstructure v1.5.0 // indirect
go.mongodb.org/mongo-driver v1.10.3 // indirect
)

go 1.14
Loading

0 comments on commit 0667cd7

Please sign in to comment.