diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/AcceptJobOfferResult.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/AcceptJobOfferResult.Serialization.cs
similarity index 76%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/AcceptJobOfferResult.Serialization.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/AcceptJobOfferResult.Serialization.cs
index 2e4886be3368f..16b6afc246dc8 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/AcceptJobOfferResult.Serialization.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/AcceptJobOfferResult.Serialization.cs
@@ -6,6 +6,7 @@
#nullable disable
using System.Text.Json;
+using Azure;
using Azure.Core;
namespace Azure.Communication.JobRouter.Models
@@ -41,5 +42,13 @@ internal static AcceptJobOfferResult DeserializeAcceptJobOfferResult(JsonElement
}
return new AcceptJobOfferResult(assignmentId, jobId, workerId);
}
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static AcceptJobOfferResult FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeAcceptJobOfferResult(document.RootElement);
+ }
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/AcceptJobOfferResult.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/AcceptJobOfferResult.cs
similarity index 92%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/AcceptJobOfferResult.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/AcceptJobOfferResult.cs
index 04b884341c6f4..a2a91162ca17e 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/AcceptJobOfferResult.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/AcceptJobOfferResult.cs
@@ -10,7 +10,10 @@
namespace Azure.Communication.JobRouter.Models
{
- /// Response containing Id's for the worker, job, and assignment from an accepted offer.
+ ///
+ /// Response containing Id's for the worker, job, and assignment from an accepted
+ /// offer
+ ///
public partial class AcceptJobOfferResult
{
/// Initializes a new instance of AcceptJobOfferResult.
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/AzureCommunicationJobRouterClientOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/AzureCommunicationJobRouterClientOptions.cs
new file mode 100644
index 0000000000000..144789f0500cc
--- /dev/null
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/AzureCommunicationJobRouterClientOptions.cs
@@ -0,0 +1,37 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using Azure.Core;
+
+namespace Azure.Communication.JobRouter
+{
+ /// Client options for Azure.Communication.JobRouter library clients.
+ public partial class AzureCommunicationJobRouterClientOptions : ClientOptions
+ {
+ private const ServiceVersion LatestVersion = ServiceVersion.V2023_11_01;
+
+ /// The version of the service to use.
+ internal enum ServiceVersion
+ {
+ /// Service version "2023-11-01".
+ V2023_11_01 = 1,
+ }
+
+ internal string Version { get; }
+
+ /// Initializes new instance of AzureCommunicationJobRouterClientOptions.
+ public AzureCommunicationJobRouterClientOptions(ServiceVersion version = LatestVersion)
+ {
+ Version = version switch
+ {
+ ServiceVersion.V2023_11_01 => "2023-11-01",
+ _ => throw new NotSupportedException()
+ };
+ }
+ }
+}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/BestWorkerMode.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/BestWorkerMode.Serialization.cs
similarity index 69%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/BestWorkerMode.Serialization.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/BestWorkerMode.Serialization.cs
index adc65b52b7951..6fc34c49865a7 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/BestWorkerMode.Serialization.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/BestWorkerMode.Serialization.cs
@@ -6,46 +6,14 @@
#nullable disable
using System.Text.Json;
+using Azure;
using Azure.Communication.JobRouter.Models;
using Azure.Core;
namespace Azure.Communication.JobRouter
{
- public partial class BestWorkerMode : IUtf8JsonSerializable
+ public partial class BestWorkerMode
{
- void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
- {
- writer.WriteStartObject();
- if (Optional.IsDefined(ScoringRule))
- {
- writer.WritePropertyName("scoringRule"u8);
- writer.WriteObjectValue(ScoringRule);
- }
- if (Optional.IsDefined(ScoringRuleOptions))
- {
- writer.WritePropertyName("scoringRuleOptions"u8);
- writer.WriteObjectValue(ScoringRuleOptions);
- }
- writer.WritePropertyName("kind"u8);
- writer.WriteStringValue(Kind);
- if (Optional.IsDefined(MinConcurrentOffers))
- {
- writer.WritePropertyName("minConcurrentOffers"u8);
- writer.WriteNumberValue(MinConcurrentOffers);
- }
- if (Optional.IsDefined(MaxConcurrentOffers))
- {
- writer.WritePropertyName("maxConcurrentOffers"u8);
- writer.WriteNumberValue(MaxConcurrentOffers);
- }
- if (Optional.IsDefined(BypassSelectors))
- {
- writer.WritePropertyName("bypassSelectors"u8);
- writer.WriteBooleanValue(BypassSelectors.Value);
- }
- writer.WriteEndObject();
- }
-
internal static BestWorkerMode DeserializeBestWorkerMode(JsonElement element)
{
if (element.ValueKind == JsonValueKind.Null)
@@ -113,5 +81,13 @@ internal static BestWorkerMode DeserializeBestWorkerMode(JsonElement element)
}
return new BestWorkerMode(kind, minConcurrentOffers, maxConcurrentOffers, Optional.ToNullable(bypassSelectors), scoringRule.Value, scoringRuleOptions.Value);
}
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static new BestWorkerMode FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeBestWorkerMode(document.RootElement);
+ }
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/BestWorkerMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/BestWorkerMode.cs
similarity index 53%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/BestWorkerMode.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/BestWorkerMode.cs
index 3cb41b46f2a5c..dc113b5c3624b 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/BestWorkerMode.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/BestWorkerMode.cs
@@ -13,33 +13,42 @@ namespace Azure.Communication.JobRouter
public partial class BestWorkerMode : DistributionMode
{
/// Initializes a new instance of BestWorkerMode.
- /// The type discriminator describing a sub-type of Mode.
+ /// Discriminator.
/// Governs the minimum desired number of active concurrent offers a job can have.
/// Governs the maximum number of active concurrent offers a job can have.
///
/// (Optional)
- /// If set to true, then router will match workers to jobs even if they don't match label selectors.
- /// Warning: You may get workers that are not qualified for the job they are matched with if you set this
- /// variable to true. This flag is intended more for temporary usage.
+ /// If set to true, then router will match workers to jobs even if they
+ /// don't match label selectors.
+ /// Warning: You may get workers that are not
+ /// qualified for the job they are matched with if you set this
+ /// variable to true.
+ /// This flag is intended more for temporary usage.
/// By default, set to false.
///
///
/// A rule of one of the following types:
///
- /// StaticRule: A rule providing static rules that always return the same result, regardless of input.
- /// DirectMapRule: A rule that return the same labels as the input labels.
- /// ExpressionRule: A rule providing inline expression rules.
- /// AzureFunctionRule: A rule providing a binding to an HTTP Triggered Azure Function.
- /// WebhookRule: A rule providing a binding to a webserver following OAuth2.0 authentication protocol.
- /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
- /// The available derived classes include , , , and .
+ /// StaticRule: A rule
+ /// providing static rules that always return the same result, regardless of
+ /// input.
+ /// DirectMapRule: A rule that return the same labels as the input
+ /// labels.
+ /// ExpressionRule: A rule providing inline expression
+ /// rules.
+ /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure
+ /// Function.
+ /// WebhookRule: A rule providing a binding to a webserver following
+ /// OAuth2.0 authentication protocol.
+ ///
+ ///
+ /// Encapsulates all options that can be passed as parameters for scoring rule with
+ /// BestWorkerMode
///
- /// Encapsulates all options that can be passed as parameters for scoring rule with BestWorkerMode.
internal BestWorkerMode(string kind, int minConcurrentOffers, int maxConcurrentOffers, bool? bypassSelectors, RouterRule scoringRule, ScoringRuleOptions scoringRuleOptions) : base(kind, minConcurrentOffers, maxConcurrentOffers, bypassSelectors)
{
ScoringRule = scoringRule;
ScoringRuleOptions = scoringRuleOptions;
- Kind = kind ?? "best-worker";
}
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelExceptionAction.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelExceptionAction.Serialization.cs
similarity index 66%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelExceptionAction.Serialization.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelExceptionAction.Serialization.cs
index 44edd36173956..52491f6438e6f 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelExceptionAction.Serialization.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelExceptionAction.Serialization.cs
@@ -6,30 +6,13 @@
#nullable disable
using System.Text.Json;
+using Azure;
using Azure.Core;
namespace Azure.Communication.JobRouter
{
- public partial class CancelExceptionAction : IUtf8JsonSerializable
+ public partial class CancelExceptionAction
{
- void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
- {
- writer.WriteStartObject();
- if (Optional.IsDefined(Note))
- {
- writer.WritePropertyName("note"u8);
- writer.WriteStringValue(Note);
- }
- if (Optional.IsDefined(DispositionCode))
- {
- writer.WritePropertyName("dispositionCode"u8);
- writer.WriteStringValue(DispositionCode);
- }
- writer.WritePropertyName("kind"u8);
- writer.WriteStringValue(Kind);
- writer.WriteEndObject();
- }
-
internal static CancelExceptionAction DeserializeCancelExceptionAction(JsonElement element)
{
if (element.ValueKind == JsonValueKind.Null)
@@ -59,5 +42,13 @@ internal static CancelExceptionAction DeserializeCancelExceptionAction(JsonEleme
}
return new CancelExceptionAction(kind, note.Value, dispositionCode.Value);
}
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static new CancelExceptionAction FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeCancelExceptionAction(document.RootElement);
+ }
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelExceptionAction.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelExceptionAction.cs
new file mode 100644
index 0000000000000..f43560905ff86
--- /dev/null
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelExceptionAction.cs
@@ -0,0 +1,46 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+namespace Azure.Communication.JobRouter
+{
+ /// An action that marks a job as cancelled.
+ public partial class CancelExceptionAction : ExceptionAction
+ {
+ /// Initializes a new instance of CancelExceptionAction.
+ internal CancelExceptionAction()
+ {
+ Kind = "cancel";
+ }
+
+ /// Initializes a new instance of CancelExceptionAction.
+ /// Discriminator.
+ ///
+ /// (Optional) A note that will be appended to the jobs' Notes collection with the
+ /// current timestamp.
+ ///
+ ///
+ /// (Optional) Indicates the outcome of the job, populate this field with your own
+ /// custom values.
+ ///
+ internal CancelExceptionAction(string kind, string note, string dispositionCode) : base(kind)
+ {
+ Note = note;
+ DispositionCode = dispositionCode;
+ }
+
+ ///
+ /// (Optional) A note that will be appended to the jobs' Notes collection with the
+ /// current timestamp.
+ ///
+ public string Note { get; }
+ ///
+ /// (Optional) Indicates the outcome of the job, populate this field with your own
+ /// custom values.
+ ///
+ public string DispositionCode { get; }
+ }
+}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelJobRequest.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelJobRequest.Serialization.cs
similarity index 74%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelJobRequest.Serialization.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelJobRequest.Serialization.cs
index d9e66366ab157..3131479cf9d61 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelJobRequest.Serialization.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelJobRequest.Serialization.cs
@@ -27,5 +27,13 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
}
writer.WriteEndObject();
}
+
+ /// Convert into a Utf8JsonRequestContent.
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this);
+ return content;
+ }
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelJobRequest.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelJobRequest.cs
new file mode 100644
index 0000000000000..d115b31a8ebfa
--- /dev/null
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelJobRequest.cs
@@ -0,0 +1,46 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+namespace Azure.Communication.JobRouter
+{
+ /// Request payload for deleting a job.
+ internal partial class CancelJobRequest
+ {
+ /// Initializes a new instance of CancelJobRequest.
+ public CancelJobRequest()
+ {
+ }
+
+ /// Initializes a new instance of CancelJobRequest.
+ ///
+ /// (Optional) A note that will be appended to the jobs' Notes collection with the
+ /// current timestamp.
+ ///
+ ///
+ /// Indicates the outcome of the job, populate this field with your own custom
+ /// values.
+ /// If not provided, default value of "Cancelled" is set.
+ ///
+ internal CancelJobRequest(string note, string dispositionCode)
+ {
+ Note = note;
+ DispositionCode = dispositionCode;
+ }
+
+ ///
+ /// (Optional) A note that will be appended to the jobs' Notes collection with the
+ /// current timestamp.
+ ///
+ public string Note { get; set; }
+ ///
+ /// Indicates the outcome of the job, populate this field with your own custom
+ /// values.
+ /// If not provided, default value of "Cancelled" is set.
+ ///
+ public string DispositionCode { get; set; }
+ }
+}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ChannelConfiguration.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ChannelConfiguration.Serialization.cs
similarity index 71%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ChannelConfiguration.Serialization.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ChannelConfiguration.Serialization.cs
index 0f005a0aad59e..f6b0c5890eb59 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ChannelConfiguration.Serialization.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ChannelConfiguration.Serialization.cs
@@ -6,25 +6,13 @@
#nullable disable
using System.Text.Json;
+using Azure;
using Azure.Core;
namespace Azure.Communication.JobRouter
{
- public partial class ChannelConfiguration : IUtf8JsonSerializable
+ public partial class ChannelConfiguration
{
- void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
- {
- writer.WriteStartObject();
- writer.WritePropertyName("capacityCostPerJob"u8);
- writer.WriteNumberValue(CapacityCostPerJob);
- if (Optional.IsDefined(MaxNumberOfJobs))
- {
- writer.WritePropertyName("maxNumberOfJobs"u8);
- writer.WriteNumberValue(MaxNumberOfJobs.Value);
- }
- writer.WriteEndObject();
- }
-
internal static ChannelConfiguration DeserializeChannelConfiguration(JsonElement element)
{
if (element.ValueKind == JsonValueKind.Null)
@@ -52,5 +40,13 @@ internal static ChannelConfiguration DeserializeChannelConfiguration(JsonElement
}
return new ChannelConfiguration(capacityCostPerJob, Optional.ToNullable(maxNumberOfJobs));
}
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static ChannelConfiguration FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeChannelConfiguration(document.RootElement);
+ }
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ChannelConfiguration.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ChannelConfiguration.cs
similarity index 58%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ChannelConfiguration.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ChannelConfiguration.cs
index 37e35196027fb..79af361595366 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ChannelConfiguration.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ChannelConfiguration.cs
@@ -11,14 +11,20 @@ namespace Azure.Communication.JobRouter
public partial class ChannelConfiguration
{
/// Initializes a new instance of ChannelConfiguration.
- /// The amount of capacity that an instance of a job of this channel will consume of the total worker capacity.
- public ChannelConfiguration(int capacityCostPerJob)
+ ///
+ /// The amount of capacity that an instance of a job of this channel will consume
+ /// of the total worker capacity.
+ ///
+ internal ChannelConfiguration(int capacityCostPerJob)
{
CapacityCostPerJob = capacityCostPerJob;
}
/// Initializes a new instance of ChannelConfiguration.
- /// The amount of capacity that an instance of a job of this channel will consume of the total worker capacity.
+ ///
+ /// The amount of capacity that an instance of a job of this channel will consume
+ /// of the total worker capacity.
+ ///
/// The maximum number of jobs that can be supported concurrently for this channel.
internal ChannelConfiguration(int capacityCostPerJob, int? maxNumberOfJobs)
{
@@ -26,9 +32,12 @@ internal ChannelConfiguration(int capacityCostPerJob, int? maxNumberOfJobs)
MaxNumberOfJobs = maxNumberOfJobs;
}
- /// The amount of capacity that an instance of a job of this channel will consume of the total worker capacity.
- public int CapacityCostPerJob { get; set; }
+ ///
+ /// The amount of capacity that an instance of a job of this channel will consume
+ /// of the total worker capacity.
+ ///
+ public int CapacityCostPerJob { get; }
/// The maximum number of jobs that can be supported concurrently for this channel.
- public int? MaxNumberOfJobs { get; set; }
+ public int? MaxNumberOfJobs { get; }
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicy.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicy.Serialization.cs
similarity index 62%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicy.Serialization.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicy.Serialization.cs
index a9daab64bb03e..293451a564c5c 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicy.Serialization.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicy.Serialization.cs
@@ -7,61 +7,20 @@
using System.Collections.Generic;
using System.Text.Json;
-using Azure.Communication.JobRouter;
+using Azure;
using Azure.Core;
-namespace Azure.Communication.JobRouter.Models
+namespace Azure.Communication.JobRouter
{
- public partial class ClassificationPolicy : IUtf8JsonSerializable
+ public partial class ClassificationPolicy
{
- void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
- {
- writer.WriteStartObject();
- if (Optional.IsDefined(Name))
- {
- writer.WritePropertyName("name"u8);
- writer.WriteStringValue(Name);
- }
- if (Optional.IsDefined(FallbackQueueId))
- {
- writer.WritePropertyName("fallbackQueueId"u8);
- writer.WriteStringValue(FallbackQueueId);
- }
- if (Optional.IsCollectionDefined(_queueSelectors))
- {
- writer.WritePropertyName("queueSelectors"u8);
- writer.WriteStartArray();
- foreach (var item in _queueSelectors)
- {
- writer.WriteObjectValue(item);
- }
- writer.WriteEndArray();
- }
- if (Optional.IsDefined(PrioritizationRule))
- {
- writer.WritePropertyName("prioritizationRule"u8);
- writer.WriteObjectValue(PrioritizationRule);
- }
- if (Optional.IsCollectionDefined(_workerSelectors))
- {
- writer.WritePropertyName("workerSelectors"u8);
- writer.WriteStartArray();
- foreach (var item in _workerSelectors)
- {
- writer.WriteObjectValue(item);
- }
- writer.WriteEndArray();
- }
- writer.WriteEndObject();
- }
-
internal static ClassificationPolicy DeserializeClassificationPolicy(JsonElement element)
{
if (element.ValueKind == JsonValueKind.Null)
{
return null;
}
- Optional id = default;
+ string id = default;
Optional name = default;
Optional fallbackQueueId = default;
Optional> queueSelectors = default;
@@ -122,7 +81,15 @@ internal static ClassificationPolicy DeserializeClassificationPolicy(JsonElement
continue;
}
}
- return new ClassificationPolicy(id.Value, name.Value, fallbackQueueId.Value, Optional.ToList(queueSelectors), prioritizationRule.Value, Optional.ToList(workerSelectors));
+ return new ClassificationPolicy(id, name.Value, fallbackQueueId.Value, Optional.ToList(queueSelectors), prioritizationRule.Value, Optional.ToList(workerSelectors));
+ }
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static ClassificationPolicy FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeClassificationPolicy(document.RootElement);
}
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicy.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicy.cs
new file mode 100644
index 0000000000000..5ebe1877a881b
--- /dev/null
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicy.cs
@@ -0,0 +1,50 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System.Collections.Generic;
+using Azure.Core;
+
+namespace Azure.Communication.JobRouter
+{
+ /// A container for the rules that govern how jobs are classified.
+ public partial class ClassificationPolicy
+ {
+ /// Initializes a new instance of ClassificationPolicy.
+ /// Unique identifier of this policy.
+ /// Friendly name of this policy.
+ /// The fallback queue to select if the queue selector doesn't find a match.
+ /// The queue selectors to resolve a queue for a given job.
+ ///
+ /// A rule of one of the following types:
+ ///
+ /// StaticRule: A rule
+ /// providing static rules that always return the same result, regardless of
+ /// input.
+ /// DirectMapRule: A rule that return the same labels as the input
+ /// labels.
+ /// ExpressionRule: A rule providing inline expression
+ /// rules.
+ /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure
+ /// Function.
+ /// WebhookRule: A rule providing a binding to a webserver following
+ /// OAuth2.0 authentication protocol.
+ ///
+ /// The worker label selectors to attach to a given job.
+ internal ClassificationPolicy(string id, string name, string fallbackQueueId, IList queueSelectors, RouterRule prioritizationRule, IList workerSelectors)
+ {
+ Id = id;
+ Name = name;
+ FallbackQueueId = fallbackQueueId;
+ _queueSelectors = queueSelectors;
+ PrioritizationRule = prioritizationRule;
+ _workerSelectors = workerSelectors;
+ }
+
+ /// Unique identifier of this policy.
+ public string Id { get; }
+ }
+}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyItem.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicyItem.Serialization.cs
similarity index 65%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyItem.Serialization.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicyItem.Serialization.cs
index 45d3876403fa9..f81f8c1b94558 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyItem.Serialization.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicyItem.Serialization.cs
@@ -6,6 +6,8 @@
#nullable disable
using System.Text.Json;
+using Azure;
+using Azure.Communication.JobRouter;
using Azure.Core;
namespace Azure.Communication.JobRouter.Models
@@ -18,16 +20,12 @@ internal static ClassificationPolicyItem DeserializeClassificationPolicyItem(Jso
{
return null;
}
- Optional classificationPolicy = default;
- Optional etag = default;
+ ClassificationPolicy classificationPolicy = default;
+ string etag = default;
foreach (var property in element.EnumerateObject())
{
if (property.NameEquals("classificationPolicy"u8))
{
- if (property.Value.ValueKind == JsonValueKind.Null)
- {
- continue;
- }
classificationPolicy = ClassificationPolicy.DeserializeClassificationPolicy(property.Value);
continue;
}
@@ -37,7 +35,15 @@ internal static ClassificationPolicyItem DeserializeClassificationPolicyItem(Jso
continue;
}
}
- return new ClassificationPolicyItem(classificationPolicy.Value, etag.Value);
+ return new ClassificationPolicyItem(classificationPolicy, etag);
+ }
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static ClassificationPolicyItem FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeClassificationPolicyItem(document.RootElement);
}
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicyItem.cs
similarity index 73%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyItem.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicyItem.cs
index 53d52d7f8dc03..9ab6151edf985 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyItem.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicyItem.cs
@@ -5,21 +5,24 @@
#nullable disable
+using System;
+using Azure.Communication.JobRouter;
+using Azure.Core;
+
namespace Azure.Communication.JobRouter.Models
{
/// Paged instance of ClassificationPolicy.
public partial class ClassificationPolicyItem
{
- /// Initializes a new instance of ClassificationPolicyItem.
- internal ClassificationPolicyItem()
- {
- }
-
/// Initializes a new instance of ClassificationPolicyItem.
/// A container for the rules that govern how jobs are classified.
/// (Optional) The Concurrency Token.
+ /// or is null.
internal ClassificationPolicyItem(ClassificationPolicy classificationPolicy, string etag)
{
+ Argument.AssertNotNull(classificationPolicy, nameof(classificationPolicy));
+ Argument.AssertNotNull(etag, nameof(etag));
+
ClassificationPolicy = classificationPolicy;
_etag = etag;
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CloseJobRequest.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CloseJobRequest.Serialization.cs
similarity index 79%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CloseJobRequest.Serialization.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/CloseJobRequest.Serialization.cs
index 6b151616a3f00..689c8b136a186 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CloseJobRequest.Serialization.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CloseJobRequest.Serialization.cs
@@ -34,5 +34,13 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
}
writer.WriteEndObject();
}
+
+ /// Convert into a Utf8JsonRequestContent.
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this);
+ return content;
+ }
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CloseJobRequest.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CloseJobRequest.cs
new file mode 100644
index 0000000000000..904b7ac9de92b
--- /dev/null
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CloseJobRequest.cs
@@ -0,0 +1,70 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using Azure.Core;
+
+namespace Azure.Communication.JobRouter
+{
+ /// Request payload for closing jobs.
+ internal partial class CloseJobRequest
+ {
+ /// Initializes a new instance of CloseJobRequest.
+ /// The assignment within which the job is to be closed.
+ /// is null.
+ public CloseJobRequest(string assignmentId)
+ {
+ Argument.AssertNotNull(assignmentId, nameof(assignmentId));
+
+ AssignmentId = assignmentId;
+ }
+
+ /// Initializes a new instance of CloseJobRequest.
+ /// The assignment within which the job is to be closed.
+ ///
+ /// Indicates the outcome of the job, populate this field with your own custom
+ /// values.
+ ///
+ ///
+ /// If not provided, worker capacity is released immediately along with a
+ /// JobClosedEvent notification.
+ /// If provided, worker capacity is released along
+ /// with a JobClosedEvent notification at a future time in UTC.
+ ///
+ ///
+ /// (Optional) A note that will be appended to the jobs' Notes collection with the
+ /// current timestamp.
+ ///
+ internal CloseJobRequest(string assignmentId, string dispositionCode, DateTimeOffset? closeAt, string note)
+ {
+ AssignmentId = assignmentId;
+ DispositionCode = dispositionCode;
+ CloseAt = closeAt;
+ Note = note;
+ }
+
+ /// The assignment within which the job is to be closed.
+ public string AssignmentId { get; }
+ ///
+ /// Indicates the outcome of the job, populate this field with your own custom
+ /// values.
+ ///
+ public string DispositionCode { get; set; }
+ ///
+ /// If not provided, worker capacity is released immediately along with a
+ /// JobClosedEvent notification.
+ /// If provided, worker capacity is released along
+ /// with a JobClosedEvent notification at a future time in UTC.
+ ///
+ public DateTimeOffset? CloseAt { get; set; }
+ ///
+ /// (Optional) A note that will be appended to the jobs' Notes collection with the
+ /// current timestamp.
+ ///
+ public string Note { get; set; }
+ }
+}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterClientBuilderExtensions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterClientBuilderExtensions.cs
new file mode 100644
index 0000000000000..50ad54c695db2
--- /dev/null
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterClientBuilderExtensions.cs
@@ -0,0 +1,14 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+namespace Microsoft.Extensions.Azure
+{
+ /// Extension methods to add to client builder.
+ public static partial class CommunicationJobRouterClientBuilderExtensions
+ {
+ }
+}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterModelFactory.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterModelFactory.cs
index fdde257d05637..34df8aedfe888 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterModelFactory.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterModelFactory.cs
@@ -7,24 +7,438 @@
using System;
using System.Collections.Generic;
+using System.Linq;
+using Azure.Communication.JobRouter.Models;
-namespace Azure.Communication.JobRouter.Models
+namespace Azure.Communication.JobRouter
{
/// Model factory for models.
public static partial class CommunicationJobRouterModelFactory
{
+ /// Initializes a new instance of DistributionMode.
+ /// Discriminator.
+ /// Governs the minimum desired number of active concurrent offers a job can have.
+ /// Governs the maximum number of active concurrent offers a job can have.
+ ///
+ /// (Optional)
+ /// If set to true, then router will match workers to jobs even if they
+ /// don't match label selectors.
+ /// Warning: You may get workers that are not
+ /// qualified for the job they are matched with if you set this
+ /// variable to true.
+ /// This flag is intended more for temporary usage.
+ /// By default, set to false.
+ ///
+ /// A new instance for mocking.
+ public static DistributionMode DistributionMode(string kind = null, int minConcurrentOffers = default, int maxConcurrentOffers = default, bool? bypassSelectors = null)
+ {
+ return new UnknownDistributionMode(kind, minConcurrentOffers, maxConcurrentOffers, bypassSelectors);
+ }
+
+ /// Initializes a new instance of BestWorkerMode.
+ /// Governs the minimum desired number of active concurrent offers a job can have.
+ /// Governs the maximum number of active concurrent offers a job can have.
+ ///
+ /// (Optional)
+ /// If set to true, then router will match workers to jobs even if they
+ /// don't match label selectors.
+ /// Warning: You may get workers that are not
+ /// qualified for the job they are matched with if you set this
+ /// variable to true.
+ /// This flag is intended more for temporary usage.
+ /// By default, set to false.
+ ///
+ ///
+ /// A rule of one of the following types:
+ ///
+ /// StaticRule: A rule
+ /// providing static rules that always return the same result, regardless of
+ /// input.
+ /// DirectMapRule: A rule that return the same labels as the input
+ /// labels.
+ /// ExpressionRule: A rule providing inline expression
+ /// rules.
+ /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure
+ /// Function.
+ /// WebhookRule: A rule providing a binding to a webserver following
+ /// OAuth2.0 authentication protocol.
+ ///
+ ///
+ /// Encapsulates all options that can be passed as parameters for scoring rule with
+ /// BestWorkerMode
+ ///
+ /// A new instance for mocking.
+ public static BestWorkerMode BestWorkerMode(int minConcurrentOffers = default, int maxConcurrentOffers = default, bool? bypassSelectors = null, RouterRule scoringRule = null, ScoringRuleOptions scoringRuleOptions = null)
+ {
+ return new BestWorkerMode("best-worker", minConcurrentOffers, maxConcurrentOffers, bypassSelectors, scoringRule, scoringRuleOptions);
+ }
+
+ /// Initializes a new instance of ExpressionRouterRule.
+ /// The expression language to compile to and execute.
+ ///
+ /// The string containing the expression to evaluate. Should contain return
+ /// statement with calculated values.
+ ///
+ /// A new instance for mocking.
+ public static ExpressionRouterRule ExpressionRouterRule(string language = null, string expression = null)
+ {
+ return new ExpressionRouterRule("expression-rule", language, expression);
+ }
+
+ /// Initializes a new instance of FunctionRouterRule.
+ /// URL for Azure Function.
+ /// Credentials used to access Azure function rule.
+ /// A new instance for mocking.
+ public static FunctionRouterRule FunctionRouterRule(Uri functionUri = null, FunctionRouterRuleCredential credential = null)
+ {
+ return new FunctionRouterRule("azure-function-rule", functionUri, credential);
+ }
+
+ /// Initializes a new instance of WebhookRouterRule.
+ /// Uri for Authorization Server.
+ ///
+ /// OAuth2.0 Credentials used to Contoso's Authorization server.
+ /// Reference:
+ /// https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/
+ ///
+ /// Uri for Contoso's Web Server.
+ /// A new instance for mocking.
+ public static WebhookRouterRule WebhookRouterRule(Uri authorizationServerUri = null, Oauth2ClientCredential clientCredential = null, Uri webhookUri = null)
+ {
+ return new WebhookRouterRule("webhook-rule", authorizationServerUri, clientCredential, webhookUri);
+ }
+
+ /// Initializes a new instance of Oauth2ClientCredential.
+ /// ClientId for Contoso Authorization server.
+ /// Client secret for Contoso Authorization server.
+ /// A new instance for mocking.
+ public static Oauth2ClientCredential Oauth2ClientCredential(string clientId = null, string clientSecret = null)
+ {
+ return new Oauth2ClientCredential(clientId, clientSecret);
+ }
+
+ /// Initializes a new instance of ScoringRuleOptions.
+ ///
+ /// (Optional) Set batch size when AllowScoringBatchOfWorkers is set to true.
+ /// Defaults to 20 if not configured.
+ ///
+ ///
+ /// (Optional) List of extra parameters from the job that will be sent as part of
+ /// the payload to scoring rule.
+ /// If not set, the job's labels (sent in the payload
+ /// as `job`) and the job's worker selectors (sent in the payload as
+ /// `selectors`)
+ /// are added to the payload of the scoring rule by default.
+ /// Note:
+ /// Worker labels are always sent with scoring payload.
+ ///
+ ///
+ /// (Optional)
+ /// If set to true, will score workers in batches, and the parameter
+ /// name of the worker labels will be sent as `workers`.
+ /// By default, set to false
+ /// and the parameter name for the worker labels will be sent as `worker`.
+ /// Note: If
+ /// enabled, use BatchSize to set batch size.
+ ///
+ ///
+ /// (Optional)
+ /// If false, will sort scores by ascending order. By default, set to
+ /// true.
+ ///
+ /// A new instance for mocking.
+ public static ScoringRuleOptions ScoringRuleOptions(int? batchSize = null, IEnumerable scoringParameters = null, bool? allowScoringBatchOfWorkers = null, bool? descendingOrder = null)
+ {
+ scoringParameters ??= new List();
+
+ return new ScoringRuleOptions(batchSize, scoringParameters?.ToList(), allowScoringBatchOfWorkers, descendingOrder);
+ }
+
+ /// Initializes a new instance of LongestIdleMode.
+ /// Governs the minimum desired number of active concurrent offers a job can have.
+ /// Governs the maximum number of active concurrent offers a job can have.
+ ///
+ /// (Optional)
+ /// If set to true, then router will match workers to jobs even if they
+ /// don't match label selectors.
+ /// Warning: You may get workers that are not
+ /// qualified for the job they are matched with if you set this
+ /// variable to true.
+ /// This flag is intended more for temporary usage.
+ /// By default, set to false.
+ ///
+ /// A new instance for mocking.
+ public static LongestIdleMode LongestIdleMode(int minConcurrentOffers = default, int maxConcurrentOffers = default, bool? bypassSelectors = null)
+ {
+ return new LongestIdleMode("longest-idle", minConcurrentOffers, maxConcurrentOffers, bypassSelectors);
+ }
+
+ /// Initializes a new instance of RoundRobinMode.
+ /// Governs the minimum desired number of active concurrent offers a job can have.
+ /// Governs the maximum number of active concurrent offers a job can have.
+ ///
+ /// (Optional)
+ /// If set to true, then router will match workers to jobs even if they
+ /// don't match label selectors.
+ /// Warning: You may get workers that are not
+ /// qualified for the job they are matched with if you set this
+ /// variable to true.
+ /// This flag is intended more for temporary usage.
+ /// By default, set to false.
+ ///
+ /// A new instance for mocking.
+ public static RoundRobinMode RoundRobinMode(int minConcurrentOffers = default, int maxConcurrentOffers = default, bool? bypassSelectors = null)
+ {
+ return new RoundRobinMode("round-robin", minConcurrentOffers, maxConcurrentOffers, bypassSelectors);
+ }
+
+ /// Initializes a new instance of ConditionalQueueSelectorAttachment.
+ ///
+ /// A rule of one of the following types:
+ ///
+ /// StaticRule: A rule
+ /// providing static rules that always return the same result, regardless of
+ /// input.
+ /// DirectMapRule: A rule that return the same labels as the input
+ /// labels.
+ /// ExpressionRule: A rule providing inline expression
+ /// rules.
+ /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure
+ /// Function.
+ /// WebhookRule: A rule providing a binding to a webserver following
+ /// OAuth2.0 authentication protocol.
+ ///
+ /// The queue selectors to attach.
+ /// A new instance for mocking.
+ public static ConditionalQueueSelectorAttachment ConditionalQueueSelectorAttachment(RouterRule condition = null, IEnumerable queueSelectors = null)
+ {
+ queueSelectors ??= new List();
+
+ return new ConditionalQueueSelectorAttachment("conditional", condition, queueSelectors?.ToList());
+ }
+
+ /// Initializes a new instance of PassThroughQueueSelectorAttachment.
+ /// The label key to query against.
+ /// Describes how the value of the label is compared to the value pass through.
+ /// A new instance for mocking.
+ public static PassThroughQueueSelectorAttachment PassThroughQueueSelectorAttachment(string key = null, LabelOperator labelOperator = default)
+ {
+ return new PassThroughQueueSelectorAttachment("pass-through", key, labelOperator);
+ }
+
+ /// Initializes a new instance of RuleEngineQueueSelectorAttachment.
+ ///
+ /// A rule of one of the following types:
+ ///
+ /// StaticRule: A rule
+ /// providing static rules that always return the same result, regardless of
+ /// input.
+ /// DirectMapRule: A rule that return the same labels as the input
+ /// labels.
+ /// ExpressionRule: A rule providing inline expression
+ /// rules.
+ /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure
+ /// Function.
+ /// WebhookRule: A rule providing a binding to a webserver following
+ /// OAuth2.0 authentication protocol.
+ ///
+ /// A new instance for mocking.
+ public static RuleEngineQueueSelectorAttachment RuleEngineQueueSelectorAttachment(RouterRule rule = null)
+ {
+ return new RuleEngineQueueSelectorAttachment("rule-engine", rule);
+ }
+
+ /// Initializes a new instance of StaticQueueSelectorAttachment.
+ ///
+ /// Describes a condition that must be met against a set of labels for queue
+ /// selection
+ ///
+ /// A new instance for mocking.
+ public static StaticQueueSelectorAttachment StaticQueueSelectorAttachment(RouterQueueSelector queueSelector = null)
+ {
+ return new StaticQueueSelectorAttachment("static", queueSelector);
+ }
+
+ /// Initializes a new instance of WeightedAllocationQueueSelectorAttachment.
+ /// A collection of percentage based weighted allocations.
+ /// A new instance for mocking.
+ public static WeightedAllocationQueueSelectorAttachment WeightedAllocationQueueSelectorAttachment(IEnumerable allocations = null)
+ {
+ allocations ??= new List();
+
+ return new WeightedAllocationQueueSelectorAttachment("weighted-allocation-queue-selector", allocations?.ToList());
+ }
+
+ /// Initializes a new instance of QueueWeightedAllocation.
+ /// The percentage of this weight, expressed as a fraction of 1.
+ ///
+ /// A collection of queue selectors that will be applied if this allocation is
+ /// selected.
+ ///
+ /// A new instance for mocking.
+ public static QueueWeightedAllocation QueueWeightedAllocation(double weight = default, IEnumerable queueSelectors = null)
+ {
+ queueSelectors ??= new List();
+
+ return new QueueWeightedAllocation(weight, queueSelectors?.ToList());
+ }
+
+ /// Initializes a new instance of ConditionalWorkerSelectorAttachment.
+ ///
+ /// A rule of one of the following types:
+ ///
+ /// StaticRule: A rule
+ /// providing static rules that always return the same result, regardless of
+ /// input.
+ /// DirectMapRule: A rule that return the same labels as the input
+ /// labels.
+ /// ExpressionRule: A rule providing inline expression
+ /// rules.
+ /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure
+ /// Function.
+ /// WebhookRule: A rule providing a binding to a webserver following
+ /// OAuth2.0 authentication protocol.
+ ///
+ /// The worker selectors to attach.
+ /// A new instance for mocking.
+ public static ConditionalWorkerSelectorAttachment ConditionalWorkerSelectorAttachment(RouterRule condition = null, IEnumerable workerSelectors = null)
+ {
+ workerSelectors ??= new List();
+
+ return new ConditionalWorkerSelectorAttachment("conditional", condition, workerSelectors?.ToList());
+ }
+
+ /// Initializes a new instance of RuleEngineWorkerSelectorAttachment.
+ ///
+ /// A rule of one of the following types:
+ ///
+ /// StaticRule: A rule
+ /// providing static rules that always return the same result, regardless of
+ /// input.
+ /// DirectMapRule: A rule that return the same labels as the input
+ /// labels.
+ /// ExpressionRule: A rule providing inline expression
+ /// rules.
+ /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure
+ /// Function.
+ /// WebhookRule: A rule providing a binding to a webserver following
+ /// OAuth2.0 authentication protocol.
+ ///
+ /// A new instance for mocking.
+ public static RuleEngineWorkerSelectorAttachment RuleEngineWorkerSelectorAttachment(RouterRule rule = null)
+ {
+ return new RuleEngineWorkerSelectorAttachment("rule-engine", rule);
+ }
+
+ /// Initializes a new instance of StaticWorkerSelectorAttachment.
+ ///
+ /// Describes a condition that must be met against a set of labels for worker
+ /// selection
+ ///
+ /// A new instance for mocking.
+ public static StaticWorkerSelectorAttachment StaticWorkerSelectorAttachment(RouterWorkerSelector workerSelector = null)
+ {
+ return new StaticWorkerSelectorAttachment("static", workerSelector);
+ }
+
+ /// Initializes a new instance of WeightedAllocationWorkerSelectorAttachment.
+ /// A collection of percentage based weighted allocations.
+ /// A new instance for mocking.
+ public static WeightedAllocationWorkerSelectorAttachment WeightedAllocationWorkerSelectorAttachment(IEnumerable allocations = null)
+ {
+ allocations ??= new List();
+
+ return new WeightedAllocationWorkerSelectorAttachment("weighted-allocation-worker-selector", allocations?.ToList());
+ }
+
+ /// Initializes a new instance of WorkerWeightedAllocation.
+ /// The percentage of this weight, expressed as a fraction of 1.
+ ///
+ /// A collection of worker selectors that will be applied if this allocation is
+ /// selected.
+ ///
+ /// A new instance for mocking.
+ public static WorkerWeightedAllocation WorkerWeightedAllocation(double weight = default, IEnumerable workerSelectors = null)
+ {
+ workerSelectors ??= new List();
+
+ return new WorkerWeightedAllocation(weight, workerSelectors?.ToList());
+ }
+
+ /// Initializes a new instance of ExceptionRule.
+ /// The trigger for this exception rule.
+ ///
+ /// A dictionary collection of actions to perform once the exception is triggered.
+ /// Key is the Id of each exception action.
+ ///
+ /// or is null.
+ /// A new instance for mocking.
+ public static ExceptionRule ExceptionRule(ExceptionTrigger trigger = null, IDictionary actions = null)
+ {
+ if (trigger == null)
+ {
+ throw new ArgumentNullException(nameof(trigger));
+ }
+ actions ??= new Dictionary();
+
+ return new ExceptionRule(trigger, actions);
+ }
+
+ /// Initializes a new instance of QueueLengthExceptionTrigger.
+ /// Threshold of number of jobs ahead in the queue to for this trigger to fire.
+ /// A new instance for mocking.
+ public static QueueLengthExceptionTrigger QueueLengthExceptionTrigger(int threshold = default)
+ {
+ return new QueueLengthExceptionTrigger("queue-length", threshold);
+ }
+
+ /// Initializes a new instance of CancelExceptionAction.
+ ///
+ /// (Optional) A note that will be appended to the jobs' Notes collection with the
+ /// current timestamp.
+ ///
+ ///
+ /// (Optional) Indicates the outcome of the job, populate this field with your own
+ /// custom values.
+ ///
+ /// A new instance for mocking.
+ public static CancelExceptionAction CancelExceptionAction(string note = null, string dispositionCode = null)
+ {
+ return new CancelExceptionAction("cancel", note, dispositionCode);
+ }
+
+ /// Initializes a new instance of ManualReclassifyExceptionAction.
+ /// Updated QueueId.
+ /// Updated Priority.
+ /// Updated WorkerSelectors.
+ /// A new instance for mocking.
+ public static ManualReclassifyExceptionAction ManualReclassifyExceptionAction(string queueId = null, int? priority = null, IEnumerable workerSelectors = null)
+ {
+ workerSelectors ??= new List();
+
+ return new ManualReclassifyExceptionAction("manual-reclassify", queueId, priority, workerSelectors?.ToList());
+ }
+
/// Initializes a new instance of RouterJobAssignment.
/// The Id of the job assignment.
/// The Id of the Worker assigned to the job.
/// The assignment time of the job in UTC.
/// The time the job was marked as completed after being assigned in UTC.
/// The time the job was marked as closed after being completed in UTC.
- /// A new instance for mocking.
+ /// A new instance for mocking.
public static RouterJobAssignment RouterJobAssignment(string assignmentId = null, string workerId = null, DateTimeOffset assignedAt = default, DateTimeOffset? completedAt = null, DateTimeOffset? closedAt = null)
{
return new RouterJobAssignment(assignmentId, workerId, assignedAt, completedAt, closedAt);
}
+ /// Initializes a new instance of ScheduleAndSuspendMode.
+ /// Scheduled time.
+ /// A new instance for mocking.
+ public static ScheduleAndSuspendMode ScheduleAndSuspendMode(DateTimeOffset? scheduleAt = null)
+ {
+ return new ScheduleAndSuspendMode(scheduleAt);
+ }
+
/// Initializes a new instance of UnassignJobResult.
/// The Id of the job unassigned.
/// The number of times a job is unassigned. At a maximum 3.
@@ -67,7 +481,10 @@ public static AcceptJobOfferResult AcceptJobOfferResult(string assignmentId = nu
/// Initializes a new instance of RouterQueueStatistics.
/// Id of the queue these details are about.
/// Length of the queue: total number of enqueued jobs.
- /// The estimated wait time of this queue rounded up to the nearest minute, grouped by job priority.
+ ///
+ /// The estimated wait time of this queue rounded up to the nearest minute, grouped
+ /// by job priority
+ ///
/// The wait time of the job that has been enqueued in this queue for the longest.
/// A new instance for mocking.
public static RouterQueueStatistics RouterQueueStatistics(string queueId = null, int length = default, IReadOnlyDictionary estimatedWaitTimeMinutes = null, double? longestJobWaitTimeMinutes = null)
@@ -77,6 +494,18 @@ public static RouterQueueStatistics RouterQueueStatistics(string queueId = null,
return new RouterQueueStatistics(queueId, length, estimatedWaitTimeMinutes, longestJobWaitTimeMinutes);
}
+ /// Initializes a new instance of ChannelConfiguration.
+ ///
+ /// The amount of capacity that an instance of a job of this channel will consume
+ /// of the total worker capacity.
+ ///
+ /// The maximum number of jobs that can be supported concurrently for this channel.
+ /// A new instance for mocking.
+ public static ChannelConfiguration ChannelConfiguration(int capacityCostPerJob = default, int? maxNumberOfJobs = null)
+ {
+ return new ChannelConfiguration(capacityCostPerJob, maxNumberOfJobs);
+ }
+
/// Initializes a new instance of RouterJobOffer.
/// The Id of the offer.
/// The Id of the job.
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CompleteJobRequest.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CompleteJobRequest.Serialization.cs
similarity index 71%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CompleteJobRequest.Serialization.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/CompleteJobRequest.Serialization.cs
index f3b60b47d21aa..a903934bdf7a0 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CompleteJobRequest.Serialization.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CompleteJobRequest.Serialization.cs
@@ -24,5 +24,13 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
}
writer.WriteEndObject();
}
+
+ /// Convert into a Utf8JsonRequestContent.
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this);
+ return content;
+ }
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CompleteJobRequest.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CompleteJobRequest.cs
similarity index 59%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CompleteJobRequest.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/CompleteJobRequest.cs
index 5ccc3b36b8b77..6c2b949384ebb 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CompleteJobRequest.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CompleteJobRequest.cs
@@ -23,9 +23,24 @@ public CompleteJobRequest(string assignmentId)
AssignmentId = assignmentId;
}
+ /// Initializes a new instance of CompleteJobRequest.
+ /// The assignment within the job to complete.
+ ///
+ /// (Optional) A note that will be appended to the jobs' Notes collection with the
+ /// current timestamp.
+ ///
+ internal CompleteJobRequest(string assignmentId, string note)
+ {
+ AssignmentId = assignmentId;
+ Note = note;
+ }
+
/// The assignment within the job to complete.
public string AssignmentId { get; }
- /// (Optional) A note that will be appended to the jobs' Notes collection with the current timestamp.
+ ///
+ /// (Optional) A note that will be appended to the jobs' Notes collection with the
+ /// current timestamp.
+ ///
public string Note { get; set; }
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalQueueSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalQueueSelectorAttachment.Serialization.cs
similarity index 69%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalQueueSelectorAttachment.Serialization.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalQueueSelectorAttachment.Serialization.cs
index 72d1abc865589..0031202913a4f 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalQueueSelectorAttachment.Serialization.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalQueueSelectorAttachment.Serialization.cs
@@ -7,29 +7,13 @@
using System.Collections.Generic;
using System.Text.Json;
+using Azure;
using Azure.Core;
namespace Azure.Communication.JobRouter
{
- public partial class ConditionalQueueSelectorAttachment : IUtf8JsonSerializable
+ public partial class ConditionalQueueSelectorAttachment
{
- void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
- {
- writer.WriteStartObject();
- writer.WritePropertyName("condition"u8);
- writer.WriteObjectValue(Condition);
- writer.WritePropertyName("queueSelectors"u8);
- writer.WriteStartArray();
- foreach (var item in QueueSelectors)
- {
- writer.WriteObjectValue(item);
- }
- writer.WriteEndArray();
- writer.WritePropertyName("kind"u8);
- writer.WriteStringValue(Kind);
- writer.WriteEndObject();
- }
-
internal static ConditionalQueueSelectorAttachment DeserializeConditionalQueueSelectorAttachment(JsonElement element)
{
if (element.ValueKind == JsonValueKind.Null)
@@ -37,7 +21,7 @@ internal static ConditionalQueueSelectorAttachment DeserializeConditionalQueueSe
return null;
}
RouterRule condition = default;
- IList queueSelectors = default;
+ IReadOnlyList queueSelectors = default;
string kind = default;
foreach (var property in element.EnumerateObject())
{
@@ -64,5 +48,13 @@ internal static ConditionalQueueSelectorAttachment DeserializeConditionalQueueSe
}
return new ConditionalQueueSelectorAttachment(kind, condition, queueSelectors);
}
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static new ConditionalQueueSelectorAttachment FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeConditionalQueueSelectorAttachment(document.RootElement);
+ }
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalQueueSelectorAttachment.cs
new file mode 100644
index 0000000000000..3518611c8b82c
--- /dev/null
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalQueueSelectorAttachment.cs
@@ -0,0 +1,94 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Azure.Core;
+
+namespace Azure.Communication.JobRouter
+{
+ ///
+ /// Describes a set of queue selectors that will be attached if the given condition
+ /// resolves to true
+ ///
+ public partial class ConditionalQueueSelectorAttachment : QueueSelectorAttachment
+ {
+ /// Initializes a new instance of ConditionalQueueSelectorAttachment.
+ ///
+ /// A rule of one of the following types:
+ ///
+ /// StaticRule: A rule
+ /// providing static rules that always return the same result, regardless of
+ /// input.
+ /// DirectMapRule: A rule that return the same labels as the input
+ /// labels.
+ /// ExpressionRule: A rule providing inline expression
+ /// rules.
+ /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure
+ /// Function.
+ /// WebhookRule: A rule providing a binding to a webserver following
+ /// OAuth2.0 authentication protocol.
+ ///
+ /// The queue selectors to attach.
+ /// or is null.
+ internal ConditionalQueueSelectorAttachment(RouterRule condition, IEnumerable queueSelectors)
+ {
+ Argument.AssertNotNull(condition, nameof(condition));
+ Argument.AssertNotNull(queueSelectors, nameof(queueSelectors));
+
+ Kind = "conditional";
+ Condition = condition;
+ QueueSelectors = queueSelectors.ToList();
+ }
+
+ /// Initializes a new instance of ConditionalQueueSelectorAttachment.
+ /// Discriminator.
+ ///
+ /// A rule of one of the following types:
+ ///
+ /// StaticRule: A rule
+ /// providing static rules that always return the same result, regardless of
+ /// input.
+ /// DirectMapRule: A rule that return the same labels as the input
+ /// labels.
+ /// ExpressionRule: A rule providing inline expression
+ /// rules.
+ /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure
+ /// Function.
+ /// WebhookRule: A rule providing a binding to a webserver following
+ /// OAuth2.0 authentication protocol.
+ ///
+ /// The queue selectors to attach.
+ internal ConditionalQueueSelectorAttachment(string kind, RouterRule condition, IReadOnlyList queueSelectors) : base(kind)
+ {
+ Condition = condition;
+ QueueSelectors = queueSelectors;
+ }
+
+ ///
+ /// A rule of one of the following types:
+ ///
+ /// StaticRule: A rule
+ /// providing static rules that always return the same result, regardless of
+ /// input.
+ /// DirectMapRule: A rule that return the same labels as the input
+ /// labels.
+ /// ExpressionRule: A rule providing inline expression
+ /// rules.
+ /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure
+ /// Function.
+ /// WebhookRule: A rule providing a binding to a webserver following
+ /// OAuth2.0 authentication protocol.
+ /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
+ /// The available derived classes include , , , and .
+ ///
+ public RouterRule Condition { get; }
+ /// The queue selectors to attach.
+ public IReadOnlyList QueueSelectors { get; }
+ }
+}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalWorkerSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalWorkerSelectorAttachment.Serialization.cs
similarity index 69%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalWorkerSelectorAttachment.Serialization.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalWorkerSelectorAttachment.Serialization.cs
index 6feaaba94f2c7..55e38315bb962 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalWorkerSelectorAttachment.Serialization.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalWorkerSelectorAttachment.Serialization.cs
@@ -7,29 +7,13 @@
using System.Collections.Generic;
using System.Text.Json;
+using Azure;
using Azure.Core;
namespace Azure.Communication.JobRouter
{
- public partial class ConditionalWorkerSelectorAttachment : IUtf8JsonSerializable
+ public partial class ConditionalWorkerSelectorAttachment
{
- void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
- {
- writer.WriteStartObject();
- writer.WritePropertyName("condition"u8);
- writer.WriteObjectValue(Condition);
- writer.WritePropertyName("workerSelectors"u8);
- writer.WriteStartArray();
- foreach (var item in WorkerSelectors)
- {
- writer.WriteObjectValue(item);
- }
- writer.WriteEndArray();
- writer.WritePropertyName("kind"u8);
- writer.WriteStringValue(Kind);
- writer.WriteEndObject();
- }
-
internal static ConditionalWorkerSelectorAttachment DeserializeConditionalWorkerSelectorAttachment(JsonElement element)
{
if (element.ValueKind == JsonValueKind.Null)
@@ -37,7 +21,7 @@ internal static ConditionalWorkerSelectorAttachment DeserializeConditionalWorker
return null;
}
RouterRule condition = default;
- IList workerSelectors = default;
+ IReadOnlyList workerSelectors = default;
string kind = default;
foreach (var property in element.EnumerateObject())
{
@@ -64,5 +48,13 @@ internal static ConditionalWorkerSelectorAttachment DeserializeConditionalWorker
}
return new ConditionalWorkerSelectorAttachment(kind, condition, workerSelectors);
}
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static new ConditionalWorkerSelectorAttachment FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeConditionalWorkerSelectorAttachment(document.RootElement);
+ }
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalWorkerSelectorAttachment.cs
new file mode 100644
index 0000000000000..a3051bde4479b
--- /dev/null
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ConditionalWorkerSelectorAttachment.cs
@@ -0,0 +1,94 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+using System.Collections.Generic;
+using System.Linq;
+using Azure.Core;
+
+namespace Azure.Communication.JobRouter
+{
+ ///
+ /// Describes a set of worker selectors that will be attached if the given
+ /// condition resolves to true
+ ///
+ public partial class ConditionalWorkerSelectorAttachment : WorkerSelectorAttachment
+ {
+ /// Initializes a new instance of ConditionalWorkerSelectorAttachment.
+ ///
+ /// A rule of one of the following types:
+ ///
+ /// StaticRule: A rule
+ /// providing static rules that always return the same result, regardless of
+ /// input.
+ /// DirectMapRule: A rule that return the same labels as the input
+ /// labels.
+ /// ExpressionRule: A rule providing inline expression
+ /// rules.
+ /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure
+ /// Function.
+ /// WebhookRule: A rule providing a binding to a webserver following
+ /// OAuth2.0 authentication protocol.
+ ///
+ /// The worker selectors to attach.
+ /// or is null.
+ internal ConditionalWorkerSelectorAttachment(RouterRule condition, IEnumerable workerSelectors)
+ {
+ Argument.AssertNotNull(condition, nameof(condition));
+ Argument.AssertNotNull(workerSelectors, nameof(workerSelectors));
+
+ Kind = "conditional";
+ Condition = condition;
+ WorkerSelectors = workerSelectors.ToList();
+ }
+
+ /// Initializes a new instance of ConditionalWorkerSelectorAttachment.
+ /// Discriminator.
+ ///
+ /// A rule of one of the following types:
+ ///
+ /// StaticRule: A rule
+ /// providing static rules that always return the same result, regardless of
+ /// input.
+ /// DirectMapRule: A rule that return the same labels as the input
+ /// labels.
+ /// ExpressionRule: A rule providing inline expression
+ /// rules.
+ /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure
+ /// Function.
+ /// WebhookRule: A rule providing a binding to a webserver following
+ /// OAuth2.0 authentication protocol.
+ ///
+ /// The worker selectors to attach.
+ internal ConditionalWorkerSelectorAttachment(string kind, RouterRule condition, IReadOnlyList workerSelectors) : base(kind)
+ {
+ Condition = condition;
+ WorkerSelectors = workerSelectors;
+ }
+
+ ///
+ /// A rule of one of the following types:
+ ///
+ /// StaticRule: A rule
+ /// providing static rules that always return the same result, regardless of
+ /// input.
+ /// DirectMapRule: A rule that return the same labels as the input
+ /// labels.
+ /// ExpressionRule: A rule providing inline expression
+ /// rules.
+ /// FunctionRule: A rule providing a binding to an HTTP Triggered Azure
+ /// Function.
+ /// WebhookRule: A rule providing a binding to a webserver following
+ /// OAuth2.0 authentication protocol.
+ /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
+ /// The available derived classes include , , , and .
+ ///
+ public RouterRule Condition { get; }
+ /// The worker selectors to attach.
+ public IReadOnlyList WorkerSelectors { get; }
+ }
+}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Configuration.json b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Configuration.json
new file mode 100644
index 0000000000000..924c7e0303b72
--- /dev/null
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Configuration.json
@@ -0,0 +1,11 @@
+{
+ "output-folder": ".",
+ "namespace": "Azure.Communication.JobRouter",
+ "library-name": "Azure.Communication.JobRouter",
+ "shared-source-folders": [
+ "../../TempTypeSpecFiles/Communication.JobRouter/node_modules/@autorest/csharp/Generator.Shared",
+ "../../TempTypeSpecFiles/Communication.JobRouter/node_modules/@autorest/csharp/Azure.Core.Shared"
+ ],
+ "use-overloads-between-protocol-and-convenience": true,
+ "model-namespace": false
+}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DeclineJobOfferRequest.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DeclineJobOfferRequest.Serialization.cs
similarity index 62%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DeclineJobOfferRequest.Serialization.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/DeclineJobOfferRequest.Serialization.cs
index e865afcce73e4..0f4f223a9401c 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DeclineJobOfferRequest.Serialization.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DeclineJobOfferRequest.Serialization.cs
@@ -10,7 +10,7 @@
namespace Azure.Communication.JobRouter
{
- public partial class DeclineJobOfferRequest : IUtf8JsonSerializable
+ internal partial class DeclineJobOfferRequest : IUtf8JsonSerializable
{
void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
{
@@ -22,5 +22,13 @@ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
}
writer.WriteEndObject();
}
+
+ /// Convert into a Utf8JsonRequestContent.
+ internal virtual RequestContent ToRequestContent()
+ {
+ var content = new Utf8JsonRequestContent();
+ content.JsonWriter.WriteObjectValue(this);
+ return content;
+ }
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/DeclineJobOfferRequest.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DeclineJobOfferRequest.cs
new file mode 100644
index 0000000000000..11cf5452faefd
--- /dev/null
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DeclineJobOfferRequest.cs
@@ -0,0 +1,46 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+using System;
+
+namespace Azure.Communication.JobRouter
+{
+ /// Request payload for declining offers.
+ internal partial class DeclineJobOfferRequest
+ {
+ /// Initializes a new instance of DeclineJobOfferRequest.
+ public DeclineJobOfferRequest()
+ {
+ }
+
+ /// Initializes a new instance of DeclineJobOfferRequest.
+ ///
+ /// If the RetryOfferAt is not provided, then this job will not be offered again to
+ /// the worker who declined this job unless
+ /// the worker is de-registered and
+ /// re-registered. If a RetryOfferAt time is provided, then the job will be
+ /// re-matched to
+ /// eligible workers at the retry time in UTC. The worker that
+ /// declined the job will also be eligible for the job at that time.
+ ///
+ internal DeclineJobOfferRequest(DateTimeOffset? retryOfferAt)
+ {
+ RetryOfferAt = retryOfferAt;
+ }
+
+ ///
+ /// If the RetryOfferAt is not provided, then this job will not be offered again to
+ /// the worker who declined this job unless
+ /// the worker is de-registered and
+ /// re-registered. If a RetryOfferAt time is provided, then the job will be
+ /// re-matched to
+ /// eligible workers at the retry time in UTC. The worker that
+ /// declined the job will also be eligible for the job at that time.
+ ///
+ public DateTimeOffset? RetryOfferAt { get; set; }
+ }
+}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DirectMapRouterRule.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DirectMapRouterRule.Serialization.cs
similarity index 65%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DirectMapRouterRule.Serialization.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/DirectMapRouterRule.Serialization.cs
index daef8caee0d24..b8e740fbe7a9a 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DirectMapRouterRule.Serialization.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DirectMapRouterRule.Serialization.cs
@@ -6,20 +6,13 @@
#nullable disable
using System.Text.Json;
+using Azure;
using Azure.Core;
namespace Azure.Communication.JobRouter
{
- public partial class DirectMapRouterRule : IUtf8JsonSerializable
+ public partial class DirectMapRouterRule
{
- void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
- {
- writer.WriteStartObject();
- writer.WritePropertyName("kind"u8);
- writer.WriteStringValue(Kind);
- writer.WriteEndObject();
- }
-
internal static DirectMapRouterRule DeserializeDirectMapRouterRule(JsonElement element)
{
if (element.ValueKind == JsonValueKind.Null)
@@ -37,5 +30,13 @@ internal static DirectMapRouterRule DeserializeDirectMapRouterRule(JsonElement e
}
return new DirectMapRouterRule(kind);
}
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static new DirectMapRouterRule FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeDirectMapRouterRule(document.RootElement);
+ }
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DirectMapRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DirectMapRouterRule.cs
similarity index 78%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DirectMapRouterRule.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/DirectMapRouterRule.cs
index 353584682545c..d3a62a43c2d0b 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DirectMapRouterRule.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DirectMapRouterRule.cs
@@ -11,16 +11,15 @@ namespace Azure.Communication.JobRouter
public partial class DirectMapRouterRule : RouterRule
{
/// Initializes a new instance of DirectMapRouterRule.
- public DirectMapRouterRule()
+ internal DirectMapRouterRule()
{
Kind = "direct-map-rule";
}
/// Initializes a new instance of DirectMapRouterRule.
- /// The type discriminator describing a sub-type of Rule.
+ /// Discriminator.
internal DirectMapRouterRule(string kind) : base(kind)
{
- Kind = kind ?? "direct-map-rule";
}
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionMode.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionMode.Serialization.cs
similarity index 52%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionMode.Serialization.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionMode.Serialization.cs
index f393cfc3ad711..0b8916b71436b 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionMode.Serialization.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionMode.Serialization.cs
@@ -6,35 +6,12 @@
#nullable disable
using System.Text.Json;
-using Azure.Core;
+using Azure;
namespace Azure.Communication.JobRouter
{
- public partial class DistributionMode : IUtf8JsonSerializable
+ public partial class DistributionMode
{
- void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
- {
- writer.WriteStartObject();
- writer.WritePropertyName("kind"u8);
- writer.WriteStringValue(Kind);
- if (Optional.IsDefined(MinConcurrentOffers))
- {
- writer.WritePropertyName("minConcurrentOffers"u8);
- writer.WriteNumberValue(MinConcurrentOffers);
- }
- if (Optional.IsDefined(MaxConcurrentOffers))
- {
- writer.WritePropertyName("maxConcurrentOffers"u8);
- writer.WriteNumberValue(MaxConcurrentOffers);
- }
- if (Optional.IsDefined(BypassSelectors))
- {
- writer.WritePropertyName("bypassSelectors"u8);
- writer.WriteBooleanValue(BypassSelectors.Value);
- }
- writer.WriteEndObject();
- }
-
internal static DistributionMode DeserializeDistributionMode(JsonElement element)
{
if (element.ValueKind == JsonValueKind.Null)
@@ -52,5 +29,13 @@ internal static DistributionMode DeserializeDistributionMode(JsonElement element
}
return UnknownDistributionMode.DeserializeUnknownDistributionMode(element);
}
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static DistributionMode FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeDistributionMode(document.RootElement);
+ }
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionMode.cs
similarity index 73%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionMode.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionMode.cs
index 6267ec74677fd..04b9938f68dcb 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionMode.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionMode.cs
@@ -20,14 +20,17 @@ protected DistributionMode()
}
/// Initializes a new instance of DistributionMode.
- /// The type discriminator describing a sub-type of Mode.
+ /// Discriminator.
/// Governs the minimum desired number of active concurrent offers a job can have.
/// Governs the maximum number of active concurrent offers a job can have.
///
/// (Optional)
- /// If set to true, then router will match workers to jobs even if they don't match label selectors.
- /// Warning: You may get workers that are not qualified for the job they are matched with if you set this
- /// variable to true. This flag is intended more for temporary usage.
+ /// If set to true, then router will match workers to jobs even if they
+ /// don't match label selectors.
+ /// Warning: You may get workers that are not
+ /// qualified for the job they are matched with if you set this
+ /// variable to true.
+ /// This flag is intended more for temporary usage.
/// By default, set to false.
///
internal DistributionMode(string kind, int minConcurrentOffers, int maxConcurrentOffers, bool? bypassSelectors)
@@ -38,15 +41,18 @@ internal DistributionMode(string kind, int minConcurrentOffers, int maxConcurren
BypassSelectors = bypassSelectors;
}
- /// The type discriminator describing a sub-type of Mode.
+ /// Discriminator.
internal string Kind { get; set; }
///
/// (Optional)
- /// If set to true, then router will match workers to jobs even if they don't match label selectors.
- /// Warning: You may get workers that are not qualified for the job they are matched with if you set this
- /// variable to true. This flag is intended more for temporary usage.
+ /// If set to true, then router will match workers to jobs even if they
+ /// don't match label selectors.
+ /// Warning: You may get workers that are not
+ /// qualified for the job they are matched with if you set this
+ /// variable to true.
+ /// This flag is intended more for temporary usage.
/// By default, set to false.
///
- public bool? BypassSelectors { get; set; }
+ public bool? BypassSelectors { get; }
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicy.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicy.Serialization.cs
similarity index 66%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicy.Serialization.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicy.Serialization.cs
index c1e9ce5b1a940..e501e5eb5f418 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicy.Serialization.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicy.Serialization.cs
@@ -6,41 +6,21 @@
#nullable disable
using System.Text.Json;
+using Azure;
using Azure.Communication.JobRouter;
using Azure.Core;
namespace Azure.Communication.JobRouter.Models
{
- public partial class DistributionPolicy : IUtf8JsonSerializable
+ public partial class DistributionPolicy
{
- void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
- {
- writer.WriteStartObject();
- if (Optional.IsDefined(Name))
- {
- writer.WritePropertyName("name"u8);
- writer.WriteStringValue(Name);
- }
- if (Optional.IsDefined(_offerExpiresAfterSeconds))
- {
- writer.WritePropertyName("offerExpiresAfterSeconds"u8);
- writer.WriteNumberValue(_offerExpiresAfterSeconds.Value);
- }
- if (Optional.IsDefined(Mode))
- {
- writer.WritePropertyName("mode"u8);
- writer.WriteObjectValue(Mode);
- }
- writer.WriteEndObject();
- }
-
internal static DistributionPolicy DeserializeDistributionPolicy(JsonElement element)
{
if (element.ValueKind == JsonValueKind.Null)
{
return null;
}
- Optional id = default;
+ string id = default;
Optional name = default;
Optional offerExpiresAfterSeconds = default;
Optional mode = default;
@@ -75,7 +55,15 @@ internal static DistributionPolicy DeserializeDistributionPolicy(JsonElement ele
continue;
}
}
- return new DistributionPolicy(id.Value, name.Value, Optional.ToNullable(offerExpiresAfterSeconds), mode.Value);
+ return new DistributionPolicy(id, name.Value, Optional.ToNullable(offerExpiresAfterSeconds), mode.Value);
+ }
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static DistributionPolicy FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeDistributionPolicy(document.RootElement);
}
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicy.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicy.cs
similarity index 61%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicy.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicy.cs
index db3ac9175cdb2..82379d6939867 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicy.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicy.cs
@@ -15,12 +15,11 @@ public partial class DistributionPolicy
/// Initializes a new instance of DistributionPolicy.
/// The unique identifier of the policy.
/// The human readable name of the policy.
- /// The number of seconds after which any offers created under this policy will be expired.
- ///
- /// Abstract base class for defining a distribution mode
- /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
- /// The available derived classes include , and .
+ ///
+ /// The number of seconds after which any offers created under this policy will be
+ /// expired.
///
+ /// Abstract base class for defining a distribution mode.
internal DistributionPolicy(string id, string name, double? offerExpiresAfterSeconds, DistributionMode mode)
{
Id = id;
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyItem.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicyItem.Serialization.cs
similarity index 67%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyItem.Serialization.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicyItem.Serialization.cs
index 0a2b5a4f8eda3..60018b8171410 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyItem.Serialization.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicyItem.Serialization.cs
@@ -6,6 +6,7 @@
#nullable disable
using System.Text.Json;
+using Azure;
using Azure.Core;
namespace Azure.Communication.JobRouter.Models
@@ -18,16 +19,12 @@ internal static DistributionPolicyItem DeserializeDistributionPolicyItem(JsonEle
{
return null;
}
- Optional distributionPolicy = default;
- Optional etag = default;
+ DistributionPolicy distributionPolicy = default;
+ string etag = default;
foreach (var property in element.EnumerateObject())
{
if (property.NameEquals("distributionPolicy"u8))
{
- if (property.Value.ValueKind == JsonValueKind.Null)
- {
- continue;
- }
distributionPolicy = DistributionPolicy.DeserializeDistributionPolicy(property.Value);
continue;
}
@@ -37,7 +34,15 @@ internal static DistributionPolicyItem DeserializeDistributionPolicyItem(JsonEle
continue;
}
}
- return new DistributionPolicyItem(distributionPolicy.Value, etag.Value);
+ return new DistributionPolicyItem(distributionPolicy, etag);
+ }
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static DistributionPolicyItem FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeDistributionPolicyItem(document.RootElement);
}
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicyItem.cs
similarity index 74%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyItem.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicyItem.cs
index bb862e636db22..b1621e89a800e 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyItem.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicyItem.cs
@@ -5,21 +5,23 @@
#nullable disable
+using System;
+using Azure.Core;
+
namespace Azure.Communication.JobRouter.Models
{
/// Paged instance of DistributionPolicy.
public partial class DistributionPolicyItem
{
- /// Initializes a new instance of DistributionPolicyItem.
- internal DistributionPolicyItem()
- {
- }
-
/// Initializes a new instance of DistributionPolicyItem.
/// Policy governing how jobs are distributed to workers.
/// (Optional) The Concurrency Token.
+ /// or is null.
internal DistributionPolicyItem(DistributionPolicy distributionPolicy, string etag)
{
+ Argument.AssertNotNull(distributionPolicy, nameof(distributionPolicy));
+ Argument.AssertNotNull(etag, nameof(etag));
+
DistributionPolicy = distributionPolicy;
_etag = etag;
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Docs/JobRouterAdministrationRestClient.xml b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Docs/JobRouterAdministrationRestClient.xml
new file mode 100644
index 0000000000000..918ac1eda27a2
--- /dev/null
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Docs/JobRouterAdministrationRestClient.xml
@@ -0,0 +1,1029 @@
+
+
+
+
+
+This sample shows how to call UpsertDistributionPolicyAsync with required parameters and parse the result.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+var data = new {};
+
+Response response = await client.UpsertDistributionPolicyAsync("", RequestContent.Create(data));
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+]]>
+This sample shows how to call UpsertDistributionPolicyAsync with all parameters and request content, and how to parse the result.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+var data = new {
+ name = "",
+ offerExpiresAfterSeconds = 123.45d,
+ mode = new {
+ scoringRule = new {
+ kind = "direct-map-rule",
+ },
+ scoringRuleOptions = new {
+ batchSize = 1234,
+ scoringParameters = new[] {
+ "jobLabels"
+ },
+ allowScoringBatchOfWorkers = true,
+ descendingOrder = true,
+ },
+ kind = "best-worker",
+ minConcurrentOffers = 1234,
+ maxConcurrentOffers = 1234,
+ bypassSelectors = true,
+ },
+};
+
+Response response = await client.UpsertDistributionPolicyAsync("", RequestContent.Create(data), null);
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+Console.WriteLine(result.GetProperty("name").ToString());
+Console.WriteLine(result.GetProperty("offerExpiresAfterSeconds").ToString());
+Console.WriteLine(result.GetProperty("mode").GetProperty("kind").ToString());
+Console.WriteLine(result.GetProperty("mode").GetProperty("minConcurrentOffers").ToString());
+Console.WriteLine(result.GetProperty("mode").GetProperty("maxConcurrentOffers").ToString());
+Console.WriteLine(result.GetProperty("mode").GetProperty("bypassSelectors").ToString());
+]]>
+
+
+
+
+This sample shows how to call UpsertDistributionPolicy with required parameters and parse the result.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+var data = new {};
+
+Response response = client.UpsertDistributionPolicy("", RequestContent.Create(data));
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+]]>
+This sample shows how to call UpsertDistributionPolicy with all parameters and request content, and how to parse the result.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+var data = new {
+ name = "",
+ offerExpiresAfterSeconds = 123.45d,
+ mode = new {
+ scoringRule = new {
+ kind = "direct-map-rule",
+ },
+ scoringRuleOptions = new {
+ batchSize = 1234,
+ scoringParameters = new[] {
+ "jobLabels"
+ },
+ allowScoringBatchOfWorkers = true,
+ descendingOrder = true,
+ },
+ kind = "best-worker",
+ minConcurrentOffers = 1234,
+ maxConcurrentOffers = 1234,
+ bypassSelectors = true,
+ },
+};
+
+Response response = client.UpsertDistributionPolicy("", RequestContent.Create(data), null);
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+Console.WriteLine(result.GetProperty("name").ToString());
+Console.WriteLine(result.GetProperty("offerExpiresAfterSeconds").ToString());
+Console.WriteLine(result.GetProperty("mode").GetProperty("kind").ToString());
+Console.WriteLine(result.GetProperty("mode").GetProperty("minConcurrentOffers").ToString());
+Console.WriteLine(result.GetProperty("mode").GetProperty("maxConcurrentOffers").ToString());
+Console.WriteLine(result.GetProperty("mode").GetProperty("bypassSelectors").ToString());
+]]>
+
+
+
+
+This sample shows how to call GetDistributionPolicyAsync with required parameters.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+var result = await client.GetDistributionPolicyAsync("");
+]]>
+
+
+
+
+This sample shows how to call GetDistributionPolicy with required parameters.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+var result = client.GetDistributionPolicy("");
+]]>
+
+
+
+
+This sample shows how to call GetDistributionPolicyAsync with required parameters and parse the result.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+Response response = await client.GetDistributionPolicyAsync("", new RequestContext());
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+Console.WriteLine(result.GetProperty("name").ToString());
+Console.WriteLine(result.GetProperty("offerExpiresAfterSeconds").ToString());
+Console.WriteLine(result.GetProperty("mode").GetProperty("kind").ToString());
+Console.WriteLine(result.GetProperty("mode").GetProperty("minConcurrentOffers").ToString());
+Console.WriteLine(result.GetProperty("mode").GetProperty("maxConcurrentOffers").ToString());
+Console.WriteLine(result.GetProperty("mode").GetProperty("bypassSelectors").ToString());
+]]>
+
+
+
+
+This sample shows how to call GetDistributionPolicy with required parameters and parse the result.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+Response response = client.GetDistributionPolicy("", new RequestContext());
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+Console.WriteLine(result.GetProperty("name").ToString());
+Console.WriteLine(result.GetProperty("offerExpiresAfterSeconds").ToString());
+Console.WriteLine(result.GetProperty("mode").GetProperty("kind").ToString());
+Console.WriteLine(result.GetProperty("mode").GetProperty("minConcurrentOffers").ToString());
+Console.WriteLine(result.GetProperty("mode").GetProperty("maxConcurrentOffers").ToString());
+Console.WriteLine(result.GetProperty("mode").GetProperty("bypassSelectors").ToString());
+]]>
+
+
+
+
+This sample shows how to call DeleteDistributionPolicyAsync with required parameters.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+Response response = await client.DeleteDistributionPolicyAsync("");
+Console.WriteLine(response.Status);
+]]>
+
+
+
+
+This sample shows how to call DeleteDistributionPolicy with required parameters.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+Response response = client.DeleteDistributionPolicy("");
+Console.WriteLine(response.Status);
+]]>
+
+
+
+
+This sample shows how to call UpsertClassificationPolicyAsync with required parameters and parse the result.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+var data = new {};
+
+Response response = await client.UpsertClassificationPolicyAsync("", RequestContent.Create(data));
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+]]>
+This sample shows how to call UpsertClassificationPolicyAsync with all parameters and request content, and how to parse the result.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+var data = new {
+ name = "",
+ fallbackQueueId = "",
+ queueSelectors = new[] {
+ new {
+ condition = new {
+ kind = "direct-map-rule",
+ },
+ queueSelectors = new[] {
+ new {
+ key = "",
+ labelOperator = "equal",
+ value = new {},
+ }
+ },
+ kind = "conditional",
+ }
+ },
+ prioritizationRule = new {
+ kind = "direct-map-rule",
+ },
+ workerSelectors = new[] {
+ new {
+ condition = new {
+ kind = "direct-map-rule",
+ },
+ workerSelectors = new[] {
+ new {
+ key = "",
+ labelOperator = "equal",
+ value = new {},
+ expiresAfterSeconds = 123.45d,
+ expedite = true,
+ }
+ },
+ kind = "conditional",
+ }
+ },
+};
+
+Response response = await client.UpsertClassificationPolicyAsync("", RequestContent.Create(data), null);
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+Console.WriteLine(result.GetProperty("name").ToString());
+Console.WriteLine(result.GetProperty("fallbackQueueId").ToString());
+Console.WriteLine(result.GetProperty("queueSelectors")[0].GetProperty("kind").ToString());
+Console.WriteLine(result.GetProperty("prioritizationRule").GetProperty("kind").ToString());
+Console.WriteLine(result.GetProperty("workerSelectors")[0].GetProperty("kind").ToString());
+]]>
+
+
+
+
+This sample shows how to call UpsertClassificationPolicy with required parameters and parse the result.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+var data = new {};
+
+Response response = client.UpsertClassificationPolicy("", RequestContent.Create(data));
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+]]>
+This sample shows how to call UpsertClassificationPolicy with all parameters and request content, and how to parse the result.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+var data = new {
+ name = "",
+ fallbackQueueId = "",
+ queueSelectors = new[] {
+ new {
+ condition = new {
+ kind = "direct-map-rule",
+ },
+ queueSelectors = new[] {
+ new {
+ key = "",
+ labelOperator = "equal",
+ value = new {},
+ }
+ },
+ kind = "conditional",
+ }
+ },
+ prioritizationRule = new {
+ kind = "direct-map-rule",
+ },
+ workerSelectors = new[] {
+ new {
+ condition = new {
+ kind = "direct-map-rule",
+ },
+ workerSelectors = new[] {
+ new {
+ key = "",
+ labelOperator = "equal",
+ value = new {},
+ expiresAfterSeconds = 123.45d,
+ expedite = true,
+ }
+ },
+ kind = "conditional",
+ }
+ },
+};
+
+Response response = client.UpsertClassificationPolicy("", RequestContent.Create(data), null);
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+Console.WriteLine(result.GetProperty("name").ToString());
+Console.WriteLine(result.GetProperty("fallbackQueueId").ToString());
+Console.WriteLine(result.GetProperty("queueSelectors")[0].GetProperty("kind").ToString());
+Console.WriteLine(result.GetProperty("prioritizationRule").GetProperty("kind").ToString());
+Console.WriteLine(result.GetProperty("workerSelectors")[0].GetProperty("kind").ToString());
+]]>
+
+
+
+
+This sample shows how to call GetClassificationPolicyAsync with required parameters.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+var result = await client.GetClassificationPolicyAsync("");
+]]>
+
+
+
+
+This sample shows how to call GetClassificationPolicy with required parameters.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+var result = client.GetClassificationPolicy("");
+]]>
+
+
+
+
+This sample shows how to call GetClassificationPolicyAsync with required parameters and parse the result.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+Response response = await client.GetClassificationPolicyAsync("", new RequestContext());
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+Console.WriteLine(result.GetProperty("name").ToString());
+Console.WriteLine(result.GetProperty("fallbackQueueId").ToString());
+Console.WriteLine(result.GetProperty("queueSelectors")[0].GetProperty("kind").ToString());
+Console.WriteLine(result.GetProperty("prioritizationRule").GetProperty("kind").ToString());
+Console.WriteLine(result.GetProperty("workerSelectors")[0].GetProperty("kind").ToString());
+]]>
+
+
+
+
+This sample shows how to call GetClassificationPolicy with required parameters and parse the result.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+Response response = client.GetClassificationPolicy("", new RequestContext());
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+Console.WriteLine(result.GetProperty("name").ToString());
+Console.WriteLine(result.GetProperty("fallbackQueueId").ToString());
+Console.WriteLine(result.GetProperty("queueSelectors")[0].GetProperty("kind").ToString());
+Console.WriteLine(result.GetProperty("prioritizationRule").GetProperty("kind").ToString());
+Console.WriteLine(result.GetProperty("workerSelectors")[0].GetProperty("kind").ToString());
+]]>
+
+
+
+
+This sample shows how to call DeleteClassificationPolicyAsync with required parameters.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+Response response = await client.DeleteClassificationPolicyAsync("");
+Console.WriteLine(response.Status);
+]]>
+
+
+
+
+This sample shows how to call DeleteClassificationPolicy with required parameters.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+Response response = client.DeleteClassificationPolicy("");
+Console.WriteLine(response.Status);
+]]>
+
+
+
+
+This sample shows how to call UpsertExceptionPolicyAsync with required parameters and parse the result.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+var data = new {};
+
+Response response = await client.UpsertExceptionPolicyAsync("", RequestContent.Create(data));
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+]]>
+This sample shows how to call UpsertExceptionPolicyAsync with all parameters and request content, and how to parse the result.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+var data = new {
+ name = "",
+ exceptionRules = new {
+ key = new {
+ trigger = new {
+ threshold = 1234,
+ kind = "queue-length",
+ },
+ actions = new {
+ key = new {
+ note = "",
+ dispositionCode = "",
+ kind = "cancel",
+ },
+ },
+ },
+ },
+};
+
+Response response = await client.UpsertExceptionPolicyAsync("", RequestContent.Create(data), null);
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+Console.WriteLine(result.GetProperty("name").ToString());
+Console.WriteLine(result.GetProperty("exceptionRules").GetProperty("").GetProperty("trigger").GetProperty("kind").ToString());
+Console.WriteLine(result.GetProperty("exceptionRules").GetProperty("").GetProperty("actions").GetProperty("").GetProperty("kind").ToString());
+]]>
+
+
+
+
+This sample shows how to call UpsertExceptionPolicy with required parameters and parse the result.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+var data = new {};
+
+Response response = client.UpsertExceptionPolicy("", RequestContent.Create(data));
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+]]>
+This sample shows how to call UpsertExceptionPolicy with all parameters and request content, and how to parse the result.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+var data = new {
+ name = "",
+ exceptionRules = new {
+ key = new {
+ trigger = new {
+ threshold = 1234,
+ kind = "queue-length",
+ },
+ actions = new {
+ key = new {
+ note = "",
+ dispositionCode = "",
+ kind = "cancel",
+ },
+ },
+ },
+ },
+};
+
+Response response = client.UpsertExceptionPolicy("", RequestContent.Create(data), null);
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+Console.WriteLine(result.GetProperty("name").ToString());
+Console.WriteLine(result.GetProperty("exceptionRules").GetProperty("").GetProperty("trigger").GetProperty("kind").ToString());
+Console.WriteLine(result.GetProperty("exceptionRules").GetProperty("").GetProperty("actions").GetProperty("").GetProperty("kind").ToString());
+]]>
+
+
+
+
+This sample shows how to call GetExceptionPolicyAsync with required parameters.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+var result = await client.GetExceptionPolicyAsync("");
+]]>
+
+
+
+
+This sample shows how to call GetExceptionPolicy with required parameters.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+var result = client.GetExceptionPolicy("");
+]]>
+
+
+
+
+This sample shows how to call GetExceptionPolicyAsync with required parameters and parse the result.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+Response response = await client.GetExceptionPolicyAsync("", new RequestContext());
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+Console.WriteLine(result.GetProperty("name").ToString());
+Console.WriteLine(result.GetProperty("exceptionRules").GetProperty("").GetProperty("trigger").GetProperty("kind").ToString());
+Console.WriteLine(result.GetProperty("exceptionRules").GetProperty("").GetProperty("actions").GetProperty("").GetProperty("kind").ToString());
+]]>
+
+
+
+
+This sample shows how to call GetExceptionPolicy with required parameters and parse the result.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+Response response = client.GetExceptionPolicy("", new RequestContext());
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+Console.WriteLine(result.GetProperty("name").ToString());
+Console.WriteLine(result.GetProperty("exceptionRules").GetProperty("").GetProperty("trigger").GetProperty("kind").ToString());
+Console.WriteLine(result.GetProperty("exceptionRules").GetProperty("").GetProperty("actions").GetProperty("").GetProperty("kind").ToString());
+]]>
+
+
+
+
+This sample shows how to call DeleteExceptionPolicyAsync with required parameters.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+Response response = await client.DeleteExceptionPolicyAsync("");
+Console.WriteLine(response.Status);
+]]>
+
+
+
+
+This sample shows how to call DeleteExceptionPolicy with required parameters.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+Response response = client.DeleteExceptionPolicy("");
+Console.WriteLine(response.Status);
+]]>
+
+
+
+
+This sample shows how to call UpsertQueueAsync with required parameters and parse the result.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+var data = new {};
+
+Response response = await client.UpsertQueueAsync("", RequestContent.Create(data));
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+]]>
+This sample shows how to call UpsertQueueAsync with all parameters and request content, and how to parse the result.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+var data = new {
+ name = "",
+ distributionPolicyId = "",
+ labels = new {
+ key = new {},
+ },
+ exceptionPolicyId = "",
+};
+
+Response response = await client.UpsertQueueAsync("", RequestContent.Create(data), null);
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+Console.WriteLine(result.GetProperty("name").ToString());
+Console.WriteLine(result.GetProperty("distributionPolicyId").ToString());
+Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString());
+Console.WriteLine(result.GetProperty("exceptionPolicyId").ToString());
+]]>
+
+
+
+
+This sample shows how to call UpsertQueue with required parameters and parse the result.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+var data = new {};
+
+Response response = client.UpsertQueue("", RequestContent.Create(data));
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+]]>
+This sample shows how to call UpsertQueue with all parameters and request content, and how to parse the result.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+var data = new {
+ name = "",
+ distributionPolicyId = "",
+ labels = new {
+ key = new {},
+ },
+ exceptionPolicyId = "",
+};
+
+Response response = client.UpsertQueue("", RequestContent.Create(data), null);
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+Console.WriteLine(result.GetProperty("name").ToString());
+Console.WriteLine(result.GetProperty("distributionPolicyId").ToString());
+Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString());
+Console.WriteLine(result.GetProperty("exceptionPolicyId").ToString());
+]]>
+
+
+
+
+This sample shows how to call GetQueueAsync with required parameters.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+var result = await client.GetQueueAsync("");
+]]>
+
+
+
+
+This sample shows how to call GetQueue with required parameters.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+var result = client.GetQueue("");
+]]>
+
+
+
+
+This sample shows how to call GetQueueAsync with required parameters and parse the result.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+Response response = await client.GetQueueAsync("", new RequestContext());
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+Console.WriteLine(result.GetProperty("name").ToString());
+Console.WriteLine(result.GetProperty("distributionPolicyId").ToString());
+Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString());
+Console.WriteLine(result.GetProperty("exceptionPolicyId").ToString());
+]]>
+
+
+
+
+This sample shows how to call GetQueue with required parameters and parse the result.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+Response response = client.GetQueue("", new RequestContext());
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+Console.WriteLine(result.GetProperty("name").ToString());
+Console.WriteLine(result.GetProperty("distributionPolicyId").ToString());
+Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString());
+Console.WriteLine(result.GetProperty("exceptionPolicyId").ToString());
+]]>
+
+
+
+
+This sample shows how to call DeleteQueueAsync with required parameters.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+Response response = await client.DeleteQueueAsync("");
+Console.WriteLine(response.Status);
+]]>
+
+
+
+
+This sample shows how to call DeleteQueue with required parameters.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+Response response = client.DeleteQueue("");
+Console.WriteLine(response.Status);
+]]>
+
+
+
+
+This sample shows how to call GetDistributionPoliciesAsync with required parameters.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+await foreach (var item in client.GetDistributionPoliciesAsync(1234))
+{
+}
+]]>
+
+
+
+
+This sample shows how to call GetDistributionPolicies with required parameters.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+foreach (var item in client.GetDistributionPolicies(1234))
+{
+}
+]]>
+
+
+
+
+This sample shows how to call GetDistributionPoliciesAsync with required parameters and parse the result.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+await foreach (var item in client.GetDistributionPoliciesAsync(1234, new RequestContext()))
+{
+ JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
+ Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("id").ToString());
+ Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("name").ToString());
+ Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("offerExpiresAfterSeconds").ToString());
+ Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("kind").ToString());
+ Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("minConcurrentOffers").ToString());
+ Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("maxConcurrentOffers").ToString());
+ Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("bypassSelectors").ToString());
+ Console.WriteLine(result.GetProperty("etag").ToString());
+}
+]]>
+
+
+
+
+This sample shows how to call GetDistributionPolicies with required parameters and parse the result.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+foreach (var item in client.GetDistributionPolicies(1234, new RequestContext()))
+{
+ JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
+ Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("id").ToString());
+ Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("name").ToString());
+ Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("offerExpiresAfterSeconds").ToString());
+ Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("kind").ToString());
+ Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("minConcurrentOffers").ToString());
+ Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("maxConcurrentOffers").ToString());
+ Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("mode").GetProperty("bypassSelectors").ToString());
+ Console.WriteLine(result.GetProperty("etag").ToString());
+}
+]]>
+
+
+
+
+This sample shows how to call GetClassificationPoliciesAsync with required parameters.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+await foreach (var item in client.GetClassificationPoliciesAsync(1234))
+{
+}
+]]>
+
+
+
+
+This sample shows how to call GetClassificationPolicies with required parameters.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+foreach (var item in client.GetClassificationPolicies(1234))
+{
+}
+]]>
+
+
+
+
+This sample shows how to call GetClassificationPoliciesAsync with required parameters and parse the result.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+await foreach (var item in client.GetClassificationPoliciesAsync(1234, new RequestContext()))
+{
+ JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
+ Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("id").ToString());
+ Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("name").ToString());
+ Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("fallbackQueueId").ToString());
+ Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("queueSelectors")[0].GetProperty("kind").ToString());
+ Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("prioritizationRule").GetProperty("kind").ToString());
+ Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("workerSelectors")[0].GetProperty("kind").ToString());
+ Console.WriteLine(result.GetProperty("etag").ToString());
+}
+]]>
+
+
+
+
+This sample shows how to call GetClassificationPolicies with required parameters and parse the result.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+foreach (var item in client.GetClassificationPolicies(1234, new RequestContext()))
+{
+ JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
+ Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("id").ToString());
+ Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("name").ToString());
+ Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("fallbackQueueId").ToString());
+ Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("queueSelectors")[0].GetProperty("kind").ToString());
+ Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("prioritizationRule").GetProperty("kind").ToString());
+ Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("workerSelectors")[0].GetProperty("kind").ToString());
+ Console.WriteLine(result.GetProperty("etag").ToString());
+}
+]]>
+
+
+
+
+This sample shows how to call GetExceptionPoliciesAsync with required parameters.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+await foreach (var item in client.GetExceptionPoliciesAsync(1234))
+{
+}
+]]>
+
+
+
+
+This sample shows how to call GetExceptionPolicies with required parameters.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+foreach (var item in client.GetExceptionPolicies(1234))
+{
+}
+]]>
+
+
+
+
+This sample shows how to call GetExceptionPoliciesAsync with required parameters and parse the result.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+await foreach (var item in client.GetExceptionPoliciesAsync(1234, new RequestContext()))
+{
+ JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
+ Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("id").ToString());
+ Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("name").ToString());
+ Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("exceptionRules").GetProperty("").GetProperty("trigger").GetProperty("kind").ToString());
+ Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("exceptionRules").GetProperty("").GetProperty("actions").GetProperty("").GetProperty("kind").ToString());
+ Console.WriteLine(result.GetProperty("etag").ToString());
+}
+]]>
+
+
+
+
+This sample shows how to call GetExceptionPolicies with required parameters and parse the result.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+foreach (var item in client.GetExceptionPolicies(1234, new RequestContext()))
+{
+ JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
+ Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("id").ToString());
+ Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("name").ToString());
+ Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("exceptionRules").GetProperty("").GetProperty("trigger").GetProperty("kind").ToString());
+ Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("exceptionRules").GetProperty("").GetProperty("actions").GetProperty("").GetProperty("kind").ToString());
+ Console.WriteLine(result.GetProperty("etag").ToString());
+}
+]]>
+
+
+
+
+This sample shows how to call GetQueuesAsync with required parameters.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+await foreach (var item in client.GetQueuesAsync(1234))
+{
+}
+]]>
+
+
+
+
+This sample shows how to call GetQueues with required parameters.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+foreach (var item in client.GetQueues(1234))
+{
+}
+]]>
+
+
+
+
+This sample shows how to call GetQueuesAsync with required parameters and parse the result.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+await foreach (var item in client.GetQueuesAsync(1234, new RequestContext()))
+{
+ JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
+ Console.WriteLine(result.GetProperty("queue").GetProperty("id").ToString());
+ Console.WriteLine(result.GetProperty("queue").GetProperty("name").ToString());
+ Console.WriteLine(result.GetProperty("queue").GetProperty("distributionPolicyId").ToString());
+ Console.WriteLine(result.GetProperty("queue").GetProperty("labels").GetProperty("").ToString());
+ Console.WriteLine(result.GetProperty("queue").GetProperty("exceptionPolicyId").ToString());
+ Console.WriteLine(result.GetProperty("etag").ToString());
+}
+]]>
+
+
+
+
+This sample shows how to call GetQueues with required parameters and parse the result.
+");
+var client = new JobRouterAdministrationRestClient(endpoint);
+
+foreach (var item in client.GetQueues(1234, new RequestContext()))
+{
+ JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
+ Console.WriteLine(result.GetProperty("queue").GetProperty("id").ToString());
+ Console.WriteLine(result.GetProperty("queue").GetProperty("name").ToString());
+ Console.WriteLine(result.GetProperty("queue").GetProperty("distributionPolicyId").ToString());
+ Console.WriteLine(result.GetProperty("queue").GetProperty("labels").GetProperty("").ToString());
+ Console.WriteLine(result.GetProperty("queue").GetProperty("exceptionPolicyId").ToString());
+ Console.WriteLine(result.GetProperty("etag").ToString());
+}
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Docs/JobRouterRestClient.xml b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Docs/JobRouterRestClient.xml
new file mode 100644
index 0000000000000..0376f9539a2a9
--- /dev/null
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Docs/JobRouterRestClient.xml
@@ -0,0 +1,1443 @@
+
+
+
+
+
+This sample shows how to call UpsertJobAsync with required parameters and parse the result.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var data = new {};
+
+Response response = await client.UpsertJobAsync("", RequestContent.Create(data));
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+]]>
+This sample shows how to call UpsertJobAsync with all parameters and request content, and how to parse the result.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var data = new {
+ channelReference = "",
+ channelId = "",
+ classificationPolicyId = "",
+ queueId = "",
+ priority = 1234,
+ dispositionCode = "",
+ requestedWorkerSelectors = new[] {
+ new {
+ key = "",
+ labelOperator = "equal",
+ value = new {},
+ expiresAfterSeconds = 123.45d,
+ expedite = true,
+ }
+ },
+ labels = new {
+ key = new {},
+ },
+ tags = new {
+ key = new {},
+ },
+ notes = new {
+ key = "",
+ },
+ matchingMode = new {
+ modeType = "queueAndMatchMode",
+ queueAndMatchMode = new {},
+ scheduleAndSuspendMode = new {
+ scheduleAt = "2022-05-10T14:57:31.2311892-04:00",
+ },
+ suspendMode = new {},
+ },
+};
+
+Response response = await client.UpsertJobAsync("", RequestContent.Create(data), null);
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+Console.WriteLine(result.GetProperty("channelReference").ToString());
+Console.WriteLine(result.GetProperty("status").ToString());
+Console.WriteLine(result.GetProperty("enqueuedAt").ToString());
+Console.WriteLine(result.GetProperty("channelId").ToString());
+Console.WriteLine(result.GetProperty("classificationPolicyId").ToString());
+Console.WriteLine(result.GetProperty("queueId").ToString());
+Console.WriteLine(result.GetProperty("priority").ToString());
+Console.WriteLine(result.GetProperty("dispositionCode").ToString());
+Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("key").ToString());
+Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("labelOperator").ToString());
+Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("value").ToString());
+Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString());
+Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expedite").ToString());
+Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("status").ToString());
+Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAt").ToString());
+Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("key").ToString());
+Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("labelOperator").ToString());
+Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("value").ToString());
+Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString());
+Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expedite").ToString());
+Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("status").ToString());
+Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAt").ToString());
+Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString());
+Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("assignmentId").ToString());
+Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("workerId").ToString());
+Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("assignedAt").ToString());
+Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("completedAt").ToString());
+Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("closedAt").ToString());
+Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString());
+Console.WriteLine(result.GetProperty("notes").GetProperty("").ToString());
+Console.WriteLine(result.GetProperty("scheduledAt").ToString());
+Console.WriteLine(result.GetProperty("matchingMode").GetProperty("modeType").ToString());
+Console.WriteLine(result.GetProperty("matchingMode").GetProperty("queueAndMatchMode").ToString());
+Console.WriteLine(result.GetProperty("matchingMode").GetProperty("scheduleAndSuspendMode").GetProperty("scheduleAt").ToString());
+Console.WriteLine(result.GetProperty("matchingMode").GetProperty("suspendMode").ToString());
+]]>
+
+
+
+
+This sample shows how to call UpsertJob with required parameters and parse the result.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var data = new {};
+
+Response response = client.UpsertJob("", RequestContent.Create(data));
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+]]>
+This sample shows how to call UpsertJob with all parameters and request content, and how to parse the result.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var data = new {
+ channelReference = "",
+ channelId = "",
+ classificationPolicyId = "",
+ queueId = "",
+ priority = 1234,
+ dispositionCode = "",
+ requestedWorkerSelectors = new[] {
+ new {
+ key = "",
+ labelOperator = "equal",
+ value = new {},
+ expiresAfterSeconds = 123.45d,
+ expedite = true,
+ }
+ },
+ labels = new {
+ key = new {},
+ },
+ tags = new {
+ key = new {},
+ },
+ notes = new {
+ key = "",
+ },
+ matchingMode = new {
+ modeType = "queueAndMatchMode",
+ queueAndMatchMode = new {},
+ scheduleAndSuspendMode = new {
+ scheduleAt = "2022-05-10T14:57:31.2311892-04:00",
+ },
+ suspendMode = new {},
+ },
+};
+
+Response response = client.UpsertJob("", RequestContent.Create(data), null);
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+Console.WriteLine(result.GetProperty("channelReference").ToString());
+Console.WriteLine(result.GetProperty("status").ToString());
+Console.WriteLine(result.GetProperty("enqueuedAt").ToString());
+Console.WriteLine(result.GetProperty("channelId").ToString());
+Console.WriteLine(result.GetProperty("classificationPolicyId").ToString());
+Console.WriteLine(result.GetProperty("queueId").ToString());
+Console.WriteLine(result.GetProperty("priority").ToString());
+Console.WriteLine(result.GetProperty("dispositionCode").ToString());
+Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("key").ToString());
+Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("labelOperator").ToString());
+Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("value").ToString());
+Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString());
+Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expedite").ToString());
+Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("status").ToString());
+Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAt").ToString());
+Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("key").ToString());
+Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("labelOperator").ToString());
+Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("value").ToString());
+Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString());
+Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expedite").ToString());
+Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("status").ToString());
+Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAt").ToString());
+Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString());
+Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("assignmentId").ToString());
+Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("workerId").ToString());
+Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("assignedAt").ToString());
+Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("completedAt").ToString());
+Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("closedAt").ToString());
+Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString());
+Console.WriteLine(result.GetProperty("notes").GetProperty("").ToString());
+Console.WriteLine(result.GetProperty("scheduledAt").ToString());
+Console.WriteLine(result.GetProperty("matchingMode").GetProperty("modeType").ToString());
+Console.WriteLine(result.GetProperty("matchingMode").GetProperty("queueAndMatchMode").ToString());
+Console.WriteLine(result.GetProperty("matchingMode").GetProperty("scheduleAndSuspendMode").GetProperty("scheduleAt").ToString());
+Console.WriteLine(result.GetProperty("matchingMode").GetProperty("suspendMode").ToString());
+]]>
+
+
+
+
+This sample shows how to call GetJobAsync with required parameters.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var result = await client.GetJobAsync("");
+]]>
+
+
+
+
+This sample shows how to call GetJob with required parameters.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var result = client.GetJob("");
+]]>
+
+
+
+
+This sample shows how to call GetJobAsync with required parameters and parse the result.
+");
+var client = new JobRouterRestClient(endpoint);
+
+Response response = await client.GetJobAsync("", new RequestContext());
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+Console.WriteLine(result.GetProperty("channelReference").ToString());
+Console.WriteLine(result.GetProperty("status").ToString());
+Console.WriteLine(result.GetProperty("enqueuedAt").ToString());
+Console.WriteLine(result.GetProperty("channelId").ToString());
+Console.WriteLine(result.GetProperty("classificationPolicyId").ToString());
+Console.WriteLine(result.GetProperty("queueId").ToString());
+Console.WriteLine(result.GetProperty("priority").ToString());
+Console.WriteLine(result.GetProperty("dispositionCode").ToString());
+Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("key").ToString());
+Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("labelOperator").ToString());
+Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("value").ToString());
+Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString());
+Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expedite").ToString());
+Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("status").ToString());
+Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAt").ToString());
+Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("key").ToString());
+Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("labelOperator").ToString());
+Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("value").ToString());
+Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString());
+Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expedite").ToString());
+Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("status").ToString());
+Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAt").ToString());
+Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString());
+Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("assignmentId").ToString());
+Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("workerId").ToString());
+Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("assignedAt").ToString());
+Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("completedAt").ToString());
+Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("closedAt").ToString());
+Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString());
+Console.WriteLine(result.GetProperty("notes").GetProperty("").ToString());
+Console.WriteLine(result.GetProperty("scheduledAt").ToString());
+Console.WriteLine(result.GetProperty("matchingMode").GetProperty("modeType").ToString());
+Console.WriteLine(result.GetProperty("matchingMode").GetProperty("queueAndMatchMode").ToString());
+Console.WriteLine(result.GetProperty("matchingMode").GetProperty("scheduleAndSuspendMode").GetProperty("scheduleAt").ToString());
+Console.WriteLine(result.GetProperty("matchingMode").GetProperty("suspendMode").ToString());
+]]>
+
+
+
+
+This sample shows how to call GetJob with required parameters and parse the result.
+");
+var client = new JobRouterRestClient(endpoint);
+
+Response response = client.GetJob("", new RequestContext());
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+Console.WriteLine(result.GetProperty("channelReference").ToString());
+Console.WriteLine(result.GetProperty("status").ToString());
+Console.WriteLine(result.GetProperty("enqueuedAt").ToString());
+Console.WriteLine(result.GetProperty("channelId").ToString());
+Console.WriteLine(result.GetProperty("classificationPolicyId").ToString());
+Console.WriteLine(result.GetProperty("queueId").ToString());
+Console.WriteLine(result.GetProperty("priority").ToString());
+Console.WriteLine(result.GetProperty("dispositionCode").ToString());
+Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("key").ToString());
+Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("labelOperator").ToString());
+Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("value").ToString());
+Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString());
+Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expedite").ToString());
+Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("status").ToString());
+Console.WriteLine(result.GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAt").ToString());
+Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("key").ToString());
+Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("labelOperator").ToString());
+Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("value").ToString());
+Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString());
+Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expedite").ToString());
+Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("status").ToString());
+Console.WriteLine(result.GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAt").ToString());
+Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString());
+Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("assignmentId").ToString());
+Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("workerId").ToString());
+Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("assignedAt").ToString());
+Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("completedAt").ToString());
+Console.WriteLine(result.GetProperty("assignments").GetProperty("").GetProperty("closedAt").ToString());
+Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString());
+Console.WriteLine(result.GetProperty("notes").GetProperty("").ToString());
+Console.WriteLine(result.GetProperty("scheduledAt").ToString());
+Console.WriteLine(result.GetProperty("matchingMode").GetProperty("modeType").ToString());
+Console.WriteLine(result.GetProperty("matchingMode").GetProperty("queueAndMatchMode").ToString());
+Console.WriteLine(result.GetProperty("matchingMode").GetProperty("scheduleAndSuspendMode").GetProperty("scheduleAt").ToString());
+Console.WriteLine(result.GetProperty("matchingMode").GetProperty("suspendMode").ToString());
+]]>
+
+
+
+
+This sample shows how to call DeleteJobAsync with required parameters.
+");
+var client = new JobRouterRestClient(endpoint);
+
+Response response = await client.DeleteJobAsync("");
+Console.WriteLine(response.Status);
+]]>
+
+
+
+
+This sample shows how to call DeleteJob with required parameters.
+");
+var client = new JobRouterRestClient(endpoint);
+
+Response response = client.DeleteJob("");
+Console.WriteLine(response.Status);
+]]>
+
+
+
+
+This sample shows how to call ReclassifyJobAsync with required parameters and request content.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var data = new {};
+
+Response response = await client.ReclassifyJobAsync("", RequestContent.Create(data));
+Console.WriteLine(response.Status);
+]]>
+
+
+
+
+This sample shows how to call ReclassifyJob with required parameters and request content.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var data = new {};
+
+Response response = client.ReclassifyJob("", RequestContent.Create(data));
+Console.WriteLine(response.Status);
+]]>
+
+
+
+
+This sample shows how to call CancelJobAsync with required parameters.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var cancelJobRequest = new CancelJobRequest()
+{
+ Note = "",
+ DispositionCode = "",
+};
+var result = await client.CancelJobAsync("", cancelJobRequest);
+]]>
+
+
+
+
+This sample shows how to call CancelJob with required parameters.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var cancelJobRequest = new CancelJobRequest()
+{
+ Note = "",
+ DispositionCode = "",
+};
+var result = client.CancelJob("", cancelJobRequest);
+]]>
+
+
+
+
+This sample shows how to call CancelJobAsync with required parameters.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var data = new {};
+
+Response response = await client.CancelJobAsync("", RequestContent.Create(data));
+Console.WriteLine(response.Status);
+]]>
+This sample shows how to call CancelJobAsync with all parameters and request content.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var data = new {
+ note = "",
+ dispositionCode = "",
+};
+
+Response response = await client.CancelJobAsync("", RequestContent.Create(data));
+Console.WriteLine(response.Status);
+]]>
+
+
+
+
+This sample shows how to call CancelJob with required parameters.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var data = new {};
+
+Response response = client.CancelJob("", RequestContent.Create(data));
+Console.WriteLine(response.Status);
+]]>
+This sample shows how to call CancelJob with all parameters and request content.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var data = new {
+ note = "",
+ dispositionCode = "",
+};
+
+Response response = client.CancelJob("", RequestContent.Create(data));
+Console.WriteLine(response.Status);
+]]>
+
+
+
+
+This sample shows how to call CompleteJobAsync with required parameters.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var completeJobRequest = new CompleteJobRequest("")
+{
+ Note = "",
+};
+var result = await client.CompleteJobAsync("", completeJobRequest);
+]]>
+
+
+
+
+This sample shows how to call CompleteJob with required parameters.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var completeJobRequest = new CompleteJobRequest("")
+{
+ Note = "",
+};
+var result = client.CompleteJob("", completeJobRequest);
+]]>
+
+
+
+
+This sample shows how to call CompleteJobAsync with required parameters and request content.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var data = new {
+ assignmentId = "",
+};
+
+Response response = await client.CompleteJobAsync("", RequestContent.Create(data));
+Console.WriteLine(response.Status);
+]]>
+This sample shows how to call CompleteJobAsync with all parameters and request content.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var data = new {
+ assignmentId = "",
+ note = "",
+};
+
+Response response = await client.CompleteJobAsync("", RequestContent.Create(data));
+Console.WriteLine(response.Status);
+]]>
+
+
+
+
+This sample shows how to call CompleteJob with required parameters and request content.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var data = new {
+ assignmentId = "",
+};
+
+Response response = client.CompleteJob("", RequestContent.Create(data));
+Console.WriteLine(response.Status);
+]]>
+This sample shows how to call CompleteJob with all parameters and request content.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var data = new {
+ assignmentId = "",
+ note = "",
+};
+
+Response response = client.CompleteJob("", RequestContent.Create(data));
+Console.WriteLine(response.Status);
+]]>
+
+
+
+
+This sample shows how to call CloseJobAsync with required parameters.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var closeJobRequest = new CloseJobRequest("")
+{
+ DispositionCode = "",
+ CloseAt = DateTimeOffset.UtcNow,
+ Note = "",
+};
+var result = await client.CloseJobAsync("", closeJobRequest);
+]]>
+
+
+
+
+This sample shows how to call CloseJob with required parameters.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var closeJobRequest = new CloseJobRequest("")
+{
+ DispositionCode = "",
+ CloseAt = DateTimeOffset.UtcNow,
+ Note = "",
+};
+var result = client.CloseJob("", closeJobRequest);
+]]>
+
+
+
+
+This sample shows how to call CloseJobAsync with required parameters and request content.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var data = new {
+ assignmentId = "",
+};
+
+Response response = await client.CloseJobAsync("", RequestContent.Create(data));
+Console.WriteLine(response.Status);
+]]>
+This sample shows how to call CloseJobAsync with all parameters and request content.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var data = new {
+ assignmentId = "",
+ dispositionCode = "",
+ closeAt = "2022-05-10T14:57:31.2311892-04:00",
+ note = "",
+};
+
+Response response = await client.CloseJobAsync("", RequestContent.Create(data));
+Console.WriteLine(response.Status);
+]]>
+
+
+
+
+This sample shows how to call CloseJob with required parameters and request content.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var data = new {
+ assignmentId = "",
+};
+
+Response response = client.CloseJob("", RequestContent.Create(data));
+Console.WriteLine(response.Status);
+]]>
+This sample shows how to call CloseJob with all parameters and request content.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var data = new {
+ assignmentId = "",
+ dispositionCode = "",
+ closeAt = "2022-05-10T14:57:31.2311892-04:00",
+ note = "",
+};
+
+Response response = client.CloseJob("", RequestContent.Create(data));
+Console.WriteLine(response.Status);
+]]>
+
+
+
+
+This sample shows how to call GetQueuePositionAsync with required parameters.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var result = await client.GetQueuePositionAsync("");
+]]>
+
+
+
+
+This sample shows how to call GetQueuePosition with required parameters.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var result = client.GetQueuePosition("");
+]]>
+
+
+
+
+This sample shows how to call GetQueuePositionAsync with required parameters and parse the result.
+");
+var client = new JobRouterRestClient(endpoint);
+
+Response response = await client.GetQueuePositionAsync("", new RequestContext());
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("jobId").ToString());
+Console.WriteLine(result.GetProperty("position").ToString());
+Console.WriteLine(result.GetProperty("queueId").ToString());
+Console.WriteLine(result.GetProperty("queueLength").ToString());
+Console.WriteLine(result.GetProperty("estimatedWaitTimeMinutes").ToString());
+]]>
+
+
+
+
+This sample shows how to call GetQueuePosition with required parameters and parse the result.
+");
+var client = new JobRouterRestClient(endpoint);
+
+Response response = client.GetQueuePosition("", new RequestContext());
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("jobId").ToString());
+Console.WriteLine(result.GetProperty("position").ToString());
+Console.WriteLine(result.GetProperty("queueId").ToString());
+Console.WriteLine(result.GetProperty("queueLength").ToString());
+Console.WriteLine(result.GetProperty("estimatedWaitTimeMinutes").ToString());
+]]>
+
+
+
+
+This sample shows how to call UnassignJobAsync with required parameters.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var unassignJobRequest = new UnassignJobRequest()
+{
+ SuspendMatching = true,
+};
+var result = await client.UnassignJobAsync("", "", unassignJobRequest);
+]]>
+
+
+
+
+This sample shows how to call UnassignJob with required parameters.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var unassignJobRequest = new UnassignJobRequest()
+{
+ SuspendMatching = true,
+};
+var result = client.UnassignJob("", "", unassignJobRequest);
+]]>
+
+
+
+
+This sample shows how to call UnassignJobAsync with required parameters and parse the result.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var data = new {};
+
+Response response = await client.UnassignJobAsync("", "", RequestContent.Create(data));
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("jobId").ToString());
+Console.WriteLine(result.GetProperty("unassignmentCount").ToString());
+]]>
+This sample shows how to call UnassignJobAsync with all parameters and request content, and how to parse the result.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var data = new {
+ suspendMatching = true,
+};
+
+Response response = await client.UnassignJobAsync("", "", RequestContent.Create(data));
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("jobId").ToString());
+Console.WriteLine(result.GetProperty("unassignmentCount").ToString());
+]]>
+
+
+
+
+This sample shows how to call UnassignJob with required parameters and parse the result.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var data = new {};
+
+Response response = client.UnassignJob("", "", RequestContent.Create(data));
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("jobId").ToString());
+Console.WriteLine(result.GetProperty("unassignmentCount").ToString());
+]]>
+This sample shows how to call UnassignJob with all parameters and request content, and how to parse the result.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var data = new {
+ suspendMatching = true,
+};
+
+Response response = client.UnassignJob("", "", RequestContent.Create(data));
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("jobId").ToString());
+Console.WriteLine(result.GetProperty("unassignmentCount").ToString());
+]]>
+
+
+
+
+This sample shows how to call AcceptJobAsync with required parameters.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var result = await client.AcceptJobAsync("", "");
+]]>
+
+
+
+
+This sample shows how to call AcceptJob with required parameters.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var result = client.AcceptJob("", "");
+]]>
+
+
+
+
+This sample shows how to call AcceptJobAsync with required parameters and parse the result.
+");
+var client = new JobRouterRestClient(endpoint);
+
+Response response = await client.AcceptJobAsync("", "", new RequestContext());
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("assignmentId").ToString());
+Console.WriteLine(result.GetProperty("jobId").ToString());
+Console.WriteLine(result.GetProperty("workerId").ToString());
+]]>
+
+
+
+
+This sample shows how to call AcceptJob with required parameters and parse the result.
+");
+var client = new JobRouterRestClient(endpoint);
+
+Response response = client.AcceptJob("", "", new RequestContext());
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("assignmentId").ToString());
+Console.WriteLine(result.GetProperty("jobId").ToString());
+Console.WriteLine(result.GetProperty("workerId").ToString());
+]]>
+
+
+
+
+This sample shows how to call DeclineJobAsync with required parameters.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var declineJobOfferRequest = new DeclineJobOfferRequest()
+{
+ RetryOfferAt = DateTimeOffset.UtcNow,
+};
+var result = await client.DeclineJobAsync("", "", declineJobOfferRequest);
+]]>
+
+
+
+
+This sample shows how to call DeclineJob with required parameters.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var declineJobOfferRequest = new DeclineJobOfferRequest()
+{
+ RetryOfferAt = DateTimeOffset.UtcNow,
+};
+var result = client.DeclineJob("", "", declineJobOfferRequest);
+]]>
+
+
+
+
+This sample shows how to call DeclineJobAsync with required parameters.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var data = new {};
+
+Response response = await client.DeclineJobAsync("", "", RequestContent.Create(data));
+Console.WriteLine(response.Status);
+]]>
+This sample shows how to call DeclineJobAsync with all parameters and request content.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var data = new {
+ retryOfferAt = "2022-05-10T14:57:31.2311892-04:00",
+};
+
+Response response = await client.DeclineJobAsync("", "", RequestContent.Create(data));
+Console.WriteLine(response.Status);
+]]>
+
+
+
+
+This sample shows how to call DeclineJob with required parameters.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var data = new {};
+
+Response response = client.DeclineJob("", "", RequestContent.Create(data));
+Console.WriteLine(response.Status);
+]]>
+This sample shows how to call DeclineJob with all parameters and request content.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var data = new {
+ retryOfferAt = "2022-05-10T14:57:31.2311892-04:00",
+};
+
+Response response = client.DeclineJob("", "", RequestContent.Create(data));
+Console.WriteLine(response.Status);
+]]>
+
+
+
+
+This sample shows how to call GetQueueStatisticsAsync with required parameters.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var result = await client.GetQueueStatisticsAsync("");
+]]>
+
+
+
+
+This sample shows how to call GetQueueStatistics with required parameters.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var result = client.GetQueueStatistics("");
+]]>
+
+
+
+
+This sample shows how to call GetQueueStatisticsAsync with required parameters and parse the result.
+");
+var client = new JobRouterRestClient(endpoint);
+
+Response response = await client.GetQueueStatisticsAsync("", new RequestContext());
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("queueId").ToString());
+Console.WriteLine(result.GetProperty("length").ToString());
+Console.WriteLine(result.GetProperty("estimatedWaitTimeMinutes").GetProperty("").ToString());
+Console.WriteLine(result.GetProperty("longestJobWaitTimeMinutes").ToString());
+]]>
+
+
+
+
+This sample shows how to call GetQueueStatistics with required parameters and parse the result.
+");
+var client = new JobRouterRestClient(endpoint);
+
+Response response = client.GetQueueStatistics("", new RequestContext());
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("queueId").ToString());
+Console.WriteLine(result.GetProperty("length").ToString());
+Console.WriteLine(result.GetProperty("estimatedWaitTimeMinutes").GetProperty("").ToString());
+Console.WriteLine(result.GetProperty("longestJobWaitTimeMinutes").ToString());
+]]>
+
+
+
+
+This sample shows how to call UpsertWorkerAsync with required parameters and parse the result.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var data = new {};
+
+Response response = await client.UpsertWorkerAsync("", RequestContent.Create(data));
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+]]>
+This sample shows how to call UpsertWorkerAsync with all parameters and request content, and how to parse the result.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var data = new {
+ queueAssignments = new {
+ key = new {},
+ },
+ totalCapacity = 1234,
+ labels = new {
+ key = new {},
+ },
+ tags = new {
+ key = new {},
+ },
+ channelConfigurations = new {
+ key = new {
+ capacityCostPerJob = 1234,
+ maxNumberOfJobs = 1234,
+ },
+ },
+ availableForOffers = true,
+};
+
+Response response = await client.UpsertWorkerAsync("", RequestContent.Create(data), null);
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+Console.WriteLine(result.GetProperty("state").ToString());
+Console.WriteLine(result.GetProperty("queueAssignments").GetProperty("").ToString());
+Console.WriteLine(result.GetProperty("totalCapacity").ToString());
+Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString());
+Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString());
+Console.WriteLine(result.GetProperty("channelConfigurations").GetProperty("").GetProperty("capacityCostPerJob").ToString());
+Console.WriteLine(result.GetProperty("channelConfigurations").GetProperty("").GetProperty("maxNumberOfJobs").ToString());
+Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offerId").ToString());
+Console.WriteLine(result.GetProperty("offers")[0].GetProperty("jobId").ToString());
+Console.WriteLine(result.GetProperty("offers")[0].GetProperty("capacityCost").ToString());
+Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offeredAt").ToString());
+Console.WriteLine(result.GetProperty("offers")[0].GetProperty("expiresAt").ToString());
+Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("assignmentId").ToString());
+Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("jobId").ToString());
+Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("capacityCost").ToString());
+Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("assignedAt").ToString());
+Console.WriteLine(result.GetProperty("loadRatio").ToString());
+Console.WriteLine(result.GetProperty("availableForOffers").ToString());
+]]>
+
+
+
+
+This sample shows how to call UpsertWorker with required parameters and parse the result.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var data = new {};
+
+Response response = client.UpsertWorker("", RequestContent.Create(data));
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+]]>
+This sample shows how to call UpsertWorker with all parameters and request content, and how to parse the result.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var data = new {
+ queueAssignments = new {
+ key = new {},
+ },
+ totalCapacity = 1234,
+ labels = new {
+ key = new {},
+ },
+ tags = new {
+ key = new {},
+ },
+ channelConfigurations = new {
+ key = new {
+ capacityCostPerJob = 1234,
+ maxNumberOfJobs = 1234,
+ },
+ },
+ availableForOffers = true,
+};
+
+Response response = client.UpsertWorker("", RequestContent.Create(data), null);
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+Console.WriteLine(result.GetProperty("state").ToString());
+Console.WriteLine(result.GetProperty("queueAssignments").GetProperty("").ToString());
+Console.WriteLine(result.GetProperty("totalCapacity").ToString());
+Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString());
+Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString());
+Console.WriteLine(result.GetProperty("channelConfigurations").GetProperty("").GetProperty("capacityCostPerJob").ToString());
+Console.WriteLine(result.GetProperty("channelConfigurations").GetProperty("").GetProperty("maxNumberOfJobs").ToString());
+Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offerId").ToString());
+Console.WriteLine(result.GetProperty("offers")[0].GetProperty("jobId").ToString());
+Console.WriteLine(result.GetProperty("offers")[0].GetProperty("capacityCost").ToString());
+Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offeredAt").ToString());
+Console.WriteLine(result.GetProperty("offers")[0].GetProperty("expiresAt").ToString());
+Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("assignmentId").ToString());
+Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("jobId").ToString());
+Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("capacityCost").ToString());
+Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("assignedAt").ToString());
+Console.WriteLine(result.GetProperty("loadRatio").ToString());
+Console.WriteLine(result.GetProperty("availableForOffers").ToString());
+]]>
+
+
+
+
+This sample shows how to call GetWorkerAsync with required parameters.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var result = await client.GetWorkerAsync("");
+]]>
+
+
+
+
+This sample shows how to call GetWorker with required parameters.
+");
+var client = new JobRouterRestClient(endpoint);
+
+var result = client.GetWorker("");
+]]>
+
+
+
+
+This sample shows how to call GetWorkerAsync with required parameters and parse the result.
+");
+var client = new JobRouterRestClient(endpoint);
+
+Response response = await client.GetWorkerAsync("", new RequestContext());
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+Console.WriteLine(result.GetProperty("state").ToString());
+Console.WriteLine(result.GetProperty("queueAssignments").GetProperty("").ToString());
+Console.WriteLine(result.GetProperty("totalCapacity").ToString());
+Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString());
+Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString());
+Console.WriteLine(result.GetProperty("channelConfigurations").GetProperty("").GetProperty("capacityCostPerJob").ToString());
+Console.WriteLine(result.GetProperty("channelConfigurations").GetProperty("").GetProperty("maxNumberOfJobs").ToString());
+Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offerId").ToString());
+Console.WriteLine(result.GetProperty("offers")[0].GetProperty("jobId").ToString());
+Console.WriteLine(result.GetProperty("offers")[0].GetProperty("capacityCost").ToString());
+Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offeredAt").ToString());
+Console.WriteLine(result.GetProperty("offers")[0].GetProperty("expiresAt").ToString());
+Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("assignmentId").ToString());
+Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("jobId").ToString());
+Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("capacityCost").ToString());
+Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("assignedAt").ToString());
+Console.WriteLine(result.GetProperty("loadRatio").ToString());
+Console.WriteLine(result.GetProperty("availableForOffers").ToString());
+]]>
+
+
+
+
+This sample shows how to call GetWorker with required parameters and parse the result.
+");
+var client = new JobRouterRestClient(endpoint);
+
+Response response = client.GetWorker("", new RequestContext());
+
+JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement;
+Console.WriteLine(result.GetProperty("id").ToString());
+Console.WriteLine(result.GetProperty("state").ToString());
+Console.WriteLine(result.GetProperty("queueAssignments").GetProperty("").ToString());
+Console.WriteLine(result.GetProperty("totalCapacity").ToString());
+Console.WriteLine(result.GetProperty("labels").GetProperty("").ToString());
+Console.WriteLine(result.GetProperty("tags").GetProperty("").ToString());
+Console.WriteLine(result.GetProperty("channelConfigurations").GetProperty("").GetProperty("capacityCostPerJob").ToString());
+Console.WriteLine(result.GetProperty("channelConfigurations").GetProperty("").GetProperty("maxNumberOfJobs").ToString());
+Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offerId").ToString());
+Console.WriteLine(result.GetProperty("offers")[0].GetProperty("jobId").ToString());
+Console.WriteLine(result.GetProperty("offers")[0].GetProperty("capacityCost").ToString());
+Console.WriteLine(result.GetProperty("offers")[0].GetProperty("offeredAt").ToString());
+Console.WriteLine(result.GetProperty("offers")[0].GetProperty("expiresAt").ToString());
+Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("assignmentId").ToString());
+Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("jobId").ToString());
+Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("capacityCost").ToString());
+Console.WriteLine(result.GetProperty("assignedJobs")[0].GetProperty("assignedAt").ToString());
+Console.WriteLine(result.GetProperty("loadRatio").ToString());
+Console.WriteLine(result.GetProperty("availableForOffers").ToString());
+]]>
+
+
+
+
+This sample shows how to call DeleteWorkerAsync with required parameters.
+");
+var client = new JobRouterRestClient(endpoint);
+
+Response response = await client.DeleteWorkerAsync("");
+Console.WriteLine(response.Status);
+]]>
+
+
+
+
+This sample shows how to call DeleteWorker with required parameters.
+");
+var client = new JobRouterRestClient(endpoint);
+
+Response response = client.DeleteWorker("");
+Console.WriteLine(response.Status);
+]]>
+
+
+
+
+This sample shows how to call GetJobsAsync with required parameters.
+");
+var client = new JobRouterRestClient(endpoint);
+
+await foreach (var item in client.GetJobsAsync(null, "", "", "", DateTimeOffset.UtcNow, DateTimeOffset.UtcNow, 1234))
+{
+}
+]]>
+
+
+
+
+This sample shows how to call GetJobs with required parameters.
+");
+var client = new JobRouterRestClient(endpoint);
+
+foreach (var item in client.GetJobs(null, "", "", "", DateTimeOffset.UtcNow, DateTimeOffset.UtcNow, 1234))
+{
+}
+]]>
+
+
+
+
+This sample shows how to call GetJobsAsync with required parameters and parse the result.
+");
+var client = new JobRouterRestClient(endpoint);
+
+await foreach (var item in client.GetJobsAsync("", "", "", "", DateTimeOffset.UtcNow, DateTimeOffset.UtcNow, 1234))
+{
+ JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
+ Console.WriteLine(result.GetProperty("job").GetProperty("id").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("channelReference").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("status").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("enqueuedAt").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("channelId").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("classificationPolicyId").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("queueId").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("priority").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("dispositionCode").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("key").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("labelOperator").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("value").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("expedite").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("status").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAt").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("key").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("labelOperator").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("value").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("expedite").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("status").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAt").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("labels").GetProperty("").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("assignmentId").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("workerId").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("assignedAt").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("completedAt").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("closedAt").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("tags").GetProperty("").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("notes").GetProperty("").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("scheduledAt").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("matchingMode").GetProperty("modeType").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("matchingMode").GetProperty("queueAndMatchMode").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("matchingMode").GetProperty("scheduleAndSuspendMode").GetProperty("scheduleAt").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("matchingMode").GetProperty("suspendMode").ToString());
+ Console.WriteLine(result.GetProperty("etag").ToString());
+}
+]]>
+
+
+
+
+This sample shows how to call GetJobs with required parameters and parse the result.
+");
+var client = new JobRouterRestClient(endpoint);
+
+foreach (var item in client.GetJobs("", "", "", "", DateTimeOffset.UtcNow, DateTimeOffset.UtcNow, 1234))
+{
+ JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
+ Console.WriteLine(result.GetProperty("job").GetProperty("id").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("channelReference").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("status").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("enqueuedAt").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("channelId").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("classificationPolicyId").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("queueId").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("priority").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("dispositionCode").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("key").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("labelOperator").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("value").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("expedite").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("status").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("requestedWorkerSelectors")[0].GetProperty("expiresAt").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("key").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("labelOperator").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("value").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAfterSeconds").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("expedite").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("status").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("attachedWorkerSelectors")[0].GetProperty("expiresAt").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("labels").GetProperty("").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("assignmentId").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("workerId").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("assignedAt").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("completedAt").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("assignments").GetProperty("").GetProperty("closedAt").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("tags").GetProperty("").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("notes").GetProperty("").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("scheduledAt").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("matchingMode").GetProperty("modeType").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("matchingMode").GetProperty("queueAndMatchMode").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("matchingMode").GetProperty("scheduleAndSuspendMode").GetProperty("scheduleAt").ToString());
+ Console.WriteLine(result.GetProperty("job").GetProperty("matchingMode").GetProperty("suspendMode").ToString());
+ Console.WriteLine(result.GetProperty("etag").ToString());
+}
+]]>
+
+
+
+
+This sample shows how to call GetWorkersAsync with required parameters.
+");
+var client = new JobRouterRestClient(endpoint);
+
+await foreach (var item in client.GetWorkersAsync(null, "", "", true, 1234))
+{
+}
+]]>
+
+
+
+
+This sample shows how to call GetWorkers with required parameters.
+");
+var client = new JobRouterRestClient(endpoint);
+
+foreach (var item in client.GetWorkers(null, "", "", true, 1234))
+{
+}
+]]>
+
+
+
+
+This sample shows how to call GetWorkersAsync with required parameters and parse the result.
+");
+var client = new JobRouterRestClient(endpoint);
+
+await foreach (var item in client.GetWorkersAsync("", "", "", true, 1234))
+{
+ JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
+ Console.WriteLine(result.GetProperty("worker").GetProperty("id").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("state").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("queueAssignments").GetProperty("").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("totalCapacity").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("labels").GetProperty("").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("tags").GetProperty("").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("channelConfigurations").GetProperty("").GetProperty("capacityCostPerJob").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("channelConfigurations").GetProperty("").GetProperty("maxNumberOfJobs").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("offerId").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("jobId").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("capacityCost").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("offeredAt").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("expiresAt").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("assignmentId").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("jobId").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("capacityCost").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("assignedAt").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("loadRatio").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("availableForOffers").ToString());
+ Console.WriteLine(result.GetProperty("etag").ToString());
+}
+]]>
+
+
+
+
+This sample shows how to call GetWorkers with required parameters and parse the result.
+");
+var client = new JobRouterRestClient(endpoint);
+
+foreach (var item in client.GetWorkers("", "", "", true, 1234))
+{
+ JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement;
+ Console.WriteLine(result.GetProperty("worker").GetProperty("id").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("state").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("queueAssignments").GetProperty("").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("totalCapacity").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("labels").GetProperty("").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("tags").GetProperty("").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("channelConfigurations").GetProperty("").GetProperty("capacityCostPerJob").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("channelConfigurations").GetProperty("").GetProperty("maxNumberOfJobs").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("offerId").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("jobId").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("capacityCost").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("offeredAt").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("offers")[0].GetProperty("expiresAt").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("assignmentId").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("jobId").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("capacityCost").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("assignedJobs")[0].GetProperty("assignedAt").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("loadRatio").ToString());
+ Console.WriteLine(result.GetProperty("worker").GetProperty("availableForOffers").ToString());
+ Console.WriteLine(result.GetProperty("etag").ToString());
+}
+]]>
+
+
+
+
\ No newline at end of file
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionAction.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionAction.Serialization.cs
similarity index 71%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionAction.Serialization.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionAction.Serialization.cs
index 58d63c875aa34..1071df7151730 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionAction.Serialization.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionAction.Serialization.cs
@@ -6,20 +6,12 @@
#nullable disable
using System.Text.Json;
-using Azure.Core;
+using Azure;
namespace Azure.Communication.JobRouter
{
- public partial class ExceptionAction : IUtf8JsonSerializable
+ public partial class ExceptionAction
{
- void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
- {
- writer.WriteStartObject();
- writer.WritePropertyName("kind"u8);
- writer.WriteStringValue(Kind);
- writer.WriteEndObject();
- }
-
internal static ExceptionAction DeserializeExceptionAction(JsonElement element)
{
if (element.ValueKind == JsonValueKind.Null)
@@ -37,5 +29,13 @@ internal static ExceptionAction DeserializeExceptionAction(JsonElement element)
}
return UnknownExceptionAction.DeserializeUnknownExceptionAction(element);
}
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static ExceptionAction FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeExceptionAction(document.RootElement);
+ }
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionAction.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionAction.cs
similarity index 76%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionAction.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionAction.cs
index 04f932639c9e4..cc41005a23af0 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionAction.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionAction.cs
@@ -15,10 +15,18 @@ namespace Azure.Communication.JobRouter
public abstract partial class ExceptionAction
{
/// Initializes a new instance of ExceptionAction.
- /// The type discriminator describing a sub-type of ExceptionAction.
+ protected ExceptionAction()
+ {
+ }
+
+ /// Initializes a new instance of ExceptionAction.
+ /// Discriminator.
internal ExceptionAction(string kind)
{
Kind = kind;
}
+
+ /// Discriminator.
+ internal string Kind { get; set; }
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicy.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicy.Serialization.cs
similarity index 65%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicy.Serialization.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicy.Serialization.cs
index 53945af79ba52..0efde1c50a57a 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicy.Serialization.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicy.Serialization.cs
@@ -7,42 +7,21 @@
using System.Collections.Generic;
using System.Text.Json;
+using Azure;
using Azure.Communication.JobRouter;
using Azure.Core;
namespace Azure.Communication.JobRouter.Models
{
- public partial class ExceptionPolicy : IUtf8JsonSerializable
+ public partial class ExceptionPolicy
{
- void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
- {
- writer.WriteStartObject();
- if (Optional.IsDefined(Name))
- {
- writer.WritePropertyName("name"u8);
- writer.WriteStringValue(Name);
- }
- if (Optional.IsCollectionDefined(_exceptionRules))
- {
- writer.WritePropertyName("exceptionRules"u8);
- writer.WriteStartObject();
- foreach (var item in _exceptionRules)
- {
- writer.WritePropertyName(item.Key);
- writer.WriteObjectValue(item.Value);
- }
- writer.WriteEndObject();
- }
- writer.WriteEndObject();
- }
-
internal static ExceptionPolicy DeserializeExceptionPolicy(JsonElement element)
{
if (element.ValueKind == JsonValueKind.Null)
{
return null;
}
- Optional id = default;
+ string id = default;
Optional name = default;
Optional> exceptionRules = default;
foreach (var property in element.EnumerateObject())
@@ -72,7 +51,15 @@ internal static ExceptionPolicy DeserializeExceptionPolicy(JsonElement element)
continue;
}
}
- return new ExceptionPolicy(id.Value, name.Value, Optional.ToDictionary(exceptionRules));
+ return new ExceptionPolicy(id, name.Value, Optional.ToDictionary(exceptionRules));
+ }
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static ExceptionPolicy FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeExceptionPolicy(document.RootElement);
}
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicy.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicy.cs
similarity index 82%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicy.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicy.cs
index 7e5330581818d..05d790f49ca00 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicy.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicy.cs
@@ -17,7 +17,10 @@ public partial class ExceptionPolicy
/// Initializes a new instance of ExceptionPolicy.
/// The Id of the exception policy.
/// (Optional) The name of the exception policy.
- /// (Optional) A dictionary collection of exception rules on the exception policy. Key is the Id of each exception rule.
+ ///
+ /// (Optional) A dictionary collection of exception rules on the exception policy.
+ /// Key is the Id of each exception rule.
+ ///
internal ExceptionPolicy(string id, string name, IDictionary exceptionRules)
{
Id = id;
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyItem.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicyItem.Serialization.cs
similarity index 63%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyItem.Serialization.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicyItem.Serialization.cs
index 597ed20fa80ef..ba734381d5ae1 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyItem.Serialization.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicyItem.Serialization.cs
@@ -6,6 +6,7 @@
#nullable disable
using System.Text.Json;
+using Azure;
using Azure.Core;
namespace Azure.Communication.JobRouter.Models
@@ -18,16 +19,12 @@ internal static ExceptionPolicyItem DeserializeExceptionPolicyItem(JsonElement e
{
return null;
}
- Optional exceptionPolicy = default;
- Optional etag = default;
+ ExceptionPolicy exceptionPolicy = default;
+ string etag = default;
foreach (var property in element.EnumerateObject())
{
if (property.NameEquals("exceptionPolicy"u8))
{
- if (property.Value.ValueKind == JsonValueKind.Null)
- {
- continue;
- }
exceptionPolicy = ExceptionPolicy.DeserializeExceptionPolicy(property.Value);
continue;
}
@@ -37,7 +34,15 @@ internal static ExceptionPolicyItem DeserializeExceptionPolicyItem(JsonElement e
continue;
}
}
- return new ExceptionPolicyItem(exceptionPolicy.Value, etag.Value);
+ return new ExceptionPolicyItem(exceptionPolicy, etag);
+ }
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static ExceptionPolicyItem FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeExceptionPolicyItem(document.RootElement);
}
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicyItem.cs
similarity index 75%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyItem.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicyItem.cs
index eb0e17f4d974f..9dad91fe0a4a5 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyItem.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicyItem.cs
@@ -5,21 +5,23 @@
#nullable disable
+using System;
+using Azure.Core;
+
namespace Azure.Communication.JobRouter.Models
{
/// Paged instance of ExceptionPolicy.
public partial class ExceptionPolicyItem
{
- /// Initializes a new instance of ExceptionPolicyItem.
- internal ExceptionPolicyItem()
- {
- }
-
/// Initializes a new instance of ExceptionPolicyItem.
/// A policy that defines actions to execute when exception are triggered.
/// (Optional) The Concurrency Token.
+ /// or is null.
internal ExceptionPolicyItem(ExceptionPolicy exceptionPolicy, string etag)
{
+ Argument.AssertNotNull(exceptionPolicy, nameof(exceptionPolicy));
+ Argument.AssertNotNull(etag, nameof(etag));
+
ExceptionPolicy = exceptionPolicy;
_etag = etag;
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionRule.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionRule.Serialization.cs
similarity index 71%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionRule.Serialization.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionRule.Serialization.cs
index 0e02d1e33937e..a8fe0a89c30b0 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionRule.Serialization.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionRule.Serialization.cs
@@ -7,28 +7,13 @@
using System.Collections.Generic;
using System.Text.Json;
+using Azure;
using Azure.Core;
namespace Azure.Communication.JobRouter
{
- public partial class ExceptionRule : IUtf8JsonSerializable
+ public partial class ExceptionRule
{
- void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
- {
- writer.WriteStartObject();
- writer.WritePropertyName("trigger"u8);
- writer.WriteObjectValue(Trigger);
- writer.WritePropertyName("actions"u8);
- writer.WriteStartObject();
- foreach (var item in Actions)
- {
- writer.WritePropertyName(item.Key);
- writer.WriteObjectValue(item.Value);
- }
- writer.WriteEndObject();
- writer.WriteEndObject();
- }
-
internal static ExceptionRule DeserializeExceptionRule(JsonElement element)
{
if (element.ValueKind == JsonValueKind.Null)
@@ -57,5 +42,13 @@ internal static ExceptionRule DeserializeExceptionRule(JsonElement element)
}
return new ExceptionRule(trigger, actions);
}
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static ExceptionRule FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeExceptionRule(document.RootElement);
+ }
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionRule.cs
similarity index 94%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionRule.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionRule.cs
index 5b2dd805d7a1d..74245ac57ad48 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionRule.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionRule.cs
@@ -19,6 +19,6 @@ public partial class ExceptionRule
/// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes.
/// The available derived classes include and .
///
- public ExceptionTrigger Trigger { get; set; }
+ public ExceptionTrigger Trigger { get; }
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionTrigger.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionTrigger.Serialization.cs
similarity index 69%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionTrigger.Serialization.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionTrigger.Serialization.cs
index a722b95af3f82..02be16d62778c 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionTrigger.Serialization.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionTrigger.Serialization.cs
@@ -6,20 +6,12 @@
#nullable disable
using System.Text.Json;
-using Azure.Core;
+using Azure;
namespace Azure.Communication.JobRouter
{
- public partial class ExceptionTrigger : IUtf8JsonSerializable
+ public partial class ExceptionTrigger
{
- void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
- {
- writer.WriteStartObject();
- writer.WritePropertyName("kind"u8);
- writer.WriteStringValue(Kind);
- writer.WriteEndObject();
- }
-
internal static ExceptionTrigger DeserializeExceptionTrigger(JsonElement element)
{
if (element.ValueKind == JsonValueKind.Null)
@@ -36,5 +28,13 @@ internal static ExceptionTrigger DeserializeExceptionTrigger(JsonElement element
}
return UnknownExceptionTrigger.DeserializeUnknownExceptionTrigger(element);
}
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static ExceptionTrigger FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeExceptionTrigger(document.RootElement);
+ }
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionTrigger.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionTrigger.cs
similarity index 87%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionTrigger.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionTrigger.cs
index a4092743f2818..a060787cfd536 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionTrigger.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionTrigger.cs
@@ -20,10 +20,13 @@ protected ExceptionTrigger()
}
/// Initializes a new instance of ExceptionTrigger.
- /// The type discriminator describing a sub-type of ExceptionTrigger.
+ /// Discriminator.
internal ExceptionTrigger(string kind)
{
Kind = kind;
}
+
+ /// Discriminator.
+ internal string Kind { get; set; }
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExpressionRouterRule.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExpressionRouterRule.Serialization.cs
similarity index 69%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExpressionRouterRule.Serialization.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ExpressionRouterRule.Serialization.cs
index 512472b165cbb..f48caf3880e64 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExpressionRouterRule.Serialization.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExpressionRouterRule.Serialization.cs
@@ -6,27 +6,13 @@
#nullable disable
using System.Text.Json;
+using Azure;
using Azure.Core;
namespace Azure.Communication.JobRouter
{
- public partial class ExpressionRouterRule : IUtf8JsonSerializable
+ public partial class ExpressionRouterRule
{
- void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
- {
- writer.WriteStartObject();
- if (Optional.IsDefined(Language))
- {
- writer.WritePropertyName("language"u8);
- writer.WriteStringValue(Language);
- }
- writer.WritePropertyName("expression"u8);
- writer.WriteStringValue(Expression);
- writer.WritePropertyName("kind"u8);
- writer.WriteStringValue(Kind);
- writer.WriteEndObject();
- }
-
internal static ExpressionRouterRule DeserializeExpressionRouterRule(JsonElement element)
{
if (element.ValueKind == JsonValueKind.Null)
@@ -56,5 +42,13 @@ internal static ExpressionRouterRule DeserializeExpressionRouterRule(JsonElement
}
return new ExpressionRouterRule(kind, language.Value, expression);
}
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static new ExpressionRouterRule FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeExpressionRouterRule(document.RootElement);
+ }
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExpressionRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExpressionRouterRule.cs
similarity index 60%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExpressionRouterRule.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ExpressionRouterRule.cs
index 658f0c6a463fd..a5c32dbb509b5 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExpressionRouterRule.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExpressionRouterRule.cs
@@ -14,16 +14,21 @@ namespace Azure.Communication.JobRouter
public partial class ExpressionRouterRule : RouterRule
{
/// Initializes a new instance of ExpressionRouterRule.
- /// The type discriminator describing a sub-type of Rule.
+ /// Discriminator.
/// The expression language to compile to and execute.
- /// The string containing the expression to evaluate. Should contain return statement with calculated values.
+ ///
+ /// The string containing the expression to evaluate. Should contain return
+ /// statement with calculated values.
+ ///
internal ExpressionRouterRule(string kind, string language, string expression) : base(kind)
{
Language = language;
Expression = expression;
- Kind = kind ?? "expression-rule";
}
- /// The string containing the expression to evaluate. Should contain return statement with calculated values.
- public string Expression { get; set; }
+ ///
+ /// The string containing the expression to evaluate. Should contain return
+ /// statement with calculated values.
+ ///
+ public string Expression { get; }
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExpressionRouterRuleLanguage.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExpressionRouterRuleLanguage.cs
similarity index 89%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExpressionRouterRuleLanguage.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ExpressionRouterRuleLanguage.cs
index cb40ec95479a9..688f830a662f7 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExpressionRouterRuleLanguage.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExpressionRouterRuleLanguage.cs
@@ -10,8 +10,8 @@
namespace Azure.Communication.JobRouter
{
- /// The expression language to compile to and execute.
- public readonly partial struct ExpressionRouterRuleLanguage : IEquatable
+ /// The available expression languages that can be configured.
+ internal readonly partial struct ExpressionRouterRuleLanguage : IEquatable
{
private readonly string _value;
@@ -24,7 +24,7 @@ public ExpressionRouterRuleLanguage(string value)
private const string PowerFxValue = "powerFx";
- /// powerFx.
+ /// PowerFx.
public static ExpressionRouterRuleLanguage PowerFx { get; } = new ExpressionRouterRuleLanguage(PowerFxValue);
/// Determines if two values are the same.
public static bool operator ==(ExpressionRouterRuleLanguage left, ExpressionRouterRuleLanguage right) => left.Equals(right);
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRule.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRule.Serialization.cs
similarity index 72%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRule.Serialization.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRule.Serialization.cs
index 4e04e254b9c3d..a74af384a51b3 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRule.Serialization.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRule.Serialization.cs
@@ -7,27 +7,13 @@
using System;
using System.Text.Json;
+using Azure;
using Azure.Core;
namespace Azure.Communication.JobRouter
{
- public partial class FunctionRouterRule : IUtf8JsonSerializable
+ public partial class FunctionRouterRule
{
- void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
- {
- writer.WriteStartObject();
- writer.WritePropertyName("functionUri"u8);
- writer.WriteStringValue(FunctionUri.AbsoluteUri);
- if (Optional.IsDefined(Credential))
- {
- writer.WritePropertyName("credential"u8);
- writer.WriteObjectValue(Credential);
- }
- writer.WritePropertyName("kind"u8);
- writer.WriteStringValue(Kind);
- writer.WriteEndObject();
- }
-
internal static FunctionRouterRule DeserializeFunctionRouterRule(JsonElement element)
{
if (element.ValueKind == JsonValueKind.Null)
@@ -61,5 +47,13 @@ internal static FunctionRouterRule DeserializeFunctionRouterRule(JsonElement ele
}
return new FunctionRouterRule(kind, functionUri, credential.Value);
}
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static new FunctionRouterRule FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeFunctionRouterRule(document.RootElement);
+ }
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRule.cs
similarity index 81%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRule.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRule.cs
index 5d1750a5d34fe..9e65631235f12 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRule.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRule.cs
@@ -14,16 +14,15 @@ namespace Azure.Communication.JobRouter
public partial class FunctionRouterRule : RouterRule
{
/// Initializes a new instance of FunctionRouterRule.
- /// The type discriminator describing a sub-type of Rule.
+ /// Discriminator.
/// URL for Azure Function.
/// Credentials used to access Azure function rule.
internal FunctionRouterRule(string kind, Uri functionUri, FunctionRouterRuleCredential credential) : base(kind)
{
FunctionUri = functionUri;
Credential = credential;
- Kind = kind ?? "azure-function-rule";
}
/// Credentials used to access Azure function rule.
- public FunctionRouterRuleCredential Credential { get; set; }
+ public FunctionRouterRuleCredential Credential { get; }
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRuleCredential.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRuleCredential.Serialization.cs
similarity index 64%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRuleCredential.Serialization.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRuleCredential.Serialization.cs
index 7d7958ac9c54d..2b98e06f9c9ca 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRuleCredential.Serialization.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRuleCredential.Serialization.cs
@@ -6,33 +6,13 @@
#nullable disable
using System.Text.Json;
+using Azure;
using Azure.Core;
namespace Azure.Communication.JobRouter
{
- public partial class FunctionRouterRuleCredential : IUtf8JsonSerializable
+ public partial class FunctionRouterRuleCredential
{
- void IUtf8JsonSerializable.Write(Utf8JsonWriter writer)
- {
- writer.WriteStartObject();
- if (Optional.IsDefined(FunctionKey))
- {
- writer.WritePropertyName("functionKey"u8);
- writer.WriteStringValue(FunctionKey);
- }
- if (Optional.IsDefined(AppKey))
- {
- writer.WritePropertyName("appKey"u8);
- writer.WriteStringValue(AppKey);
- }
- if (Optional.IsDefined(ClientId))
- {
- writer.WritePropertyName("clientId"u8);
- writer.WriteStringValue(ClientId);
- }
- writer.WriteEndObject();
- }
-
internal static FunctionRouterRuleCredential DeserializeFunctionRouterRuleCredential(JsonElement element)
{
if (element.ValueKind == JsonValueKind.Null)
@@ -62,5 +42,13 @@ internal static FunctionRouterRuleCredential DeserializeFunctionRouterRuleCreden
}
return new FunctionRouterRuleCredential(functionKey.Value, appKey.Value, clientId.Value);
}
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static FunctionRouterRuleCredential FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeFunctionRouterRuleCredential(document.RootElement);
+ }
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRuleCredential.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRuleCredential.cs
similarity index 85%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRuleCredential.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRuleCredential.cs
index 76b54979463b0..de1d09283948c 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRuleCredential.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRuleCredential.cs
@@ -14,11 +14,13 @@ public partial class FunctionRouterRuleCredential
/// (Optional) Access key scoped to a particular function.
///
/// (Optional) Access key scoped to a Azure Function app.
- /// This key grants access to all functions under the app.
+ /// This key grants access to
+ /// all functions under the app.
///
///
/// (Optional) Client id, when AppKey is provided
- /// In context of Azure function, this is usually the name of the key
+ /// In context of Azure function,
+ /// this is usually the name of the key
///
internal FunctionRouterRuleCredential(string functionKey, string appKey, string clientId)
{
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchModeType.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobMatchModeType.cs
similarity index 85%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchModeType.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/JobMatchModeType.cs
index 0398c4518b36e..90176de4f9182 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchModeType.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobMatchModeType.cs
@@ -10,7 +10,7 @@
namespace Azure.Communication.JobRouter
{
- /// The JobMatchModeType.
+ /// Discriminator values for supported matching mode types.
public readonly partial struct JobMatchModeType : IEquatable
{
private readonly string _value;
@@ -26,11 +26,11 @@ public JobMatchModeType(string value)
private const string ScheduleAndSuspendModeValue = "scheduleAndSuspendMode";
private const string SuspendModeValue = "suspendMode";
- /// queueAndMatchMode.
+ /// Discriminator used when matching worker to a job is required to be done right after job is queued.
public static JobMatchModeType QueueAndMatchMode { get; } = new JobMatchModeType(QueueAndMatchModeValue);
- /// scheduleAndSuspendMode.
+ /// Discriminator used for scheduling jobs to be queued at a future time.
public static JobMatchModeType ScheduleAndSuspendMode { get; } = new JobMatchModeType(ScheduleAndSuspendModeValue);
- /// suspendMode.
+ /// Discriminator used when matching workers to a job needs to be suspended.
public static JobMatchModeType SuspendMode { get; } = new JobMatchModeType(SuspendModeValue);
/// Determines if two values are the same.
public static bool operator ==(JobMatchModeType left, JobMatchModeType right) => left.Equals(right);
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchingMode.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobMatchingMode.Serialization.cs
similarity index 84%
rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchingMode.Serialization.cs
rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/JobMatchingMode.Serialization.cs
index 0717ffcb5c16d..9686530aaabc4 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchingMode.Serialization.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobMatchingMode.Serialization.cs
@@ -6,11 +6,12 @@
#nullable disable
using System.Text.Json;
+using Azure;
using Azure.Core;
namespace Azure.Communication.JobRouter
{
- public partial class JobMatchingMode : IUtf8JsonSerializable
+ public partial class JobMatchingMode
{
internal static JobMatchingMode DeserializeJobMatchingMode(JsonElement element)
{
@@ -63,5 +64,13 @@ internal static JobMatchingMode DeserializeJobMatchingMode(JsonElement element)
}
return new JobMatchingMode(Optional.ToNullable(modeType), queueAndMatchMode.Value, scheduleAndSuspendMode.Value, suspendMode.Value);
}
+
+ /// Deserializes the model from a raw response.
+ /// The response to deserialize the model from.
+ internal static JobMatchingMode FromResponse(Response response)
+ {
+ using var document = JsonDocument.Parse(response.Content);
+ return DeserializeJobMatchingMode(document.RootElement);
+ }
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobMatchingMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobMatchingMode.cs
new file mode 100644
index 0000000000000..155d649cc6632
--- /dev/null
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobMatchingMode.cs
@@ -0,0 +1,47 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+// Licensed under the MIT License.
+
+//
+
+#nullable disable
+
+namespace Azure.Communication.JobRouter
+{
+ ///
+ /// The matching mode to be applied to this job.
+ ///
+ /// Supported types:
+ ///
+ ///
+ /// QueueAndMatchMode: Used when matching worker to a job is required to be
+ /// done right after job is queued.
+ /// ScheduleAndSuspendMode: Used for scheduling
+ /// jobs to be queued at a future time. At specified time, matching of a worker to
+ /// the job will not start automatically.
+ /// SuspendMode: Used when matching workers
+ /// to a job needs to be suspended.
+ ///
+ public partial class JobMatchingMode
+ {
+ /// Initializes a new instance of JobMatchingMode.
+ /// Discriminator value used to differentiate between supported matching mode types.
+ ///
+ /// Describes a matching mode where matching worker to a job is automatically
+ /// started after job is queued successfully.
+ ///
+ ///
+ /// Describes a matching mode used for scheduling jobs to be queued at a future
+ /// time.
+ /// At the specified time, matching worker to a job will not start
+ /// automatically.
+ ///
+ /// Describes a matching mode where matching worker to a job is suspended.
+ internal JobMatchingMode(JobMatchModeType? modeType, object queueAndMatchMode, ScheduleAndSuspendMode scheduleAndSuspendMode, object suspendMode)
+ {
+ ModeType = modeType;
+ _queueAndMatchMode = queueAndMatchMode;
+ ScheduleAndSuspendMode = scheduleAndSuspendMode;
+ _suspendMode = suspendMode;
+ }
+ }
+}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterAdministrationRestClient.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterAdministrationRestClient.cs
index c484f7d1c336d..cf3861549b1a6 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterAdministrationRestClient.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterAdministrationRestClient.cs
@@ -6,9 +6,9 @@
#nullable disable
using System;
-using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
+using Autorest.CSharp.Core;
using Azure;
using Azure.Communication.JobRouter.Models;
using Azure.Core;
@@ -16,133 +16,49 @@
namespace Azure.Communication.JobRouter
{
+ // Data plane generated client.
+ /// The JobRouterAdministrationRest service client.
internal partial class JobRouterAdministrationRestClient
{
private readonly HttpPipeline _pipeline;
- private readonly string _endpoint;
+ private readonly Uri _endpoint;
private readonly string _apiVersion;
/// The ClientDiagnostics is used to provide tracing support for the client library.
internal ClientDiagnostics ClientDiagnostics { get; }
- /// Initializes a new instance of JobRouterAdministrationRestClient.
- /// The handler for diagnostic messaging in the client.
- /// The HTTP pipeline for sending and receiving REST requests and responses.
- /// The endpoint of the Azure Communication resource.
- /// Api Version.
- /// , , or is null.
- public JobRouterAdministrationRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, string apiVersion = "2022-07-18-preview")
- {
- ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics));
- _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline));
- _endpoint = endpoint ?? throw new ArgumentNullException(nameof(endpoint));
- _apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion));
- }
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ public virtual HttpPipeline Pipeline => _pipeline;
- internal HttpMessage CreateUpsertClassificationPolicyRequest(string id, ClassificationPolicy patch)
+ /// Initializes a new instance of JobRouterAdministrationRestClient for mocking.
+ protected JobRouterAdministrationRestClient()
{
- var message = _pipeline.CreateMessage();
- var request = message.Request;
- request.Method = RequestMethod.Patch;
- var uri = new RawRequestUriBuilder();
- uri.AppendRaw(_endpoint, false);
- uri.AppendPath("/routing/classificationPolicies/", false);
- uri.AppendPath(id, true);
- uri.AppendQuery("api-version", _apiVersion, true);
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json");
- request.Headers.Add("Content-Type", "application/merge-patch+json");
- var content = new Utf8JsonRequestContent();
- content.JsonWriter.WriteObjectValue(patch);
- request.Content = content;
- return message;
}
- /// Creates or updates a classification policy.
- /// Id of the classification policy.
- /// Model of classification policy properties to be patched. See also: https://datatracker.ietf.org/doc/html/rfc7386.
- /// The cancellation token to use.
- /// or is null.
- public async Task> UpsertClassificationPolicyAsync(string id, ClassificationPolicy patch, CancellationToken cancellationToken = default)
+ /// Initializes a new instance of JobRouterAdministrationRestClient.
+ /// The Uri to use.
+ /// is null.
+ public JobRouterAdministrationRestClient(Uri endpoint) : this(endpoint, new AzureCommunicationJobRouterClientOptions())
{
- if (id == null)
- {
- throw new ArgumentNullException(nameof(id));
- }
- if (patch == null)
- {
- throw new ArgumentNullException(nameof(patch));
- }
-
- using var message = CreateUpsertClassificationPolicyRequest(id, patch);
- await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
- switch (message.Response.Status)
- {
- case 200:
- case 201:
- {
- ClassificationPolicy value = default;
- using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
- value = ClassificationPolicy.DeserializeClassificationPolicy(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
- }
}
- /// Creates or updates a classification policy.
- /// Id of the classification policy.
- /// Model of classification policy properties to be patched. See also: https://datatracker.ietf.org/doc/html/rfc7386.
- /// The cancellation token to use.
- /// or is null.
- public Response UpsertClassificationPolicy(string id, ClassificationPolicy patch, CancellationToken cancellationToken = default)
+ /// Initializes a new instance of JobRouterAdministrationRestClient.
+ /// The Uri to use.
+ /// The options for configuring the client.
+ /// is null.
+ public JobRouterAdministrationRestClient(Uri endpoint, AzureCommunicationJobRouterClientOptions options)
{
- if (id == null)
- {
- throw new ArgumentNullException(nameof(id));
- }
- if (patch == null)
- {
- throw new ArgumentNullException(nameof(patch));
- }
-
- using var message = CreateUpsertClassificationPolicyRequest(id, patch);
- _pipeline.Send(message, cancellationToken);
- switch (message.Response.Status)
- {
- case 200:
- case 201:
- {
- ClassificationPolicy value = default;
- using var document = JsonDocument.Parse(message.Response.ContentStream);
- value = ClassificationPolicy.DeserializeClassificationPolicy(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
- }
- }
+ Argument.AssertNotNull(endpoint, nameof(endpoint));
+ options ??= new AzureCommunicationJobRouterClientOptions();
- internal HttpMessage CreateUpsertClassificationPolicyRequest(string id, RequestContent content, RequestContext context)
- {
- var message = _pipeline.CreateMessage(context, ResponseClassifier200201);
- var request = message.Request;
- request.Method = RequestMethod.Patch;
- var uri = new RawRequestUriBuilder();
- uri.AppendRaw(_endpoint, false);
- uri.AppendPath("/routing/classificationPolicies/", false);
- uri.AppendPath(id, true);
- uri.AppendQuery("api-version", _apiVersion, true);
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json");
- request.Headers.Add("Content-Type", "application/merge-patch+json");
- request.Content = content;
- return message;
+ ClientDiagnostics = new ClientDiagnostics(options, true);
+ _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), Array.Empty(), new ResponseClassifier());
+ _endpoint = endpoint;
+ _apiVersion = options.Version;
}
///
- /// [Protocol Method] Creates or updates a classification policy.
+ /// [Protocol Method] Creates or updates a distribution policy.
///
///
///
@@ -151,23 +67,28 @@ internal HttpMessage CreateUpsertClassificationPolicyRequest(string id, RequestC
///
///
///
- /// Id of the classification policy.
+ /// The unique identifier of the policy.
/// The content to send as the body of the request.
+ /// The content to send as the request conditions of the request.
/// The request context, which can override default behaviors of the client pipeline on a per-call basis.
/// or is null.
/// is an empty string, and was expected to be non-empty.
/// Service returned a non-success status code.
/// The response returned from the service.
- public virtual async Task UpsertClassificationPolicyAsync(string id, RequestContent content, RequestContext context = null)
+ ///
+ public virtual async Task UpsertDistributionPolicyAsync(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null)
{
Argument.AssertNotNullOrEmpty(id, nameof(id));
Argument.AssertNotNull(content, nameof(content));
- using var scope = ClientDiagnostics.CreateScope("JobRouterAdministration.UpsertClassificationPolicy");
+ Argument.AssertNull(requestConditions.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation.");
+ Argument.AssertNull(requestConditions.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation.");
+
+ using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.UpsertDistributionPolicy");
scope.Start();
try
{
- using HttpMessage message = CreateUpsertClassificationPolicyRequest(id, content, context);
+ using HttpMessage message = CreateUpsertDistributionPolicyRequest(id, content, requestConditions, context);
return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
}
catch (Exception e)
@@ -178,7 +99,7 @@ public virtual async Task UpsertClassificationPolicyAsync(string id, R
}
///
- /// [Protocol Method] Creates or updates a classification policy.
+ /// [Protocol Method] Creates or updates a distribution policy.
///
///
///
@@ -187,23 +108,28 @@ public virtual async Task UpsertClassificationPolicyAsync(string id, R
///
///
///
- /// Id of the classification policy.
+ /// The unique identifier of the policy.
/// The content to send as the body of the request.
+ /// The content to send as the request conditions of the request.
/// The request context, which can override default behaviors of the client pipeline on a per-call basis.
/// or is null.
/// is an empty string, and was expected to be non-empty.
/// Service returned a non-success status code.
/// The response returned from the service.
- public virtual Response UpsertClassificationPolicy(string id, RequestContent content, RequestContext context = null)
+ ///
+ public virtual Response UpsertDistributionPolicy(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null)
{
Argument.AssertNotNullOrEmpty(id, nameof(id));
Argument.AssertNotNull(content, nameof(content));
- using var scope = ClientDiagnostics.CreateScope("JobRouterAdministration.UpsertClassificationPolicy");
+ Argument.AssertNull(requestConditions.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation.");
+ Argument.AssertNull(requestConditions.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation.");
+
+ using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.UpsertDistributionPolicy");
scope.Start();
try
{
- using HttpMessage message = CreateUpsertClassificationPolicyRequest(id, content, context);
+ using HttpMessage message = CreateUpsertDistributionPolicyRequest(id, content, requestConditions, context);
return _pipeline.ProcessMessage(message, context);
}
catch (Exception e)
@@ -213,298 +139,155 @@ public virtual Response UpsertClassificationPolicy(string id, RequestContent con
}
}
- internal HttpMessage CreateGetClassificationPolicyRequest(string id)
- {
- var message = _pipeline.CreateMessage();
- var request = message.Request;
- request.Method = RequestMethod.Get;
- var uri = new RawRequestUriBuilder();
- uri.AppendRaw(_endpoint, false);
- uri.AppendPath("/routing/classificationPolicies/", false);
- uri.AppendPath(id, true);
- uri.AppendQuery("api-version", _apiVersion, true);
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json");
- return message;
- }
-
- /// Retrieves an existing classification policy by Id.
- /// Id of the classification policy.
+ /// Retrieves an existing distribution policy by Id.
+ /// The unique identifier of the policy.
/// The cancellation token to use.
/// is null.
- public async Task> GetClassificationPolicyAsync(string id, CancellationToken cancellationToken = default)
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ public virtual async Task> GetDistributionPolicyAsync(string id, CancellationToken cancellationToken = default)
{
- if (id == null)
- {
- throw new ArgumentNullException(nameof(id));
- }
+ Argument.AssertNotNullOrEmpty(id, nameof(id));
- using var message = CreateGetClassificationPolicyRequest(id);
- await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
- switch (message.Response.Status)
- {
- case 200:
- {
- ClassificationPolicy value = default;
- using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
- value = ClassificationPolicy.DeserializeClassificationPolicy(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
- }
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await GetDistributionPolicyAsync(id, context).ConfigureAwait(false);
+ return Response.FromValue(DistributionPolicy.FromResponse(response), response);
}
- /// Retrieves an existing classification policy by Id.
- /// Id of the classification policy.
+ /// Retrieves an existing distribution policy by Id.
+ /// The unique identifier of the policy.
/// The cancellation token to use.
/// is null.
- public Response GetClassificationPolicy(string id, CancellationToken cancellationToken = default)
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ public virtual Response GetDistributionPolicy(string id, CancellationToken cancellationToken = default)
{
- if (id == null)
- {
- throw new ArgumentNullException(nameof(id));
- }
-
- using var message = CreateGetClassificationPolicyRequest(id);
- _pipeline.Send(message, cancellationToken);
- switch (message.Response.Status)
- {
- case 200:
- {
- ClassificationPolicy value = default;
- using var document = JsonDocument.Parse(message.Response.ContentStream);
- value = ClassificationPolicy.DeserializeClassificationPolicy(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
- }
- }
+ Argument.AssertNotNullOrEmpty(id, nameof(id));
- internal HttpMessage CreateDeleteClassificationPolicyRequest(string id)
- {
- var message = _pipeline.CreateMessage();
- var request = message.Request;
- request.Method = RequestMethod.Delete;
- var uri = new RawRequestUriBuilder();
- uri.AppendRaw(_endpoint, false);
- uri.AppendPath("/routing/classificationPolicies/", false);
- uri.AppendPath(id, true);
- uri.AppendQuery("api-version", _apiVersion, true);
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json");
- return message;
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = GetDistributionPolicy(id, context);
+ return Response.FromValue(DistributionPolicy.FromResponse(response), response);
}
- /// Delete a classification policy by Id.
- /// Id of the classification policy.
- /// The cancellation token to use.
+ ///
+ /// [Protocol Method] Retrieves an existing distribution policy by Id.
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The unique identifier of the policy.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
/// is null.
- public async Task DeleteClassificationPolicyAsync(string id, CancellationToken cancellationToken = default)
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual async Task GetDistributionPolicyAsync(string id, RequestContext context)
{
- if (id == null)
- {
- throw new ArgumentNullException(nameof(id));
- }
-
- using var message = CreateDeleteClassificationPolicyRequest(id);
- await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
- switch (message.Response.Status)
- {
- case 204:
- return message.Response;
- default:
- throw new RequestFailedException(message.Response);
- }
- }
+ Argument.AssertNotNullOrEmpty(id, nameof(id));
- /// Delete a classification policy by Id.
- /// Id of the classification policy.
- /// The cancellation token to use.
- /// is null.
- public Response DeleteClassificationPolicy(string id, CancellationToken cancellationToken = default)
- {
- if (id == null)
+ using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.GetDistributionPolicy");
+ scope.Start();
+ try
{
- throw new ArgumentNullException(nameof(id));
+ using HttpMessage message = CreateGetDistributionPolicyRequest(id, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
}
-
- using var message = CreateDeleteClassificationPolicyRequest(id);
- _pipeline.Send(message, cancellationToken);
- switch (message.Response.Status)
+ catch (Exception e)
{
- case 204:
- return message.Response;
- default:
- throw new RequestFailedException(message.Response);
+ scope.Failed(e);
+ throw;
}
}
- internal HttpMessage CreateListClassificationPoliciesRequest(int? maxpagesize)
+ ///
+ /// [Protocol Method] Retrieves an existing distribution policy by Id.
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The unique identifier of the policy.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual Response GetDistributionPolicy(string id, RequestContext context)
{
- var message = _pipeline.CreateMessage();
- var request = message.Request;
- request.Method = RequestMethod.Get;
- var uri = new RawRequestUriBuilder();
- uri.AppendRaw(_endpoint, false);
- uri.AppendPath("/routing/classificationPolicies", false);
- if (maxpagesize != null)
- {
- uri.AppendQuery("maxpagesize", maxpagesize.Value, true);
- }
- uri.AppendQuery("api-version", _apiVersion, true);
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json");
- return message;
- }
+ Argument.AssertNotNullOrEmpty(id, nameof(id));
- /// Retrieves existing classification policies.
- /// Maximum page size.
- /// The cancellation token to use.
- public async Task> ListClassificationPoliciesAsync(int? maxpagesize = null, CancellationToken cancellationToken = default)
- {
- using var message = CreateListClassificationPoliciesRequest(maxpagesize);
- await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
- switch (message.Response.Status)
+ using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.GetDistributionPolicy");
+ scope.Start();
+ try
{
- case 200:
- {
- ClassificationPolicyCollection value = default;
- using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
- value = ClassificationPolicyCollection.DeserializeClassificationPolicyCollection(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
+ using HttpMessage message = CreateGetDistributionPolicyRequest(id, context);
+ return _pipeline.ProcessMessage(message, context);
}
- }
-
- /// Retrieves existing classification policies.
- /// Maximum page size.
- /// The cancellation token to use.
- public Response ListClassificationPolicies(int? maxpagesize = null, CancellationToken cancellationToken = default)
- {
- using var message = CreateListClassificationPoliciesRequest(maxpagesize);
- _pipeline.Send(message, cancellationToken);
- switch (message.Response.Status)
+ catch (Exception e)
{
- case 200:
- {
- ClassificationPolicyCollection value = default;
- using var document = JsonDocument.Parse(message.Response.ContentStream);
- value = ClassificationPolicyCollection.DeserializeClassificationPolicyCollection(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
+ scope.Failed(e);
+ throw;
}
}
- internal HttpMessage CreateUpsertDistributionPolicyRequest(string id, DistributionPolicy patch)
- {
- var message = _pipeline.CreateMessage();
- var request = message.Request;
- request.Method = RequestMethod.Patch;
- var uri = new RawRequestUriBuilder();
- uri.AppendRaw(_endpoint, false);
- uri.AppendPath("/routing/distributionPolicies/", false);
- uri.AppendPath(id, true);
- uri.AppendQuery("api-version", _apiVersion, true);
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json");
- request.Headers.Add("Content-Type", "application/merge-patch+json");
- var content = new Utf8JsonRequestContent();
- content.JsonWriter.WriteObjectValue(patch);
- request.Content = content;
- return message;
- }
-
- /// Creates or updates a distribution policy.
- /// Id of the distribution policy.
- /// Model of distribution policy properties to be patched. See also: https://datatracker.ietf.org/doc/html/rfc7386.
- /// The cancellation token to use.
- /// or is null.
- public async Task> UpsertDistributionPolicyAsync(string id, DistributionPolicy patch, CancellationToken cancellationToken = default)
+ // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method
+ ///
+ /// [Protocol Method] Delete a distribution policy by Id.
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The unique identifier of the policy.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual async Task DeleteDistributionPolicyAsync(string id, RequestContext context = null)
{
- if (id == null)
- {
- throw new ArgumentNullException(nameof(id));
- }
- if (patch == null)
- {
- throw new ArgumentNullException(nameof(patch));
- }
-
- using var message = CreateUpsertDistributionPolicyRequest(id, patch);
- await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
- switch (message.Response.Status)
- {
- case 200:
- case 201:
- {
- DistributionPolicy value = default;
- using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
- value = DistributionPolicy.DeserializeDistributionPolicy(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
- }
- }
+ Argument.AssertNotNullOrEmpty(id, nameof(id));
- /// Creates or updates a distribution policy.
- /// Id of the distribution policy.
- /// Model of distribution policy properties to be patched. See also: https://datatracker.ietf.org/doc/html/rfc7386.
- /// The cancellation token to use.
- /// or is null.
- public Response UpsertDistributionPolicy(string id, DistributionPolicy patch, CancellationToken cancellationToken = default)
- {
- if (id == null)
- {
- throw new ArgumentNullException(nameof(id));
- }
- if (patch == null)
+ using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.DeleteDistributionPolicy");
+ scope.Start();
+ try
{
- throw new ArgumentNullException(nameof(patch));
+ using HttpMessage message = CreateDeleteDistributionPolicyRequest(id, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
}
-
- using var message = CreateUpsertDistributionPolicyRequest(id, patch);
- _pipeline.Send(message, cancellationToken);
- switch (message.Response.Status)
+ catch (Exception e)
{
- case 200:
- case 201:
- {
- DistributionPolicy value = default;
- using var document = JsonDocument.Parse(message.Response.ContentStream);
- value = DistributionPolicy.DeserializeDistributionPolicy(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
+ scope.Failed(e);
+ throw;
}
}
- internal HttpMessage CreateUpsertDistributionPolicyRequest(string id, RequestContent content, RequestContext context)
- {
- var message = _pipeline.CreateMessage(context, ResponseClassifier200201);
- var request = message.Request;
- request.Method = RequestMethod.Patch;
- var uri = new RawRequestUriBuilder();
- uri.AppendRaw(_endpoint, false);
- uri.AppendPath("/routing/distributionPolicies/", false);
- uri.AppendPath(id, true);
- uri.AppendQuery("api-version", _apiVersion, true);
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json");
- request.Headers.Add("Content-Type", "application/merge-patch+json");
- request.Content = content;
- return message;
- }
-
+ // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method
///
- /// [Protocol Method] Creates or updates a distribution policy.
+ /// [Protocol Method] Delete a distribution policy by Id.
///
///
///
@@ -513,24 +296,23 @@ internal HttpMessage CreateUpsertDistributionPolicyRequest(string id, RequestCon
///
///
///
- /// Id of the distribution policy.
- /// The content to send as the body of the request.
+ /// The unique identifier of the policy.
/// The request context, which can override default behaviors of the client pipeline on a per-call basis.
- /// or is null.
+ /// is null.
/// is an empty string, and was expected to be non-empty.
/// Service returned a non-success status code.
/// The response returned from the service.
- public virtual async Task UpsertDistributionPolicyAsync(string id, RequestContent content, RequestContext context = null)
+ ///
+ public virtual Response DeleteDistributionPolicy(string id, RequestContext context = null)
{
Argument.AssertNotNullOrEmpty(id, nameof(id));
- Argument.AssertNotNull(content, nameof(content));
- using var scope = ClientDiagnostics.CreateScope("JobRouterAdministration.UpsertDistributionPolicy");
+ using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.DeleteDistributionPolicy");
scope.Start();
try
{
- using HttpMessage message = CreateUpsertDistributionPolicyRequest(id, content, context);
- return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ using HttpMessage message = CreateDeleteDistributionPolicyRequest(id, context);
+ return _pipeline.ProcessMessage(message, context);
}
catch (Exception e)
{
@@ -540,7 +322,7 @@ public virtual async Task UpsertDistributionPolicyAsync(string id, Req
}
///
- /// [Protocol Method] Creates or updates a distribution policy.
+ /// [Protocol Method] Creates or updates a classification policy.
///
///
///
@@ -549,24 +331,29 @@ public virtual async Task UpsertDistributionPolicyAsync(string id, Req
///
///
///
- /// Id of the distribution policy.
+ /// Unique identifier of this policy.
/// The content to send as the body of the request.
+ /// The content to send as the request conditions of the request.
/// The request context, which can override default behaviors of the client pipeline on a per-call basis.
/// or is null.
/// is an empty string, and was expected to be non-empty.
/// Service returned a non-success status code.
/// The response returned from the service.
- public virtual Response UpsertDistributionPolicy(string id, RequestContent content, RequestContext context = null)
+ ///
+ public virtual async Task UpsertClassificationPolicyAsync(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null)
{
Argument.AssertNotNullOrEmpty(id, nameof(id));
Argument.AssertNotNull(content, nameof(content));
- using var scope = ClientDiagnostics.CreateScope("JobRouterAdministration.UpsertDistributionPolicy");
+ Argument.AssertNull(requestConditions.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation.");
+ Argument.AssertNull(requestConditions.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation.");
+
+ using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.UpsertClassificationPolicy");
scope.Start();
try
{
- using HttpMessage message = CreateUpsertDistributionPolicyRequest(id, content, context);
- return _pipeline.ProcessMessage(message, context);
+ using HttpMessage message = CreateUpsertClassificationPolicyRequest(id, content, requestConditions, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
}
catch (Exception e)
{
@@ -575,296 +362,229 @@ public virtual Response UpsertDistributionPolicy(string id, RequestContent conte
}
}
- internal HttpMessage CreateGetDistributionPolicyRequest(string id)
- {
- var message = _pipeline.CreateMessage();
- var request = message.Request;
- request.Method = RequestMethod.Get;
- var uri = new RawRequestUriBuilder();
- uri.AppendRaw(_endpoint, false);
- uri.AppendPath("/routing/distributionPolicies/", false);
- uri.AppendPath(id, true);
- uri.AppendQuery("api-version", _apiVersion, true);
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json");
- return message;
- }
-
- /// Retrieves an existing distribution policy by Id.
- /// Id of the distribution policy.
- /// The cancellation token to use.
- /// is null.
- public async Task> GetDistributionPolicyAsync(string id, CancellationToken cancellationToken = default)
+ ///
+ /// [Protocol Method] Creates or updates a classification policy.
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Unique identifier of this policy.
+ /// The content to send as the body of the request.
+ /// The content to send as the request conditions of the request.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// or is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual Response UpsertClassificationPolicy(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null)
{
- if (id == null)
+ Argument.AssertNotNullOrEmpty(id, nameof(id));
+ Argument.AssertNotNull(content, nameof(content));
+
+ Argument.AssertNull(requestConditions.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation.");
+ Argument.AssertNull(requestConditions.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation.");
+
+ using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.UpsertClassificationPolicy");
+ scope.Start();
+ try
{
- throw new ArgumentNullException(nameof(id));
+ using HttpMessage message = CreateUpsertClassificationPolicyRequest(id, content, requestConditions, context);
+ return _pipeline.ProcessMessage(message, context);
}
-
- using var message = CreateGetDistributionPolicyRequest(id);
- await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
- switch (message.Response.Status)
+ catch (Exception e)
{
- case 200:
- {
- DistributionPolicy value = default;
- using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
- value = DistributionPolicy.DeserializeDistributionPolicy(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
+ scope.Failed(e);
+ throw;
}
}
- /// Retrieves an existing distribution policy by Id.
- /// Id of the distribution policy.
+ /// Retrieves an existing classification policy by Id.
+ /// Unique identifier of this policy.
/// The cancellation token to use.
/// is null.
- public Response GetDistributionPolicy(string id, CancellationToken cancellationToken = default)
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ public virtual async Task> GetClassificationPolicyAsync(string id, CancellationToken cancellationToken = default)
{
- if (id == null)
- {
- throw new ArgumentNullException(nameof(id));
- }
-
- using var message = CreateGetDistributionPolicyRequest(id);
- _pipeline.Send(message, cancellationToken);
- switch (message.Response.Status)
- {
- case 200:
- {
- DistributionPolicy value = default;
- using var document = JsonDocument.Parse(message.Response.ContentStream);
- value = DistributionPolicy.DeserializeDistributionPolicy(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
- }
- }
+ Argument.AssertNotNullOrEmpty(id, nameof(id));
- internal HttpMessage CreateDeleteDistributionPolicyRequest(string id)
- {
- var message = _pipeline.CreateMessage();
- var request = message.Request;
- request.Method = RequestMethod.Delete;
- var uri = new RawRequestUriBuilder();
- uri.AppendRaw(_endpoint, false);
- uri.AppendPath("/routing/distributionPolicies/", false);
- uri.AppendPath(id, true);
- uri.AppendQuery("api-version", _apiVersion, true);
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json");
- return message;
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await GetClassificationPolicyAsync(id, context).ConfigureAwait(false);
+ return Response.FromValue(ClassificationPolicy.FromResponse(response), response);
}
- /// Delete a distribution policy by Id.
- /// Id of the distribution policy.
+ /// Retrieves an existing classification policy by Id.
+ /// Unique identifier of this policy.
/// The cancellation token to use.
/// is null.
- public async Task DeleteDistributionPolicyAsync(string id, CancellationToken cancellationToken = default)
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ public virtual Response GetClassificationPolicy(string id, CancellationToken cancellationToken = default)
{
- if (id == null)
- {
- throw new ArgumentNullException(nameof(id));
- }
+ Argument.AssertNotNullOrEmpty(id, nameof(id));
- using var message = CreateDeleteDistributionPolicyRequest(id);
- await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
- switch (message.Response.Status)
- {
- case 204:
- return message.Response;
- default:
- throw new RequestFailedException(message.Response);
- }
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = GetClassificationPolicy(id, context);
+ return Response.FromValue(ClassificationPolicy.FromResponse(response), response);
}
- /// Delete a distribution policy by Id.
- /// Id of the distribution policy.
- /// The cancellation token to use.
+ ///
+ /// [Protocol Method] Retrieves an existing classification policy by Id.
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// Unique identifier of this policy.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
/// is null.
- public Response DeleteDistributionPolicy(string id, CancellationToken cancellationToken = default)
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual async Task GetClassificationPolicyAsync(string id, RequestContext context)
{
- if (id == null)
- {
- throw new ArgumentNullException(nameof(id));
- }
+ Argument.AssertNotNullOrEmpty(id, nameof(id));
- using var message = CreateDeleteDistributionPolicyRequest(id);
- _pipeline.Send(message, cancellationToken);
- switch (message.Response.Status)
+ using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.GetClassificationPolicy");
+ scope.Start();
+ try
{
- case 204:
- return message.Response;
- default:
- throw new RequestFailedException(message.Response);
+ using HttpMessage message = CreateGetClassificationPolicyRequest(id, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
}
- }
-
- internal HttpMessage CreateListDistributionPoliciesRequest(int? maxpagesize)
- {
- var message = _pipeline.CreateMessage();
- var request = message.Request;
- request.Method = RequestMethod.Get;
- var uri = new RawRequestUriBuilder();
- uri.AppendRaw(_endpoint, false);
- uri.AppendPath("/routing/distributionPolicies", false);
- if (maxpagesize != null)
+ catch (Exception e)
{
- uri.AppendQuery("maxpagesize", maxpagesize.Value, true);
+ scope.Failed(e);
+ throw;
}
- uri.AppendQuery("api-version", _apiVersion, true);
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json");
- return message;
}
- /// Retrieves existing distribution policies.
- /// Maximum page size.
- /// The cancellation token to use.
- public async Task> ListDistributionPoliciesAsync(int? maxpagesize = null, CancellationToken cancellationToken = default)
+ ///
+ /// [Protocol Method] Retrieves an existing classification policy by Id.
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// Unique identifier of this policy.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual Response GetClassificationPolicy(string id, RequestContext context)
{
- using var message = CreateListDistributionPoliciesRequest(maxpagesize);
- await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
- switch (message.Response.Status)
+ Argument.AssertNotNullOrEmpty(id, nameof(id));
+
+ using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.GetClassificationPolicy");
+ scope.Start();
+ try
{
- case 200:
- {
- DistributionPolicyCollection value = default;
- using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
- value = DistributionPolicyCollection.DeserializeDistributionPolicyCollection(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
+ using HttpMessage message = CreateGetClassificationPolicyRequest(id, context);
+ return _pipeline.ProcessMessage(message, context);
}
- }
-
- /// Retrieves existing distribution policies.
- /// Maximum page size.
- /// The cancellation token to use.
- public Response ListDistributionPolicies(int? maxpagesize = null, CancellationToken cancellationToken = default)
- {
- using var message = CreateListDistributionPoliciesRequest(maxpagesize);
- _pipeline.Send(message, cancellationToken);
- switch (message.Response.Status)
+ catch (Exception e)
{
- case 200:
- {
- DistributionPolicyCollection value = default;
- using var document = JsonDocument.Parse(message.Response.ContentStream);
- value = DistributionPolicyCollection.DeserializeDistributionPolicyCollection(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
+ scope.Failed(e);
+ throw;
}
}
- internal HttpMessage CreateUpsertExceptionPolicyRequest(string id, ExceptionPolicy patch)
+ // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method
+ ///
+ /// [Protocol Method] Delete a classification policy by Id.
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Unique identifier of this policy.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual async Task DeleteClassificationPolicyAsync(string id, RequestContext context = null)
{
- var message = _pipeline.CreateMessage();
- var request = message.Request;
- request.Method = RequestMethod.Patch;
- var uri = new RawRequestUriBuilder();
- uri.AppendRaw(_endpoint, false);
- uri.AppendPath("/routing/exceptionPolicies/", false);
- uri.AppendPath(id, true);
- uri.AppendQuery("api-version", _apiVersion, true);
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json");
- request.Headers.Add("Content-Type", "application/merge-patch+json");
- var content = new Utf8JsonRequestContent();
- content.JsonWriter.WriteObjectValue(patch);
- request.Content = content;
- return message;
- }
+ Argument.AssertNotNullOrEmpty(id, nameof(id));
- /// Creates or updates a exception policy.
- /// Id of the exception policy.
- /// Model of exception policy properties to be patched. See also: https://datatracker.ietf.org/doc/html/rfc7386.
- /// The cancellation token to use.
- /// or is null.
- public async Task> UpsertExceptionPolicyAsync(string id, ExceptionPolicy patch, CancellationToken cancellationToken = default)
- {
- if (id == null)
- {
- throw new ArgumentNullException(nameof(id));
- }
- if (patch == null)
+ using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.DeleteClassificationPolicy");
+ scope.Start();
+ try
{
- throw new ArgumentNullException(nameof(patch));
+ using HttpMessage message = CreateDeleteClassificationPolicyRequest(id, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
}
-
- using var message = CreateUpsertExceptionPolicyRequest(id, patch);
- await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
- switch (message.Response.Status)
+ catch (Exception e)
{
- case 200:
- case 201:
- {
- ExceptionPolicy value = default;
- using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
- value = ExceptionPolicy.DeserializeExceptionPolicy(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
+ scope.Failed(e);
+ throw;
}
}
- /// Creates or updates a exception policy.
- /// Id of the exception policy.
- /// Model of exception policy properties to be patched. See also: https://datatracker.ietf.org/doc/html/rfc7386.
- /// The cancellation token to use.
- /// or is null.
- public Response UpsertExceptionPolicy(string id, ExceptionPolicy patch, CancellationToken cancellationToken = default)
+ // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method
+ ///
+ /// [Protocol Method] Delete a classification policy by Id.
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Unique identifier of this policy.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual Response DeleteClassificationPolicy(string id, RequestContext context = null)
{
- if (id == null)
- {
- throw new ArgumentNullException(nameof(id));
- }
- if (patch == null)
+ Argument.AssertNotNullOrEmpty(id, nameof(id));
+
+ using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.DeleteClassificationPolicy");
+ scope.Start();
+ try
{
- throw new ArgumentNullException(nameof(patch));
+ using HttpMessage message = CreateDeleteClassificationPolicyRequest(id, context);
+ return _pipeline.ProcessMessage(message, context);
}
-
- using var message = CreateUpsertExceptionPolicyRequest(id, patch);
- _pipeline.Send(message, cancellationToken);
- switch (message.Response.Status)
+ catch (Exception e)
{
- case 200:
- case 201:
- {
- ExceptionPolicy value = default;
- using var document = JsonDocument.Parse(message.Response.ContentStream);
- value = ExceptionPolicy.DeserializeExceptionPolicy(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
+ scope.Failed(e);
+ throw;
}
}
- internal HttpMessage CreateUpsertExceptionPolicyRequest(string id, RequestContent content, RequestContext context)
- {
- var message = _pipeline.CreateMessage(context, ResponseClassifier200201);
- var request = message.Request;
- request.Method = RequestMethod.Patch;
- var uri = new RawRequestUriBuilder();
- uri.AppendRaw(_endpoint, false);
- uri.AppendPath("/routing/exceptionPolicies/", false);
- uri.AppendPath(id, true);
- uri.AppendQuery("api-version", _apiVersion, true);
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json");
- request.Headers.Add("Content-Type", "application/merge-patch+json");
- request.Content = content;
- return message;
- }
-
///
/// [Protocol Method] Creates or updates a exception policy.
///
@@ -875,23 +595,28 @@ internal HttpMessage CreateUpsertExceptionPolicyRequest(string id, RequestConten
///
///
///
- /// Id of the exception policy.
+ /// The Id of the exception policy.
/// The content to send as the body of the request.
+ /// The content to send as the request conditions of the request.
/// The request context, which can override default behaviors of the client pipeline on a per-call basis.
/// or is null.
/// is an empty string, and was expected to be non-empty.
/// Service returned a non-success status code.
/// The response returned from the service.
- public virtual async Task UpsertExceptionPolicyAsync(string id, RequestContent content, RequestContext context = null)
+ ///
+ public virtual async Task UpsertExceptionPolicyAsync(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null)
{
Argument.AssertNotNullOrEmpty(id, nameof(id));
Argument.AssertNotNull(content, nameof(content));
- using var scope = ClientDiagnostics.CreateScope("JobRouterAdministration.UpsertExceptionPolicy");
+ Argument.AssertNull(requestConditions.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation.");
+ Argument.AssertNull(requestConditions.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation.");
+
+ using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.UpsertExceptionPolicy");
scope.Start();
try
{
- using HttpMessage message = CreateUpsertExceptionPolicyRequest(id, content, context);
+ using HttpMessage message = CreateUpsertExceptionPolicyRequest(id, content, requestConditions, context);
return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
}
catch (Exception e)
@@ -911,23 +636,28 @@ public virtual async Task UpsertExceptionPolicyAsync(string id, Reques
///
///
///
- /// Id of the exception policy.
+ /// The Id of the exception policy.
/// The content to send as the body of the request.
+ /// The content to send as the request conditions of the request.
/// The request context, which can override default behaviors of the client pipeline on a per-call basis.
/// or is null.
/// is an empty string, and was expected to be non-empty.
/// Service returned a non-success status code.
/// The response returned from the service.
- public virtual Response UpsertExceptionPolicy(string id, RequestContent content, RequestContext context = null)
+ ///
+ public virtual Response UpsertExceptionPolicy(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null)
{
Argument.AssertNotNullOrEmpty(id, nameof(id));
Argument.AssertNotNull(content, nameof(content));
- using var scope = ClientDiagnostics.CreateScope("JobRouterAdministration.UpsertExceptionPolicy");
+ Argument.AssertNull(requestConditions.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation.");
+ Argument.AssertNull(requestConditions.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation.");
+
+ using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.UpsertExceptionPolicy");
scope.Start();
try
{
- using HttpMessage message = CreateUpsertExceptionPolicyRequest(id, content, context);
+ using HttpMessage message = CreateUpsertExceptionPolicyRequest(id, content, requestConditions, context);
return _pipeline.ProcessMessage(message, context);
}
catch (Exception e)
@@ -937,296 +667,188 @@ public virtual Response UpsertExceptionPolicy(string id, RequestContent content,
}
}
- internal HttpMessage CreateGetExceptionPolicyRequest(string id)
- {
- var message = _pipeline.CreateMessage();
- var request = message.Request;
- request.Method = RequestMethod.Get;
- var uri = new RawRequestUriBuilder();
- uri.AppendRaw(_endpoint, false);
- uri.AppendPath("/routing/exceptionPolicies/", false);
- uri.AppendPath(id, true);
- uri.AppendQuery("api-version", _apiVersion, true);
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json");
- return message;
- }
-
/// Retrieves an existing exception policy by Id.
- /// Id of the exception policy to retrieve.
+ /// The Id of the exception policy.
/// The cancellation token to use.
/// is null.
- public async Task> GetExceptionPolicyAsync(string id, CancellationToken cancellationToken = default)
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ public virtual async Task> GetExceptionPolicyAsync(string id, CancellationToken cancellationToken = default)
{
- if (id == null)
- {
- throw new ArgumentNullException(nameof(id));
- }
+ Argument.AssertNotNullOrEmpty(id, nameof(id));
- using var message = CreateGetExceptionPolicyRequest(id);
- await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
- switch (message.Response.Status)
- {
- case 200:
- {
- ExceptionPolicy value = default;
- using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
- value = ExceptionPolicy.DeserializeExceptionPolicy(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
- }
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await GetExceptionPolicyAsync(id, context).ConfigureAwait(false);
+ return Response.FromValue(ExceptionPolicy.FromResponse(response), response);
}
/// Retrieves an existing exception policy by Id.
- /// Id of the exception policy to retrieve.
+ /// The Id of the exception policy.
/// The cancellation token to use.
/// is null.
- public Response GetExceptionPolicy(string id, CancellationToken cancellationToken = default)
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ public virtual Response GetExceptionPolicy(string id, CancellationToken cancellationToken = default)
{
- if (id == null)
- {
- throw new ArgumentNullException(nameof(id));
- }
-
- using var message = CreateGetExceptionPolicyRequest(id);
- _pipeline.Send(message, cancellationToken);
- switch (message.Response.Status)
- {
- case 200:
- {
- ExceptionPolicy value = default;
- using var document = JsonDocument.Parse(message.Response.ContentStream);
- value = ExceptionPolicy.DeserializeExceptionPolicy(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
- }
- }
+ Argument.AssertNotNullOrEmpty(id, nameof(id));
- internal HttpMessage CreateDeleteExceptionPolicyRequest(string id)
- {
- var message = _pipeline.CreateMessage();
- var request = message.Request;
- request.Method = RequestMethod.Delete;
- var uri = new RawRequestUriBuilder();
- uri.AppendRaw(_endpoint, false);
- uri.AppendPath("/routing/exceptionPolicies/", false);
- uri.AppendPath(id, true);
- uri.AppendQuery("api-version", _apiVersion, true);
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json");
- return message;
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = GetExceptionPolicy(id, context);
+ return Response.FromValue(ExceptionPolicy.FromResponse(response), response);
}
- /// Deletes a exception policy by Id.
- /// Id of the exception policy to delete.
- /// The cancellation token to use.
- /// is null.
- public async Task DeleteExceptionPolicyAsync(string id, CancellationToken cancellationToken = default)
- {
- if (id == null)
- {
- throw new ArgumentNullException(nameof(id));
- }
-
- using var message = CreateDeleteExceptionPolicyRequest(id);
- await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
- switch (message.Response.Status)
- {
- case 204:
- return message.Response;
- default:
- throw new RequestFailedException(message.Response);
- }
- }
-
- /// Deletes a exception policy by Id.
- /// Id of the exception policy to delete.
- /// The cancellation token to use.
+ ///
+ /// [Protocol Method] Retrieves an existing exception policy by Id.
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The Id of the exception policy.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
/// is null.
- public Response DeleteExceptionPolicy(string id, CancellationToken cancellationToken = default)
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual async Task GetExceptionPolicyAsync(string id, RequestContext context)
{
- if (id == null)
- {
- throw new ArgumentNullException(nameof(id));
- }
+ Argument.AssertNotNullOrEmpty(id, nameof(id));
- using var message = CreateDeleteExceptionPolicyRequest(id);
- _pipeline.Send(message, cancellationToken);
- switch (message.Response.Status)
+ using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.GetExceptionPolicy");
+ scope.Start();
+ try
{
- case 204:
- return message.Response;
- default:
- throw new RequestFailedException(message.Response);
+ using HttpMessage message = CreateGetExceptionPolicyRequest(id, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
}
- }
-
- internal HttpMessage CreateListExceptionPoliciesRequest(int? maxpagesize)
- {
- var message = _pipeline.CreateMessage();
- var request = message.Request;
- request.Method = RequestMethod.Get;
- var uri = new RawRequestUriBuilder();
- uri.AppendRaw(_endpoint, false);
- uri.AppendPath("/routing/exceptionPolicies", false);
- if (maxpagesize != null)
+ catch (Exception e)
{
- uri.AppendQuery("maxpagesize", maxpagesize.Value, true);
+ scope.Failed(e);
+ throw;
}
- uri.AppendQuery("api-version", _apiVersion, true);
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json");
- return message;
}
- /// Retrieves existing exception policies.
- /// Number of objects to return per page.
- /// The cancellation token to use.
- public async Task> ListExceptionPoliciesAsync(int? maxpagesize = null, CancellationToken cancellationToken = default)
+ ///
+ /// [Protocol Method] Retrieves an existing exception policy by Id.
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The Id of the exception policy.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual Response GetExceptionPolicy(string id, RequestContext context)
{
- using var message = CreateListExceptionPoliciesRequest(maxpagesize);
- await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
- switch (message.Response.Status)
+ Argument.AssertNotNullOrEmpty(id, nameof(id));
+
+ using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.GetExceptionPolicy");
+ scope.Start();
+ try
{
- case 200:
- {
- ExceptionPolicyCollection value = default;
- using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
- value = ExceptionPolicyCollection.DeserializeExceptionPolicyCollection(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
+ using HttpMessage message = CreateGetExceptionPolicyRequest(id, context);
+ return _pipeline.ProcessMessage(message, context);
}
- }
-
- /// Retrieves existing exception policies.
- /// Number of objects to return per page.
- /// The cancellation token to use.
- public Response ListExceptionPolicies(int? maxpagesize = null, CancellationToken cancellationToken = default)
- {
- using var message = CreateListExceptionPoliciesRequest(maxpagesize);
- _pipeline.Send(message, cancellationToken);
- switch (message.Response.Status)
+ catch (Exception e)
{
- case 200:
- {
- ExceptionPolicyCollection value = default;
- using var document = JsonDocument.Parse(message.Response.ContentStream);
- value = ExceptionPolicyCollection.DeserializeExceptionPolicyCollection(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
+ scope.Failed(e);
+ throw;
}
}
- internal HttpMessage CreateUpsertQueueRequest(string id, RouterQueue patch)
+ // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method
+ ///
+ /// [Protocol Method] Deletes a exception policy by Id.
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The Id of the exception policy.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual async Task DeleteExceptionPolicyAsync(string id, RequestContext context = null)
{
- var message = _pipeline.CreateMessage();
- var request = message.Request;
- request.Method = RequestMethod.Patch;
- var uri = new RawRequestUriBuilder();
- uri.AppendRaw(_endpoint, false);
- uri.AppendPath("/routing/queues/", false);
- uri.AppendPath(id, true);
- uri.AppendQuery("api-version", _apiVersion, true);
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json");
- request.Headers.Add("Content-Type", "application/merge-patch+json");
- var content = new Utf8JsonRequestContent();
- content.JsonWriter.WriteObjectValue(patch);
- request.Content = content;
- return message;
- }
+ Argument.AssertNotNullOrEmpty(id, nameof(id));
- /// Creates or updates a queue.
- /// Id of the queue.
- /// Model of queue properties to be patched. See also: https://datatracker.ietf.org/doc/html/rfc7386.
- /// The cancellation token to use.
- /// or is null.
- public async Task> UpsertQueueAsync(string id, RouterQueue patch, CancellationToken cancellationToken = default)
- {
- if (id == null)
- {
- throw new ArgumentNullException(nameof(id));
- }
- if (patch == null)
+ using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.DeleteExceptionPolicy");
+ scope.Start();
+ try
{
- throw new ArgumentNullException(nameof(patch));
+ using HttpMessage message = CreateDeleteExceptionPolicyRequest(id, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
}
-
- using var message = CreateUpsertQueueRequest(id, patch);
- await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
- switch (message.Response.Status)
+ catch (Exception e)
{
- case 200:
- case 201:
- {
- RouterQueue value = default;
- using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
- value = RouterQueue.DeserializeRouterQueue(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
+ scope.Failed(e);
+ throw;
}
}
- /// Creates or updates a queue.
- /// Id of the queue.
- /// Model of queue properties to be patched. See also: https://datatracker.ietf.org/doc/html/rfc7386.
- /// The cancellation token to use.
- /// or is null.
- public Response UpsertQueue(string id, RouterQueue patch, CancellationToken cancellationToken = default)
+ // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method
+ ///
+ /// [Protocol Method] Deletes a exception policy by Id.
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The Id of the exception policy.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual Response DeleteExceptionPolicy(string id, RequestContext context = null)
{
- if (id == null)
- {
- throw new ArgumentNullException(nameof(id));
- }
- if (patch == null)
+ Argument.AssertNotNullOrEmpty(id, nameof(id));
+
+ using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.DeleteExceptionPolicy");
+ scope.Start();
+ try
{
- throw new ArgumentNullException(nameof(patch));
+ using HttpMessage message = CreateDeleteExceptionPolicyRequest(id, context);
+ return _pipeline.ProcessMessage(message, context);
}
-
- using var message = CreateUpsertQueueRequest(id, patch);
- _pipeline.Send(message, cancellationToken);
- switch (message.Response.Status)
+ catch (Exception e)
{
- case 200:
- case 201:
- {
- RouterQueue value = default;
- using var document = JsonDocument.Parse(message.Response.ContentStream);
- value = RouterQueue.DeserializeRouterQueue(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
+ scope.Failed(e);
+ throw;
}
}
- internal HttpMessage CreateUpsertQueueRequest(string id, RequestContent content, RequestContext context)
- {
- var message = _pipeline.CreateMessage(context, ResponseClassifier200201);
- var request = message.Request;
- request.Method = RequestMethod.Patch;
- var uri = new RawRequestUriBuilder();
- uri.AppendRaw(_endpoint, false);
- uri.AppendPath("/routing/queues/", false);
- uri.AppendPath(id, true);
- uri.AppendQuery("api-version", _apiVersion, true);
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json");
- request.Headers.Add("Content-Type", "application/merge-patch+json");
- request.Content = content;
- return message;
- }
-
///
/// [Protocol Method] Creates or updates a queue.
///
@@ -1237,23 +859,28 @@ internal HttpMessage CreateUpsertQueueRequest(string id, RequestContent content,
///
///
///
- /// Id of the queue.
+ /// The Id of this queue.
/// The content to send as the body of the request.
+ /// The content to send as the request conditions of the request.
/// The request context, which can override default behaviors of the client pipeline on a per-call basis.
/// or is null.
/// is an empty string, and was expected to be non-empty.
/// Service returned a non-success status code.
/// The response returned from the service.
- public virtual async Task UpsertQueueAsync(string id, RequestContent content, RequestContext context = null)
+ ///
+ public virtual async Task UpsertQueueAsync(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null)
{
Argument.AssertNotNullOrEmpty(id, nameof(id));
Argument.AssertNotNull(content, nameof(content));
- using var scope = ClientDiagnostics.CreateScope("JobRouterAdministration.UpsertQueue");
+ Argument.AssertNull(requestConditions.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation.");
+ Argument.AssertNull(requestConditions.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation.");
+
+ using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.UpsertQueue");
scope.Start();
try
{
- using HttpMessage message = CreateUpsertQueueRequest(id, content, context);
+ using HttpMessage message = CreateUpsertQueueRequest(id, content, requestConditions, context);
return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
}
catch (Exception e)
@@ -1273,23 +900,28 @@ public virtual async Task UpsertQueueAsync(string id, RequestContent c
///
///
///
- /// Id of the queue.
+ /// The Id of this queue.
/// The content to send as the body of the request.
+ /// The content to send as the request conditions of the request.
/// The request context, which can override default behaviors of the client pipeline on a per-call basis.
/// or is null.
/// is an empty string, and was expected to be non-empty.
/// Service returned a non-success status code.
/// The response returned from the service.
- public virtual Response UpsertQueue(string id, RequestContent content, RequestContext context = null)
+ ///
+ public virtual Response UpsertQueue(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null)
{
Argument.AssertNotNullOrEmpty(id, nameof(id));
Argument.AssertNotNull(content, nameof(content));
- using var scope = ClientDiagnostics.CreateScope("JobRouterAdministration.UpsertQueue");
+ Argument.AssertNull(requestConditions.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation.");
+ Argument.AssertNull(requestConditions.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation.");
+
+ using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.UpsertQueue");
scope.Start();
try
{
- using HttpMessage message = CreateUpsertQueueRequest(id, content, context);
+ using HttpMessage message = CreateUpsertQueueRequest(id, content, requestConditions, context);
return _pipeline.ProcessMessage(message, context);
}
catch (Exception e)
@@ -1299,419 +931,780 @@ public virtual Response UpsertQueue(string id, RequestContent content, RequestCo
}
}
- internal HttpMessage CreateGetQueueRequest(string id)
- {
- var message = _pipeline.CreateMessage();
- var request = message.Request;
- request.Method = RequestMethod.Get;
- var uri = new RawRequestUriBuilder();
- uri.AppendRaw(_endpoint, false);
- uri.AppendPath("/routing/queues/", false);
- uri.AppendPath(id, true);
- uri.AppendQuery("api-version", _apiVersion, true);
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json");
- return message;
- }
-
/// Retrieves an existing queue by Id.
- /// Id of the queue to retrieve.
+ /// The Id of this queue.
/// The cancellation token to use.
/// is null.
- public async Task> GetQueueAsync(string id, CancellationToken cancellationToken = default)
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ public virtual async Task> GetQueueAsync(string id, CancellationToken cancellationToken = default)
{
- if (id == null)
- {
- throw new ArgumentNullException(nameof(id));
- }
+ Argument.AssertNotNullOrEmpty(id, nameof(id));
- using var message = CreateGetQueueRequest(id);
- await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
- switch (message.Response.Status)
- {
- case 200:
- {
- RouterQueue value = default;
- using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
- value = RouterQueue.DeserializeRouterQueue(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
- }
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await GetQueueAsync(id, context).ConfigureAwait(false);
+ return Response.FromValue(RouterQueue.FromResponse(response), response);
}
/// Retrieves an existing queue by Id.
- /// Id of the queue to retrieve.
+ /// The Id of this queue.
/// The cancellation token to use.
/// is null.
- public Response GetQueue(string id, CancellationToken cancellationToken = default)
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ public virtual Response GetQueue(string id, CancellationToken cancellationToken = default)
{
- if (id == null)
- {
- throw new ArgumentNullException(nameof(id));
- }
-
- using var message = CreateGetQueueRequest(id);
- _pipeline.Send(message, cancellationToken);
- switch (message.Response.Status)
- {
- case 200:
- {
- RouterQueue value = default;
- using var document = JsonDocument.Parse(message.Response.ContentStream);
- value = RouterQueue.DeserializeRouterQueue(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
- }
- }
+ Argument.AssertNotNullOrEmpty(id, nameof(id));
- internal HttpMessage CreateDeleteQueueRequest(string id)
- {
- var message = _pipeline.CreateMessage();
- var request = message.Request;
- request.Method = RequestMethod.Delete;
- var uri = new RawRequestUriBuilder();
- uri.AppendRaw(_endpoint, false);
- uri.AppendPath("/routing/queues/", false);
- uri.AppendPath(id, true);
- uri.AppendQuery("api-version", _apiVersion, true);
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json");
- return message;
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = GetQueue(id, context);
+ return Response.FromValue(RouterQueue.FromResponse(response), response);
}
- /// Deletes a queue by Id.
- /// Id of the queue to delete.
- /// The cancellation token to use.
+ ///
+ /// [Protocol Method] Retrieves an existing queue by Id.
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The Id of this queue.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
/// is null.
- public async Task DeleteQueueAsync(string id, CancellationToken cancellationToken = default)
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual async Task GetQueueAsync(string id, RequestContext context)
{
- if (id == null)
+ Argument.AssertNotNullOrEmpty(id, nameof(id));
+
+ using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.GetQueue");
+ scope.Start();
+ try
{
- throw new ArgumentNullException(nameof(id));
+ using HttpMessage message = CreateGetQueueRequest(id, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
}
-
- using var message = CreateDeleteQueueRequest(id);
- await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
- switch (message.Response.Status)
+ catch (Exception e)
{
- case 204:
- return message.Response;
- default:
- throw new RequestFailedException(message.Response);
+ scope.Failed(e);
+ throw;
}
}
- /// Deletes a queue by Id.
- /// Id of the queue to delete.
- /// The cancellation token to use.
+ ///
+ /// [Protocol Method] Retrieves an existing queue by Id.
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The Id of this queue.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
/// is null.
- public Response DeleteQueue(string id, CancellationToken cancellationToken = default)
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual Response GetQueue(string id, RequestContext context)
{
- if (id == null)
+ Argument.AssertNotNullOrEmpty(id, nameof(id));
+
+ using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.GetQueue");
+ scope.Start();
+ try
{
- throw new ArgumentNullException(nameof(id));
+ using HttpMessage message = CreateGetQueueRequest(id, context);
+ return _pipeline.ProcessMessage(message, context);
}
-
- using var message = CreateDeleteQueueRequest(id);
- _pipeline.Send(message, cancellationToken);
- switch (message.Response.Status)
+ catch (Exception e)
{
- case 204:
- return message.Response;
- default:
- throw new RequestFailedException(message.Response);
+ scope.Failed(e);
+ throw;
}
}
- internal HttpMessage CreateListQueuesRequest(int? maxpagesize)
- {
- var message = _pipeline.CreateMessage();
- var request = message.Request;
- request.Method = RequestMethod.Get;
- var uri = new RawRequestUriBuilder();
- uri.AppendRaw(_endpoint, false);
- uri.AppendPath("/routing/queues", false);
- if (maxpagesize != null)
- {
- uri.AppendQuery("maxpagesize", maxpagesize.Value, true);
+ // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method
+ ///
+ /// [Protocol Method] Deletes a queue by Id.
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The Id of this queue.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual async Task DeleteQueueAsync(string id, RequestContext context = null)
+ {
+ Argument.AssertNotNullOrEmpty(id, nameof(id));
+
+ using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.DeleteQueue");
+ scope.Start();
+ try
+ {
+ using HttpMessage message = CreateDeleteQueueRequest(id, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
}
- uri.AppendQuery("api-version", _apiVersion, true);
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json");
- return message;
}
- /// Retrieves existing queues.
- /// Number of objects to return per page.
- /// The cancellation token to use.
- public async Task> ListQueuesAsync(int? maxpagesize = null, CancellationToken cancellationToken = default)
+ // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method
+ ///
+ /// [Protocol Method] Deletes a queue by Id.
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The Id of this queue.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// is null.
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual Response DeleteQueue(string id, RequestContext context = null)
{
- using var message = CreateListQueuesRequest(maxpagesize);
- await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
- switch (message.Response.Status)
+ Argument.AssertNotNullOrEmpty(id, nameof(id));
+
+ using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationRestClient.DeleteQueue");
+ scope.Start();
+ try
{
- case 200:
- {
- RouterQueueCollection value = default;
- using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
- value = RouterQueueCollection.DeserializeRouterQueueCollection(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
+ using HttpMessage message = CreateDeleteQueueRequest(id, context);
+ return _pipeline.ProcessMessage(message, context);
+ }
+ catch (Exception e)
+ {
+ scope.Failed(e);
+ throw;
}
}
- /// Retrieves existing queues.
- /// Number of objects to return per page.
+ /// Retrieves existing distribution policies.
+ /// Maximum page size.
/// The cancellation token to use.
- public Response ListQueues(int? maxpagesize = null, CancellationToken cancellationToken = default)
+ ///
+ public virtual AsyncPageable GetDistributionPoliciesAsync(int maxpagesize, CancellationToken cancellationToken = default)
{
- using var message = CreateListQueuesRequest(maxpagesize);
- _pipeline.Send(message, cancellationToken);
- switch (message.Response.Status)
- {
- case 200:
- {
- RouterQueueCollection value = default;
- using var document = JsonDocument.Parse(message.Response.ContentStream);
- value = RouterQueueCollection.DeserializeRouterQueueCollection(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
- }
+ RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null;
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDistributionPoliciesRequest(maxpagesize, context);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDistributionPoliciesNextPageRequest(nextLink, maxpagesize, context);
+ return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, DistributionPolicyItem.DeserializeDistributionPolicyItem, ClientDiagnostics, _pipeline, "JobRouterAdministrationRestClient.GetDistributionPolicies", "value", "nextLink", context);
}
- /// Retrieves existing classification policies.
- /// The URL to the next page of results.
+ /// Retrieves existing distribution policies.
/// Maximum page size.
/// The cancellation token to use.
- /// is null.
- public async Task> ListClassificationPoliciesNextPageAsync(string nextLink, int? maxpagesize = null, CancellationToken cancellationToken = default)
+ ///
+ public virtual Pageable GetDistributionPolicies(int maxpagesize, CancellationToken cancellationToken = default)
{
- if (nextLink == null)
- {
- throw new ArgumentNullException(nameof(nextLink));
- }
+ RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null;
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDistributionPoliciesRequest(maxpagesize, context);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDistributionPoliciesNextPageRequest(nextLink, maxpagesize, context);
+ return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, DistributionPolicyItem.DeserializeDistributionPolicyItem, ClientDiagnostics, _pipeline, "JobRouterAdministrationRestClient.GetDistributionPolicies", "value", "nextLink", context);
+ }
- using var message = CreateListClassificationPoliciesNextPageRequest(nextLink, maxpagesize);
- await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
- switch (message.Response.Status)
- {
- case 200:
- {
- ClassificationPolicyCollection value = default;
- using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
- value = ClassificationPolicyCollection.DeserializeClassificationPolicyCollection(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
- }
+ ///
+ /// [Protocol Method] Retrieves existing distribution policies.
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// Maximum page size.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// Service returned a non-success status code.
+ /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below.
+ ///
+ public virtual AsyncPageable GetDistributionPoliciesAsync(int maxpagesize, RequestContext context)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDistributionPoliciesRequest(maxpagesize, context);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDistributionPoliciesNextPageRequest(nextLink, maxpagesize, context);
+ return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "JobRouterAdministrationRestClient.GetDistributionPolicies", "value", "nextLink", context);
+ }
+
+ ///
+ /// [Protocol Method] Retrieves existing distribution policies.
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// Maximum page size.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// Service returned a non-success status code.
+ /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below.
+ ///
+ public virtual Pageable GetDistributionPolicies(int maxpagesize, RequestContext context)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetDistributionPoliciesRequest(maxpagesize, context);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetDistributionPoliciesNextPageRequest(nextLink, maxpagesize, context);
+ return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "JobRouterAdministrationRestClient.GetDistributionPolicies", "value", "nextLink", context);
}
/// Retrieves existing classification policies.
- /// The URL to the next page of results.
/// Maximum page size.
/// The cancellation token to use.
- /// is null.
- public Response ListClassificationPoliciesNextPage(string nextLink, int? maxpagesize = null, CancellationToken cancellationToken = default)
+ ///
+ public virtual AsyncPageable GetClassificationPoliciesAsync(int maxpagesize, CancellationToken cancellationToken = default)
{
- if (nextLink == null)
- {
- throw new ArgumentNullException(nameof(nextLink));
- }
-
- using var message = CreateListClassificationPoliciesNextPageRequest(nextLink, maxpagesize);
- _pipeline.Send(message, cancellationToken);
- switch (message.Response.Status)
- {
- case 200:
- {
- ClassificationPolicyCollection value = default;
- using var document = JsonDocument.Parse(message.Response.ContentStream);
- value = ClassificationPolicyCollection.DeserializeClassificationPolicyCollection(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
- }
+ RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null;
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetClassificationPoliciesRequest(maxpagesize, context);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetClassificationPoliciesNextPageRequest(nextLink, maxpagesize, context);
+ return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ClassificationPolicyItem.DeserializeClassificationPolicyItem, ClientDiagnostics, _pipeline, "JobRouterAdministrationRestClient.GetClassificationPolicies", "value", "nextLink", context);
}
- /// Retrieves existing distribution policies.
- /// The URL to the next page of results.
+ /// Retrieves existing classification policies.
/// Maximum page size.
/// The cancellation token to use.
- /// is null.
- public async Task> ListDistributionPoliciesNextPageAsync(string nextLink, int? maxpagesize = null, CancellationToken cancellationToken = default)
+ ///
+ public virtual Pageable GetClassificationPolicies(int maxpagesize, CancellationToken cancellationToken = default)
{
- if (nextLink == null)
- {
- throw new ArgumentNullException(nameof(nextLink));
- }
-
- using var message = CreateListDistributionPoliciesNextPageRequest(nextLink, maxpagesize);
- await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
- switch (message.Response.Status)
- {
- case 200:
- {
- DistributionPolicyCollection value = default;
- using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
- value = DistributionPolicyCollection.DeserializeDistributionPolicyCollection(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
- }
+ RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null;
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetClassificationPoliciesRequest(maxpagesize, context);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetClassificationPoliciesNextPageRequest(nextLink, maxpagesize, context);
+ return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ClassificationPolicyItem.DeserializeClassificationPolicyItem, ClientDiagnostics, _pipeline, "JobRouterAdministrationRestClient.GetClassificationPolicies", "value", "nextLink", context);
}
- /// Retrieves existing distribution policies.
- /// The URL to the next page of results.
+ ///
+ /// [Protocol Method] Retrieves existing classification policies.
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
/// Maximum page size.
- /// The cancellation token to use.
- /// is null.
- public Response ListDistributionPoliciesNextPage(string nextLink, int? maxpagesize = null, CancellationToken cancellationToken = default)
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// Service returned a non-success status code.
+ /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below.
+ ///
+ public virtual AsyncPageable GetClassificationPoliciesAsync(int maxpagesize, RequestContext context)
{
- if (nextLink == null)
- {
- throw new ArgumentNullException(nameof(nextLink));
- }
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetClassificationPoliciesRequest(maxpagesize, context);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetClassificationPoliciesNextPageRequest(nextLink, maxpagesize, context);
+ return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "JobRouterAdministrationRestClient.GetClassificationPolicies", "value", "nextLink", context);
+ }
- using var message = CreateListDistributionPoliciesNextPageRequest(nextLink, maxpagesize);
- _pipeline.Send(message, cancellationToken);
- switch (message.Response.Status)
- {
- case 200:
- {
- DistributionPolicyCollection value = default;
- using var document = JsonDocument.Parse(message.Response.ContentStream);
- value = DistributionPolicyCollection.DeserializeDistributionPolicyCollection(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
- }
+ ///
+ /// [Protocol Method] Retrieves existing classification policies.
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// Maximum page size.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// Service returned a non-success status code.
+ /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below.
+ ///
+ public virtual Pageable GetClassificationPolicies(int maxpagesize, RequestContext context)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetClassificationPoliciesRequest(maxpagesize, context);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetClassificationPoliciesNextPageRequest(nextLink, maxpagesize, context);
+ return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "JobRouterAdministrationRestClient.GetClassificationPolicies", "value", "nextLink", context);
}
/// Retrieves existing exception policies.
- /// The URL to the next page of results.
/// Number of objects to return per page.
/// The cancellation token to use.
- /// is null.
- public async Task> ListExceptionPoliciesNextPageAsync(string nextLink, int? maxpagesize = null, CancellationToken cancellationToken = default)
+ ///
+ public virtual AsyncPageable GetExceptionPoliciesAsync(int maxpagesize, CancellationToken cancellationToken = default)
{
- if (nextLink == null)
- {
- throw new ArgumentNullException(nameof(nextLink));
- }
-
- using var message = CreateListExceptionPoliciesNextPageRequest(nextLink, maxpagesize);
- await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
- switch (message.Response.Status)
- {
- case 200:
- {
- ExceptionPolicyCollection value = default;
- using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
- value = ExceptionPolicyCollection.DeserializeExceptionPolicyCollection(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
- }
+ RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null;
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetExceptionPoliciesRequest(maxpagesize, context);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetExceptionPoliciesNextPageRequest(nextLink, maxpagesize, context);
+ return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, ExceptionPolicyItem.DeserializeExceptionPolicyItem, ClientDiagnostics, _pipeline, "JobRouterAdministrationRestClient.GetExceptionPolicies", "value", "nextLink", context);
}
/// Retrieves existing exception policies.
- /// The URL to the next page of results.
/// Number of objects to return per page.
/// The cancellation token to use.
- /// is null.
- public Response ListExceptionPoliciesNextPage(string nextLink, int? maxpagesize = null, CancellationToken cancellationToken = default)
+ ///
+ public virtual Pageable GetExceptionPolicies(int maxpagesize, CancellationToken cancellationToken = default)
{
- if (nextLink == null)
- {
- throw new ArgumentNullException(nameof(nextLink));
- }
+ RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null;
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetExceptionPoliciesRequest(maxpagesize, context);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetExceptionPoliciesNextPageRequest(nextLink, maxpagesize, context);
+ return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, ExceptionPolicyItem.DeserializeExceptionPolicyItem, ClientDiagnostics, _pipeline, "JobRouterAdministrationRestClient.GetExceptionPolicies", "value", "nextLink", context);
+ }
- using var message = CreateListExceptionPoliciesNextPageRequest(nextLink, maxpagesize);
- _pipeline.Send(message, cancellationToken);
- switch (message.Response.Status)
- {
- case 200:
- {
- ExceptionPolicyCollection value = default;
- using var document = JsonDocument.Parse(message.Response.ContentStream);
- value = ExceptionPolicyCollection.DeserializeExceptionPolicyCollection(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
- }
+ ///
+ /// [Protocol Method] Retrieves existing exception policies.
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// Number of objects to return per page.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// Service returned a non-success status code.
+ /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below.
+ ///
+ public virtual AsyncPageable GetExceptionPoliciesAsync(int maxpagesize, RequestContext context)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetExceptionPoliciesRequest(maxpagesize, context);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetExceptionPoliciesNextPageRequest(nextLink, maxpagesize, context);
+ return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "JobRouterAdministrationRestClient.GetExceptionPolicies", "value", "nextLink", context);
+ }
+
+ ///
+ /// [Protocol Method] Retrieves existing exception policies.
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// Number of objects to return per page.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// Service returned a non-success status code.
+ /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below.
+ ///
+ public virtual Pageable GetExceptionPolicies(int maxpagesize, RequestContext context)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetExceptionPoliciesRequest(maxpagesize, context);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetExceptionPoliciesNextPageRequest(nextLink, maxpagesize, context);
+ return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "JobRouterAdministrationRestClient.GetExceptionPolicies", "value", "nextLink", context);
+ }
+
+ /// Retrieves existing queues.
+ /// Number of objects to return per page.
+ /// The cancellation token to use.
+ ///
+ public virtual AsyncPageable GetQueuesAsync(int maxpagesize, CancellationToken cancellationToken = default)
+ {
+ RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null;
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetQueuesRequest(maxpagesize, context);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetQueuesNextPageRequest(nextLink, maxpagesize, context);
+ return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, RouterQueueItem.DeserializeRouterQueueItem, ClientDiagnostics, _pipeline, "JobRouterAdministrationRestClient.GetQueues", "value", "nextLink", context);
}
/// Retrieves existing queues.
- /// The URL to the next page of results.
/// Number of objects to return per page.
/// The cancellation token to use.
- /// is null.
- public async Task> ListQueuesNextPageAsync(string nextLink, int? maxpagesize = null, CancellationToken cancellationToken = default)
+ ///
+ public virtual Pageable GetQueues(int maxpagesize, CancellationToken cancellationToken = default)
{
- if (nextLink == null)
+ RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null;
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetQueuesRequest(maxpagesize, context);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetQueuesNextPageRequest(nextLink, maxpagesize, context);
+ return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, RouterQueueItem.DeserializeRouterQueueItem, ClientDiagnostics, _pipeline, "JobRouterAdministrationRestClient.GetQueues", "value", "nextLink", context);
+ }
+
+ ///
+ /// [Protocol Method] Retrieves existing queues.
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// Number of objects to return per page.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// Service returned a non-success status code.
+ /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below.
+ ///
+ public virtual AsyncPageable GetQueuesAsync(int maxpagesize, RequestContext context)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetQueuesRequest(maxpagesize, context);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetQueuesNextPageRequest(nextLink, maxpagesize, context);
+ return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "JobRouterAdministrationRestClient.GetQueues", "value", "nextLink", context);
+ }
+
+ ///
+ /// [Protocol Method] Retrieves existing queues.
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// Number of objects to return per page.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
+ /// Service returned a non-success status code.
+ /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below.
+ ///
+ public virtual Pageable GetQueues(int maxpagesize, RequestContext context)
+ {
+ HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetQueuesRequest(maxpagesize, context);
+ HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetQueuesNextPageRequest(nextLink, maxpagesize, context);
+ return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "JobRouterAdministrationRestClient.GetQueues", "value", "nextLink", context);
+ }
+
+ internal HttpMessage CreateUpsertDistributionPolicyRequest(string id, RequestContent content, RequestConditions requestConditions, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier200201);
+ var request = message.Request;
+ request.Method = RequestMethod.Patch;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/routing/distributionPolicies/", false);
+ uri.AppendPath(id, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ if (requestConditions != null)
{
- throw new ArgumentNullException(nameof(nextLink));
+ request.Headers.Add(requestConditions, "R");
}
+ request.Headers.Add("Content-Type", "application/merge-patch+json");
+ request.Content = content;
+ return message;
+ }
+
+ internal HttpMessage CreateGetDistributionPolicyRequest(string id, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier200);
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/routing/distributionPolicies/", false);
+ uri.AppendPath(id, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
- using var message = CreateListQueuesNextPageRequest(nextLink, maxpagesize);
- await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
- switch (message.Response.Status)
+ internal HttpMessage CreateGetDistributionPoliciesRequest(int maxpagesize, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier200);
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/routing/distributionPolicies", false);
+ uri.AppendQuery("maxpagesize", maxpagesize, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateDeleteDistributionPolicyRequest(string id, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier204);
+ var request = message.Request;
+ request.Method = RequestMethod.Delete;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/routing/distributionPolicies/", false);
+ uri.AppendPath(id, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateUpsertClassificationPolicyRequest(string id, RequestContent content, RequestConditions requestConditions, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier200201);
+ var request = message.Request;
+ request.Method = RequestMethod.Patch;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/routing/classificationPolicies/", false);
+ uri.AppendPath(id, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ if (requestConditions != null)
{
- case 200:
- {
- RouterQueueCollection value = default;
- using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
- value = RouterQueueCollection.DeserializeRouterQueueCollection(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
+ request.Headers.Add(requestConditions, "R");
}
+ request.Headers.Add("Content-Type", "application/merge-patch+json");
+ request.Content = content;
+ return message;
}
- /// Retrieves existing queues.
- /// The URL to the next page of results.
- /// Number of objects to return per page.
- /// The cancellation token to use.
- /// is null.
- public Response ListQueuesNextPage(string nextLink, int? maxpagesize = null, CancellationToken cancellationToken = default)
+ internal HttpMessage CreateGetClassificationPolicyRequest(string id, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier200);
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/routing/classificationPolicies/", false);
+ uri.AppendPath(id, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateGetClassificationPoliciesRequest(int maxpagesize, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier200);
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/routing/classificationPolicies", false);
+ uri.AppendQuery("maxpagesize", maxpagesize, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateDeleteClassificationPolicyRequest(string id, RequestContext context)
{
- if (nextLink == null)
+ var message = _pipeline.CreateMessage(context, ResponseClassifier204);
+ var request = message.Request;
+ request.Method = RequestMethod.Delete;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/routing/classificationPolicies/", false);
+ uri.AppendPath(id, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateUpsertExceptionPolicyRequest(string id, RequestContent content, RequestConditions requestConditions, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier200201);
+ var request = message.Request;
+ request.Method = RequestMethod.Patch;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/routing/exceptionPolicies/", false);
+ uri.AppendPath(id, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ if (requestConditions != null)
+ {
+ request.Headers.Add(requestConditions, "R");
+ }
+ request.Headers.Add("Content-Type", "application/merge-patch+json");
+ request.Content = content;
+ return message;
+ }
+
+ internal HttpMessage CreateGetExceptionPolicyRequest(string id, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier200);
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/routing/exceptionPolicies/", false);
+ uri.AppendPath(id, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateGetExceptionPoliciesRequest(int maxpagesize, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier200);
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/routing/exceptionPolicies", false);
+ uri.AppendQuery("maxpagesize", maxpagesize, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateDeleteExceptionPolicyRequest(string id, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier204);
+ var request = message.Request;
+ request.Method = RequestMethod.Delete;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/routing/exceptionPolicies/", false);
+ uri.AppendPath(id, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateUpsertQueueRequest(string id, RequestContent content, RequestConditions requestConditions, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier200201);
+ var request = message.Request;
+ request.Method = RequestMethod.Patch;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/routing/queues/", false);
+ uri.AppendPath(id, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ if (requestConditions != null)
{
- throw new ArgumentNullException(nameof(nextLink));
+ request.Headers.Add(requestConditions, "R");
}
+ request.Headers.Add("Content-Type", "application/merge-patch+json");
+ request.Content = content;
+ return message;
+ }
+
+ internal HttpMessage CreateGetQueueRequest(string id, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier200);
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/routing/queues/", false);
+ uri.AppendPath(id, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ internal HttpMessage CreateGetQueuesRequest(int maxpagesize, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier200);
+ var request = message.Request;
+ request.Method = RequestMethod.Get;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/routing/queues", false);
+ uri.AppendQuery("maxpagesize", maxpagesize, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
- using var message = CreateListQueuesNextPageRequest(nextLink, maxpagesize);
- _pipeline.Send(message, cancellationToken);
- switch (message.Response.Status)
+ internal HttpMessage CreateDeleteQueueRequest(string id, RequestContext context)
+ {
+ var message = _pipeline.CreateMessage(context, ResponseClassifier204);
+ var request = message.Request;
+ request.Method = RequestMethod.Delete;
+ var uri = new RawRequestUriBuilder();
+ uri.Reset(_endpoint);
+ uri.AppendPath("/routing/queues/", false);
+ uri.AppendPath(id, true);
+ uri.AppendQuery("api-version", _apiVersion, true);
+ request.Uri = uri;
+ request.Headers.Add("Accept", "application/json");
+ return message;
+ }
+
+ private static RequestContext DefaultRequestContext = new RequestContext();
+ internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default)
+ {
+ if (!cancellationToken.CanBeCanceled)
{
- case 200:
- {
- RouterQueueCollection value = default;
- using var document = JsonDocument.Parse(message.Response.ContentStream);
- value = RouterQueueCollection.DeserializeRouterQueueCollection(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
+ return DefaultRequestContext;
}
+
+ return new RequestContext() { CancellationToken = cancellationToken };
}
private static ResponseClassifier _responseClassifier200201;
private static ResponseClassifier ResponseClassifier200201 => _responseClassifier200201 ??= new StatusCodeClassifier(stackalloc ushort[] { 200, 201 });
+ private static ResponseClassifier _responseClassifier200;
+ private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 });
+ private static ResponseClassifier _responseClassifier204;
+ private static ResponseClassifier ResponseClassifier204 => _responseClassifier204 ??= new StatusCodeClassifier(stackalloc ushort[] { 204 });
}
}
diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterRestClient.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterRestClient.cs
index 15694ece3888b..e14735052f3a0 100644
--- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterRestClient.cs
+++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterRestClient.cs
@@ -6,9 +6,9 @@
#nullable disable
using System;
-using System.Text.Json;
using System.Threading;
using System.Threading.Tasks;
+using Autorest.CSharp.Core;
using Azure;
using Azure.Communication.JobRouter.Models;
using Azure.Core;
@@ -16,129 +16,45 @@
namespace Azure.Communication.JobRouter
{
+ // Data plane generated client.
+ /// The JobRouterRest service client.
internal partial class JobRouterRestClient
{
private readonly HttpPipeline _pipeline;
- private readonly string _endpoint;
+ private readonly Uri _endpoint;
private readonly string _apiVersion;
/// The ClientDiagnostics is used to provide tracing support for the client library.
internal ClientDiagnostics ClientDiagnostics { get; }
- /// Initializes a new instance of JobRouterRestClient.
- /// The handler for diagnostic messaging in the client.
- /// The HTTP pipeline for sending and receiving REST requests and responses.
- /// The endpoint of the Azure Communication resource.
- /// Api Version.
- /// , , or is null.
- public JobRouterRestClient(ClientDiagnostics clientDiagnostics, HttpPipeline pipeline, string endpoint, string apiVersion = "2022-07-18-preview")
- {
- ClientDiagnostics = clientDiagnostics ?? throw new ArgumentNullException(nameof(clientDiagnostics));
- _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline));
- _endpoint = endpoint ?? throw new ArgumentNullException(nameof(endpoint));
- _apiVersion = apiVersion ?? throw new ArgumentNullException(nameof(apiVersion));
- }
+ /// The HTTP pipeline for sending and receiving REST requests and responses.
+ public virtual HttpPipeline Pipeline => _pipeline;
- internal HttpMessage CreateUpsertJobRequest(string id, RouterJob patch)
+ /// Initializes a new instance of JobRouterRestClient for mocking.
+ protected JobRouterRestClient()
{
- var message = _pipeline.CreateMessage();
- var request = message.Request;
- request.Method = RequestMethod.Patch;
- var uri = new RawRequestUriBuilder();
- uri.AppendRaw(_endpoint, false);
- uri.AppendPath("/routing/jobs/", false);
- uri.AppendPath(id, true);
- uri.AppendQuery("api-version", _apiVersion, true);
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json");
- request.Headers.Add("Content-Type", "application/merge-patch+json");
- var content = new Utf8JsonRequestContent();
- content.JsonWriter.WriteObjectValue(patch);
- request.Content = content;
- return message;
}
- /// Creates or updates a router job.
- /// Id of the job.
- /// Model of job properties to be created or patched. See also: https://datatracker.ietf.org/doc/html/rfc7386.
- /// The cancellation token to use.
- /// or is null.
- public async Task> UpsertJobAsync(string id, RouterJob patch, CancellationToken cancellationToken = default)
+ /// Initializes a new instance of JobRouterRestClient.
+ /// The Uri to use.
+ /// is null.
+ public JobRouterRestClient(Uri endpoint) : this(endpoint, new AzureCommunicationJobRouterClientOptions())
{
- if (id == null)
- {
- throw new ArgumentNullException(nameof(id));
- }
- if (patch == null)
- {
- throw new ArgumentNullException(nameof(patch));
- }
-
- using var message = CreateUpsertJobRequest(id, patch);
- await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
- switch (message.Response.Status)
- {
- case 200:
- case 201:
- {
- RouterJob value = default;
- using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
- value = RouterJob.DeserializeRouterJob(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
- }
}
- /// Creates or updates a router job.
- /// Id of the job.
- /// Model of job properties to be created or patched. See also: https://datatracker.ietf.org/doc/html/rfc7386.
- /// The cancellation token to use.
- /// or is null.
- public Response UpsertJob(string id, RouterJob patch, CancellationToken cancellationToken = default)
+ /// Initializes a new instance of JobRouterRestClient.
+ /// The Uri to use.
+ /// The options for configuring the client.
+ /// is null.
+ public JobRouterRestClient(Uri endpoint, AzureCommunicationJobRouterClientOptions options)
{
- if (id == null)
- {
- throw new ArgumentNullException(nameof(id));
- }
- if (patch == null)
- {
- throw new ArgumentNullException(nameof(patch));
- }
-
- using var message = CreateUpsertJobRequest(id, patch);
- _pipeline.Send(message, cancellationToken);
- switch (message.Response.Status)
- {
- case 200:
- case 201:
- {
- RouterJob value = default;
- using var document = JsonDocument.Parse(message.Response.ContentStream);
- value = RouterJob.DeserializeRouterJob(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
- }
- }
+ Argument.AssertNotNull(endpoint, nameof(endpoint));
+ options ??= new AzureCommunicationJobRouterClientOptions();
- internal HttpMessage CreateUpsertJobRequest(string id, RequestContent content, RequestContext context)
- {
- var message = _pipeline.CreateMessage(context, ResponseClassifier200201);
- var request = message.Request;
- request.Method = RequestMethod.Patch;
- var uri = new RawRequestUriBuilder();
- uri.AppendRaw(_endpoint, false);
- uri.AppendPath("/routing/jobs/", false);
- uri.AppendPath(id, true);
- uri.AppendQuery("api-version", _apiVersion, true);
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json");
- request.Headers.Add("Content-Type", "application/merge-patch+json");
- request.Content = content;
- return message;
+ ClientDiagnostics = new ClientDiagnostics(options, true);
+ _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), Array.Empty(), new ResponseClassifier());
+ _endpoint = endpoint;
+ _apiVersion = options.Version;
}
///
@@ -151,23 +67,28 @@ internal HttpMessage CreateUpsertJobRequest(string id, RequestContent content, R
///
///
///
- /// Id of the job.
+ /// The id of the job.
/// The content to send as the body of the request.
+ /// The content to send as the request conditions of the request.
/// The request context, which can override default behaviors of the client pipeline on a per-call basis.
/// or is null.
/// is an empty string, and was expected to be non-empty.
/// Service returned a non-success status code.
/// The response returned from the service.
- public virtual async Task UpsertJobAsync(string id, RequestContent content, RequestContext context = null)
+ ///
+ public virtual async Task UpsertJobAsync(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null)
{
Argument.AssertNotNullOrEmpty(id, nameof(id));
Argument.AssertNotNull(content, nameof(content));
- using var scope = ClientDiagnostics.CreateScope("JobRouter.UpsertJob");
+ Argument.AssertNull(requestConditions.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation.");
+ Argument.AssertNull(requestConditions.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation.");
+
+ using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.UpsertJob");
scope.Start();
try
{
- using HttpMessage message = CreateUpsertJobRequest(id, content, context);
+ using HttpMessage message = CreateUpsertJobRequest(id, content, requestConditions, context);
return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
}
catch (Exception e)
@@ -187,23 +108,28 @@ public virtual async Task UpsertJobAsync(string id, RequestContent con
///
///
///
- /// Id of the job.
+ /// The id of the job.
/// The content to send as the body of the request.
+ /// The content to send as the request conditions of the request.
/// The request context, which can override default behaviors of the client pipeline on a per-call basis.
/// or is null.
/// is an empty string, and was expected to be non-empty.
/// Service returned a non-success status code.
/// The response returned from the service.
- public virtual Response UpsertJob(string id, RequestContent content, RequestContext context = null)
+ ///
+ public virtual Response UpsertJob(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null)
{
Argument.AssertNotNullOrEmpty(id, nameof(id));
Argument.AssertNotNull(content, nameof(content));
- using var scope = ClientDiagnostics.CreateScope("JobRouter.UpsertJob");
+ Argument.AssertNull(requestConditions.IfNoneMatch, nameof(requestConditions), "Service does not support the If-None-Match header for this operation.");
+ Argument.AssertNull(requestConditions.IfModifiedSince, nameof(requestConditions), "Service does not support the If-Modified-Since header for this operation.");
+
+ using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.UpsertJob");
scope.Start();
try
{
- using HttpMessage message = CreateUpsertJobRequest(id, content, context);
+ using HttpMessage message = CreateUpsertJobRequest(id, content, requestConditions, context);
return _pipeline.ProcessMessage(message, context);
}
catch (Exception e)
@@ -213,1177 +139,2030 @@ public virtual Response UpsertJob(string id, RequestContent content, RequestCont
}
}
- internal HttpMessage CreateGetJobRequest(string id)
- {
- var message = _pipeline.CreateMessage();
- var request = message.Request;
- request.Method = RequestMethod.Get;
- var uri = new RawRequestUriBuilder();
- uri.AppendRaw(_endpoint, false);
- uri.AppendPath("/routing/jobs/", false);
- uri.AppendPath(id, true);
- uri.AppendQuery("api-version", _apiVersion, true);
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json");
- return message;
- }
-
/// Retrieves an existing job by Id.
- /// Id of the job to retrieve.
+ /// The id of the job.
/// The cancellation token to use.
/// is null.
- public async Task> GetJobAsync(string id, CancellationToken cancellationToken = default)
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ public virtual async Task> GetJobAsync(string id, CancellationToken cancellationToken = default)
{
- if (id == null)
- {
- throw new ArgumentNullException(nameof(id));
- }
+ Argument.AssertNotNullOrEmpty(id, nameof(id));
- using var message = CreateGetJobRequest(id);
- await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
- switch (message.Response.Status)
- {
- case 200:
- {
- RouterJob value = default;
- using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
- value = RouterJob.DeserializeRouterJob(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
- }
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = await GetJobAsync(id, context).ConfigureAwait(false);
+ return Response.FromValue(RouterJob.FromResponse(response), response);
}
/// Retrieves an existing job by Id.
- /// Id of the job to retrieve.
+ /// The id of the job.
/// The cancellation token to use.
/// is null.
- public Response GetJob(string id, CancellationToken cancellationToken = default)
+ /// is an empty string, and was expected to be non-empty.
+ ///
+ public virtual Response GetJob(string id, CancellationToken cancellationToken = default)
{
- if (id == null)
- {
- throw new ArgumentNullException(nameof(id));
- }
-
- using var message = CreateGetJobRequest(id);
- _pipeline.Send(message, cancellationToken);
- switch (message.Response.Status)
- {
- case 200:
- {
- RouterJob value = default;
- using var document = JsonDocument.Parse(message.Response.ContentStream);
- value = RouterJob.DeserializeRouterJob(document.RootElement);
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
- }
- }
+ Argument.AssertNotNullOrEmpty(id, nameof(id));
- internal HttpMessage CreateDeleteJobRequest(string id)
- {
- var message = _pipeline.CreateMessage();
- var request = message.Request;
- request.Method = RequestMethod.Delete;
- var uri = new RawRequestUriBuilder();
- uri.AppendRaw(_endpoint, false);
- uri.AppendPath("/routing/jobs/", false);
- uri.AppendPath(id, true);
- uri.AppendQuery("api-version", _apiVersion, true);
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json");
- return message;
+ RequestContext context = FromCancellationToken(cancellationToken);
+ Response response = GetJob(id, context);
+ return Response.FromValue(RouterJob.FromResponse(response), response);
}
- /// Deletes a job and all of its traces.
- /// Id of the job.
- /// The cancellation token to use.
+ ///
+ /// [Protocol Method] Retrieves an existing job by Id.
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The id of the job.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
/// is null.
- public async Task DeleteJobAsync(string id, CancellationToken cancellationToken = default)
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual async Task GetJobAsync(string id, RequestContext context)
{
- if (id == null)
+ Argument.AssertNotNullOrEmpty(id, nameof(id));
+
+ using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.GetJob");
+ scope.Start();
+ try
{
- throw new ArgumentNullException(nameof(id));
+ using HttpMessage message = CreateGetJobRequest(id, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
}
-
- using var message = CreateDeleteJobRequest(id);
- await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
- switch (message.Response.Status)
+ catch (Exception e)
{
- case 204:
- return message.Response;
- default:
- throw new RequestFailedException(message.Response);
+ scope.Failed(e);
+ throw;
}
}
- /// Deletes a job and all of its traces.
- /// Id of the job.
- /// The cancellation token to use.
+ ///
+ /// [Protocol Method] Retrieves an existing job by Id.
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// Please try the simpler convenience overload with strongly typed models first.
+ ///
+ ///
+ ///
+ ///
+ /// The id of the job.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
/// is null.
- public Response DeleteJob(string id, CancellationToken cancellationToken = default)
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual Response GetJob(string id, RequestContext context)
{
- if (id == null)
- {
- throw new ArgumentNullException(nameof(id));
- }
+ Argument.AssertNotNullOrEmpty(id, nameof(id));
- using var message = CreateDeleteJobRequest(id);
- _pipeline.Send(message, cancellationToken);
- switch (message.Response.Status)
+ using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.GetJob");
+ scope.Start();
+ try
{
- case 204:
- return message.Response;
- default:
- throw new RequestFailedException(message.Response);
+ using HttpMessage message = CreateGetJobRequest(id, context);
+ return _pipeline.ProcessMessage(message, context);
}
- }
-
- internal HttpMessage CreateReclassifyJobActionRequest(string id, object reclassifyJobRequest)
- {
- var message = _pipeline.CreateMessage();
- var request = message.Request;
- request.Method = RequestMethod.Post;
- var uri = new RawRequestUriBuilder();
- uri.AppendRaw(_endpoint, false);
- uri.AppendPath("/routing/jobs/", false);
- uri.AppendPath(id, true);
- uri.AppendPath(":reclassify", false);
- uri.AppendQuery("api-version", _apiVersion, true);
- request.Uri = uri;
- request.Headers.Add("Accept", "application/json");
- if (reclassifyJobRequest != null)
+ catch (Exception e)
{
- request.Headers.Add("Content-Type", "application/json");
- var content = new Utf8JsonRequestContent();
- content.JsonWriter.WriteObjectValue(reclassifyJobRequest);
- request.Content = content;
+ scope.Failed(e);
+ throw;
}
- return message;
}
- /// Reclassify a job.
- /// Id of the job.
- /// Request object for reclassifying a job.
- /// The cancellation token to use.
+ // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method
+ ///
+ /// [Protocol Method] Deletes a job and all of its traces.
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The id of the job.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
/// is null.
- public async Task> ReclassifyJobActionAsync(string id, object reclassifyJobRequest = null, CancellationToken cancellationToken = default)
+ /// is an empty string, and was expected to be non-empty.
+ /// Service returned a non-success status code.
+ /// The response returned from the service.
+ ///
+ public virtual async Task DeleteJobAsync(string id, RequestContext context = null)
{
- if (id == null)
+ Argument.AssertNotNullOrEmpty(id, nameof(id));
+
+ using var scope = ClientDiagnostics.CreateScope("JobRouterRestClient.DeleteJob");
+ scope.Start();
+ try
{
- throw new ArgumentNullException(nameof(id));
+ using HttpMessage message = CreateDeleteJobRequest(id, context);
+ return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false);
}
-
- using var message = CreateReclassifyJobActionRequest(id, reclassifyJobRequest);
- await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false);
- switch (message.Response.Status)
+ catch (Exception e)
{
- case 200:
- {
- object value = default;
- using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false);
- value = document.RootElement.GetObject();
- return Response.FromValue(value, message.Response);
- }
- default:
- throw new RequestFailedException(message.Response);
+ scope.Failed(e);
+ throw;
}
}
- /// Reclassify a job.
- /// Id of the job.
- /// Request object for reclassifying a job.
- /// The cancellation token to use.
+ // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method
+ ///
+ /// [Protocol Method] Deletes a job and all of its traces.
+ ///
+ ///
+ ///
+ /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios.
+ ///
+ ///
+ ///
+ ///
+ /// The id of the job.
+ /// The request context, which can override default behaviors of the client pipeline on a per-call basis.
/// is null.
- public Response