Udostępnij za pośrednictwem


Workspace Policy - Get

Pobierz konfigurację zasad na poziomie interfejsu 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 identyfikatora URI

Nazwa W Wymagane Typ Opis
policyId
path True

PolicyIdName

Identyfikator zasad.

resourceGroupName
path True

string

minLength: 1
maxLength: 90

Nazwa grupy zasobów. Nazwa jest niewrażliwa na wielkość liter.

serviceName
path True

string

minLength: 1
maxLength: 50
pattern: ^[a-zA-Z](?:[a-zA-Z0-9-]*[a-zA-Z0-9])?$

Nazwa usługi API Management.

subscriptionId
path True

string (uuid)

Identyfikator subskrypcji docelowej. Wartość musi być identyfikatorem UUID.

workspaceId
path True

string

minLength: 1
maxLength: 80
pattern: ^[^*#&+:<>?]+$

Identyfikator obszaru roboczego. Musi być unikatowa w bieżącym wystąpieniu usługi API Management.

api-version
query True

string

minLength: 1

Wersja interfejsu API do użycia dla tej operacji.

format
query

PolicyExportFormat

Format eksportu zasad.

Odpowiedzi

Nazwa Typ Opis
200 OK

PolicyContract

Informacje o zasadach obszaru roboczego.

Nagłówki

ETag: string

Other Status Codes

ErrorResponse

Odpowiedź na błąd opisująca, dlaczego operacja nie powiodła się.

Zabezpieczenia

azure_auth

Przepływ protokołu OAuth2 usługi Azure Active Directory.

Typ: oauth2
Flow: implicit
Adres URL autoryzacji: https://login.microsoftonline.com/common/oauth2/authorize

Zakresy

Nazwa Opis
user_impersonation personifikacja konta użytkownika

Przykłady

ApiManagementGetWorkspacePolicy

Przykładowe żądanie

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

Przykładowa odpowiedź

{
  "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=\"&#x9;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 =&gt; s[Random.Next(s.Length)])\r\n                              .ToArray()));\r\n          }                           \r\n                        </log-to-eventhub>\r\n    <base />\r\n  </outbound>\r\n</policies>"
  }
}

Definicje

Nazwa Opis
ErrorAdditionalInfo

Dodatkowe informacje o błędzie zarządzania zasobami.

ErrorDetail

Szczegóły błędu.

ErrorResponse

Odpowiedź na błąd

PolicyContentFormat

Format zasadContent.

PolicyContract

Szczegóły kontraktu zasad.

PolicyExportFormat

Format eksportu zasad.

PolicyIdName

Identyfikator zasad.

ErrorAdditionalInfo

Dodatkowe informacje o błędzie zarządzania zasobami.

Nazwa Typ Opis
info

object

Dodatkowe informacje.

type

string

Dodatkowy typ informacji.

ErrorDetail

Szczegóły błędu.

Nazwa Typ Opis
additionalInfo

ErrorAdditionalInfo[]

Dodatkowe informacje o błędzie.

code

string

Kod błędu.

details

ErrorDetail[]

Szczegóły błędu.

message

string

Komunikat o błędzie.

target

string

Element docelowy błędu.

ErrorResponse

Odpowiedź na błąd

Nazwa Typ Opis
error

ErrorDetail

Obiekt błędu.

PolicyContentFormat

Format zasadContent.

Wartość Opis
xml

Zawartość jest wbudowana, a typ zawartości jest dokumentem XML.

xml-link

Dokument XML zasad jest hostowany w punkcie końcowym HTTP dostępnym z poziomu usługi API Management.

rawxml

Zawartość jest śródliniowa, a typ zawartości jest dokumentem zasad niekodowanych w formacie XML.

rawxml-link

Dokument zasad nie jest zakodowany w formacie XML i jest hostowany w punkcie końcowym HTTP dostępnym z usługi API Management.

PolicyContract

Szczegóły kontraktu zasad.

Nazwa Typ Domyślna wartość Opis
id

string

W pełni kwalifikowany identyfikator zasobu dla zasobu. Przykład - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

Nazwa zasobu

properties.format

PolicyContentFormat

xml

Format zasadContent.

properties.value

string

Zawartość zasad zgodnie z formatem.

type

string

Typ zasobu. Np. "Microsoft.Compute/virtualMachines" lub "Microsoft.Storage/storageAccounts"

PolicyExportFormat

Format eksportu zasad.

Wartość Opis
xml

Zawartość jest wbudowana, a typ zawartości jest dokumentem XML.

rawxml

Zawartość jest śródliniowa, a typ zawartości jest dokumentem zasad niekodowanych w formacie XML.

PolicyIdName

Identyfikator zasad.

Wartość Opis
policy