Skip to content

Commit

Permalink
Add Project Service API swagger (#40)
Browse files Browse the repository at this point in the history
Signed-off-by: Ferran Rodenas <rodenasf@vmware.com>
  • Loading branch information
frodenas authored Aug 6, 2021
1 parent 78f1e2c commit db1e1fa
Show file tree
Hide file tree
Showing 37 changed files with 7,141 additions and 3 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ swagger/vra-blueprint-fixed.json
swagger/vra-iaas-fixed.json
swagger/vra-catalog-deployment-fixed.json
swagger/vra-pipeline-fixed.json
swagger/vra-project-fixed.json
sdk-test
tokens
examples/cloud_account/cloud_account
10 changes: 7 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
.PHONY: all swagger modified update update-blueprint update-catalog-deployment update-iaas update-content clean
.PHONY: all swagger modified update update-blueprint update-catalog-deployment update-iaas update-content update-pipeline update-project clean
SWAGGER_VERSION=0.27.0
SWAGGER_ENDPOINT ?= api.mgmt.cloud.vmware.com

Expand All @@ -11,7 +11,8 @@ swagger: check-swagger
./hack/fix_blueprint_swagger
./hack/fix_catalog_deployment_swagger
./hack/fix_pipeline_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 | python3 -mjson.tool > swagger/vra-combined.json
./hack/fix_project_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 | 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 @@ -22,7 +23,7 @@ check-swagger:
modified:
git ls-files --modified | xargs git add

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

update-blueprint:
curl --insecure 'https://${SWAGGER_ENDPOINT}/blueprint/api/swagger/swagger-api-docs?group=2019-09-12' | python3 -mjson.tool > swagger/vra-blueprint.json
Expand All @@ -39,6 +40,9 @@ update-content:
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

test:
go build -o sdk-test

Expand Down
41 changes: 41 additions & 0 deletions hack/fix_project_swagger
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
#!/usr/bin/env python3

import argparse
import json


# This is the location of the Project swagger
old_filename = "swagger/vra-project.json"
new_filename = "swagger/vra-project-fixed.json"


def remove_global_security(swagger):
if 'securityDefinitions' in swagger:
del swagger['securityDefinitions']


# See https://jira.eng.vmware.com/browse/TCS-4017 for context
def remove_security(swagger):
for p in swagger['paths']:
param_list = swagger['paths'][p]
for method in param_list:
if 'security' in swagger['paths'][p][method]:
del swagger['paths'][p][method]['security']


if __name__ == "__main__":
parser = argparse.ArgumentParser()
parser.add_argument('--omit-security', action='store_false')
args = parser.parse_args()

# read in the swagger spec
swagger = json.loads(open(old_filename).read())

if args.omit_security:
remove_global_security(swagger)
remove_security(swagger)

# Overwrite the swagger spec
f = open(new_filename, "w")
f.write(json.dumps(swagger, sort_keys=False, indent=2))
f.write('\n')
44 changes: 44 additions & 0 deletions pkg/client/about/about_client.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

126 changes: 126 additions & 0 deletions pkg/client/about/get_about_page_mixin4_parameters.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

66 changes: 66 additions & 0 deletions pkg/client/about/get_about_page_mixin4_responses.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit db1e1fa

Please sign in to comment.