Dela via


Policy Fragment - Create Or Update

Skapar eller uppdaterar ett principfragment.

PUT https://management.azure.com/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.ApiManagement/service/{serviceName}/policyFragments/{id}?api-version=2024-05-01

URI-parametrar

Name I Obligatorisk Typ Description
id
path True

string

minLength: 1
maxLength: 80
pattern: (^[\w]+$)|(^[\w][\w\-]+[\w]$)

En resursidentifierare.

resourceGroupName
path True

string

minLength: 1
maxLength: 90

Namnet på resursgruppen. Namnet är skiftlägesokänsligt.

serviceName
path True

string

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

Namnet på API Management-tjänsten.

subscriptionId
path True

string (uuid)

ID för målprenumerationen. Värdet måste vara ett UUID.

api-version
query True

string

minLength: 1

DEN API-version som ska användas för den här åtgärden.

Begärandehuvud

Name Obligatorisk Typ Description
If-Match

string

ETag för entiteten. Krävs inte när du skapar en entitet, men krävs vid uppdatering av en entitet.

Begärandetext

Name Obligatorisk Typ Description
properties.value True

string

Innehållet i principfragmentet.

properties.description

string

minLength: 0
maxLength: 1000

Beskrivning av principfragment.

properties.format

PolicyFragmentContentFormat

Format för innehållet i principfragmentet.

Svar

Name Typ Description
200 OK

PolicyFragmentContract

Principfragmentet har uppdaterats.

Sidhuvuden

  • ETag: string
  • location: string
  • Azure-AsyncOperation: string
201 Created

PolicyFragmentContract

Principfragmentet har skapats.

Sidhuvuden

  • ETag: string
  • location: string
  • Azure-AsyncOperation: string
Other Status Codes

ErrorResponse

Felsvar som beskriver varför åtgärden misslyckades.

Säkerhet

azure_auth

Azure Active Directory OAuth2-flöde.

Typ: oauth2
Flow: implicit
Auktoriseringswebbadress: https://login.microsoftonline.com/common/oauth2/authorize

Omfattningar

Name Description
user_impersonation personifiera ditt användarkonto

Exempel

ApiManagementCreatePolicy

Exempelbegäran

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/policyFragments/policyFragment1?api-version=2024-05-01

{
  "properties": {
    "format": "xml",
    "description": "A policy fragment example",
    "value": "<fragment><json-to-xml apply=\"always\" consider-accept-header=\"false\" /></fragment>"
  }
}

Exempelsvar

location: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/policyFragments/policyFragment1?api-version=2024-05-01&asyncId=5c730e343244df1b9cb56e85&asyncCode=200
Azure-AsyncOperation: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/tenant/operationResults/5c730e343244df1b9cb56e85?api-version=2024-05-01
{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/policyFragments/policyFragment1",
  "type": "Microsoft.ApiManagement/service/policyFragments",
  "name": "policyFragment1",
  "properties": {
    "format": "xml",
    "description": "A policy fragment example",
    "value": "<json-to-xml apply=\"always\" consider-accept-header=\"false\" />",
    "provisioningState": "InProgress"
  }
}
location: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/policyFragments/policyFragment1?api-version=2024-05-01&asyncId=5c730e343244df1b9cb56e85&asyncCode=201
Azure-AsyncOperation: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/tenant/operationResults/5c730e343244df1b9cb56e85?api-version=2024-05-01
{
  "id": "/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/policyFragments/policyFragment1",
  "type": "Microsoft.ApiManagement/service/policyFragments",
  "name": "policyFragment1",
  "properties": {
    "format": "xml",
    "description": "A policy fragment example",
    "value": "<json-to-xml apply=\"always\" consider-accept-header=\"false\" />",
    "provisioningState": "InProgress"
  }
}

Definitioner

Name Description
ErrorAdditionalInfo

Ytterligare information om resurshanteringsfelet.

ErrorDetail

Felinformationen.

ErrorResponse

Felsvar

PolicyFragmentContentFormat

Format för innehållet i principfragmentet.

PolicyFragmentContract

Avtalsinformation om principfragment.

ErrorAdditionalInfo

Ytterligare information om resurshanteringsfelet.

Name Typ Description
info

object

Ytterligare information.

type

string

Ytterligare informationstyp.

ErrorDetail

Felinformationen.

Name Typ Description
additionalInfo

ErrorAdditionalInfo[]

Ytterligare information om felet.

code

string

Felkoden.

details

ErrorDetail[]

Felinformationen.

message

string

Felmeddelandet.

target

string

Felmålet.

ErrorResponse

Felsvar

Name Typ Description
error

ErrorDetail

Felobjektet.

PolicyFragmentContentFormat

Format för innehållet i principfragmentet.

Värde Description
xml

Innehållet är infogat och innehållstypen är ett XML-dokument.

rawxml

Innehållet är infogat och Innehållstyp är ett icke XML-kodat principdokument.

PolicyFragmentContract

Avtalsinformation om principfragment.

Name Typ Standardvärde Description
id

string

Fullständigt kvalificerat resurs-ID för resursen. Ex – /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

Namnet på resursen

properties.description

string

minLength: 0
maxLength: 1000

Beskrivning av principfragment.

properties.format

PolicyFragmentContentFormat

xml

Format för innehållet i principfragmentet.

properties.provisioningState

string

Etableringstillståndet

properties.value

string

Innehållet i principfragmentet.

type

string

Resurstypen. Till exempel "Microsoft.Compute/virtualMachines" eller "Microsoft.Storage/storageAccounts"