Job Router Administration Operations - Upsert Classification Policy

Creates or updates a classification policy.

PATCH {endpoint}/routing/classificationPolicies/{classificationPolicyId}?api-version=2023-11-01

URI Parameters

Name In Required Type Description
classificationPolicyId
path True

string

Id of a classification policy.

endpoint
path True

string

Uri of your Communication resource

api-version
query True

string

The API version to use for this operation.

Request Header

Media Types: "application/merge-patch+json"

Name Required Type Description
If-Match

string

The request should only proceed if an entity matches this string.

If-Unmodified-Since

string

date-time-rfc7231

The request should only proceed if the entity was not modified after this time.

Request Body

Media Types: "application/merge-patch+json"

Name Type Description
fallbackQueueId

string

Id of a fallback queue to select if queue selector attachments doesn't find a match.

name

string

Friendly name of this policy.

prioritizationRule RouterRuleCreateOrUpdate:

A rule to determine a priority score for a job.

queueSelectorAttachments QueueSelectorAttachment[]:

Queue selector attachments used to resolve a queue for a job.

workerSelectorAttachments WorkerSelectorAttachment[]:

Worker selector attachments used to attach worker selectors to a job.

Responses

Name Type Description
200 OK

ClassificationPolicy

The request has succeeded.

Headers

  • ETag: string
  • Last-Modified: string
201 Created

ClassificationPolicy

The request has succeeded and a new resource has been created as a result.

Headers

  • ETag: string
  • Last-Modified: string
Other Status Codes

Azure.Core.Foundations.ErrorResponse

An unexpected error response.

Headers

x-ms-error-code: string

Examples

Creates a Classification Policy
Updates a Classification Policy

Creates a Classification Policy

Sample request

PATCH https://contoso.westus.communications.azure.com/routing/classificationPolicies/90eb00c4-234e-4df7-a231-ef7895518384?api-version=2023-11-01

{
  "name": "Main",
  "fallbackQueueId": "MainQueue",
  "queueSelectorAttachments": [
    {
      "kind": "conditional",
      "condition": {
        "kind": "expression",
        "language": "powerFx",
        "expression": "1 = 1"
      },
      "queueSelectors": [
        {
          "key": "foo",
          "labelOperator": "equal",
          "value": "bar"
        }
      ]
    }
  ],
  "prioritizationRule": {
    "kind": "static",
    "value": "2"
  }
}

Sample response

{
  "id": "90eb00c4-234e-4df7-a231-ef7895518384",
  "name": "Main",
  "fallbackQueueId": "MainQueue",
  "queueSelectorAttachments": [
    {
      "kind": "conditional",
      "condition": {
        "kind": "expression",
        "language": "powerFx",
        "expression": "1 = 1"
      },
      "queueSelectors": [
        {
          "key": "foo",
          "labelOperator": "equal",
          "value": "bar"
        }
      ]
    }
  ],
  "prioritizationRule": {
    "kind": "static",
    "value": "2"
  },
  "workerSelectorAttachments": [],
  "etag": "etag"
}
{
  "id": "90eb00c4-234e-4df7-a231-ef7895518384",
  "name": "Main",
  "fallbackQueueId": "MainQueue",
  "queueSelectorAttachments": [
    {
      "kind": "conditional",
      "condition": {
        "kind": "expression",
        "language": "powerFx",
        "expression": "1 = 1"
      },
      "queueSelectors": [
        {
          "key": "foo",
          "labelOperator": "equal",
          "value": "bar"
        }
      ]
    }
  ],
  "prioritizationRule": {
    "kind": "static",
    "value": "2"
  },
  "workerSelectorAttachments": [],
  "etag": "etag"
}

Updates a Classification Policy

Sample request

PATCH https://contoso.westus.communications.azure.com/routing/classificationPolicies/90eb00c4-234e-4df7-a231-ef7895518384?api-version=2023-11-01

{
  "name": "MainUpdate"
}

Sample response

{
  "id": "90eb00c4-234e-4df7-a231-ef7895518384",
  "name": "MainUpdate",
  "fallbackQueueId": "MainQueue",
  "queueSelectorAttachments": [
    {
      "kind": "conditional",
      "condition": {
        "kind": "expression",
        "language": "powerFx",
        "expression": "1 = 1"
      },
      "queueSelectors": [
        {
          "key": "foo",
          "labelOperator": "equal",
          "value": "bar"
        }
      ]
    }
  ],
  "prioritizationRule": {
    "kind": "static",
    "value": "2"
  },
  "workerSelectorAttachments": [],
  "etag": "etag"
}
{
  "id": "90eb00c4-234e-4df7-a231-ef7895518384",
  "name": "MainUpdate",
  "fallbackQueueId": "MainQueue",
  "queueSelectorAttachments": [
    {
      "kind": "conditional",
      "condition": {
        "kind": "expression",
        "language": "powerFx",
        "expression": "1 = 1"
      },
      "queueSelectors": [
        {
          "key": "foo",
          "labelOperator": "equal",
          "value": "bar"
        }
      ]
    }
  ],
  "prioritizationRule": {
    "kind": "static",
    "value": "2"
  },
  "workerSelectorAttachments": [],
  "etag": "etag"
}

Definitions

Name Description
Azure.Core.Foundations.Error

The error object.

Azure.Core.Foundations.ErrorResponse

A response containing error details.

Azure.Core.Foundations.InnerError

An object containing more specific information about the error. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.

ClassificationPolicy

A container for the rules that govern how jobs are classified.

ClassificationPolicyCreateOrUpdate

A container for the rules that govern how jobs are classified.

ConditionalQueueSelectorAttachment

Describes a set of queue selectors that will be attached if the given condition resolves to true.

ConditionalWorkerSelectorAttachment

Describes a set of worker selectors that will be attached if the given condition resolves to true.

DirectMapRouterRule

A rule that return the same labels as the input labels.

DirectMapRouterRuleCreateOrUpdate

A rule that return the same labels as the input labels.

ExpressionRouterRule

A rule providing inline expression rules.

ExpressionRouterRuleCreateOrUpdate

A rule providing inline expression rules.

ExpressionRouterRuleLanguage

Available expression languages that can be configured.

FunctionRouterRule

A rule providing a binding to an HTTP Triggered Azure Function.

FunctionRouterRuleCreateOrUpdate

A rule providing a binding to an HTTP Triggered Azure Function.

FunctionRouterRuleCredential

Credentials used to access Azure function rule.

LabelOperator

Describes supported operations on label values.

OAuth2WebhookClientCredential

OAuth2.0 Credentials used to Contoso's Authorization server. Reference: https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/

PassThroughQueueSelectorAttachment

Attaches a queue selector where the value is passed through from a job's label with the same key.

PassThroughWorkerSelectorAttachment

Attaches a worker selector where the value is passed through from a job's label with the same key.

QueueSelectorAttachmentKind

Discriminators for supported queue selector attachment types.

QueueWeightedAllocation

Contains the weight percentage and queue selectors to be applied if selected for weighted distributions.

RouterQueueSelector

Describes a condition that must be met against a set of labels for queue selection.

RouterRuleKind

Discriminators for supported router rule types.

RouterWorkerSelector

Describes a condition that must be met against a set of labels for worker selection.

RouterWorkerSelectorStatus

Describes the status of a worker selector.

RuleEngineQueueSelectorAttachment

Attaches queue selectors to a job when the RouterRule is resolved.

RuleEngineWorkerSelectorAttachment

Attaches worker selectors to a job when a RouterRule is resolved.

StaticQueueSelectorAttachment

Describes a queue selector that will be attached to a job.

StaticRouterRule

A rule providing static rules that always return the same result, regardless of input.

StaticRouterRuleCreateOrUpdate

A rule providing static rules that always return the same result, regardless of input.

StaticWorkerSelectorAttachment

Describes a worker selector that will be attached to a job.

WebhookRouterRule

A rule providing a binding to an external web server.

WebhookRouterRuleCreateOrUpdate

A rule providing a binding to an external web server.

WeightedAllocationQueueSelectorAttachment

Describes multiple sets of queue selectors, of which one will be selected and attached according to a weighting.

WeightedAllocationWorkerSelectorAttachment

Describes multiple sets of worker selectors, of which one will be selected and attached according to a weighting.

WorkerSelectorAttachmentKind

Discriminators for supported worker selector attachment types.

WorkerWeightedAllocation

Contains the weight percentage and worker selectors to be applied if selected for weighted distributions.

Azure.Core.Foundations.Error

The error object.

Name Type Description
code

string

One of a server-defined set of error codes.

details

Azure.Core.Foundations.Error[]

An array of details about specific errors that led to this reported error.

innererror

Azure.Core.Foundations.InnerError

An object containing more specific information than the current object about the error.

message

string

A human-readable representation of the error.

target

string

The target of the error.

Azure.Core.Foundations.ErrorResponse

A response containing error details.

Name Type Description
error

Azure.Core.Foundations.Error

The error object.

Azure.Core.Foundations.InnerError

An object containing more specific information about the error. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.

Name Type Description
code

string

One of a server-defined set of error codes.

innererror

Azure.Core.Foundations.InnerError

Inner error.

ClassificationPolicy

A container for the rules that govern how jobs are classified.

Name Type Description
etag

string

The entity tag for this resource.

fallbackQueueId

string

Id of a fallback queue to select if queue selector attachments doesn't find a match.

id

string

Id of a classification policy.

name

string

Friendly name of this policy.

prioritizationRule RouterRule:

A rule to determine a priority score for a job.

queueSelectorAttachments QueueSelectorAttachment[]:

Queue selector attachments used to resolve a queue for a job.

workerSelectorAttachments WorkerSelectorAttachment[]:

Worker selector attachments used to attach worker selectors to a job.

ClassificationPolicyCreateOrUpdate

A container for the rules that govern how jobs are classified.

Name Type Description
fallbackQueueId

string

Id of a fallback queue to select if queue selector attachments doesn't find a match.

name

string

Friendly name of this policy.

prioritizationRule RouterRuleCreateOrUpdate:

A rule to determine a priority score for a job.

queueSelectorAttachments QueueSelectorAttachment[]:

Queue selector attachments used to resolve a queue for a job.

workerSelectorAttachments WorkerSelectorAttachment[]:

Worker selector attachments used to attach worker selectors to a job.

ConditionalQueueSelectorAttachment

Describes a set of queue selectors that will be attached if the given condition resolves to true.

Name Type Description
condition RouterRule:

The condition that must be true for the queue selectors to be attached.

kind string:

conditional

The type discriminator describing a sub-type of QueueSelectorAttachment.

queueSelectors

RouterQueueSelector[]

The queue selectors to attach.

ConditionalWorkerSelectorAttachment

Describes a set of worker selectors that will be attached if the given condition resolves to true.

Name Type Description
condition RouterRule:

The condition that must be true for the worker selectors to be attached.

kind string:

conditional

The type discriminator describing a sub-type of WorkerSelectorAttachment.

workerSelectors

RouterWorkerSelector[]

The worker selectors to attach.

DirectMapRouterRule

A rule that return the same labels as the input labels.

Name Type Description
kind string:

directMap

The type discriminator describing a sub-type of RouterRule

DirectMapRouterRuleCreateOrUpdate

A rule that return the same labels as the input labels.

Name Type Description
kind string:

directMap

The type discriminator describing a sub-type of RouterRule

ExpressionRouterRule

A rule providing inline expression rules.

Name Type Description
expression

string

An expression to evaluate. Should contain return statement with calculated values.

kind string:

expression

The type discriminator describing a sub-type of RouterRule

language

ExpressionRouterRuleLanguage

The expression language to compile to and execute.

ExpressionRouterRuleCreateOrUpdate

A rule providing inline expression rules.

Name Type Description
expression

string

An expression to evaluate. Should contain return statement with calculated values.

kind string:

expression

The type discriminator describing a sub-type of RouterRule

language

ExpressionRouterRuleLanguage

The expression language to compile to and execute.

ExpressionRouterRuleLanguage

Available expression languages that can be configured.

Name Type Description
powerFx

string

PowerFx

FunctionRouterRule

A rule providing a binding to an HTTP Triggered Azure Function.

Name Type Description
credential

FunctionRouterRuleCredential

Credentials used to access Azure function rule.

functionUri

string

URL for Azure Function.

kind string:

function

The type discriminator describing a sub-type of RouterRule

FunctionRouterRuleCreateOrUpdate

A rule providing a binding to an HTTP Triggered Azure Function.

Name Type Description
credential

FunctionRouterRuleCredential

Credentials used to access Azure function rule.

functionUri

string

URL for Azure Function.

kind string:

function

The type discriminator describing a sub-type of RouterRule

FunctionRouterRuleCredential

Credentials used to access Azure function rule.

Name Type Description
appKey

string

Access key scoped to a Azure Function app. This key grants access to all functions under the app.

clientId

string

Client id, when AppKey is provided In context of Azure function, this is usually the name of the key.

functionKey

string

Access key scoped to a particular function.

LabelOperator

Describes supported operations on label values.

Name Type Description
equal

string

Equal.

greaterThan

string

Greater than.

greaterThanOrEqual

string

Greater than or equal.

lessThan

string

Less than.

lessThanOrEqual

string

Less than or equal.

notEqual

string

Not Equal.

OAuth2WebhookClientCredential

OAuth2.0 Credentials used to Contoso's Authorization server. Reference: https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/

Name Type Description
clientId

string

ClientId for Contoso Authorization server.

clientSecret

string

Client secret for Contoso Authorization server.

PassThroughQueueSelectorAttachment

Attaches a queue selector where the value is passed through from a job's label with the same key.

Name Type Description
key

string

The label key to query against.

kind string:

passThrough

The type discriminator describing a sub-type of QueueSelectorAttachment.

labelOperator

LabelOperator

Describes how the value of the label is compared to the value pass through.

PassThroughWorkerSelectorAttachment

Attaches a worker selector where the value is passed through from a job's label with the same key.

Name Type Description
expiresAfterSeconds

number

Describes how long the attached label selector is valid in seconds.

key

string

The label key to query against.

kind string:

passThrough

The type discriminator describing a sub-type of WorkerSelectorAttachment.

labelOperator

LabelOperator

Describes how the value of the label is compared to the value pass through.

QueueSelectorAttachmentKind

Discriminators for supported queue selector attachment types.

Name Type Description
conditional

string

Discriminator value for ConditionalQueueSelectorAttachment.

passThrough

string

Discriminator value for PassThroughQueueSelectorAttachment.

ruleEngine

string

Discriminator value for RuleEngineQueueSelectorAttachment.

static

string

Discriminator value for StaticQueueSelectorAttachment.

weightedAllocation

string

Discriminator value for WeightedAllocationQueueSelectorAttachment.

QueueWeightedAllocation

Contains the weight percentage and queue selectors to be applied if selected for weighted distributions.

Name Type Description
queueSelectors

RouterQueueSelector[]

A collection of queue selectors that will be applied if this allocation is selected.

weight

number

The percentage of this weight, expressed as a fraction of 1.

RouterQueueSelector

Describes a condition that must be met against a set of labels for queue selection.

Name Type Description
key

string

The label key to query against.

labelOperator

LabelOperator

Describes how the value of the label is compared to the value defined on the label selector.

value

The value to compare against the actual label value with the given operator. Values must be primitive values - number, string, boolean.

RouterRuleKind

Discriminators for supported router rule types.

Name Type Description
directMap

string

Discriminator value for DirectMapRouterRule.

expression

string

Discriminator value for ExpressionRouterRule.

function

string

Discriminator value for FunctionRouterRule.

static

string

Discriminator value for StaticRouterRule.

webhook

string

Discriminator value for WebhookRouterRule.

RouterWorkerSelector

Describes a condition that must be met against a set of labels for worker selection.

Name Type Description
expedite

boolean

Pushes a job to the front of the queue as long as this selector is active.

expiresAfterSeconds

number

Describes how long this label selector is valid in seconds.

expiresAt

string

The time at which this worker selector expires in UTC.

key

string

The label key to query against.

labelOperator

LabelOperator

Describes how the value of the label is compared to the value defined on the worker selector.

status

RouterWorkerSelectorStatus

Status of the worker selector.

value

The value to compare against the actual label value with the given operator. Values must be primitive values - number, string, boolean.

RouterWorkerSelectorStatus

Describes the status of a worker selector.

Name Type Description
active

string

Worker selector is valid.

expired

string

Worker selector is not valid.

RuleEngineQueueSelectorAttachment

Attaches queue selectors to a job when the RouterRule is resolved.

Name Type Description
kind string:

ruleEngine

The type discriminator describing a sub-type of QueueSelectorAttachment.

rule RouterRule:

A RouterRule that resolves a collection of queue selectors to attach.

RuleEngineWorkerSelectorAttachment

Attaches worker selectors to a job when a RouterRule is resolved.

Name Type Description
kind string:

ruleEngine

The type discriminator describing a sub-type of WorkerSelectorAttachment.

rule RouterRule:

A RouterRule that resolves a collection of worker selectors to attach.

StaticQueueSelectorAttachment

Describes a queue selector that will be attached to a job.

Name Type Description
kind string:

static

The type discriminator describing a sub-type of QueueSelectorAttachment.

queueSelector

RouterQueueSelector

The queue selector to attach.

StaticRouterRule

A rule providing static rules that always return the same result, regardless of input.

Name Type Description
kind string:

static

The type discriminator describing a sub-type of RouterRule

value

The static value this rule always returns. Values must be primitive values - number, string, boolean.

StaticRouterRuleCreateOrUpdate

A rule providing static rules that always return the same result, regardless of input.

Name Type Description
kind string:

static

The type discriminator describing a sub-type of RouterRule

value

The static value this rule always returns. Values must be primitive values - number, string, boolean.

StaticWorkerSelectorAttachment

Describes a worker selector that will be attached to a job.

Name Type Description
kind string:

static

The type discriminator describing a sub-type of WorkerSelectorAttachment.

workerSelector

RouterWorkerSelector

The worker selector to attach.

WebhookRouterRule

A rule providing a binding to an external web server.

Name Type Description
authorizationServerUri

string

Uri for Authorization Server.

clientCredential

OAuth2WebhookClientCredential

OAuth2.0 Credentials used to Contoso's Authorization server. Reference: https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/

kind string:

webhook

The type discriminator describing a sub-type of RouterRule

webhookUri

string

Uri for Contoso's Web Server.

WebhookRouterRuleCreateOrUpdate

A rule providing a binding to an external web server.

Name Type Description
authorizationServerUri

string

Uri for Authorization Server.

clientCredential

OAuth2WebhookClientCredential

OAuth2.0 Credentials used to Contoso's Authorization server. Reference: https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/

kind string:

webhook

The type discriminator describing a sub-type of RouterRule

webhookUri

string

Uri for Contoso's Web Server.

WeightedAllocationQueueSelectorAttachment

Describes multiple sets of queue selectors, of which one will be selected and attached according to a weighting.

Name Type Description
allocations

QueueWeightedAllocation[]

A collection of percentage based weighted allocations.

kind string:

weightedAllocation

The type discriminator describing a sub-type of QueueSelectorAttachment.

WeightedAllocationWorkerSelectorAttachment

Describes multiple sets of worker selectors, of which one will be selected and attached according to a weighting.

Name Type Description
allocations

WorkerWeightedAllocation[]

A collection of percentage based weighted allocations.

kind string:

weightedAllocation

The type discriminator describing a sub-type of WorkerSelectorAttachment.

WorkerSelectorAttachmentKind

Discriminators for supported worker selector attachment types.

Name Type Description
conditional

string

Discriminator value for ConditionalWorkerSelectorAttachment.

passThrough

string

Discriminator value for PassThroughWorkerSelectorAttachment.

ruleEngine

string

Discriminator value for RuleEngineWorkerSelectorAttachment.

static

string

Discriminator value for StaticWorkerSelectorAttachment.

weightedAllocation

string

Discriminator value for WeightedAllocationWorkerSelectorAttachment.

WorkerWeightedAllocation

Contains the weight percentage and worker selectors to be applied if selected for weighted distributions.

Name Type Description
weight

number

The percentage of this weight, expressed as a fraction of 1.

workerSelectors

RouterWorkerSelector[]

A collection of worker selectors that will be applied if this allocation is selected.