-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #544 from openedx/hamza/ENT-7994-add-yaml-files
feat: add api-compact.yml and api.yaml
- Loading branch information
Showing
2 changed files
with
307 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,146 @@ | ||
# License Manager IDA: upstream API definitions, including vendor extensions. | ||
# Note, while this document is not strictly to Swagger spec, each HTTP method's | ||
# definition _must_ be to spec or the downstream ref will fail. | ||
# | ||
# Clients must include an Authorization header with OAuth2 access token in order to communicate: | ||
# Authorization: JWT {access_token} | ||
# | ||
# | ||
# Available service endpoints -- note that alternate endpoints may be presented at the API Gateway tier | ||
# POST /api/v1/subscriptions/{subscription_plan_uuid}/licenses/assign/ | ||
|
||
apigateway_responses: &apigateway_responses | ||
default: | ||
statusCode: "400" | ||
200: | ||
statusCode: "200" | ||
401: | ||
statusCode: "401" | ||
403: | ||
statusCode: "403" | ||
404: | ||
statusCode: "404" | ||
429: | ||
statusCode: "429" | ||
500: | ||
statusCode: "500" | ||
|
||
apigateway_responses_with_mapping_template_for_uuid: &apigateway_responses_with_mapping_template_for_uuid | ||
default: | ||
statusCode: "400" | ||
200: | ||
statusCode: "200" | ||
responseTemplates: | ||
# Response body mapping template, this template is used for updating | ||
# "next" and "previous" urls (both host and url path) while preserving | ||
# the protocol (http | https) and querystring parameters. | ||
application/json: > | ||
#set($inputRoot = $input.path('$')) | ||
#set($host = $stageVariables.gateway_host) | ||
#set($uuid = $input.params('uuid')) | ||
#set($URLMatchRegex = "(^https?://)[^/]*[^?]*(.*$)") | ||
#set($updatedURL = "$1$host$context.resourcePath$2") | ||
#set($resourceUuidMatch = "{uuid}") | ||
{ | ||
"count": $inputRoot.count, | ||
"next": "$inputRoot.next.replaceAll($URLMatchRegex, $updatedURL).replace($resourceUuidMatch, $uuid)", | ||
"previous": "$inputRoot.previous.replaceAll($URLMatchRegex, $updatedURL).replace($resourceUuidMatch, $uuid)", | ||
"results": $inputRoot.results | ||
} | ||
401: | ||
statusCode: "401" | ||
403: | ||
statusCode: "403" | ||
404: | ||
statusCode: "404" | ||
429: | ||
statusCode: "429" | ||
500: | ||
statusCode: "500" | ||
|
||
responses: &responses | ||
200: | ||
description: "OK" | ||
400: | ||
description: "Bad Request" | ||
401: | ||
description: "Unauthorized" | ||
403: | ||
description: "Forbidden" | ||
404: | ||
description: "Not Found" | ||
429: | ||
description: "Too Many Requests" | ||
500: | ||
description: "Internal Server Error" | ||
|
||
produces: &produces | ||
- "application/json" | ||
- "application/csv" | ||
|
||
subscription_plan_uuid: &subscription_plan_uuid | ||
name: "subscription_plan_uuid" | ||
in: "path" | ||
required: true | ||
type: "string" | ||
|
||
auth_header: &auth_header | ||
name: "Authorization" | ||
in: "header" | ||
required: true | ||
type: "string" | ||
|
||
endpoints: | ||
v1: | ||
|
||
# /v1/subscriptions/{subscription_plan_uuid}/licenses/assign/ | ||
assignLicenses: | ||
post: | ||
description: "Assigns a license to given user emails and sends an activation email." | ||
operationId: "assign_licenses" | ||
consumes: | ||
- "application/json" | ||
produces: *produces | ||
parameters: | ||
- *auth_header | ||
- *subscription_plan_uuid | ||
- name: "body" | ||
in: "body" | ||
description: "List of emails to assign licenses." | ||
required: true | ||
schema: | ||
type: "array" | ||
items: | ||
type: "object" | ||
properties: | ||
user_emails: | ||
description: "List of emails to assign licenses." | ||
type: "array" | ||
required: true | ||
user_sfids: | ||
description: "List of salesforce user ids to assign licenses." | ||
type: "array" | ||
required: true | ||
greeting: | ||
description: "Email template closing e.g Hello." | ||
type: "string" | ||
required: true | ||
closing: | ||
description: "Email template closing e.g Goodbye." | ||
type: "string" | ||
required: true | ||
notify_users: | ||
description: "Send license assignment email or not." | ||
type: "boolean" | ||
required: true | ||
responses: *responses | ||
x-amazon-apigateway-integration: | ||
responses: *apigateway_responses | ||
httpMethod: "POST" | ||
type: "http" | ||
requestParameters: | ||
integration.request.header.Authorization: "method.request.header.Authorization" | ||
integration.request.path.subscription_plan_uuid: "method.request.path.subscription_plan_uuid" | ||
uri: "https://${stageVariables.license_manager_host}/v1/subscriptions/{subscription_plan_uuid}/licenses/assign/" |
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,161 @@ | ||
# This file is a "de-compacted" version of api-compact.yaml. The consuming tools are unable to process YAML anchors. | ||
# This file was generated using http://www.yamllint.com/. | ||
|
||
--- | ||
apigateway_responses: | ||
"200": | ||
statusCode: "200" | ||
"401": | ||
statusCode: "401" | ||
"403": | ||
statusCode: "403" | ||
"404": | ||
statusCode: "404" | ||
"429": | ||
statusCode: "429" | ||
"500": | ||
statusCode: "500" | ||
default: | ||
statusCode: "400" | ||
apigateway_responses_with_mapping_template_for_uuid: | ||
"200": | ||
statusCode: "200" | ||
responseTemplates: | ||
application/json: > | ||
#set($inputRoot = $input.path('$')) #set($host = | ||
$stageVariables.gateway_host) #set($uuid = $input.params('uuid')) | ||
#set($URLMatchRegex = "(^https?://)[^/]*[^?]*(.*$)") #set($updatedURL = "$1$host$context.resourcePath$2") #set($resourceUuidMatch = "{uuid}") | ||
{ | ||
"count": $inputRoot.count, | ||
"next": "$inputRoot.next.replaceAll($URLMatchRegex, $updatedURL).replace($resourceUuidMatch, $uuid)", | ||
"previous": "$inputRoot.previous.replaceAll($URLMatchRegex, $updatedURL).replace($resourceUuidMatch, $uuid)", | ||
"results": $inputRoot.results | ||
} | ||
"401": | ||
statusCode: "401" | ||
"403": | ||
statusCode: "403" | ||
"404": | ||
statusCode: "404" | ||
"429": | ||
statusCode: "429" | ||
"500": | ||
statusCode: "500" | ||
default: | ||
statusCode: "400" | ||
responses: | ||
"200": | ||
description: OK | ||
"400": | ||
description: Bad Request | ||
"401": | ||
description: Unauthorized | ||
"403": | ||
description: Forbidden | ||
"404": | ||
description: Not Found | ||
"429": | ||
description: Too Many Requests | ||
"500": | ||
description: Internal Server Error | ||
produces: | ||
- application/json | ||
- application/csv | ||
subscription_plan_uuid: | ||
name: subscription_plan_uuid | ||
in: path | ||
required: true | ||
type: string | ||
auth_header: | ||
name: Authorization | ||
in: header | ||
required: true | ||
type: string | ||
endpoints: | ||
v1: | ||
assignLicenses: | ||
post: | ||
description: Assigns a license to given user emails and sends an activation email. | ||
operationId: assign_licenses | ||
consumes: | ||
- application/json | ||
produces: | ||
- application/json | ||
- application/csv | ||
parameters: | ||
- name: Authorization | ||
in: header | ||
required: true | ||
type: string | ||
- name: subscription_plan_uuid | ||
in: path | ||
required: true | ||
type: string | ||
- name: body | ||
in: body | ||
description: List of emails to assign licenses. | ||
required: true | ||
schema: | ||
type: array | ||
items: | ||
type: object | ||
properties: | ||
user_emails: | ||
description: List of emails to assign licenses. | ||
type: array | ||
required: true | ||
user_sfids: | ||
description: List of salesforce user ids to assign licenses. | ||
type: array | ||
required: true | ||
greeting: | ||
description: Email template closing e.g Hello. | ||
type: string | ||
required: true | ||
closing: | ||
description: Email template closing e.g Goodbye. | ||
type: string | ||
required: true | ||
notify_users: | ||
description: Send license assignment email or not. | ||
type: boolean | ||
required: true | ||
responses: | ||
"200": | ||
description: OK | ||
"400": | ||
description: Bad Request | ||
"401": | ||
description: Unauthorized | ||
"403": | ||
description: Forbidden | ||
"404": | ||
description: Not Found | ||
"429": | ||
description: Too Many Requests | ||
"500": | ||
description: Internal Server Error | ||
x-amazon-apigateway-integration: | ||
responses: | ||
"200": | ||
statusCode: "200" | ||
"401": | ||
statusCode: "401" | ||
"403": | ||
statusCode: "403" | ||
"404": | ||
statusCode: "404" | ||
"429": | ||
statusCode: "429" | ||
"500": | ||
statusCode: "500" | ||
default: | ||
statusCode: "400" | ||
httpMethod: POST | ||
type: http | ||
requestParameters: | ||
integration.request.header.Authorization: method.request.header.Authorization | ||
integration.request.path.subscription_plan_uuid: method.request.path.subscription_plan_uuid | ||
uri: https://${stageVariables.license_manager_host}/v1/subscriptions/{subscription_plan_uuid}/licenses/assign/ |