-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Update swagger files to vRA v8.6.2 * Upgrade go-swagger to v0.29.0 * Upgrade golang dependencies * Add CMX Service API swagger * Remove security parameters from blueprint and iaas swagger files
- Loading branch information
Showing
1,505 changed files
with
155,254 additions
and
94,474 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import argparse | ||
import json | ||
|
||
|
||
# This is the location of the CMX swagger | ||
old_filename = "swagger/vra-cmx.json" | ||
new_filename = "swagger/vra-cmx-fixed.json" | ||
|
||
|
||
def replace_value(d, k, v, new): | ||
if k in d and d[k] == v: | ||
d[k] = new | ||
for child in d.values(): | ||
if isinstance(child, dict): | ||
replace_value(child, k, v, new) | ||
elif isinstance(child, list): | ||
for i in child: | ||
if isinstance(i, dict): | ||
replace_value(i, k, v, new) | ||
|
||
|
||
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') |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.