Aracılığıyla paylaş


Workspace Policy - Get

İlke yapılandırmasını API düzeyinde alın.

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

URI Parametreleri

Name İçinde Gerekli Tür Description
policyId
path True

PolicyIdName

İlkenin tanımlayıcısı.

resourceGroupName
path True

string

minLength: 1
maxLength: 90

Kaynak grubunun adı. Ad büyük/küçük harfe duyarsız.

serviceName
path True

string

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

API Management hizmetinin adı.

subscriptionId
path True

string (uuid)

Hedef aboneliğin kimliği. Değer bir UUID olmalıdır.

workspaceId
path True

string

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

Çalışma alanı tanımlayıcısı. Geçerli API Management hizmet örneğinde benzersiz olmalıdır.

api-version
query True

string

minLength: 1

Bu işlem için kullanılacak API sürümü.

format
query

PolicyExportFormat

İlke Dışarı Aktarma Biçimi.

Yanıtlar

Name Tür Description
200 OK

PolicyContract

Çalışma Alanı İlkesi bilgileri.

Üst Bilgiler

ETag: string

Other Status Codes

ErrorResponse

İşlemin neden başarısız olduğunu açıklayan hata yanıtı.

Güvenlik

azure_auth

Azure Active Directory OAuth2 Akışı.

Tür: oauth2
Akış: implicit
Yetkilendirme URL’si: https://login.microsoftonline.com/common/oauth2/authorize

Kapsamlar

Name Description
user_impersonation kullanıcı hesabınızın kimliğine bürünme

Örnekler

ApiManagementGetWorkspacePolicy

Örnek isteği

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

Örnek yanıt

{
  "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>"
  }
}

Tanımlar

Name Description
ErrorAdditionalInfo

Kaynak yönetimi hatası ek bilgileri.

ErrorDetail

Hata ayrıntısı.

ErrorResponse

Hata yanıtı

PolicyContentFormat

policyContent biçimi.

PolicyContract

İlke Sözleşmesi ayrıntıları.

PolicyExportFormat

İlke Dışarı Aktarma Biçimi.

PolicyIdName

İlkenin tanımlayıcısı.

ErrorAdditionalInfo

Kaynak yönetimi hatası ek bilgileri.

Name Tür Description
info

object

Ek bilgiler.

type

string

Ek bilgi türü.

ErrorDetail

Hata ayrıntısı.

Name Tür Description
additionalInfo

ErrorAdditionalInfo[]

Hata ek bilgileri.

code

string

Hata kodu.

details

ErrorDetail[]

Hata ayrıntıları.

message

string

Hata iletisi.

target

string

Hata hedefi.

ErrorResponse

Hata yanıtı

Name Tür Description
error

ErrorDetail

Hata nesnesi.

PolicyContentFormat

policyContent biçimi.

Değer Description
xml

İçerikler satır içidir ve İçerik türü bir XML belgesidir.

xml-link

İlke XML belgesi, API Management hizmetinden erişilebilen bir HTTP uç noktasında barındırılır.

rawxml

İçerikler satır içidir ve İçerik türü XML ile kodlanmamış bir ilke belgesidir.

rawxml-link

İlke belgesi XML ile kodlanmaz ve API Management hizmetinden erişilebilen bir HTTP uç noktasında barındırılır.

PolicyContract

İlke Sözleşmesi ayrıntıları.

Name Tür Default value Description
id

string

Kaynağın tam kaynak kimliği. Örn - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

Kaynağın adı

properties.format

PolicyContentFormat

xml

policyContent biçimi.

properties.value

string

biçim tarafından tanımlanan İlkenin içeriği.

type

string

Kaynağın türü. Örneğin, "Microsoft.Compute/virtualMachines" veya "Microsoft.Storage/storageAccounts"

PolicyExportFormat

İlke Dışarı Aktarma Biçimi.

Değer Description
xml

İçerikler satır içidir ve İçerik türü bir XML belgesidir.

rawxml

İçerikler satır içidir ve İçerik türü XML ile kodlanmamış bir ilke belgesidir.

PolicyIdName

İlkenin tanımlayıcısı.

Değer Description
policy