Skip to content

Commit

Permalink
changed the way certificates are uploaded. We are now uploading the c…
Browse files Browse the repository at this point in the history
…ertificate and private key as PEM files
  • Loading branch information
ryana-ccbill committed Jul 19, 2024
1 parent 32fe482 commit a2ee007
Showing 1 changed file with 11 additions and 3 deletions.
14 changes: 11 additions & 3 deletions automation/upload_portal_documentation.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,12 +43,13 @@ def spec_exists(org_name: str, spec_name: str) -> bool:

def documentation_exists(
spec_name: str,
portal_name: str, pagesize) -> ApiDoc:
portal_name: str,
page_size: int) -> ApiDoc:
"""Retrieves a list of API Products exposed on a portal and checks if
there is an existing one using the given spec name."""

response = REQUEST.get(
'https://apigee.com/portals/api/sites/{}/apidocs?pageSize={}'.format(portal_name, pagesize))
'https://apigee.com/portals/api/sites/{}/apidocs?pageSize={}'.format(portal_name, page_size))

if response.status_code != 200:
raise RestException(utils.print_error(response))
Expand Down Expand Up @@ -156,6 +157,10 @@ def parse_args():
'-rt',
'--refresh_token',
help='apigee refresh token')
req_grp.add_argument(
'-pgs',
'--page_size',
help='page size for API calls that use paging - default is 100')

parsed = parser.parse_args()

Expand All @@ -177,6 +182,9 @@ def main():
password = args.password
refresh_token = args.refresh_token

# Some API calls make use of paging, if the page size is not defined, we default it to 100.
page_size = 100 if args.page_size is None else args.page_size

data = open(doc_path, 'r', encoding='utf8').read()
doc = json.loads(data)

Expand Down Expand Up @@ -210,7 +218,7 @@ def main():
# the spec ID dynamically.
doc.update({'specContent': spec_id})

api_doc = documentation_exists(spec_name, current_portal.id)
api_doc = documentation_exists(spec_name, current_portal.id, page_size)
if api_doc:
print("API Doc already exists.")
try:
Expand Down

0 comments on commit a2ee007

Please sign in to comment.