From 58afae16d65f26e95cb12bc5280886d3c2de3eee Mon Sep 17 00:00:00 2001 From: bszabo Date: Thu, 19 Oct 2023 16:47:23 -0400 Subject: [PATCH 1/7] feat: TNL-10746 CMS API on omnibus plan + studio_host -> cms_host --- scripts/aws/deploy_studio.py | 6 ++--- swagger/api.yaml | 13 +++++++++- swagger/{studio.yaml => cms.yaml} | 42 ++++++++----------------------- 3 files changed, 25 insertions(+), 36 deletions(-) rename swagger/{studio.yaml => cms.yaml} (60%) diff --git a/scripts/aws/deploy_studio.py b/scripts/aws/deploy_studio.py index 2ea27c3..f2f2c33 100755 --- a/scripts/aws/deploy_studio.py +++ b/scripts/aws/deploy_studio.py @@ -35,8 +35,8 @@ help="Location of landing page for 'root' level requests") parser.add_argument("--edxapp-host", required=True, help="Location of edxapp for request routing") - parser.add_argument('--studio-host', required=True, - help="Location of Studio IDA for request routing") + parser.add_argument('--cms-host', required=True, + help="Location of CMS for request routing") args = parser.parse_args() cli_args = parser.parse_args() @@ -44,7 +44,7 @@ 'id': cli_args.tag, 'landing_page': cli_args.landing_page, 'edxapp_host': cli_args.edxapp_host, - 'studio_host': cli_args.studio_host, + 'cms_host': cli_args.cms_host, } stage_settings = { 'log_level': cli_args.log_level, diff --git a/swagger/api.yaml b/swagger/api.yaml index bdffd99..4cf74b3 100644 --- a/swagger/api.yaml +++ b/swagger/api.yaml @@ -138,6 +138,17 @@ paths: requestParameters: integration.request.path.proxy: "method.request.path.proxy" + # CMS API (Studio ingestion) + "/cms/v1/file_assets/{proxy+}": + $ref: "./cms.yaml#/endpoints/file_assets/{proxy+}" + "/cms/v1/videos/uploads/{proxy+}": + $ref: "./cms.yaml#/endpoints/videos/uploads/{proxy+}" + "/cms/v1/videos/images/{proxy+}": + $ref: "./cms.yaml#/endpoints/videos/images/{proxy+}" + "/cms/v1/video_transcripts/{proxy+}": + $ref: "./cms.yaml#/endpoints/video_transcripts/{proxy+}" + "/cms/v1/xblock/{proxy+}": + $ref: "./cms.yaml#/endpoints/xblock/{proxy+}" # edX extension point. Lists the vendors in use and their specific # parameters that are expected by upstream refs. @@ -155,4 +166,4 @@ x-edx-api-vendors: - "analytics_api_host" - "registrar_host" - "enterprise_catalog_host" - - "studio_host" + - "cms_host" diff --git a/swagger/studio.yaml b/swagger/cms.yaml similarity index 60% rename from swagger/studio.yaml rename to swagger/cms.yaml index fe55860..79476f5 100644 --- a/swagger/studio.yaml +++ b/swagger/cms.yaml @@ -1,31 +1,9 @@ -# Swagger specification for the Studio content API - --- -swagger: "2.0" -info: - version: "1.0.0" - title: "Studio content" -host: "your-open-edx-site.org" -basePath: "/contentstore/v1" -schemes: -- "https" - -# Complete set of whitelisted routes for use with Studio content API -paths: - - # Index - "/": - $ref: "./index.yaml#/endpoints/index" - - # Heartbeat - "/heartbeat": - $ref: "./heartbeat.yaml#/endpoints/heartbeat" - - # OAuth2 - "/oauth2/v1/access_token": - $ref: "./oauth.yaml#/endpoints/request_access_token" - - # Studio content API +# This is a Swagger (swagger.org) specification fragment. It is +# designed to be included into a top-level Swagger 'index', not +# as a standalone document. +endpoints: + # CMS API (content ingestion) "/file_assets/{proxy+}": x-amazon-apigateway-any-method: parameters: @@ -33,7 +11,7 @@ paths: in: "path" x-amazon-apigateway-integration: type: "http_proxy" - uri: "https://${stageVariables.studio_host}/api/contentstore/v1/file_assets/{proxy}" + uri: "https://${stageVariables.cms_host}/api/contentstore/v1/file_assets/{proxy}" httpMethod: "ANY" requestParameters: integration.request.path.proxy: "method.request.path.proxy" @@ -45,7 +23,7 @@ paths: in: "path" x-amazon-apigateway-integration: type: "http_proxy" - uri: "https://${stageVariables.studio_host}/api/contentstore/v1/videos/uploads/{proxy}" + uri: "https://${stageVariables.cms_host}/api/contentstore/v1/videos/uploads/{proxy}" httpMethod: "ANY" requestParameters: integration.request.path.proxy: "method.request.path.proxy" @@ -57,7 +35,7 @@ paths: in: "path" x-amazon-apigateway-integration: type: "http_proxy" - uri: "https://${stageVariables.studio_host}/api/contentstore/v1/videos/images/{proxy}" + uri: "https://${stageVariables.cms_host}/api/contentstore/v1/videos/images/{proxy}" httpMethod: "ANY" requestParameters: integration.request.path.proxy: "method.request.path.proxy" @@ -69,7 +47,7 @@ paths: in: "path" x-amazon-apigateway-integration: type: "http_proxy" - uri: "https://${stageVariables.studio_host}/api/contentstore/v1/video_transcripts/{proxy}" + uri: "https://${stageVariables.cms_host}/api/contentstore/v1/video_transcripts/{proxy}" httpMethod: "ANY" requestParameters: integration.request.path.proxy: "method.request.path.proxy" @@ -81,7 +59,7 @@ paths: in: "path" x-amazon-apigateway-integration: type: "http_proxy" - uri: "https://${stageVariables.studio_host}/api/contentstore/v1/xblock/{proxy}" + uri: "https://${stageVariables.cms_host}/api/contentstore/v1/xblock/{proxy}" httpMethod: "ANY" requestParameters: integration.request.path.proxy: "method.request.path.proxy" From 6d4f888eeb27988a38437d60d895099563dc7004 Mon Sep 17 00:00:00 2001 From: Bernard Szabo Date: Mon, 23 Oct 2023 14:40:16 -0400 Subject: [PATCH 2/7] feat: TNL-10746 inline cms.yaml code Separate file was breaking build. Timeboxed efforts to fix while still keeping cms.yaml as a separate file were not fruitful --- swagger/cms.yaml | 66 ------------------------------------------------ 1 file changed, 66 deletions(-) delete mode 100644 swagger/cms.yaml diff --git a/swagger/cms.yaml b/swagger/cms.yaml deleted file mode 100644 index 79476f5..0000000 --- a/swagger/cms.yaml +++ /dev/null @@ -1,66 +0,0 @@ ---- -# This is a Swagger (swagger.org) specification fragment. It is -# designed to be included into a top-level Swagger 'index', not -# as a standalone document. -endpoints: - # CMS API (content ingestion) - "/file_assets/{proxy+}": - x-amazon-apigateway-any-method: - parameters: - - name: "proxy" - in: "path" - x-amazon-apigateway-integration: - type: "http_proxy" - uri: "https://${stageVariables.cms_host}/api/contentstore/v1/file_assets/{proxy}" - httpMethod: "ANY" - requestParameters: - integration.request.path.proxy: "method.request.path.proxy" - - "/videos/uploads/{proxy+}": - x-amazon-apigateway-any-method: - parameters: - - name: "proxy" - in: "path" - x-amazon-apigateway-integration: - type: "http_proxy" - uri: "https://${stageVariables.cms_host}/api/contentstore/v1/videos/uploads/{proxy}" - httpMethod: "ANY" - requestParameters: - integration.request.path.proxy: "method.request.path.proxy" - - "/videos/images/{proxy+}": - x-amazon-apigateway-any-method: - parameters: - - name: "proxy" - in: "path" - x-amazon-apigateway-integration: - type: "http_proxy" - uri: "https://${stageVariables.cms_host}/api/contentstore/v1/videos/images/{proxy}" - httpMethod: "ANY" - requestParameters: - integration.request.path.proxy: "method.request.path.proxy" - - "/video_transcripts/{proxy+}": - x-amazon-apigateway-any-method: - parameters: - - name: "proxy" - in: "path" - x-amazon-apigateway-integration: - type: "http_proxy" - uri: "https://${stageVariables.cms_host}/api/contentstore/v1/video_transcripts/{proxy}" - httpMethod: "ANY" - requestParameters: - integration.request.path.proxy: "method.request.path.proxy" - - "/xblock/{proxy+}": - x-amazon-apigateway-any-method: - parameters: - - name: "proxy" - in: "path" - x-amazon-apigateway-integration: - type: "http_proxy" - uri: "https://${stageVariables.cms_host}/api/contentstore/v1/xblock/{proxy}" - httpMethod: "ANY" - requestParameters: - integration.request.path.proxy: "method.request.path.proxy" - From ab4b8f5627a9c29f0731fb71ef0a2665cb3ef5a3 Mon Sep 17 00:00:00 2001 From: Bernard Szabo Date: Tue, 24 Oct 2023 16:39:11 -0400 Subject: [PATCH 3/7] feat: TNL-10746 include missing api.yaml changes --- swagger/api.yaml | 73 ++++++++++++++++++++++++++++++++++++++++-------- 1 file changed, 62 insertions(+), 11 deletions(-) diff --git a/swagger/api.yaml b/swagger/api.yaml index 4cf74b3..e61106e 100644 --- a/swagger/api.yaml +++ b/swagger/api.yaml @@ -138,17 +138,68 @@ paths: requestParameters: integration.request.path.proxy: "method.request.path.proxy" - # CMS API (Studio ingestion) - "/cms/v1/file_assets/{proxy+}": - $ref: "./cms.yaml#/endpoints/file_assets/{proxy+}" - "/cms/v1/videos/uploads/{proxy+}": - $ref: "./cms.yaml#/endpoints/videos/uploads/{proxy+}" - "/cms/v1/videos/images/{proxy+}": - $ref: "./cms.yaml#/endpoints/videos/images/{proxy+}" - "/cms/v1/video_transcripts/{proxy+}": - $ref: "./cms.yaml#/endpoints/video_transcripts/{proxy+}" - "/cms/v1/xblock/{proxy+}": - $ref: "./cms.yaml#/endpoints/xblock/{proxy+}" + # CMS API (content ingestion) + "cms/v0/file_assets/{proxy+}": + x-amazon-apigateway-any-method: + parameters: + - name: "proxy" + in: "path" + x-amazon-apigateway-integration: + type: "http_proxy" + uri: "https://${stageVariables.cms_host}/api/contentstore/v1/file_assets/{proxy}" + httpMethod: "ANY" + requestParameters: + integration.request.path.proxy: "method.request.path.proxy" + + "cms/v0/videos/uploads/{proxy+}": + x-amazon-apigateway-any-method: + parameters: + - name: "proxy" + in: "path" + x-amazon-apigateway-integration: + type: "http_proxy" + uri: "https://${stageVariables.cms_host}/api/contentstore/v1/videos/uploads/{proxy}" + httpMethod: "ANY" + requestParameters: + integration.request.path.proxy: "method.request.path.proxy" + + "cms/videos/images/{proxy+}": + x-amazon-apigateway-any-method: + parameters: + - name: "proxy" + in: "path" + x-amazon-apigateway-integration: + type: "http_proxy" + uri: "https://${stageVariables.cms_host}/api/contentstore/v1/videos/images/{proxy}" + httpMethod: "ANY" + requestParameters: + integration.request.path.proxy: "method.request.path.proxy" + + "cms/video_transcripts/{proxy+}": + x-amazon-apigateway-any-method: + parameters: + - name: "proxy" + in: "path" + x-amazon-apigateway-integration: + type: "http_proxy" + uri: "https://${stageVariables.cms_host}/api/contentstore/v1/video_transcripts/{proxy}" + httpMethod: "ANY" + requestParameters: + integration.request.path.proxy: "method.request.path.proxy" + + "cms/xblock/{proxy+}": + x-amazon-apigateway-any-method: + parameters: + - name: "proxy" + in: "path" + x-amazon-apigateway-integration: + type: "http_proxy" + uri: "https://${stageVariables.cms_host}/api/contentstore/v1/xblock/{proxy}" + httpMethod: "ANY" + requestParameters: + integration.request.path.proxy: "method.request.path.proxy" + + # edX extension point. Lists the vendors in use and their specific # parameters that are expected by upstream refs. From 942c55d4e2733ed8e8810b82c9c451f5d3dc1424 Mon Sep 17 00:00:00 2001 From: Bernard Szabo Date: Fri, 27 Oct 2023 16:11:13 -0400 Subject: [PATCH 4/7] feat: TNL-10746 cms endpoint names get leading slashes --- swagger/api.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/swagger/api.yaml b/swagger/api.yaml index e61106e..5921a9e 100644 --- a/swagger/api.yaml +++ b/swagger/api.yaml @@ -139,7 +139,7 @@ paths: integration.request.path.proxy: "method.request.path.proxy" # CMS API (content ingestion) - "cms/v0/file_assets/{proxy+}": + "/cms/v0/file_assets/{proxy+}": x-amazon-apigateway-any-method: parameters: - name: "proxy" @@ -151,7 +151,7 @@ paths: requestParameters: integration.request.path.proxy: "method.request.path.proxy" - "cms/v0/videos/uploads/{proxy+}": + "/cms/v0/videos/uploads/{proxy+}": x-amazon-apigateway-any-method: parameters: - name: "proxy" @@ -163,7 +163,7 @@ paths: requestParameters: integration.request.path.proxy: "method.request.path.proxy" - "cms/videos/images/{proxy+}": + "/cms/videos/images/{proxy+}": x-amazon-apigateway-any-method: parameters: - name: "proxy" @@ -175,7 +175,7 @@ paths: requestParameters: integration.request.path.proxy: "method.request.path.proxy" - "cms/video_transcripts/{proxy+}": + "/cms/video_transcripts/{proxy+}": x-amazon-apigateway-any-method: parameters: - name: "proxy" @@ -187,7 +187,7 @@ paths: requestParameters: integration.request.path.proxy: "method.request.path.proxy" - "cms/xblock/{proxy+}": + "/cms/xblock/{proxy+}": x-amazon-apigateway-any-method: parameters: - name: "proxy" From b7f9dfa173b59aa7f74c531dd2a69b73e4c676f5 Mon Sep 17 00:00:00 2001 From: Bernard Szabo Date: Fri, 27 Oct 2023 16:57:47 -0400 Subject: [PATCH 5/7] feat: TNL-10746 all cms public endpoints are v0 --- swagger/api.yaml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/swagger/api.yaml b/swagger/api.yaml index 5921a9e..cc85bcc 100644 --- a/swagger/api.yaml +++ b/swagger/api.yaml @@ -158,43 +158,43 @@ paths: in: "path" x-amazon-apigateway-integration: type: "http_proxy" - uri: "https://${stageVariables.cms_host}/api/contentstore/v1/videos/uploads/{proxy}" + uri: "https://${stageVariables.cms_host}/api/contentstore/v0/videos/uploads/{proxy}" httpMethod: "ANY" requestParameters: integration.request.path.proxy: "method.request.path.proxy" - "/cms/videos/images/{proxy+}": + "/cms/v0/videos/images/{proxy+}": x-amazon-apigateway-any-method: parameters: - name: "proxy" in: "path" x-amazon-apigateway-integration: type: "http_proxy" - uri: "https://${stageVariables.cms_host}/api/contentstore/v1/videos/images/{proxy}" + uri: "https://${stageVariables.cms_host}/api/contentstore/v0/videos/images/{proxy}" httpMethod: "ANY" requestParameters: integration.request.path.proxy: "method.request.path.proxy" - "/cms/video_transcripts/{proxy+}": + "/cms/v0/video_transcripts/{proxy+}": x-amazon-apigateway-any-method: parameters: - name: "proxy" in: "path" x-amazon-apigateway-integration: type: "http_proxy" - uri: "https://${stageVariables.cms_host}/api/contentstore/v1/video_transcripts/{proxy}" + uri: "https://${stageVariables.cms_host}/api/contentstore/v0/video_transcripts/{proxy}" httpMethod: "ANY" requestParameters: integration.request.path.proxy: "method.request.path.proxy" - "/cms/xblock/{proxy+}": + "/cms/v0/xblock/{proxy+}": x-amazon-apigateway-any-method: parameters: - name: "proxy" in: "path" x-amazon-apigateway-integration: type: "http_proxy" - uri: "https://${stageVariables.cms_host}/api/contentstore/v1/xblock/{proxy}" + uri: "https://${stageVariables.cms_host}/api/contentstore/v0/xblock/{proxy}" httpMethod: "ANY" requestParameters: integration.request.path.proxy: "method.request.path.proxy" From cc7fc873a3714276406f7ab9a6faa2286b90c735 Mon Sep 17 00:00:00 2001 From: Bernard Szabo Date: Fri, 27 Oct 2023 16:59:15 -0400 Subject: [PATCH 6/7] feat: TNL-10746 all cms public endpoints are now authoring --- swagger/api.yaml | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/swagger/api.yaml b/swagger/api.yaml index cc85bcc..7dfe89e 100644 --- a/swagger/api.yaml +++ b/swagger/api.yaml @@ -139,7 +139,7 @@ paths: integration.request.path.proxy: "method.request.path.proxy" # CMS API (content ingestion) - "/cms/v0/file_assets/{proxy+}": + "/authoring/v0/file_assets/{proxy+}": x-amazon-apigateway-any-method: parameters: - name: "proxy" @@ -151,7 +151,7 @@ paths: requestParameters: integration.request.path.proxy: "method.request.path.proxy" - "/cms/v0/videos/uploads/{proxy+}": + "/authoring/v0/videos/uploads/{proxy+}": x-amazon-apigateway-any-method: parameters: - name: "proxy" @@ -163,7 +163,7 @@ paths: requestParameters: integration.request.path.proxy: "method.request.path.proxy" - "/cms/v0/videos/images/{proxy+}": + "/authoring/v0/videos/images/{proxy+}": x-amazon-apigateway-any-method: parameters: - name: "proxy" @@ -175,7 +175,7 @@ paths: requestParameters: integration.request.path.proxy: "method.request.path.proxy" - "/cms/v0/video_transcripts/{proxy+}": + "/authoring/v0/video_transcripts/{proxy+}": x-amazon-apigateway-any-method: parameters: - name: "proxy" @@ -187,7 +187,7 @@ paths: requestParameters: integration.request.path.proxy: "method.request.path.proxy" - "/cms/v0/xblock/{proxy+}": + "/authoring/v0/xblock/{proxy+}": x-amazon-apigateway-any-method: parameters: - name: "proxy" From 7cb59bee7cf83466c83a5653336b540f8bca28ff Mon Sep 17 00:00:00 2001 From: Bernard Szabo Date: Tue, 31 Oct 2023 11:03:25 -0400 Subject: [PATCH 7/7] feat: TNL-10746 cms -> authoring cleanup Top-level comment marks section for authoring domain, with ingestion as a sample API belonging to the domain deploy_studio.py not needed with authoring API part of the omnibus API --- scripts/aws/deploy_studio.py | 56 ------------------------------------ swagger/api.yaml | 2 +- 2 files changed, 1 insertion(+), 57 deletions(-) delete mode 100755 scripts/aws/deploy_studio.py diff --git a/scripts/aws/deploy_studio.py b/scripts/aws/deploy_studio.py deleted file mode 100755 index f2f2c33..0000000 --- a/scripts/aws/deploy_studio.py +++ /dev/null @@ -1,56 +0,0 @@ -#!/usr/bin/python - -"""Various functions for day-to-day management of AWS API Gateway instances.""" - -import argparse -import logging -from scripts.aws.common.deploy import deploy - -if __name__ == '__main__': - - logging.basicConfig(level=logging.INFO, format='[%(asctime)s] %(levelname)s %(message)s') - - parser = argparse.ArgumentParser() - - parser.add_argument("--aws-region", required=False, default="us-east-1") - parser.add_argument("--api-base-domain", required=True, - help="The name of the API Gateway domain to be deployed to.") - parser.add_argument("--swagger-filename", required=True, - help="The name of a complete Swagger 2.0 specification file with AWS vendor hooks.") - parser.add_argument("--tag", required=True, - help="Unique identifier for this deployment (such as a git hash)") - parser.add_argument("--rotation-order", required=True, nargs='+', - help="Ordered list of stages in the deployment ring (ex: 'red black')") - parser.add_argument("--log-level", required=False, default="OFF", choices=['OFF', 'ERROR', 'INFO'], - help="Verbosity of messages sent to CloudWatch Logs") - parser.add_argument("--metrics", required=False, default="false", choices=['false', 'true'], - help="Enable CloudWatch metrics") - parser.add_argument("--caching", required=False, default="false", choices=['false', 'true'], - help="Enable API Gateway caching feature") - parser.add_argument("--rate-limit", required=False, default="500", type=str, - help="Default per-resource average rate limit") - parser.add_argument("--burst-limit", required=False, default="1000", type=str, - help="Default per-resource maximum rate limit") - parser.add_argument("--landing-page", required=True, - help="Location of landing page for 'root' level requests") - parser.add_argument("--edxapp-host", required=True, - help="Location of edxapp for request routing") - parser.add_argument('--cms-host', required=True, - help="Location of CMS for request routing") - - args = parser.parse_args() - cli_args = parser.parse_args() - integration_settings = { - 'id': cli_args.tag, - 'landing_page': cli_args.landing_page, - 'edxapp_host': cli_args.edxapp_host, - 'cms_host': cli_args.cms_host, - } - stage_settings = { - 'log_level': cli_args.log_level, - 'metrics': cli_args.metrics, - 'caching': cli_args.caching, - 'rate_limit': cli_args.rate_limit, - 'burst_limit': cli_args.burst_limit - } - deploy(cli_args, integration_settings, stage_settings) diff --git a/swagger/api.yaml b/swagger/api.yaml index 7dfe89e..9147102 100644 --- a/swagger/api.yaml +++ b/swagger/api.yaml @@ -138,7 +138,7 @@ paths: requestParameters: integration.request.path.proxy: "method.request.path.proxy" - # CMS API (content ingestion) + # Authoring Domain API (e.g. content ingestion via CMS) "/authoring/v0/file_assets/{proxy+}": x-amazon-apigateway-any-method: parameters: