Skip to content

Commit

Permalink
feat: define revoke and bulk-enroll endpoints in gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
Sameen Fatima committed Dec 29, 2023
1 parent eb9407e commit baabedb
Show file tree
Hide file tree
Showing 2 changed files with 311 additions and 0 deletions.
122 changes: 122 additions & 0 deletions api-compact.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
#
# Available service endpoints -- note that alternate endpoints may be presented at the API Gateway tier
# POST /api/v1/subscriptions/{uuid}/licenses/assign/
# POST /api/v1/subscriptions/{uuid}/licenses/bulk-revoke/
# POST /api/v1/bulk-license-enrollment

apigateway_responses: &apigateway_responses
default:
Expand Down Expand Up @@ -80,6 +82,25 @@ produces: &produces
- "application/json"
- "application/csv"

enterprise_customer_uuid_qs_param: &enterprise_customer_uuid_qs_param
in: "query"
name: "enterprise_customer_uuid"
required: true
type: "string"

enroll_all_qs_param: &enroll_all_qs_param
in: "query"
name: "enroll_all"
required: false
type: "string"

subscription_uuid_qs_param: &subscription_uuid_qs_param
in: "query"
name: "subscription_uuid"
required: false
type: "string"


uuid: &uuid
name: "uuid"
in: "path"
Expand Down Expand Up @@ -146,3 +167,104 @@ endpoints:
integration.request.header.Authorization: "method.request.header.Authorization"
integration.request.path.uuid: "method.request.path.uuid"
uri: "https://${stageVariables.license_manager_host}/api/v1/subscriptions/{uuid}/licenses/assign/"
# /api/v1/subscriptions/{uuid}/licenses/bulk-revoke/
revokeLicenses:
post:
description: "Revokes one or more licenses in a subscription plan"
operationId: "revoke_licenses"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- *auth_header
- *uuid
- name: "data"
in: "body"
description: "User emails OR search filters for emails and status"
required: true
schema:
type: "array"
items:
type: "object"
properties:
user_emails:
description: "List of emails with which licenses are associated"
type: "array"
items:
type: "string"
description: "user email"
filters:
description: "List of emails with which licenses are associated"
type: "array"
items:
type: "object"
description: "filter"
properties:
user_email:
description: "User email filter"
type: "string"
status_in:
description: "Array of valid license statuses"
type: "array"
items:
type: "string"
description: "status of the license"
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.uuid: "method.request.path.uuid"
uri: "https://${stageVariables.license_manager_host}/api/v1/subscriptions/{uuid}/licenses/bulk-revoke/"
# /api/v1/bulk-license-enrollment
bulkLicenseEnrollment:
post:
description: "Enrolls a list of learners in a given list of courses after verifying license subsidies."
operationId: "bulk_license_enrollment"
consumes:
- "application/json"
produces:
- "application/json"
parameters:
- *auth_header
- *enterprise_customer_uuid_qs_param
- *enroll_all_qs_param
- *subscription_uuid_qs_param
- name: "data"
in: "body"
description: "User emails and course run keys along with a notify learners flag"
required: true
schema:
type: "array"
items:
type: "object"
properties:
emails:
description: "list of learner emails"
type: "array"
items:
type: "string"
description: "user email"
course_run_keys:
description: "list of courses to enroll learners into"
type: "array"
items:
type: "string"
description: "course run key"
notify:
description: "Whether to notify learner of their enrollment"
type: "boolean"
responses: *responses
x-amazon-apigateway-integration:
responses: *apigateway_responses
httpMethod: "POST"
type: "http"
requestParameters:
integration.request.header.Authorization: "method.request.header.Authorization"
integration.request.querystring.enterprise_customer_uuid: "method.request.querystring.enterprise_customer_uuid"
integration.request.querystring.enroll_all: "method.request.querystring.enroll_all"
integration.request.querystring.subscription_uuid: "method.request.querystring.subscription_uuid"
uri: "https://${stageVariables.license_manager_host}/api/v1/bulk-license-enrollment"
189 changes: 189 additions & 0 deletions api.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,21 @@ responses:
produces:
- application/json
- application/csv
enterprise_customer_uuid_qs_param:
in: query
name: enterprise_customer_uuid
required: true
type: string
enroll_all_qs_param:
in: query
name: enroll_all
required: false
type: string
subscription_uuid_qs_param:
in: query
name: subscription_uuid
required: false
type: string
uuid:
name: uuid
in: path
Expand Down Expand Up @@ -160,3 +175,177 @@ endpoints:
integration.request.header.Authorization: method.request.header.Authorization
integration.request.path.uuid: method.request.path.uuid
uri: https://${stageVariables.license_manager_host}/api/v1/subscriptions/{uuid}/licenses/assign/
revokeLicenses:
post:
description: Revokes one or more licenses in a subscription plan
operationId: revoke_licenses
consumes:
- application/json
produces:
- application/json
parameters:
- name: Authorization
in: header
required: true
type: string
- name: uuid
in: path
required: true
type: string
- name: data
in: body
description: User emails OR search filters for emails and status
required: true
schema:
type: array
items:
type: object
properties:
user_emails:
description: List of emails with which licenses are associated
type: array
items:
type: string
description: user email
filters:
description: List of emails with which licenses are associated
type: array
items:
type: object
description: filter
properties:
user_email:
description: User email filter
type: string
status_in:
description: Array of valid license statuses
type: array
items:
type: string
description: status of the license
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.uuid: method.request.path.uuid
uri: https://${stageVariables.license_manager_host}/api/v1/subscriptions/{uuid}/licenses/bulk-revoke/
bulkLicenseEnrollment:
post:
description: Enrolls a list of learners in a given list of courses after
verifying license subsidies.
operationId: bulk_license_enrollment
consumes:
- application/json
produces:
- application/json
parameters:
- name: Authorization
in: header
required: true
type: string
- in: query
name: enterprise_customer_uuid
required: true
type: string
- in: query
name: enroll_all
required: false
type: string
- in: query
name: subscription_uuid
required: false
type: string
- name: data
in: body
description: User emails and course run keys along with a notify learners flag
required: true
schema:
type: array
items:
type: object
properties:
emails:
description: list of learner emails
type: array
items:
type: string
description: user email
course_run_keys:
description: list of courses to enroll learners into
type: array
items:
type: string
description: course run key
notify:
description: Whether to notify learner of their enrollment
type: boolean
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.querystring.enterprise_customer_uuid: method.request.querystring.enterprise_customer_uuid
integration.request.querystring.enroll_all: method.request.querystring.enroll_all
integration.request.querystring.subscription_uuid: method.request.querystring.subscription_uuid
uri: https://${stageVariables.license_manager_host}/api/v1/bulk-license-enrollment

0 comments on commit baabedb

Please sign in to comment.