Workspace Policy - Get
Získejte konfiguraci zásad na úrovni rozhraní API.
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/policy?api-version=2024-05-01
GET https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/workspaces/{workspaceId}/policies/policy?format={format}&api-version=2024-05-01
Parametry identifikátoru URI
| Name | V | Vyžadováno | Typ | Description |
|---|---|---|---|---|
|
policy
|
path | True |
Identifikátor zásady. |
|
|
resource
|
path | True |
string minLength: 1maxLength: 90 |
Název skupiny prostředků. Název nerozlišuje malá a velká písmena. |
|
service
|
path | True |
string minLength: 1maxLength: 50 pattern: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$ |
Název služby API Management. |
|
subscription
|
path | True |
string (uuid) |
ID cílového předplatného. Hodnota musí být UUID. |
|
workspace
|
path | True |
string minLength: 1maxLength: 80 pattern: ^[^*#&+:<>?]+$ |
Identifikátor pracovního prostoru V aktuální instanci služby API Management musí být jedinečné. |
|
api-version
|
query | True |
string minLength: 1 |
Verze rozhraní API, která se má použít pro tuto operaci. |
|
format
|
query |
Formát exportu zásad |
Odpovědi
| Name | Typ | Description |
|---|---|---|
| 200 OK |
Informace o zásadách pracovního prostoru Hlavičky ETag: string |
|
| Other Status Codes |
Chybová odpověď popisující, proč operace selhala. |
Zabezpečení
azure_auth
Tok OAuth2 v Azure Active Directory
Typ:
oauth2
Tok:
implicit
URL autorizace:
https://login.microsoftonline.com/common/oauth2/authorize
Rozsahy
| Name | Description |
|---|---|
| user_impersonation | zosobnění uživatelského účtu |
Příklady
ApiManagementGetWorkspacePolicy
Ukázkový požadavek
GET https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/policies/policy?api-version=2024-05-01
Ukázková odpověď
{
"id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/policies/policy",
"type": "Microsoft.ApiManagement/service/workspaces/policies",
"name": "policy",
"properties": {
"value": "<!--\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 <quota-by-key calls=\"5\" bandwidth=\"2\" renewal-period=\"	P3Y6M4DT12H30M5S\" counter-key=\"ba\" />\r\n <base />\r\n </inbound>\r\n <backend>\r\n <base />\r\n </backend>\r\n <outbound>\r\n <log-to-eventhub logger-id=\"apimService1\" partition-key=\"@(context.Subscription.Id)\">\r\n@{\r\n\tRandom Random = new Random();\r\n\t\t\t\tconst string Chars = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz \"; \r\n return string.Join(\",\", DateTime.UtcNow, new string(\r\n Enumerable.Repeat(Chars, Random.Next(2150400))\r\n .Select(s => s[Random.Next(s.Length)])\r\n .ToArray()));\r\n } \r\n </log-to-eventhub>\r\n <base />\r\n </outbound>\r\n</policies>"
}
}
Definice
| Name | Description |
|---|---|
|
Error |
Další informace o chybě správy prostředků |
|
Error |
Podrobnosti o chybě. |
|
Error |
Chybová odpověď |
|
Policy |
Formát policyContent. |
|
Policy |
Podrobnosti smlouvy o zásadách |
|
Policy |
Formát exportu zásad |
|
Policy |
Identifikátor zásady. |
ErrorAdditionalInfo
Další informace o chybě správy prostředků
| Name | Typ | Description |
|---|---|---|
| info |
object |
Další informace. |
| type |
string |
Další typ informací. |
ErrorDetail
Podrobnosti o chybě.
| Name | Typ | Description |
|---|---|---|
| additionalInfo |
Další informace o chybě. |
|
| code |
string |
Kód chyby. |
| details |
Podrobnosti o chybě. |
|
| message |
string |
Chybová zpráva. |
| target |
string |
Cíl chyby. |
ErrorResponse
Chybová odpověď
| Name | Typ | Description |
|---|---|---|
| error |
Objekt chyby. |
PolicyContentFormat
Formát policyContent.
| Hodnota | Description |
|---|---|
| xml |
Obsah je vložený a typ obsahu je dokument XML. |
| xml-link |
Dokument XML zásad je hostovaný na koncovém bodu HTTP přístupném ze služby API Management. |
| rawxml |
Obsah je vložený a typ obsahu je dokument zásad, který není kódovaný kódem XML. |
| rawxml-link |
Dokument zásad není kódovaný KÓD XML a je hostovaný na koncovém bodu HTTP přístupném ze služby API Management. |
PolicyContract
Podrobnosti smlouvy o zásadách
| Name | Typ | Default value | Description |
|---|---|---|---|
| id |
string |
Plně kvalifikované ID prostředku pro prostředek. Příklad : /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName} |
|
| name |
string |
Název prostředku |
|
| properties.format | xml |
Formát policyContent. |
|
| properties.value |
string |
Obsah zásad definovaný formátem |
|
| type |
string |
Typ prostředku. Například Microsoft.Compute/virtualMachines nebo Microsoft.Storage/storageAccounts |
PolicyExportFormat
Formát exportu zásad
| Hodnota | Description |
|---|---|
| xml |
Obsah je vložený a typ obsahu je dokument XML. |
| rawxml |
Obsah je vložený a typ obsahu je dokument zásad, který není kódovaný kódem XML. |
PolicyIdName
Identifikátor zásady.
| Hodnota | Description |
|---|---|
| policy |