Skip to content

Commit

Permalink
Support for Non Xml Encoded policies (#2791)
Browse files Browse the repository at this point in the history
  • Loading branch information
solankisamir authored and jianghaolu committed Apr 3, 2018
1 parent a4d16b1 commit 9e18b82
Show file tree
Hide file tree
Showing 3 changed files with 53 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -463,7 +463,9 @@
"description": "Format of the policyContent.",
"enum": [
"xml",
"xml-link"
"xml-link",
"rawxml",
"rawxml-link"
],
"x-ms-enum": {
"name": "PolicyContentFormat",
Expand All @@ -476,6 +478,14 @@
{
"value": "xml-link",
"description": "The policy XML document is hosted on a http endpoint accessible from the API Management service."
},
{
"value": "rawxml",
"description": "The contents are inline and Content type is a non XML encoded policy document."
},
{
"value": "rawxml-link",
"description": "The policy document is not Xml encoded and is hosted on a http endpoint accessible from the API Management service."
}
]
},
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1630,6 +1630,9 @@
"x-ms-examples": {
"ApiManagementCreateApiPolicy": {
"$ref": "./examples/ApiManagementCreateApiPolicy.json"
},
"ApiManagementCreateApiPolicyNonXmlEncoded": {
"$ref": "./examples/ApiManagementCreateApiPolicyNonXmlEncoded.json"
}
},
"consumes": [
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
{
"parameters": {
"serviceName": "apimService1",
"resourceGroupName": "rg1",
"api-version": "2018-01-01",
"subscriptionId": "subid",
"apiId": "5600b57e7e8880006a040001",
"policyId": "policy",
"If-Match": "*",
"parameters": {
"properties": {
"policyContent": "<policies>\r\n <inbound>\r\n <base />\r\n <set-header name=\"newvalue\" exists-action=\"override\">\r\n <value>\"@(context.Request.Headers.FirstOrDefault(h => h.Ke==\"Via\"))\" </value>\r\n </set-header>\r\n </inbound>\r\n </policies>",
"contentFormat": "rawxml"
}
}
},
"responses": {
"201": {
"body": {
"id": "/subscriptions/4c1a3bc6-89f9-46fe-a175-5d8984b25095/resourcegroups/Api-DF-West-US/providers/Microsoft.ApiManagement/service/samirmsiservice2/apis/echo-api/operations/create-resource/policies/policy",
"type": "Microsoft.ApiManagement/service/apis/operations/policies",
"name": "policy",
"properties": {
"policyContent": "<policies>\r\n <inbound>\r\n <base />\r\n <set-header name=\"newvalue\" exists-action=\"override\">\r\n <value>\"@(context.Request.Headers.FirstOrDefault(h =&gt; h.Ke==\"Via\"))\" </value>\r\n </set-header>\r\n </inbound>\r\n</policies>"
}
}
},
"200": {
"body": {
"id": "/subscriptions/4c1a3bc6-89f9-46fe-a175-5d8984b25095/resourcegroups/Api-DF-West-US/providers/Microsoft.ApiManagement/service/samirmsiservice2/apis/echo-api/operations/create-resource/policies/policy",
"type": "Microsoft.ApiManagement/service/apis/operations/policies",
"name": "policy",
"properties": {
"policyContent": "<policies>\r\n <inbound>\r\n <base />\r\n <set-header name=\"newvalue\" exists-action=\"override\">\r\n <value>\"@(context.Request.Headers.FirstOrDefault(h =&gt; h.Ke==\"Via\"))\" </value>\r\n </set-header>\r\n </inbound>\r\n</policies>"
}
}
}
}
}

0 comments on commit 9e18b82

Please sign in to comment.