Aws apigateway: Difference between revisions

From NovaOrdis Knowledge Base
Jump to navigation Jump to search
 
(11 intermediate revisions by the same user not shown)
Line 3: Line 3:
* [[Amazon API Gateway#Subjects|Amazon API Gateway]]
* [[Amazon API Gateway#Subjects|Amazon API Gateway]]


=get-rest-apis=
=REST API Operations=
 
==get-rest-apis==


Returns information about existing APIs.
Returns information about existing APIs.
Line 52: Line 54:
  }
  }


=import-rest-api=
==import-rest-api==


Creates a new API from an external API definition file. The API definition file should be in OpenAPI 2.0 format, optionally carrying Amazon API Gateway extensions. The new API's [[Amazon_API_Gateway_Concepts#API_Name|name]] will be given by the OpenAPI 2.0 [[OpenAPI_Specification#title|info.title]] element.
Creates a new API from an external API definition file. The API definition file should be in OpenAPI 2.0 format, optionally carrying Amazon API Gateway extensions. The new API's [[Amazon_API_Gateway_Concepts#API_Name|name]] will be given by the OpenAPI 2.0 [[OpenAPI_Specification#title|info.title]] element.
Line 60: Line 62:
  aws apigateway  import-rest-api --body 'file:///Users/ovidiu/playground/api-gateway-playground/themyscira/build/swagger.json'
  aws apigateway  import-rest-api --body 'file:///Users/ovidiu/playground/api-gateway-playground/themyscira/build/swagger.json'


=update-rest-api=
After creation, the API is not yet exposed to consumption, and API Deployment must be created for that. See: {{Internal|Aws_apigateway#create-deployment|aws apigateway create-deployment}}
 
==put-rest-api==
 
Updates the API to a new version, overwriting the old API.
 
aws apigateway put-rest-api --rest-api-id 2yox4tmvlc --mode overwrite --body 'file://./themyscira-2.json'
 
After update, the new version of the API is not yet exposed to consumption, and a new API Deployment must be created for that. See: {{Internal|Aws_apigateway#create-deployment|aws apigateway create-deployment}}
 
Also see: {{Internal|Amazon_API_Gateway_Operations#Updating_an_Existing_OpenAPI_Definition|Update an Existing OpenAPI Definition}}
 
==update-rest-api==


Patches an existing API.
Patches an existing API.
Line 66: Line 80:
Also see: {{Internal|Amazon_API_Gateway_Operations#Updating_an_Existing_OpenAPI_Definition|Update an Existing OpenAPI Definition}}
Also see: {{Internal|Amazon_API_Gateway_Operations#Updating_an_Existing_OpenAPI_Definition|Update an Existing OpenAPI Definition}}


=put-rest-api=
=Deployment Operations=
 
==create-deployment==
 
Creates an [[Amazon_API_Gateway_Concepts#Deployment_.28API_Deployment.29|API deployment]] which is used by a [[Amazon_API_Gateway_Concepts#Stage|stage]]. The newly created deployment becomes the new default deployment for the stage.
 
  aws apigateway create-deployment --rest-api-id <''api-id''> --stage-name <''stage-name''>
 
==update-deployment==
 
<font color=darkgray>Not sure what this does.</font>


  aws apigateway put-rest-api --rest-api-id 1234123412 --mode overwrite --body 'file:///path/to/API_Swagger_template.json'
  aws apigateway update-deployment --rest-api-id 1234123412 --deployment-id ztt4m2

Latest revision as of 22:01, 19 March 2019

Internal

REST API Operations

get-rest-apis

Returns information about existing APIs.

aws apigateway get-rest-apis
{
   "items": [
       {
           "apiKeySource": "HEADER",
           "description": "themyscira",
           "endpointConfiguration": {
               "types": [
                   "EDGE"
               ]
           },
           "version": "1.0",
           "createdDate": 1551007660,
           "id": "anhfchtuhe",
           "name": "themyscira"
       },
       {
           "apiKeySource": "HEADER",
           "description": "Api Documentation",
           "endpointConfiguration": {
               "types": [
                   "EDGE"
               ]
           },
           "version": "1.0",
           "createdDate": 1551394693,
           "id": "kizx5mwn97",
           "name": "blue"
       },
       {
           "apiKeySource": "HEADER",
           "description": "An Ops Service proxy integration",
           "endpointConfiguration": {
               "types": [
                   "REGIONAL"
               ]
           },
           "createdDate": 1550077237,
           "id": "pn8pztlmtc",
           "name": "ops"
       }
   ]
}

import-rest-api

Creates a new API from an external API definition file. The API definition file should be in OpenAPI 2.0 format, optionally carrying Amazon API Gateway extensions. The new API's name will be given by the OpenAPI 2.0 info.title element.

aws apigateway import-rest-api --body 'file:///path/to/API_Swagger_template.json'
aws apigateway  import-rest-api --body 'file:///Users/ovidiu/playground/api-gateway-playground/themyscira/build/swagger.json'

After creation, the API is not yet exposed to consumption, and API Deployment must be created for that. See:

aws apigateway create-deployment

put-rest-api

Updates the API to a new version, overwriting the old API.

aws apigateway put-rest-api --rest-api-id 2yox4tmvlc --mode overwrite --body 'file://./themyscira-2.json'

After update, the new version of the API is not yet exposed to consumption, and a new API Deployment must be created for that. See:

aws apigateway create-deployment

Also see:

Update an Existing OpenAPI Definition

update-rest-api

Patches an existing API.

Also see:

Update an Existing OpenAPI Definition

Deployment Operations

create-deployment

Creates an API deployment which is used by a stage. The newly created deployment becomes the new default deployment for the stage.

 aws apigateway create-deployment --rest-api-id <api-id> --stage-name <stage-name>

update-deployment

Not sure what this does.

aws apigateway update-deployment --rest-api-id 1234123412 --deployment-id ztt4m2