Freigeben über


Workspace Policy Fragment - Create Or Update

Erstellt oder aktualisiert ein Richtlinienfragment.

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

URI-Parameter

Name In Erforderlich Typ Beschreibung
id
path True

string

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

Ein Ressourcenbezeichner.

resourceGroupName
path True

string

minLength: 1
maxLength: 90

Der Name der Ressourcengruppe. Bei dem Namen wird die Groß-/Kleinschreibung nicht beachtet.

serviceName
path True

string

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

Der Name des API-Verwaltungsdiensts.

subscriptionId
path True

string (uuid)

Die ID des Zielabonnements. Der Wert muss eine UUID sein.

workspaceId
path True

string

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

Arbeitsbereichsbezeichner. Muss in der aktuellen API-Verwaltungsdienstinstanz eindeutig sein.

api-version
query True

string

minLength: 1

Die API-Version, die für diesen Vorgang verwendet werden soll.

Anforderungsheader

Name Erforderlich Typ Beschreibung
If-Match

string

ETag der Entität. Beim Erstellen einer Entität nicht erforderlich, aber beim Aktualisieren einer Entität erforderlich.

Anforderungstext

Name Erforderlich Typ Beschreibung
properties.value True

string

Inhalt des Richtlinienfragments.

properties.description

string

minLength: 0
maxLength: 1000

Beschreibung des Richtlinienfragments.

properties.format

PolicyFragmentContentFormat

Format des Richtlinienfragmentinhalts.

Antworten

Name Typ Beschreibung
200 OK

PolicyFragmentContract

Das Richtlinienfragment wurde erfolgreich aktualisiert.

Header

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

PolicyFragmentContract

Das Richtlinienfragment wurde erfolgreich erstellt.

Header

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

ErrorResponse

Fehlerantwort, die beschreibt, warum der Vorgang fehlgeschlagen ist.

Sicherheit

azure_auth

Azure Active Directory OAuth2-Fluss.

Typ: oauth2
Ablauf: implicit
Autorisierungs-URL: https://login.microsoftonline.com/common/oauth2/authorize

Bereiche

Name Beschreibung
user_impersonation Identitätswechsel ihres Benutzerkontos

Beispiele

ApiManagementCreateWorkspacePolicyFragment

Beispielanforderung

PUT https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/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>"
  }
}

Beispiel für eine Antwort

location: https://management.azure.com/subscriptions/00000000-0000-0000-0000-000000000000/resourceGroups/rg1/providers/Microsoft.ApiManagement/service/apimService1/workspaces/wks1/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/workspaces/wks1/policyFragments/policyFragment1",
  "type": "Microsoft.ApiManagement/service/workspaces/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/workspaces/wks1/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/workspaces/wks1/policyFragments/policyFragment1",
  "type": "Microsoft.ApiManagement/service/workspaces/policyFragments",
  "name": "policyFragment1",
  "properties": {
    "format": "xml",
    "description": "A policy fragment example",
    "value": "<json-to-xml apply=\"always\" consider-accept-header=\"false\" />",
    "provisioningState": "InProgress"
  }
}

Definitionen

Name Beschreibung
ErrorAdditionalInfo

Der Ressourcenverwaltungsfehler zusätzliche Informationen.

ErrorDetail

Das Fehlerdetails.

ErrorResponse

Fehlerantwort

PolicyFragmentContentFormat

Format des Richtlinienfragmentinhalts.

PolicyFragmentContract

Details des Richtlinienfragmentvertrags.

ErrorAdditionalInfo

Der Ressourcenverwaltungsfehler zusätzliche Informationen.

Name Typ Beschreibung
info

object

Die zusätzlichen Informationen.

type

string

Der zusätzliche Informationstyp.

ErrorDetail

Das Fehlerdetails.

Name Typ Beschreibung
additionalInfo

ErrorAdditionalInfo[]

Die zusätzlichen Informationen des Fehlers.

code

string

Der Fehlercode.

details

ErrorDetail[]

Die Fehlerdetails.

message

string

Die Fehlermeldung.

target

string

Das Fehlerziel.

ErrorResponse

Fehlerantwort

Name Typ Beschreibung
error

ErrorDetail

Das Fehlerobjekt.

PolicyFragmentContentFormat

Format des Richtlinienfragmentinhalts.

Wert Beschreibung
rawxml

Der Inhalt ist inline und der Inhaltstyp ist ein nicht XML-codiertes Richtliniendokument.

xml

Der Inhalt ist inline und der Inhaltstyp ist ein XML-Dokument.

PolicyFragmentContract

Details des Richtlinienfragmentvertrags.

Name Typ Standardwert Beschreibung
id

string

Vollqualifizierte Ressourcen-ID für die Ressource. Ex - /subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/{resourceProviderNamespace}/{resourceType}/{resourceName}

name

string

Der Name der Ressource

properties.description

string

minLength: 0
maxLength: 1000

Beschreibung des Richtlinienfragments.

properties.format

PolicyFragmentContentFormat

xml

Format des Richtlinienfragmentinhalts.

properties.provisioningState

string

Der Bereitstellungsstatus

properties.value

string

Inhalt des Richtlinienfragments.

type

string

Der Typ der Ressource. Z. B. "Microsoft.Compute/virtualMachines" oder "Microsoft.Storage/storageAccounts"