Skip to content

Commit

Permalink
Export API with Json Output and Add missing Api /apis/operations/poli…
Browse files Browse the repository at this point in the history
…cies (Azure#1656)

* Document Export API with Json output

* Add API Operation Policies Collection

* Removed X-Ms-Example from x-ms-paths

* Fix the issue with Contract reference and add the example back.

* Associate correct Example with Swagger

* Adding Accept header at same level apiId
  • Loading branch information
solankisamir authored and jianghaolu committed Sep 13, 2017
1 parent c57f7d2 commit f153008
Show file tree
Hide file tree
Showing 3 changed files with 181 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,54 @@
}
}
},
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies": {
"get": {
"tags": [
"ApiOperationPolicies"
],
"operationId": "ApiOperationPolicy_ListByOperation",
"description": "Get the list of policy configuration at the API Operation level.",
"x-ms-examples": {
"ApiManagementListApiOperationPolicies": {
"$ref": "./examples/ApiManagementListApiOperationPolicies.json"
}
},
"parameters": [
{
"$ref": "./apimanagement.json#/parameters/ResourceGroupNameParameter"
},
{
"$ref": "./apimanagement.json#/parameters/ServiceNameParameter"
},
{
"$ref": "#/parameters/ApiIdParameter"
},
{
"$ref": "#/parameters/OperationIdParameter"
},
{
"$ref": "./apimanagement.json#/parameters/ApiVersionParameter"
},
{
"$ref": "./apimanagement.json#/parameters/SubscriptionIdParameter"
}
],
"responses": {
"200": {
"description": "Api Operations Policy Collection.",
"schema": {
"$ref": "./apimanagement.json#/definitions/PolicyCollection"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "./apimanagement.json#/definitions/ErrorResponse"
}
}
}
}
},
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}/operations/{operationId}/policies/{policyId}": {
"get": {
"tags": [
Expand Down Expand Up @@ -1056,7 +1104,96 @@
}
}
},
"x-ms-paths": {
"/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/apis/{apiId}?export=true": {
"get": {
"tags": [
"Apis"
],
"operationId": "ApiExport_Get",
"description": "Gets the details of the API specified by its identifier in the format specified to the Storage Blob with SAS Key valid for 5 minutes.",
"x-ms-examples": {
"ApiManagementGetApiExportInOpenApi2dot0": {
"$ref": "./examples/ApiManagementGetApiExportInOpenApi2dot0.json"
}
},
"parameters": [
{
"$ref": "./apimanagement.json#/parameters/ResourceGroupNameParameter"
},
{
"$ref": "./apimanagement.json#/parameters/ServiceNameParameter"
},
{
"$ref": "#/parameters/ApiIdParameter"
},
{
"name": "Accept",
"in": "header",
"required": true,
"type": "string",
"enum": [
"application/vnd.swagger.link+json",
"application/vnd.sun.wadl.link+json",
"application/vnd.ms.wsdl.link+xml"
],
"x-ms-enum": {
"name": "ExportFormat",
"modelAsString": false,
"values": [
{
"value": "application/vnd.swagger.link+json",
"description": "Export the Api Definition in OpenApi Specification 2.0 format to the Storage Blob.",
"name": "OpenApi2"
},
{
"value": "application/vnd.ms.wsdl.link+xml",
"description": "Export the Api Definition in WSDL Schema to Storage Blob.",
"name": "Wsdl"
},
{
"value": "application/vnd.sun.wadl.link+json",
"description": "Export the Api Definition in WADL Schema to Storage Blob.",
"name": "Wadl"
}
]
},
"description": "Format in which to export the Api Details to the Storage Blob with Sas Key valid for 5 minutes."
},
{
"$ref": "./apimanagement.json#/parameters/ApiVersionParameter"
},
{
"$ref": "./apimanagement.json#/parameters/SubscriptionIdParameter"
}
],
"responses": {
"200": {
"description": "The response contains a stream with a full set of API metadata and includes API entity with an embedded array of operation entities.",
"schema": {
"$ref": "#/definitions/ApiExportResult"
}
},
"default": {
"description": "Error response describing why the operation failed.",
"schema": {
"$ref": "./apimanagement.json#/definitions/ErrorResponse"
}
}
}
}
}
},
"definitions": {
"ApiExportResult": {
"properties": {
"link": {
"type": "string",
"description": "Link to the Storage Blob containing the result of the export operation. The Blob Uri is only valid for 5 minutes."
}
},
"description": "API Export result Blob Uri."
},
"ApiCollection": {
"properties": {
"value": {
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
{
"parameters": {
"serviceName": "apimService1",
"resourceGroupName": "rg1",
"api-version": "2017-03-01",
"subscriptionId": "subid",
"apiId": "echo-api",
"Accept": "application/vnd.swagger.link+json"
},
"responses": {
"200": {
"body": {
"link": "https://apimgmtstaobxxxxxxx.blob.core.windows.net/api-export/Echo API.json?sv=2015-07-08&sr=b&sig=xxxxxxxxxx%3D&se=2017-09-08T21:54:08Z&sp=r"
}
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
{
"parameters": {
"serviceName": "apimService1",
"resourceGroupName": "rg1",
"api-version": "2017-03-01",
"subscriptionId": "subid",
"apiId": "599e2953193c3c0bd0b3e2fa",
"operationId": "599e29ab193c3c0bd0b3e2fb"
},
"responses": {
"200": {
"body": {
"value": [
{
"id": "/subscriptions/subid/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/apis/599e2953193c3c0bd0b3e2fa/operations/599e29ab193c3c0bd0b3e2fb/policies/policy",
"type": "Microsoft.ApiManagement/service/apis/operations/policies",
"name": "policy",
"properties": {
"policyContent": "<!--\r\n IMPORTANT:\r\n - Policy elements can appear only within the <inbound>, <outbound>, <backend> section elements.\r\n - Only the <forward-request> policy element can appear within the <backend> section element.\r\n - To apply a policy to the incoming request (before it is forwarded to the backend service), place a corresponding policy element within the <inbound> section element.\r\n - To apply a policy to the outgoing response (before it is sent back to the caller), place a corresponding policy element within the <outbound> section element.\r\n - To add a policy position the cursor at the desired insertion point and click on the round button associated with the policy.\r\n - To remove a policy, delete the corresponding policy statement from the policy document.\r\n - Position the <base> element within a section element to inherit all policies from the corresponding section element in the enclosing scope.\r\n - Remove the <base> element to prevent inheriting policies from the corresponding section element in the enclosing scope.\r\n - Policies are applied in the order of their appearance, from the top down.\r\n-->\r\n<policies>\r\n <inbound>\r\n <validate-jwt header-name=\"dd\">\r\n <required-claims>\r\n <claim name=\"bla\" separator=\"\">\r\n <value>xxx</value>\r\n </claim>\r\n </required-claims>\r\n </validate-jwt>\r\n <base />\r\n </inbound>\r\n <backend>\r\n <base />\r\n </backend>\r\n <outbound>\r\n <base />\r\n </outbound>\r\n</policies>"
}
}
],
"nextLink": ""
}
}
}
}

0 comments on commit f153008

Please sign in to comment.