diff --git a/sdk/communication/Azure.Communication.JobRouter/README.md b/sdk/communication/Azure.Communication.JobRouter/README.md index af025da7195b..f804d06bf4dd 100644 --- a/sdk/communication/Azure.Communication.JobRouter/README.md +++ b/sdk/communication/Azure.Communication.JobRouter/README.md @@ -24,7 +24,6 @@ To create a new Communication Service, you can use the [Azure Portal][communicat ### Using statements ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_UsingStatements using Azure.Communication.JobRouter; -using Azure.Communication.JobRouter.Models; ``` ### Create a JobRouter Client @@ -98,7 +97,7 @@ Response distributionPolicy = await routerAdministrationClie ### Queue Next, we can create the queue. ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_CreateQueue_Async -Response queue = await routerAdministrationClient.CreateQueueAsync( +Response queue = await routerAdministrationClient.CreateQueueAsync( new CreateQueueOptions( queueId: "queue-1", distributionPolicyId: distributionPolicy.Value.Id) @@ -175,7 +174,7 @@ foreach (EventGridEvent egEvent in egEvents) However, we could also wait a few seconds and then query the worker directly against the JobRouter API to see if an offer was issued to it. ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_QueryWorker_Async Response result = await routerClient.GetWorkerAsync(worker.Value.Id); -foreach (Models.RouterJobOffer? offer in result.Value.Offers) +foreach (RouterJobOffer? offer in result.Value.Offers) { Console.WriteLine($"Worker {worker.Value.Id} has an active offer for job {offer.JobId}"); } @@ -185,7 +184,7 @@ foreach (Models.RouterJobOffer? offer in result.Value.Offers) Once a worker receives an offer, it can take two possible actions: accept or decline. We are going to accept the offer. ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_AcceptOffer_Async // fetching the offer id -Models.RouterJobOffer jobOffer = result.Value.Offers.First(x => x.JobId == job.Value.Id); +RouterJobOffer jobOffer = result.Value.Offers.First(x => x.JobId == job.Value.Id); string offerId = jobOffer.OfferId; // `OfferId` can be retrieved directly from consuming event from Event grid diff --git a/sdk/communication/Azure.Communication.JobRouter/api/Azure.Communication.JobRouter.netstandard2.0.cs b/sdk/communication/Azure.Communication.JobRouter/api/Azure.Communication.JobRouter.netstandard2.0.cs index 34f5b122c974..bfc667dda38e 100644 --- a/sdk/communication/Azure.Communication.JobRouter/api/Azure.Communication.JobRouter.netstandard2.0.cs +++ b/sdk/communication/Azure.Communication.JobRouter/api/Azure.Communication.JobRouter.netstandard2.0.cs @@ -1,15 +1,21 @@ namespace Azure.Communication.JobRouter { + public partial class AcceptJobOfferResult + { + internal AcceptJobOfferResult() { } + public string AssignmentId { get { throw null; } } + public string JobId { get { throw null; } } + public string WorkerId { get { throw null; } } + } public partial class BestWorkerMode : Azure.Communication.JobRouter.DistributionMode { public BestWorkerMode() { } - public BestWorkerMode(Azure.Communication.JobRouter.RouterRule scoringRule, System.Collections.Generic.IList scoringParameterSelectors = null, bool allowScoringBatchOfWorkers = false, int? batchSize = default(int?), bool descendingOrder = true) { } + public BestWorkerMode(Azure.Communication.JobRouter.RouterRule scoringRule = null, System.Collections.Generic.IList scoringParameterSelectors = null, bool allowScoringBatchOfWorkers = false, int? batchSize = default(int?), bool descendingOrder = true, bool bypassSelectors = false) { } public Azure.Communication.JobRouter.RouterRule ScoringRule { get { throw null; } } - public Azure.Communication.JobRouter.Models.ScoringRuleOptions ScoringRuleOptions { get { throw null; } } + public Azure.Communication.JobRouter.ScoringRuleOptions ScoringRuleOptions { get { throw null; } } } public partial class CancelExceptionAction : Azure.Communication.JobRouter.ExceptionAction { - public CancelExceptionAction() { } public CancelExceptionAction(string note = null, string dispositionCode = null) { } public string DispositionCode { get { throw null; } set { } } public string Note { get { throw null; } set { } } @@ -21,12 +27,34 @@ public CancelJobOptions(string jobId) { } public string JobId { get { throw null; } } public string Note { get { throw null; } set { } } } + public partial class CancelJobRequest + { + public CancelJobRequest() { } + public string DispositionCode { get { throw null; } set { } } + public string Note { get { throw null; } set { } } + } public partial class ChannelConfiguration { - public ChannelConfiguration(int capacityCostPerJob) { } - public int CapacityCostPerJob { get { throw null; } set { } } + internal ChannelConfiguration() { } + public int CapacityCostPerJob { get { throw null; } } public int? MaxNumberOfJobs { get { throw null; } set { } } } + public partial class ClassificationPolicy + { + internal ClassificationPolicy() { } + public string FallbackQueueId { get { throw null; } } + public string Id { get { throw null; } } + public string Name { get { throw null; } } + public Azure.Communication.JobRouter.RouterRule PrioritizationRule { get { throw null; } } + public System.Collections.Generic.List QueueSelectors { get { throw null; } } + public System.Collections.Generic.List WorkerSelectors { get { throw null; } } + } + public partial class ClassificationPolicyItem + { + internal ClassificationPolicyItem() { } + public Azure.Communication.JobRouter.ClassificationPolicy ClassificationPolicy { get { throw null; } } + public Azure.ETag ETag { get { throw null; } } + } public partial class CloseJobOptions { public CloseJobOptions(string jobId, string assignmentId) { } @@ -36,6 +64,44 @@ public CloseJobOptions(string jobId, string assignmentId) { } public string JobId { get { throw null; } } public string Note { get { throw null; } set { } } } + public partial class CloseJobRequest + { + public CloseJobRequest(string assignmentId) { } + public string AssignmentId { get { throw null; } } + public System.DateTimeOffset? CloseAt { get { throw null; } set { } } + public string DispositionCode { get { throw null; } set { } } + public string Note { get { throw null; } set { } } + } + public static partial class CommunicationJobRouterModelFactory + { + public static Azure.Communication.JobRouter.AcceptJobOfferResult AcceptJobOfferResult(string assignmentId = null, string jobId = null, string workerId = null) { throw null; } + public static Azure.Communication.JobRouter.BestWorkerMode BestWorkerMode(int minConcurrentOffers = 0, int maxConcurrentOffers = 0, bool? bypassSelectors = default(bool?), Azure.Communication.JobRouter.RouterRule scoringRule = null, Azure.Communication.JobRouter.ScoringRuleOptions scoringRuleOptions = null) { throw null; } + public static Azure.Communication.JobRouter.ChannelConfiguration ChannelConfiguration(int capacityCostPerJob = 0, int? maxNumberOfJobs = default(int?)) { throw null; } + public static Azure.Communication.JobRouter.ConditionalQueueSelectorAttachment ConditionalQueueSelectorAttachment(Azure.Communication.JobRouter.RouterRule condition = null, System.Collections.Generic.IEnumerable queueSelectors = null) { throw null; } + public static Azure.Communication.JobRouter.ConditionalWorkerSelectorAttachment ConditionalWorkerSelectorAttachment(Azure.Communication.JobRouter.RouterRule condition = null, System.Collections.Generic.IEnumerable workerSelectors = null) { throw null; } + public static Azure.Communication.JobRouter.ExceptionRule ExceptionRule(Azure.Communication.JobRouter.ExceptionTrigger trigger = null, System.Collections.Generic.IDictionary actions = null) { throw null; } + public static Azure.Communication.JobRouter.ExpressionRouterRule ExpressionRouterRule(string language = null, string expression = null) { throw null; } + public static Azure.Communication.JobRouter.FunctionRouterRule FunctionRouterRule(System.Uri functionUri = null, Azure.Communication.JobRouter.FunctionRouterRuleCredential credential = null) { throw null; } + public static Azure.Communication.JobRouter.Oauth2ClientCredential Oauth2ClientCredential(string clientId = null, string clientSecret = null) { throw null; } + public static Azure.Communication.JobRouter.PassThroughQueueSelectorAttachment PassThroughQueueSelectorAttachment(string key = null, Azure.Communication.JobRouter.LabelOperator labelOperator = default(Azure.Communication.JobRouter.LabelOperator)) { throw null; } + public static Azure.Communication.JobRouter.QueueLengthExceptionTrigger QueueLengthExceptionTrigger(int threshold = 0) { throw null; } + public static Azure.Communication.JobRouter.QueueWeightedAllocation QueueWeightedAllocation(double weight = 0, System.Collections.Generic.IEnumerable queueSelectors = null) { throw null; } + public static Azure.Communication.JobRouter.RouterJobAssignment RouterJobAssignment(string assignmentId = null, string workerId = null, System.DateTimeOffset assignedAt = default(System.DateTimeOffset), System.DateTimeOffset? completedAt = default(System.DateTimeOffset?), System.DateTimeOffset? closedAt = default(System.DateTimeOffset?)) { throw null; } + public static Azure.Communication.JobRouter.RouterJobOffer RouterJobOffer(string offerId = null, string jobId = null, int capacityCost = 0, System.DateTimeOffset? offeredAt = default(System.DateTimeOffset?), System.DateTimeOffset? expiresAt = default(System.DateTimeOffset?)) { throw null; } + public static Azure.Communication.JobRouter.RouterQueueStatistics RouterQueueStatistics(string queueId = null, int length = 0, System.Collections.Generic.IReadOnlyDictionary estimatedWaitTimeMinutes = null, double? longestJobWaitTimeMinutes = default(double?)) { throw null; } + public static Azure.Communication.JobRouter.RouterWorkerAssignment RouterWorkerAssignment(string assignmentId = null, string jobId = null, int capacityCost = 0, System.DateTimeOffset assignedAt = default(System.DateTimeOffset)) { throw null; } + public static Azure.Communication.JobRouter.RuleEngineQueueSelectorAttachment RuleEngineQueueSelectorAttachment(Azure.Communication.JobRouter.RouterRule rule = null) { throw null; } + public static Azure.Communication.JobRouter.RuleEngineWorkerSelectorAttachment RuleEngineWorkerSelectorAttachment(Azure.Communication.JobRouter.RouterRule rule = null) { throw null; } + public static Azure.Communication.JobRouter.ScheduleAndSuspendMode ScheduleAndSuspendMode(System.DateTimeOffset scheduleAt = default(System.DateTimeOffset)) { throw null; } + public static Azure.Communication.JobRouter.ScoringRuleOptions ScoringRuleOptions(int? batchSize = default(int?), System.Collections.Generic.IEnumerable scoringParameters = null, bool? allowScoringBatchOfWorkers = default(bool?), bool? descendingOrder = default(bool?)) { throw null; } + public static Azure.Communication.JobRouter.StaticQueueSelectorAttachment StaticQueueSelectorAttachment(Azure.Communication.JobRouter.RouterQueueSelector queueSelector = null) { throw null; } + public static Azure.Communication.JobRouter.StaticWorkerSelectorAttachment StaticWorkerSelectorAttachment(Azure.Communication.JobRouter.RouterWorkerSelector workerSelector = null) { throw null; } + public static Azure.Communication.JobRouter.UnassignJobResult UnassignJobResult(string jobId = null, int unassignmentCount = 0) { throw null; } + public static Azure.Communication.JobRouter.WebhookRouterRule WebhookRouterRule(System.Uri authorizationServerUri = null, Azure.Communication.JobRouter.Oauth2ClientCredential clientCredential = null, System.Uri webhookUri = null) { throw null; } + public static Azure.Communication.JobRouter.WeightedAllocationQueueSelectorAttachment WeightedAllocationQueueSelectorAttachment(System.Collections.Generic.IEnumerable allocations = null) { throw null; } + public static Azure.Communication.JobRouter.WeightedAllocationWorkerSelectorAttachment WeightedAllocationWorkerSelectorAttachment(System.Collections.Generic.IEnumerable allocations = null) { throw null; } + public static Azure.Communication.JobRouter.WorkerWeightedAllocation WorkerWeightedAllocation(double weight = 0, System.Collections.Generic.IEnumerable workerSelectors = null) { throw null; } + } public partial class CompleteJobOptions { public CompleteJobOptions(string jobId, string assignmentId) { } @@ -43,17 +109,23 @@ public CompleteJobOptions(string jobId, string assignmentId) { } public string JobId { get { throw null; } } public string Note { get { throw null; } set { } } } + public partial class CompleteJobRequest + { + public CompleteJobRequest(string assignmentId) { } + public string AssignmentId { get { throw null; } } + public string Note { get { throw null; } set { } } + } public partial class ConditionalQueueSelectorAttachment : Azure.Communication.JobRouter.QueueSelectorAttachment { - public ConditionalQueueSelectorAttachment(Azure.Communication.JobRouter.RouterRule condition, System.Collections.Generic.IEnumerable queueSelectors) { } - public Azure.Communication.JobRouter.RouterRule Condition { get { throw null; } set { } } - public System.Collections.Generic.IList QueueSelectors { get { throw null; } } + internal ConditionalQueueSelectorAttachment() { } + public Azure.Communication.JobRouter.RouterRule Condition { get { throw null; } } + public System.Collections.Generic.IReadOnlyList QueueSelectors { get { throw null; } } } public partial class ConditionalWorkerSelectorAttachment : Azure.Communication.JobRouter.WorkerSelectorAttachment { - public ConditionalWorkerSelectorAttachment(Azure.Communication.JobRouter.RouterRule condition, System.Collections.Generic.IEnumerable workerSelectors) { } - public Azure.Communication.JobRouter.RouterRule Condition { get { throw null; } set { } } - public System.Collections.Generic.IList WorkerSelectors { get { throw null; } } + internal ConditionalWorkerSelectorAttachment() { } + public Azure.Communication.JobRouter.RouterRule Condition { get { throw null; } } + public System.Collections.Generic.IReadOnlyList WorkerSelectors { get { throw null; } } } public partial class CreateClassificationPolicyOptions { @@ -63,6 +135,7 @@ public CreateClassificationPolicyOptions(string classificationPolicyId) { } public string Name { get { throw null; } set { } } public Azure.Communication.JobRouter.RouterRule PrioritizationRule { get { throw null; } set { } } public System.Collections.Generic.List QueueSelectors { get { throw null; } } + public Azure.RequestConditions RequestConditions { get { throw null; } set { } } public System.Collections.Generic.List WorkerSelectors { get { throw null; } } } public partial class CreateDistributionPolicyOptions @@ -72,6 +145,7 @@ public CreateDistributionPolicyOptions(string distributionPolicyId, System.TimeS public Azure.Communication.JobRouter.DistributionMode Mode { get { throw null; } } public string Name { get { throw null; } set { } } public System.TimeSpan OfferExpiresAfter { get { throw null; } } + public Azure.RequestConditions RequestConditions { get { throw null; } set { } } } public partial class CreateExceptionPolicyOptions { @@ -79,6 +153,7 @@ public CreateExceptionPolicyOptions(string exceptionPolicyId, System.Collections public string ExceptionPolicyId { get { throw null; } } public System.Collections.Generic.IDictionary ExceptionRules { get { throw null; } } public string Name { get { throw null; } set { } } + public Azure.RequestConditions RequestConditions { get { throw null; } set { } } } public partial class CreateJobOptions { @@ -91,6 +166,7 @@ public CreateJobOptions(string jobId, string channelId, string queueId) { } public System.Collections.Generic.List Notes { get { throw null; } } public int? Priority { get { throw null; } set { } } public string QueueId { get { throw null; } } + public Azure.RequestConditions RequestConditions { get { throw null; } set { } } public System.Collections.Generic.List RequestedWorkerSelectors { get { throw null; } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } } @@ -106,6 +182,7 @@ public CreateJobWithClassificationPolicyOptions(string jobId, string channelId, public System.Collections.Generic.List Notes { get { throw null; } } public int? Priority { get { throw null; } set { } } public string QueueId { get { throw null; } set { } } + public Azure.RequestConditions RequestConditions { get { throw null; } set { } } public System.Collections.Generic.List RequestedWorkerSelectors { get { throw null; } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } } @@ -117,6 +194,7 @@ public CreateQueueOptions(string queueId, string distributionPolicyId) { } public System.Collections.Generic.IDictionary Labels { get { throw null; } } public string Name { get { throw null; } set { } } public string QueueId { get { throw null; } } + public Azure.RequestConditions RequestConditions { get { throw null; } set { } } } public partial class CreateWorkerOptions { @@ -125,6 +203,7 @@ public CreateWorkerOptions(string workerId, int totalCapacity) { } public System.Collections.Generic.IDictionary ChannelConfigurations { get { throw null; } } public System.Collections.Generic.IDictionary Labels { get { throw null; } } public System.Collections.Generic.IDictionary QueueAssignments { get { throw null; } } + public Azure.RequestConditions RequestConditions { get { throw null; } set { } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } public int TotalCapacity { get { throw null; } } public string WorkerId { get { throw null; } } @@ -152,45 +231,53 @@ protected DistributionMode() { } public int MaxConcurrentOffers { get { throw null; } set { } } public int MinConcurrentOffers { get { throw null; } set { } } } + public partial class DistributionPolicy + { + internal DistributionPolicy() { } + public string Id { get { throw null; } } + public Azure.Communication.JobRouter.DistributionMode Mode { get { throw null; } } + public string Name { get { throw null; } } + public System.TimeSpan? OfferExpiresAfter { get { throw null; } set { } } + } + public partial class DistributionPolicyItem + { + internal DistributionPolicyItem() { } + public Azure.Communication.JobRouter.DistributionPolicy DistributionPolicy { get { throw null; } } + public Azure.ETag ETag { get { throw null; } } + } public abstract partial class ExceptionAction { - internal ExceptionAction() { } - protected string Kind { get { throw null; } set { } } + protected ExceptionAction() { } + } + public partial class ExceptionPolicy + { + internal ExceptionPolicy() { } + public System.Collections.Generic.IDictionary ExceptionRules { get { throw null; } } + public string Id { get { throw null; } } + public string Name { get { throw null; } } + } + public partial class ExceptionPolicyItem + { + internal ExceptionPolicyItem() { } + public Azure.ETag ETag { get { throw null; } } + public Azure.Communication.JobRouter.ExceptionPolicy ExceptionPolicy { get { throw null; } } } public partial class ExceptionRule { public ExceptionRule(Azure.Communication.JobRouter.ExceptionTrigger trigger, System.Collections.Generic.IDictionary actions) { } public System.Collections.Generic.IDictionary Actions { get { throw null; } } - public Azure.Communication.JobRouter.ExceptionTrigger Trigger { get { throw null; } set { } } + public Azure.Communication.JobRouter.ExceptionTrigger Trigger { get { throw null; } } } public abstract partial class ExceptionTrigger { protected ExceptionTrigger() { } - protected string Kind { get { throw null; } set { } } } public partial class ExpressionRouterRule : Azure.Communication.JobRouter.RouterRule { public ExpressionRouterRule(string expression) { } - public string Expression { get { throw null; } set { } } + public string Expression { get { throw null; } } public string Language { get { throw null; } } } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct ExpressionRouterRuleLanguage : System.IEquatable - { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public ExpressionRouterRuleLanguage(string value) { throw null; } - public static Azure.Communication.JobRouter.ExpressionRouterRuleLanguage PowerFx { get { throw null; } } - public bool Equals(Azure.Communication.JobRouter.ExpressionRouterRuleLanguage other) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object obj) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.Communication.JobRouter.ExpressionRouterRuleLanguage left, Azure.Communication.JobRouter.ExpressionRouterRuleLanguage right) { throw null; } - public static implicit operator Azure.Communication.JobRouter.ExpressionRouterRuleLanguage (string value) { throw null; } - public static bool operator !=(Azure.Communication.JobRouter.ExpressionRouterRuleLanguage left, Azure.Communication.JobRouter.ExpressionRouterRuleLanguage right) { throw null; } - public override string ToString() { throw null; } - } public partial class FunctionRouterRule : Azure.Communication.JobRouter.RouterRule { public FunctionRouterRule(System.Uri functionAppUri) { } @@ -205,168 +292,166 @@ public FunctionRouterRuleCredential(string appKey, string clientId) { } public string ClientId { get { throw null; } } public string FunctionKey { get { throw null; } } } - public partial class GetJobsOptions + public abstract partial class JobMatchingMode { - public GetJobsOptions() { } - public string ChannelId { get { throw null; } set { } } - public string ClassificationPolicyId { get { throw null; } set { } } - public string QueueId { get { throw null; } set { } } - public System.DateTimeOffset? ScheduledAfter { get { throw null; } set { } } - public System.DateTimeOffset? ScheduledBefore { get { throw null; } set { } } - public Azure.Communication.JobRouter.RouterJobStatusSelector? Status { get { throw null; } set { } } - } - public partial class GetWorkersOptions - { - public GetWorkersOptions() { } - public string ChannelId { get { throw null; } set { } } - public bool HasCapacity { get { throw null; } set { } } - public string QueueId { get { throw null; } set { } } - public Azure.Communication.JobRouter.RouterWorkerStateSelector? State { get { throw null; } set { } } - } - public partial class JobMatchingMode - { - public JobMatchingMode(Azure.Communication.JobRouter.QueueAndMatchMode queueAndMatchMode) { } - public JobMatchingMode(Azure.Communication.JobRouter.ScheduleAndSuspendMode scheduleAndSuspendMode) { } - public JobMatchingMode(Azure.Communication.JobRouter.SuspendMode suspendMode) { } - public Azure.Communication.JobRouter.JobMatchModeType? ModeType { get { throw null; } } - public Azure.Communication.JobRouter.QueueAndMatchMode QueueAndMatchMode { get { throw null; } } - public Azure.Communication.JobRouter.ScheduleAndSuspendMode ScheduleAndSuspendMode { get { throw null; } } - public Azure.Communication.JobRouter.SuspendMode SuspendMode { get { throw null; } } - } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct JobMatchModeType : System.IEquatable - { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public JobMatchModeType(string value) { throw null; } - public static Azure.Communication.JobRouter.JobMatchModeType QueueAndMatchMode { get { throw null; } } - public static Azure.Communication.JobRouter.JobMatchModeType ScheduleAndSuspendMode { get { throw null; } } - public static Azure.Communication.JobRouter.JobMatchModeType SuspendMode { get { throw null; } } - public bool Equals(Azure.Communication.JobRouter.JobMatchModeType other) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object obj) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.Communication.JobRouter.JobMatchModeType left, Azure.Communication.JobRouter.JobMatchModeType right) { throw null; } - public static implicit operator Azure.Communication.JobRouter.JobMatchModeType (string value) { throw null; } - public static bool operator !=(Azure.Communication.JobRouter.JobMatchModeType left, Azure.Communication.JobRouter.JobMatchModeType right) { throw null; } - public override string ToString() { throw null; } + internal JobMatchingMode() { } } public partial class JobRouterAdministrationClient { protected JobRouterAdministrationClient() { } public JobRouterAdministrationClient(string connectionString) { } public JobRouterAdministrationClient(string connectionString, Azure.Communication.JobRouter.JobRouterClientOptions options) { } + public JobRouterAdministrationClient(System.Uri endpoint) { } public JobRouterAdministrationClient(System.Uri endpoint, Azure.AzureKeyCredential credential, Azure.Communication.JobRouter.JobRouterClientOptions options = null) { } + public JobRouterAdministrationClient(System.Uri endpoint, Azure.Communication.JobRouter.JobRouterClientOptions options) { } public JobRouterAdministrationClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Communication.JobRouter.JobRouterClientOptions options = null) { } - public virtual Azure.Response CreateClassificationPolicy(Azure.Communication.JobRouter.CreateClassificationPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CreateClassificationPolicyAsync(Azure.Communication.JobRouter.CreateClassificationPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response CreateDistributionPolicy(Azure.Communication.JobRouter.CreateDistributionPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CreateDistributionPolicyAsync(Azure.Communication.JobRouter.CreateDistributionPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response CreateExceptionPolicy(Azure.Communication.JobRouter.CreateExceptionPolicyOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CreateExceptionPolicyAsync(Azure.Communication.JobRouter.CreateExceptionPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response CreateQueue(Azure.Communication.JobRouter.CreateQueueOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CreateQueueAsync(Azure.Communication.JobRouter.CreateQueueOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response DeleteClassificationPolicy(string classificationPolicyId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task DeleteClassificationPolicyAsync(string classificationPolicyId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response DeleteDistributionPolicy(string distributionPolicyId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task DeleteDistributionPolicyAsync(string distributionPolicyId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response DeleteExceptionPolicy(string exceptionPolicyId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task DeleteExceptionPolicyAsync(string exceptionPolicyId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response DeleteQueue(string queueId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task DeleteQueueAsync(string queueId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetClassificationPolicies(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetClassificationPoliciesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetClassificationPolicy(string classificationPolicyId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetClassificationPolicyAsync(string classificationPolicyId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetDistributionPolicies(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetDistributionPoliciesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetDistributionPolicy(string distributionPolicyId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetDistributionPolicyAsync(string distributionPolicyId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetExceptionPolicies(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetExceptionPoliciesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetExceptionPolicy(string exceptionPolicyId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetExceptionPolicyAsync(string exceptionPolicyId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetQueue(string queueId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetQueueAsync(string queueId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetQueues(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetQueuesAsync(System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response UpdateClassificationPolicy(Azure.Communication.JobRouter.UpdateClassificationPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response UpdateClassificationPolicy(string classificationPolicyId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task> UpdateClassificationPolicyAsync(Azure.Communication.JobRouter.UpdateClassificationPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task UpdateClassificationPolicyAsync(string classificationPolicyId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Response UpdateDistributionPolicy(Azure.Communication.JobRouter.UpdateDistributionPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response UpdateDistributionPolicy(string distributionPolicyId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task> UpdateDistributionPolicyAsync(Azure.Communication.JobRouter.UpdateDistributionPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task UpdateDistributionPolicyAsync(string distributionPolicyId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Response UpdateExceptionPolicy(Azure.Communication.JobRouter.UpdateExceptionPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response UpdateExceptionPolicy(string exceptionPolicyId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task> UpdateExceptionPolicyAsync(Azure.Communication.JobRouter.UpdateExceptionPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task UpdateExceptionPolicyAsync(string exceptionPolicyId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Response UpdateQueue(Azure.Communication.JobRouter.UpdateQueueOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response UpdateQueue(string queueId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task> UpdateQueueAsync(Azure.Communication.JobRouter.UpdateQueueOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task UpdateQueueAsync(string queueId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response CreateClassificationPolicy(Azure.Communication.JobRouter.CreateClassificationPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateClassificationPolicyAsync(Azure.Communication.JobRouter.CreateClassificationPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateDistributionPolicy(Azure.Communication.JobRouter.CreateDistributionPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateDistributionPolicyAsync(Azure.Communication.JobRouter.CreateDistributionPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateExceptionPolicy(Azure.Communication.JobRouter.CreateExceptionPolicyOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateExceptionPolicyAsync(Azure.Communication.JobRouter.CreateExceptionPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateQueue(Azure.Communication.JobRouter.CreateQueueOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateQueueAsync(Azure.Communication.JobRouter.CreateQueueOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response DeleteClassificationPolicy(string id, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task DeleteClassificationPolicyAsync(string id, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response DeleteDistributionPolicy(string id, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task DeleteDistributionPolicyAsync(string id, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response DeleteExceptionPolicy(string id, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task DeleteExceptionPolicyAsync(string id, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response DeleteQueue(string id, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task DeleteQueueAsync(string id, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Pageable GetClassificationPolicies(int? maxpagesize, Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable GetClassificationPolicies(int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetClassificationPoliciesAsync(int? maxpagesize, Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetClassificationPoliciesAsync(int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetClassificationPolicy(string id, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetClassificationPolicy(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetClassificationPolicyAsync(string id, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetClassificationPolicyAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetDistributionPolicies(int? maxpagesize, Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable GetDistributionPolicies(int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetDistributionPoliciesAsync(int? maxpagesize, Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetDistributionPoliciesAsync(int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetDistributionPolicy(string id, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetDistributionPolicy(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetDistributionPolicyAsync(string id, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetDistributionPolicyAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetExceptionPolicies(int? maxpagesize, Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable GetExceptionPolicies(int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetExceptionPoliciesAsync(int? maxpagesize, Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetExceptionPoliciesAsync(int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetExceptionPolicy(string id, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetExceptionPolicy(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetExceptionPolicyAsync(string id, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetExceptionPolicyAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetQueue(string id, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetQueue(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetQueueAsync(string id, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetQueueAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetQueues(int? maxpagesize, Azure.RequestContext context) { throw null; } + public virtual Azure.Pageable GetQueues(int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetQueuesAsync(int? maxpagesize, Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetQueuesAsync(int? maxpagesize = default(int?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response UpdateClassificationPolicy(Azure.Communication.JobRouter.UpdateClassificationPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateClassificationPolicyAsync(Azure.Communication.JobRouter.UpdateClassificationPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response UpdateDistributionPolicy(Azure.Communication.JobRouter.UpdateDistributionPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateDistributionPolicyAsync(Azure.Communication.JobRouter.UpdateDistributionPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response UpdateExceptionPolicy(Azure.Communication.JobRouter.UpdateExceptionPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateExceptionPolicyAsync(Azure.Communication.JobRouter.UpdateExceptionPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response UpdateQueue(Azure.Communication.JobRouter.UpdateQueueOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateQueueAsync(Azure.Communication.JobRouter.UpdateQueueOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class JobRouterClient { protected JobRouterClient() { } public JobRouterClient(string connectionString) { } public JobRouterClient(string connectionString, Azure.Communication.JobRouter.JobRouterClientOptions options) { } + public JobRouterClient(System.Uri endpoint) { } public JobRouterClient(System.Uri endpoint, Azure.AzureKeyCredential credential, Azure.Communication.JobRouter.JobRouterClientOptions options = null) { } + public JobRouterClient(System.Uri endpoint, Azure.Communication.JobRouter.JobRouterClientOptions options) { } public JobRouterClient(System.Uri endpoint, Azure.Core.TokenCredential credential, Azure.Communication.JobRouter.JobRouterClientOptions options = null) { } - public virtual Azure.Response AcceptJobOffer(string workerId, string offerId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> AcceptJobOfferAsync(string workerId, string offerId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } + public virtual Azure.Response AcceptJobOffer(string workerId, string offerId, Azure.RequestContext context) { throw null; } + public virtual Azure.Response AcceptJobOffer(string workerId, string offerId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task AcceptJobOfferAsync(string workerId, string offerId, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> AcceptJobOfferAsync(string workerId, string offerId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response CancelJob(Azure.Communication.JobRouter.CancelJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CancelJob(string id, Azure.Communication.JobRouter.CancelJobRequest cancelJobRequest = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CancelJob(string id, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } public virtual System.Threading.Tasks.Task CancelJobAsync(Azure.Communication.JobRouter.CancelJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CancelJobAsync(string id, Azure.Communication.JobRouter.CancelJobRequest cancelJobRequest = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CancelJobAsync(string id, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } public virtual Azure.Response CloseJob(Azure.Communication.JobRouter.CloseJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CloseJob(string id, Azure.Communication.JobRouter.CloseJobRequest closeJobRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CloseJob(string id, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } public virtual System.Threading.Tasks.Task CloseJobAsync(Azure.Communication.JobRouter.CloseJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CloseJobAsync(string id, Azure.Communication.JobRouter.CloseJobRequest closeJobRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CloseJobAsync(string id, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } public virtual Azure.Response CompleteJob(Azure.Communication.JobRouter.CompleteJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CompleteJob(string id, Azure.Communication.JobRouter.CompleteJobRequest completeJobRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CompleteJob(string id, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } public virtual System.Threading.Tasks.Task CompleteJobAsync(Azure.Communication.JobRouter.CompleteJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response CreateJob(Azure.Communication.JobRouter.CreateJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CreateJobAsync(Azure.Communication.JobRouter.CreateJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response CreateJobWithClassificationPolicy(Azure.Communication.JobRouter.CreateJobWithClassificationPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CreateJobWithClassificationPolicyAsync(Azure.Communication.JobRouter.CreateJobWithClassificationPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response CreateWorker(Azure.Communication.JobRouter.CreateWorkerOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> CreateWorkerAsync(Azure.Communication.JobRouter.CreateWorkerOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CompleteJobAsync(string id, Azure.Communication.JobRouter.CompleteJobRequest completeJobRequest, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task CompleteJobAsync(string id, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response CreateJob(Azure.Communication.JobRouter.CreateJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateJobAsync(Azure.Communication.JobRouter.CreateJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateJobWithClassificationPolicy(Azure.Communication.JobRouter.CreateJobWithClassificationPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateJobWithClassificationPolicyAsync(Azure.Communication.JobRouter.CreateJobWithClassificationPolicyOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response CreateWorker(Azure.Communication.JobRouter.CreateWorkerOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> CreateWorkerAsync(Azure.Communication.JobRouter.CreateWorkerOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual Azure.Response DeclineJobOffer(Azure.Communication.JobRouter.DeclineJobOfferOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response DeclineJobOffer(string workerId, string offerId, Azure.Communication.JobRouter.DeclineJobOfferRequest declineJobOfferRequest = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response DeclineJobOffer(string workerId, string offerId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } public virtual System.Threading.Tasks.Task DeclineJobOfferAsync(Azure.Communication.JobRouter.DeclineJobOfferOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response DeleteJob(string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task DeleteJobAsync(string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response DeleteWorker(string workerId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task DeleteWorkerAsync(string workerId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetJob(string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetJobAsync(string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetJobs(Azure.Communication.JobRouter.GetJobsOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetJobsAsync(Azure.Communication.JobRouter.GetJobsOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetQueuePosition(string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetQueuePositionAsync(string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetQueueStatistics(string queueId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetQueueStatisticsAsync(string queueId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response GetWorker(string workerId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> GetWorkerAsync(string workerId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Pageable GetWorkers(Azure.Communication.JobRouter.GetWorkersOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.AsyncPageable GetWorkersAsync(Azure.Communication.JobRouter.GetWorkersOptions options = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeclineJobOfferAsync(string workerId, string offerId, Azure.Communication.JobRouter.DeclineJobOfferRequest declineJobOfferRequest = null, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task DeclineJobOfferAsync(string workerId, string offerId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response DeleteJob(string id, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task DeleteJobAsync(string id, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response DeleteWorker(string workerId, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task DeleteWorkerAsync(string workerId, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response GetJob(string id, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetJob(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetJobAsync(string id, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetJobAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetJobs(int? maxpagesize = default(int?), Azure.Communication.JobRouter.RouterJobStatusSelector? status = default(Azure.Communication.JobRouter.RouterJobStatusSelector?), string queueId = null, string channelId = null, string classificationPolicyId = null, System.DateTimeOffset? scheduledBefore = default(System.DateTimeOffset?), System.DateTimeOffset? scheduledAfter = default(System.DateTimeOffset?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetJobs(int? maxpagesize, string status, string queueId, string channelId, string classificationPolicyId, System.DateTimeOffset? scheduledBefore, System.DateTimeOffset? scheduledAfter, Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetJobsAsync(int? maxpagesize = default(int?), Azure.Communication.JobRouter.RouterJobStatusSelector? status = default(Azure.Communication.JobRouter.RouterJobStatusSelector?), string queueId = null, string channelId = null, string classificationPolicyId = null, System.DateTimeOffset? scheduledBefore = default(System.DateTimeOffset?), System.DateTimeOffset? scheduledAfter = default(System.DateTimeOffset?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetJobsAsync(int? maxpagesize, string status, string queueId, string channelId, string classificationPolicyId, System.DateTimeOffset? scheduledBefore, System.DateTimeOffset? scheduledAfter, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetQueuePosition(string id, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetQueuePosition(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetQueuePositionAsync(string id, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetQueuePositionAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetQueueStatistics(string id, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetQueueStatistics(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetQueueStatisticsAsync(string id, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetQueueStatisticsAsync(string id, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response GetWorker(string workerId, Azure.RequestContext context) { throw null; } + public virtual Azure.Response GetWorker(string workerId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task GetWorkerAsync(string workerId, Azure.RequestContext context) { throw null; } + public virtual System.Threading.Tasks.Task> GetWorkerAsync(string workerId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetWorkers(int? maxpagesize = default(int?), Azure.Communication.JobRouter.RouterWorkerStateSelector? state = default(Azure.Communication.JobRouter.RouterWorkerStateSelector?), string channelId = null, string queueId = null, bool? hasCapacity = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Pageable GetWorkers(int? maxpagesize, string state, string channelId, string queueId, bool? hasCapacity, Azure.RequestContext context) { throw null; } + public virtual Azure.AsyncPageable GetWorkersAsync(int? maxpagesize = default(int?), Azure.Communication.JobRouter.RouterWorkerStateSelector? state = default(Azure.Communication.JobRouter.RouterWorkerStateSelector?), string channelId = null, string queueId = null, bool? hasCapacity = default(bool?), System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.AsyncPageable GetWorkersAsync(int? maxpagesize, string state, string channelId, string queueId, bool? hasCapacity, Azure.RequestContext context) { throw null; } public virtual Azure.Response ReclassifyJob(string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } public virtual System.Threading.Tasks.Task ReclassifyJobAsync(string jobId, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response UnassignJob(Azure.Communication.JobRouter.UnassignJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task> UnassignJobAsync(Azure.Communication.JobRouter.UnassignJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response UpdateJob(Azure.Communication.JobRouter.UpdateJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response UpdateJob(string jobId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task> UpdateJobAsync(Azure.Communication.JobRouter.UpdateJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task UpdateJobAsync(string jobId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Response UpdateWorker(Azure.Communication.JobRouter.UpdateWorkerOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual Azure.Response UpdateWorker(string workerId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task> UpdateWorkerAsync(Azure.Communication.JobRouter.UpdateWorkerOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } - public virtual System.Threading.Tasks.Task UpdateWorkerAsync(string workerId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response UnassignJob(Azure.Communication.JobRouter.UnassignJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response UnassignJob(string id, string assignmentId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task> UnassignJobAsync(Azure.Communication.JobRouter.UnassignJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task UnassignJobAsync(string id, string assignmentId, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Response UpdateJob(Azure.Communication.JobRouter.UpdateJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateJobAsync(Azure.Communication.JobRouter.UpdateJobOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual Azure.Response UpdateWorker(Azure.Communication.JobRouter.UpdateWorkerOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } + public virtual System.Threading.Tasks.Task> UpdateWorkerAsync(Azure.Communication.JobRouter.UpdateWorkerOptions options, System.Threading.CancellationToken cancellationToken = default(System.Threading.CancellationToken)) { throw null; } } public partial class JobRouterClientOptions : Azure.Core.ClientOptions { - public JobRouterClientOptions(Azure.Communication.JobRouter.JobRouterClientOptions.ServiceVersion version = Azure.Communication.JobRouter.JobRouterClientOptions.ServiceVersion.V2022_07_18_preview) { } + public JobRouterClientOptions(Azure.Communication.JobRouter.JobRouterClientOptions.ServiceVersion version = Azure.Communication.JobRouter.JobRouterClientOptions.ServiceVersion.V2023_11_01) { } public enum ServiceVersion { - V2021_10_20_preview2 = 1, - V2022_07_18_preview = 2, + V2023_11_01 = 1, } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] @@ -423,60 +508,140 @@ public ManualReclassifyExceptionAction() { } } public partial class Oauth2ClientCredential { - public Oauth2ClientCredential() { } - public string ClientId { get { throw null; } set { } } - public string ClientSecret { get { throw null; } set { } } + internal Oauth2ClientCredential() { } + public string ClientId { get { throw null; } } + public string ClientSecret { get { throw null; } } } public partial class PassThroughQueueSelectorAttachment : Azure.Communication.JobRouter.QueueSelectorAttachment { public PassThroughQueueSelectorAttachment(string key, Azure.Communication.JobRouter.LabelOperator labelOperator) { } - public string Key { get { throw null; } set { } } - public Azure.Communication.JobRouter.LabelOperator LabelOperator { get { throw null; } set { } } + public string Key { get { throw null; } } + public Azure.Communication.JobRouter.LabelOperator LabelOperator { get { throw null; } } } public partial class PassThroughWorkerSelectorAttachment : Azure.Communication.JobRouter.WorkerSelectorAttachment { - public PassThroughWorkerSelectorAttachment(string key, Azure.Communication.JobRouter.LabelOperator labelOperator) { } public PassThroughWorkerSelectorAttachment(string key, Azure.Communication.JobRouter.LabelOperator labelOperator, System.TimeSpan? expiresAfter = default(System.TimeSpan?)) { } public System.TimeSpan? ExpiresAfter { get { throw null; } } - public string Key { get { throw null; } set { } } - public Azure.Communication.JobRouter.LabelOperator LabelOperator { get { throw null; } set { } } + public string Key { get { throw null; } } + public Azure.Communication.JobRouter.LabelOperator LabelOperator { get { throw null; } } } - public partial class QueueAndMatchMode + public partial class QueueAndMatchMode : Azure.Communication.JobRouter.JobMatchingMode { public QueueAndMatchMode() { } } public partial class QueueLengthExceptionTrigger : Azure.Communication.JobRouter.ExceptionTrigger { public QueueLengthExceptionTrigger(int threshold) { } - public int Threshold { get { throw null; } set { } } + public int Threshold { get { throw null; } } } public abstract partial class QueueSelectorAttachment { - internal QueueSelectorAttachment() { } - protected string Kind { get { throw null; } set { } } + protected QueueSelectorAttachment() { } } public partial class QueueWeightedAllocation { - public QueueWeightedAllocation(double weight, System.Collections.Generic.IEnumerable queueSelectors) { } - public System.Collections.Generic.IList QueueSelectors { get { throw null; } } - public double Weight { get { throw null; } set { } } + internal QueueWeightedAllocation() { } + public System.Collections.Generic.IReadOnlyList QueueSelectors { get { throw null; } } + public double Weight { get { throw null; } } } public partial class ReclassifyExceptionAction : Azure.Communication.JobRouter.ExceptionAction { public ReclassifyExceptionAction(string classificationPolicyId, System.Collections.Generic.IDictionary labelsToUpsert = null) { } - public string ClassificationPolicyId { get { throw null; } set { } } + public string ClassificationPolicyId { get { throw null; } } public System.Collections.Generic.IDictionary LabelsToUpsert { get { throw null; } set { } } } public partial class RoundRobinMode : Azure.Communication.JobRouter.DistributionMode { public RoundRobinMode() { } } + public partial class RouterJob + { + internal RouterJob() { } + public System.Collections.Generic.IReadOnlyDictionary Assignments { get { throw null; } } + public System.Collections.Generic.IReadOnlyList AttachedWorkerSelectors { get { throw null; } } + public string ChannelId { get { throw null; } } + public string ChannelReference { get { throw null; } } + public string ClassificationPolicyId { get { throw null; } } + public string DispositionCode { get { throw null; } } + public System.DateTimeOffset? EnqueuedAt { get { throw null; } } + public string Id { get { throw null; } } + public System.Collections.Generic.Dictionary Labels { get { throw null; } } + public Azure.Communication.JobRouter.JobMatchingMode MatchingMode { get { throw null; } } + public System.Collections.Generic.List Notes { get { throw null; } } + public int? Priority { get { throw null; } } + public string QueueId { get { throw null; } } + public System.Collections.Generic.List RequestedWorkerSelectors { get { throw null; } } + public System.DateTimeOffset? ScheduledAt { get { throw null; } } + public Azure.Communication.JobRouter.RouterJobStatus? Status { get { throw null; } } + public System.Collections.Generic.Dictionary Tags { get { throw null; } } + } + public partial class RouterJobAssignment + { + internal RouterJobAssignment() { } + public System.DateTimeOffset AssignedAt { get { throw null; } } + public string AssignmentId { get { throw null; } } + public System.DateTimeOffset? ClosedAt { get { throw null; } } + public System.DateTimeOffset? CompletedAt { get { throw null; } } + public string WorkerId { get { throw null; } } + } + public partial class RouterJobItem + { + internal RouterJobItem() { } + public Azure.ETag ETag { get { throw null; } } + public Azure.Communication.JobRouter.RouterJob Job { get { throw null; } } + } public partial class RouterJobNote { public RouterJobNote() { } public System.DateTimeOffset? AddedAt { get { throw null; } set { } } public string Message { get { throw null; } set { } } } + public partial class RouterJobOffer + { + internal RouterJobOffer() { } + public int CapacityCost { get { throw null; } } + public System.DateTimeOffset? ExpiresAt { get { throw null; } } + public string JobId { get { throw null; } } + public System.DateTimeOffset? OfferedAt { get { throw null; } } + public string OfferId { get { throw null; } } + } + public partial class RouterJobPositionDetails + { + internal RouterJobPositionDetails() { } + public System.TimeSpan EstimatedWaitTime { get { throw null; } } + public string JobId { get { throw null; } } + public int Position { get { throw null; } } + public string QueueId { get { throw null; } } + public int QueueLength { get { throw null; } } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RouterJobStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public RouterJobStatus(string value) { throw null; } + public static Azure.Communication.JobRouter.RouterJobStatus Assigned { get { throw null; } } + public static Azure.Communication.JobRouter.RouterJobStatus Cancelled { get { throw null; } } + public static Azure.Communication.JobRouter.RouterJobStatus ClassificationFailed { get { throw null; } } + public static Azure.Communication.JobRouter.RouterJobStatus Closed { get { throw null; } } + public static Azure.Communication.JobRouter.RouterJobStatus Completed { get { throw null; } } + public static Azure.Communication.JobRouter.RouterJobStatus Created { get { throw null; } } + public static Azure.Communication.JobRouter.RouterJobStatus PendingClassification { get { throw null; } } + public static Azure.Communication.JobRouter.RouterJobStatus PendingSchedule { get { throw null; } } + public static Azure.Communication.JobRouter.RouterJobStatus Queued { get { throw null; } } + public static Azure.Communication.JobRouter.RouterJobStatus Scheduled { get { throw null; } } + public static Azure.Communication.JobRouter.RouterJobStatus ScheduleFailed { get { throw null; } } + public static Azure.Communication.JobRouter.RouterJobStatus WaitingForActivation { get { throw null; } } + public bool Equals(Azure.Communication.JobRouter.RouterJobStatus other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Communication.JobRouter.RouterJobStatus left, Azure.Communication.JobRouter.RouterJobStatus right) { throw null; } + public static implicit operator Azure.Communication.JobRouter.RouterJobStatus (string value) { throw null; } + public static bool operator !=(Azure.Communication.JobRouter.RouterJobStatus left, Azure.Communication.JobRouter.RouterJobStatus right) { throw null; } + public override string ToString() { throw null; } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct RouterJobStatusSelector : System.IEquatable { @@ -507,34 +672,103 @@ public RouterJobNote() { } public static bool operator !=(Azure.Communication.JobRouter.RouterJobStatusSelector left, Azure.Communication.JobRouter.RouterJobStatusSelector right) { throw null; } public override string ToString() { throw null; } } + public partial class RouterQueue + { + internal RouterQueue() { } + public string DistributionPolicyId { get { throw null; } } + public string ExceptionPolicyId { get { throw null; } } + public string Id { get { throw null; } } + public System.Collections.Generic.IDictionary Labels { get { throw null; } } + public string Name { get { throw null; } } + } public partial class RouterQueueAssignment { public RouterQueueAssignment() { } } + public partial class RouterQueueItem + { + internal RouterQueueItem() { } + public Azure.ETag ETag { get { throw null; } } + public Azure.Communication.JobRouter.RouterQueue Queue { get { throw null; } } + } public partial class RouterQueueSelector { public RouterQueueSelector(string key, Azure.Communication.JobRouter.LabelOperator labelOperator, Azure.Communication.JobRouter.LabelValue value) { } - public string Key { get { throw null; } set { } } - public Azure.Communication.JobRouter.LabelOperator LabelOperator { get { throw null; } set { } } - public Azure.Communication.JobRouter.LabelValue Value { get { throw null; } set { } } + public string Key { get { throw null; } } + public Azure.Communication.JobRouter.LabelOperator LabelOperator { get { throw null; } } + public Azure.Communication.JobRouter.LabelValue Value { get { throw null; } } + } + public partial class RouterQueueStatistics + { + internal RouterQueueStatistics() { } + public System.Collections.Generic.IReadOnlyDictionary EstimatedWaitTimeMinutes { get { throw null; } } + public int Length { get { throw null; } } + public double? LongestJobWaitTimeMinutes { get { throw null; } } + public string QueueId { get { throw null; } } } public abstract partial class RouterRule { internal RouterRule() { } - public string Kind { get { throw null; } set { } } + } + public partial class RouterWorker + { + internal RouterWorker() { } + public System.Collections.Generic.IReadOnlyList AssignedJobs { get { throw null; } } + public bool? AvailableForOffers { get { throw null; } } + public System.Collections.Generic.IDictionary ChannelConfigurations { get { throw null; } } + public string Id { get { throw null; } } + public System.Collections.Generic.IDictionary Labels { get { throw null; } } + public double? LoadRatio { get { throw null; } } + public System.Collections.Generic.IReadOnlyList Offers { get { throw null; } } + public System.Collections.Generic.IDictionary QueueAssignments { get { throw null; } } + public Azure.Communication.JobRouter.RouterWorkerState? State { get { throw null; } } + public System.Collections.Generic.IDictionary Tags { get { throw null; } } + public int? TotalCapacity { get { throw null; } } + } + public partial class RouterWorkerAssignment + { + internal RouterWorkerAssignment() { } + public System.DateTimeOffset AssignedAt { get { throw null; } } + public string AssignmentId { get { throw null; } } + public int CapacityCost { get { throw null; } } + public string JobId { get { throw null; } } + } + public partial class RouterWorkerItem + { + internal RouterWorkerItem() { } + public Azure.ETag ETag { get { throw null; } } + public Azure.Communication.JobRouter.RouterWorker Worker { get { throw null; } } } public partial class RouterWorkerSelector { public RouterWorkerSelector(string key, Azure.Communication.JobRouter.LabelOperator labelOperator, Azure.Communication.JobRouter.LabelValue value) { } - public bool? Expedite { get { throw null; } set { } } + public bool? Expedite { get { throw null; } } public System.TimeSpan? ExpiresAfter { get { throw null; } set { } } - public System.DateTimeOffset? ExpiresAt { get { throw null; } } - public string Key { get { throw null; } set { } } - public Azure.Communication.JobRouter.LabelOperator LabelOperator { get { throw null; } set { } } - public Azure.Communication.JobRouter.Models.RouterWorkerSelectorStatus? Status { get { throw null; } } + public System.DateTimeOffset? ExpiresAt { get { throw null; } set { } } + public string Key { get { throw null; } } + public Azure.Communication.JobRouter.LabelOperator LabelOperator { get { throw null; } } + public Azure.Communication.JobRouter.RouterWorkerSelectorStatus? Status { get { throw null; } } public Azure.Communication.JobRouter.LabelValue Value { get { throw null; } set { } } } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct RouterWorkerSelectorStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public RouterWorkerSelectorStatus(string value) { throw null; } + public static Azure.Communication.JobRouter.RouterWorkerSelectorStatus Active { get { throw null; } } + public static Azure.Communication.JobRouter.RouterWorkerSelectorStatus Expired { get { throw null; } } + public bool Equals(Azure.Communication.JobRouter.RouterWorkerSelectorStatus other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Communication.JobRouter.RouterWorkerSelectorStatus left, Azure.Communication.JobRouter.RouterWorkerSelectorStatus right) { throw null; } + public static implicit operator Azure.Communication.JobRouter.RouterWorkerSelectorStatus (string value) { throw null; } + public static bool operator !=(Azure.Communication.JobRouter.RouterWorkerSelectorStatus left, Azure.Communication.JobRouter.RouterWorkerSelectorStatus right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct RouterWorkerState : System.IEquatable { private readonly object _dummy; @@ -575,19 +809,27 @@ public RouterWorkerSelector(string key, Azure.Communication.JobRouter.LabelOpera } public partial class RuleEngineQueueSelectorAttachment : Azure.Communication.JobRouter.QueueSelectorAttachment { - public RuleEngineQueueSelectorAttachment(Azure.Communication.JobRouter.RouterRule rule) { } - public Azure.Communication.JobRouter.RouterRule Rule { get { throw null; } set { } } + internal RuleEngineQueueSelectorAttachment() { } + public Azure.Communication.JobRouter.RouterRule Rule { get { throw null; } } } public partial class RuleEngineWorkerSelectorAttachment : Azure.Communication.JobRouter.WorkerSelectorAttachment { - public RuleEngineWorkerSelectorAttachment(Azure.Communication.JobRouter.RouterRule rule) { } - public Azure.Communication.JobRouter.RouterRule Rule { get { throw null; } set { } } + internal RuleEngineWorkerSelectorAttachment() { } + public Azure.Communication.JobRouter.RouterRule Rule { get { throw null; } } } - public partial class ScheduleAndSuspendMode + public partial class ScheduleAndSuspendMode : Azure.Communication.JobRouter.JobMatchingMode { public ScheduleAndSuspendMode(System.DateTimeOffset scheduleAt) { } public System.DateTimeOffset ScheduleAt { get { throw null; } } } + public partial class ScoringRuleOptions + { + internal ScoringRuleOptions() { } + public bool? AllowScoringBatchOfWorkers { get { throw null; } } + public int? BatchSize { get { throw null; } } + public bool? DescendingOrder { get { throw null; } } + public System.Collections.Generic.IList ScoringParameters { get { throw null; } } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct ScoringRuleParameterSelector : System.IEquatable { @@ -608,8 +850,8 @@ public ScheduleAndSuspendMode(System.DateTimeOffset scheduleAt) { } } public partial class StaticQueueSelectorAttachment : Azure.Communication.JobRouter.QueueSelectorAttachment { - public StaticQueueSelectorAttachment(Azure.Communication.JobRouter.RouterQueueSelector queueSelector) { } - public Azure.Communication.JobRouter.RouterQueueSelector QueueSelector { get { throw null; } set { } } + internal StaticQueueSelectorAttachment() { } + public Azure.Communication.JobRouter.RouterQueueSelector QueueSelector { get { throw null; } } } public partial class StaticRouterRule : Azure.Communication.JobRouter.RouterRule { @@ -618,10 +860,10 @@ public StaticRouterRule(Azure.Communication.JobRouter.LabelValue value) { } } public partial class StaticWorkerSelectorAttachment : Azure.Communication.JobRouter.WorkerSelectorAttachment { - public StaticWorkerSelectorAttachment(Azure.Communication.JobRouter.RouterWorkerSelector workerSelector) { } - public Azure.Communication.JobRouter.RouterWorkerSelector WorkerSelector { get { throw null; } set { } } + internal StaticWorkerSelectorAttachment() { } + public Azure.Communication.JobRouter.RouterWorkerSelector WorkerSelector { get { throw null; } } } - public partial class SuspendMode + public partial class SuspendMode : Azure.Communication.JobRouter.JobMatchingMode { public SuspendMode() { } } @@ -630,6 +872,13 @@ public partial class UnassignJobOptions public UnassignJobOptions(string jobId, string assignmentId) { } public string AssignmentId { get { throw null; } } public string JobId { get { throw null; } } + public bool? SuspendMatching { get { throw null; } set { } } + } + public partial class UnassignJobResult + { + internal UnassignJobResult() { } + public string JobId { get { throw null; } } + public int UnassignmentCount { get { throw null; } } } public partial class UpdateClassificationPolicyOptions { @@ -639,6 +888,7 @@ public UpdateClassificationPolicyOptions(string classificationPolicyId) { } public string Name { get { throw null; } set { } } public Azure.Communication.JobRouter.RouterRule PrioritizationRule { get { throw null; } set { } } public System.Collections.Generic.List QueueSelectors { get { throw null; } } + public Azure.RequestConditions RequestConditions { get { throw null; } set { } } public System.Collections.Generic.List WorkerSelectors { get { throw null; } } } public partial class UpdateDistributionPolicyOptions @@ -648,6 +898,7 @@ public UpdateDistributionPolicyOptions(string distributionPolicyId) { } public Azure.Communication.JobRouter.DistributionMode Mode { get { throw null; } set { } } public string Name { get { throw null; } set { } } public System.TimeSpan OfferExpiresAfter { get { throw null; } set { } } + public Azure.RequestConditions RequestConditions { get { throw null; } set { } } } public partial class UpdateExceptionPolicyOptions { @@ -655,6 +906,7 @@ public UpdateExceptionPolicyOptions(string exceptionPolicyId) { } public string ExceptionPolicyId { get { throw null; } } public System.Collections.Generic.IDictionary ExceptionRules { get { throw null; } } public string Name { get { throw null; } set { } } + public Azure.RequestConditions RequestConditions { get { throw null; } set { } } } public partial class UpdateJobOptions { @@ -669,6 +921,7 @@ public UpdateJobOptions(string jobId) { } public System.Collections.Generic.List Notes { get { throw null; } } public int? Priority { get { throw null; } set { } } public string? QueueId { get { throw null; } set { } } + public Azure.RequestConditions RequestConditions { get { throw null; } set { } } public System.Collections.Generic.List RequestedWorkerSelectors { get { throw null; } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } } @@ -680,6 +933,7 @@ public UpdateQueueOptions(string queueId) { } public System.Collections.Generic.IDictionary Labels { get { throw null; } } public string? Name { get { throw null; } set { } } public string QueueId { get { throw null; } } + public Azure.RequestConditions RequestConditions { get { throw null; } set { } } } public partial class UpdateWorkerOptions { @@ -688,6 +942,7 @@ public UpdateWorkerOptions(string workerId) { } public System.Collections.Generic.IDictionary ChannelConfigurations { get { throw null; } } public System.Collections.Generic.IDictionary Labels { get { throw null; } } public System.Collections.Generic.IDictionary QueueAssignments { get { throw null; } } + public Azure.RequestConditions RequestConditions { get { throw null; } set { } } public System.Collections.Generic.IDictionary Tags { get { throw null; } } public int? TotalCapacity { get { throw null; } set { } } public string WorkerId { get { throw null; } } @@ -699,258 +954,39 @@ public WaitTimeExceptionTrigger(System.TimeSpan threshold) { } } public partial class WebhookRouterRule : Azure.Communication.JobRouter.RouterRule { - public WebhookRouterRule() { } - public System.Uri AuthorizationServerUri { get { throw null; } set { } } - public Azure.Communication.JobRouter.Oauth2ClientCredential ClientCredential { get { throw null; } set { } } - public System.Uri WebhookUri { get { throw null; } set { } } + public WebhookRouterRule(System.Uri authorizationServerUri, Azure.Communication.JobRouter.Oauth2ClientCredential clientCredential, System.Uri webhookUri) { } + public System.Uri AuthorizationServerUri { get { throw null; } } + public Azure.Communication.JobRouter.Oauth2ClientCredential ClientCredential { get { throw null; } } + public System.Uri WebhookUri { get { throw null; } } } public partial class WeightedAllocationQueueSelectorAttachment : Azure.Communication.JobRouter.QueueSelectorAttachment { - public WeightedAllocationQueueSelectorAttachment(System.Collections.Generic.IEnumerable allocations) { } - public System.Collections.Generic.IList Allocations { get { throw null; } } + internal WeightedAllocationQueueSelectorAttachment() { } + public System.Collections.Generic.IReadOnlyList Allocations { get { throw null; } } } public partial class WeightedAllocationWorkerSelectorAttachment : Azure.Communication.JobRouter.WorkerSelectorAttachment { - public WeightedAllocationWorkerSelectorAttachment(System.Collections.Generic.IEnumerable allocations) { } - public System.Collections.Generic.IList Allocations { get { throw null; } } + internal WeightedAllocationWorkerSelectorAttachment() { } + public System.Collections.Generic.IReadOnlyList Allocations { get { throw null; } } } public abstract partial class WorkerSelectorAttachment { - internal WorkerSelectorAttachment() { } - protected string Kind { get { throw null; } set { } } + protected WorkerSelectorAttachment() { } } public partial class WorkerWeightedAllocation { - public WorkerWeightedAllocation(double weight, System.Collections.Generic.IEnumerable workerSelectors) { } - public double Weight { get { throw null; } set { } } - public System.Collections.Generic.IList WorkerSelectors { get { throw null; } } + internal WorkerWeightedAllocation() { } + public double Weight { get { throw null; } } + public System.Collections.Generic.IReadOnlyList WorkerSelectors { get { throw null; } } } } -namespace Azure.Communication.JobRouter.Models +namespace Microsoft.Extensions.Azure { - public partial class AcceptJobOfferResult - { - internal AcceptJobOfferResult() { } - public string AssignmentId { get { throw null; } } - public string JobId { get { throw null; } } - public string WorkerId { get { throw null; } } - } - public partial class ClassificationPolicy - { - internal ClassificationPolicy() { } - public string FallbackQueueId { get { throw null; } } - public string Id { get { throw null; } } - public string Name { get { throw null; } } - public Azure.Communication.JobRouter.RouterRule PrioritizationRule { get { throw null; } } - public System.Collections.Generic.List QueueSelectors { get { throw null; } } - public System.Collections.Generic.List WorkerSelectors { get { throw null; } } - } - public partial class ClassificationPolicyItem - { - internal ClassificationPolicyItem() { } - public Azure.Communication.JobRouter.Models.ClassificationPolicy ClassificationPolicy { get { throw null; } } - public Azure.ETag ETag { get { throw null; } } - } - public static partial class CommunicationJobRouterModelFactory - { - public static Azure.Communication.JobRouter.Models.AcceptJobOfferResult AcceptJobOfferResult(string assignmentId = null, string jobId = null, string workerId = null) { throw null; } - public static Azure.Communication.JobRouter.Models.RouterJobAssignment RouterJobAssignment(string assignmentId = null, string workerId = null, System.DateTimeOffset assignedAt = default(System.DateTimeOffset), System.DateTimeOffset? completedAt = default(System.DateTimeOffset?), System.DateTimeOffset? closedAt = default(System.DateTimeOffset?)) { throw null; } - public static Azure.Communication.JobRouter.Models.RouterJobOffer RouterJobOffer(string offerId = null, string jobId = null, int capacityCost = 0, System.DateTimeOffset? offeredAt = default(System.DateTimeOffset?), System.DateTimeOffset? expiresAt = default(System.DateTimeOffset?)) { throw null; } - public static Azure.Communication.JobRouter.Models.RouterQueueStatistics RouterQueueStatistics(string queueId = null, int length = 0, System.Collections.Generic.IReadOnlyDictionary estimatedWaitTimeMinutes = null, double? longestJobWaitTimeMinutes = default(double?)) { throw null; } - public static Azure.Communication.JobRouter.Models.RouterWorkerAssignment RouterWorkerAssignment(string assignmentId = null, string jobId = null, int capacityCost = 0, System.DateTimeOffset assignedAt = default(System.DateTimeOffset)) { throw null; } - public static Azure.Communication.JobRouter.Models.UnassignJobResult UnassignJobResult(string jobId = null, int unassignmentCount = 0) { throw null; } - } - public partial class DistributionPolicy - { - internal DistributionPolicy() { } - public string Id { get { throw null; } } - public Azure.Communication.JobRouter.DistributionMode Mode { get { throw null; } } - public string Name { get { throw null; } } - public System.TimeSpan? OfferExpiresAfter { get { throw null; } set { } } - } - public partial class DistributionPolicyItem - { - internal DistributionPolicyItem() { } - public Azure.Communication.JobRouter.Models.DistributionPolicy DistributionPolicy { get { throw null; } } - public Azure.ETag ETag { get { throw null; } } - } - public partial class ExceptionPolicy - { - internal ExceptionPolicy() { } - public System.Collections.Generic.IDictionary ExceptionRules { get { throw null; } } - public string Id { get { throw null; } } - public string Name { get { throw null; } } - } - public partial class ExceptionPolicyItem - { - internal ExceptionPolicyItem() { } - public Azure.ETag ETag { get { throw null; } } - public Azure.Communication.JobRouter.Models.ExceptionPolicy ExceptionPolicy { get { throw null; } } - } - public partial class RouterJob - { - internal RouterJob() { } - public System.Collections.Generic.IReadOnlyDictionary Assignments { get { throw null; } } - public System.Collections.Generic.IReadOnlyList AttachedWorkerSelectors { get { throw null; } } - public string ChannelId { get { throw null; } } - public string ChannelReference { get { throw null; } } - public string ClassificationPolicyId { get { throw null; } } - public string DispositionCode { get { throw null; } } - public System.DateTimeOffset? EnqueuedAt { get { throw null; } } - public string Id { get { throw null; } } - public System.Collections.Generic.Dictionary Labels { get { throw null; } } - public Azure.Communication.JobRouter.JobMatchingMode MatchingMode { get { throw null; } } - public System.Collections.Generic.List Notes { get { throw null; } } - public int? Priority { get { throw null; } } - public string QueueId { get { throw null; } } - public System.Collections.Generic.List RequestedWorkerSelectors { get { throw null; } } - public System.DateTimeOffset? ScheduledAt { get { throw null; } } - public Azure.Communication.JobRouter.Models.RouterJobStatus? Status { get { throw null; } } - public System.Collections.Generic.Dictionary Tags { get { throw null; } } - } - public partial class RouterJobAssignment - { - internal RouterJobAssignment() { } - public System.DateTimeOffset AssignedAt { get { throw null; } } - public string AssignmentId { get { throw null; } } - public System.DateTimeOffset? ClosedAt { get { throw null; } } - public System.DateTimeOffset? CompletedAt { get { throw null; } } - public string WorkerId { get { throw null; } } - } - public partial class RouterJobItem - { - internal RouterJobItem() { } - public Azure.ETag ETag { get { throw null; } } - public Azure.Communication.JobRouter.Models.RouterJob Job { get { throw null; } } - } - public partial class RouterJobOffer - { - internal RouterJobOffer() { } - public int CapacityCost { get { throw null; } } - public System.DateTimeOffset? ExpiresAt { get { throw null; } } - public string JobId { get { throw null; } } - public System.DateTimeOffset? OfferedAt { get { throw null; } } - public string OfferId { get { throw null; } } - } - public partial class RouterJobPositionDetails - { - internal RouterJobPositionDetails() { } - public System.TimeSpan EstimatedWaitTime { get { throw null; } } - public string JobId { get { throw null; } } - public int Position { get { throw null; } } - public string QueueId { get { throw null; } } - public int QueueLength { get { throw null; } } - } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct RouterJobStatus : System.IEquatable - { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public RouterJobStatus(string value) { throw null; } - public static Azure.Communication.JobRouter.Models.RouterJobStatus Assigned { get { throw null; } } - public static Azure.Communication.JobRouter.Models.RouterJobStatus Cancelled { get { throw null; } } - public static Azure.Communication.JobRouter.Models.RouterJobStatus ClassificationFailed { get { throw null; } } - public static Azure.Communication.JobRouter.Models.RouterJobStatus Closed { get { throw null; } } - public static Azure.Communication.JobRouter.Models.RouterJobStatus Completed { get { throw null; } } - public static Azure.Communication.JobRouter.Models.RouterJobStatus Created { get { throw null; } } - public static Azure.Communication.JobRouter.Models.RouterJobStatus PendingClassification { get { throw null; } } - public static Azure.Communication.JobRouter.Models.RouterJobStatus PendingSchedule { get { throw null; } } - public static Azure.Communication.JobRouter.Models.RouterJobStatus Queued { get { throw null; } } - public static Azure.Communication.JobRouter.Models.RouterJobStatus Scheduled { get { throw null; } } - public static Azure.Communication.JobRouter.Models.RouterJobStatus ScheduleFailed { get { throw null; } } - public static Azure.Communication.JobRouter.Models.RouterJobStatus WaitingForActivation { get { throw null; } } - public bool Equals(Azure.Communication.JobRouter.Models.RouterJobStatus other) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object obj) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.Communication.JobRouter.Models.RouterJobStatus left, Azure.Communication.JobRouter.Models.RouterJobStatus right) { throw null; } - public static implicit operator Azure.Communication.JobRouter.Models.RouterJobStatus (string value) { throw null; } - public static bool operator !=(Azure.Communication.JobRouter.Models.RouterJobStatus left, Azure.Communication.JobRouter.Models.RouterJobStatus right) { throw null; } - public override string ToString() { throw null; } - } - public partial class RouterQueue - { - internal RouterQueue() { } - public string DistributionPolicyId { get { throw null; } } - public string ExceptionPolicyId { get { throw null; } } - public string Id { get { throw null; } } - public System.Collections.Generic.IDictionary Labels { get { throw null; } } - public string Name { get { throw null; } } - } - public partial class RouterQueueItem - { - internal RouterQueueItem() { } - public Azure.ETag ETag { get { throw null; } } - public Azure.Communication.JobRouter.Models.RouterQueue Queue { get { throw null; } } - } - public partial class RouterQueueStatistics - { - internal RouterQueueStatistics() { } - public System.Collections.Generic.IReadOnlyDictionary EstimatedWaitTimeMinutes { get { throw null; } } - public int Length { get { throw null; } } - public double? LongestJobWaitTimeMinutes { get { throw null; } } - public string QueueId { get { throw null; } } - } - public partial class RouterWorker - { - internal RouterWorker() { } - public System.Collections.Generic.IReadOnlyList AssignedJobs { get { throw null; } } - public bool? AvailableForOffers { get { throw null; } } - public System.Collections.Generic.IDictionary ChannelConfigurations { get { throw null; } } - public string Id { get { throw null; } } - public System.Collections.Generic.IDictionary Labels { get { throw null; } } - public double? LoadRatio { get { throw null; } } - public System.Collections.Generic.IReadOnlyList Offers { get { throw null; } } - public System.Collections.Generic.IDictionary QueueAssignments { get { throw null; } } - public Azure.Communication.JobRouter.RouterWorkerState? State { get { throw null; } } - public System.Collections.Generic.IDictionary Tags { get { throw null; } } - public int? TotalCapacity { get { throw null; } } - } - public partial class RouterWorkerAssignment + public static partial class CommunicationJobRouterClientBuilderExtensions { - internal RouterWorkerAssignment() { } - public System.DateTimeOffset AssignedAt { get { throw null; } } - public string AssignmentId { get { throw null; } } - public int CapacityCost { get { throw null; } } - public string JobId { get { throw null; } } - } - public partial class RouterWorkerItem - { - internal RouterWorkerItem() { } - public Azure.ETag ETag { get { throw null; } } - public Azure.Communication.JobRouter.Models.RouterWorker Worker { get { throw null; } } - } - [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] - public readonly partial struct RouterWorkerSelectorStatus : System.IEquatable - { - private readonly object _dummy; - private readonly int _dummyPrimitive; - public RouterWorkerSelectorStatus(string value) { throw null; } - public static Azure.Communication.JobRouter.Models.RouterWorkerSelectorStatus Active { get { throw null; } } - public static Azure.Communication.JobRouter.Models.RouterWorkerSelectorStatus Expired { get { throw null; } } - public bool Equals(Azure.Communication.JobRouter.Models.RouterWorkerSelectorStatus other) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override bool Equals(object obj) { throw null; } - [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] - public override int GetHashCode() { throw null; } - public static bool operator ==(Azure.Communication.JobRouter.Models.RouterWorkerSelectorStatus left, Azure.Communication.JobRouter.Models.RouterWorkerSelectorStatus right) { throw null; } - public static implicit operator Azure.Communication.JobRouter.Models.RouterWorkerSelectorStatus (string value) { throw null; } - public static bool operator !=(Azure.Communication.JobRouter.Models.RouterWorkerSelectorStatus left, Azure.Communication.JobRouter.Models.RouterWorkerSelectorStatus right) { throw null; } - public override string ToString() { throw null; } - } - public partial class ScoringRuleOptions - { - internal ScoringRuleOptions() { } - public bool? AllowScoringBatchOfWorkers { get { throw null; } set { } } - public int? BatchSize { get { throw null; } set { } } - public bool? DescendingOrder { get { throw null; } set { } } - public System.Collections.Generic.IList ScoringParameters { get { throw null; } } - } - public partial class UnassignJobResult - { - internal UnassignJobResult() { } - public string JobId { get { throw null; } } - public int UnassignmentCount { get { throw null; } } + public static Azure.Core.Extensions.IAzureClientBuilder AddJobRouterAdministrationClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilder { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddJobRouterAdministrationClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddJobRouterClient(this TBuilder builder, System.Uri endpoint) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilder { throw null; } + public static Azure.Core.Extensions.IAzureClientBuilder AddJobRouterClient(this TBuilder builder, TConfiguration configuration) where TBuilder : Azure.Core.Extensions.IAzureClientFactoryBuilderWithConfiguration { throw null; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/assets.json b/sdk/communication/Azure.Communication.JobRouter/assets.json index 23f452d4a153..70009be9e6ba 100644 --- a/sdk/communication/Azure.Communication.JobRouter/assets.json +++ b/sdk/communication/Azure.Communication.JobRouter/assets.json @@ -2,5 +2,5 @@ "AssetsRepo": "Azure/azure-sdk-assets", "AssetsRepoPrefixPath": "net", "TagPrefix": "net/communication/Azure.Communication.JobRouter", - "Tag": "net/communication/Azure.Communication.JobRouter_b53dd17d6a" + "Tag": "net/communication/Azure.Communication.JobRouter_33a06c6ea8" } diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/ClassificationPolicyCrud.md b/sdk/communication/Azure.Communication.JobRouter/samples/ClassificationPolicyCrud.md index 4ace09537e62..c1d9ee8475cf 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/ClassificationPolicyCrud.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/ClassificationPolicyCrud.md @@ -4,7 +4,6 @@ ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_UsingStatements using Azure.Communication.JobRouter; -using Azure.Communication.JobRouter.Models; ``` ## Create a client @@ -82,17 +81,6 @@ Console.WriteLine($"Classification policy successfully update with new prioritiz *NOTE: It is not possible to update a single QueueSelectorAttachment or WorkerSelectorAttachment. In order to add QueueSelectorAttachment to an already existing set of QueueSelectorAttachment(s), either specify all the QueueSelectorAttachment(s) again OR perform a Get operation first to retrieve the current value of the classification policy (preferred). -## Remove from classification policy - -```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateClassificationPolicyRemoveProp -Response updatedClassificationPolicyWithoutName = routerAdministrationClient.UpdateClassificationPolicy(classificationPolicyId, - RequestContent.Create(new { Name = (string?)null })); - -Response queriedClassificationPolicyWithoutName = routerAdministrationClient.GetClassificationPolicy(classificationPolicyId); - -Console.WriteLine($"Classification policy successfully updated: 'Name' has been removed. Status: {string.IsNullOrWhiteSpace(queriedClassificationPolicyWithoutName.Value.Name)}"); -``` - ## List classification policies ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetClassificationPolicies diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/ClassificationPolicyCrudAsync.md b/sdk/communication/Azure.Communication.JobRouter/samples/ClassificationPolicyCrudAsync.md index 3793ed7c53fd..145ddb596149 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/ClassificationPolicyCrudAsync.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/ClassificationPolicyCrudAsync.md @@ -4,7 +4,6 @@ ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_UsingStatements using Azure.Communication.JobRouter; -using Azure.Communication.JobRouter.Models; ``` ## Create a client @@ -82,16 +81,6 @@ Console.WriteLine($"Classification policy successfully update with new prioritiz *NOTE: It is not possible to update a single QueueSelectorAttachment or WorkerSelectorAttachment. In order to add QueueSelectorAttachment to an already existing set of QueueSelectorAttachment(s), either specify all the QueueSelectorAttachment(s) again OR perform a Get operation first to retrieve the current value of the classification policy (preferred). -## Remove from classification policy - -```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateClassificationPolicyRemoveProp_Async -Response updatedClassificationPolicyWithoutName = await routerAdministrationClient.UpdateClassificationPolicyAsync(classificationPolicyId, - RequestContent.Create(new { Name = (string?)null })); - -Response queriedClassificationPolicyWithoutName = await routerAdministrationClient.GetClassificationPolicyAsync(classificationPolicyId); - -Console.WriteLine($"Classification policy successfully updated: 'Name' has been removed. Status: {string.IsNullOrWhiteSpace(queriedClassificationPolicyWithoutName.Value.Name)}"); -``` ## List classification policies diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/DistributionPolicyCrud.md b/sdk/communication/Azure.Communication.JobRouter/samples/DistributionPolicyCrud.md index 30aab052eec5..36910e631521 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/DistributionPolicyCrud.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/DistributionPolicyCrud.md @@ -4,7 +4,6 @@ ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_UsingStatements using Azure.Communication.JobRouter; -using Azure.Communication.JobRouter.Models; ``` ## Create a client @@ -55,17 +54,6 @@ Response updatedDistributionPolicy = routerAdministrationCli Console.WriteLine($"Distribution policy successfully update with new distribution mode. Mode Type: {updatedDistributionPolicy.Value.Mode.Kind}"); ``` -## Remove from distribution policy - -```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateDistributionPolicyRemoveProp -Response updatedDistributionPolicyWithoutName = routerAdministrationClient.UpdateDistributionPolicy(distributionPolicyId, - RequestContent.Create(new { Name = (string?)null })); - -Response queriedDistributionPolicyWithoutName = routerAdministrationClient.GetDistributionPolicy(distributionPolicyId); - -Console.WriteLine($"Distribution policy successfully updated: 'Name' has been removed. Status: Status: {string.IsNullOrWhiteSpace(queriedDistributionPolicyWithoutName.Value.Name)}"); -``` - ## List distribution policies ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetDistributionPolicies diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/DistributionPolicyCrudAsync.md b/sdk/communication/Azure.Communication.JobRouter/samples/DistributionPolicyCrudAsync.md index e0ea59aa0c0a..8d63dc1b107a 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/DistributionPolicyCrudAsync.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/DistributionPolicyCrudAsync.md @@ -4,7 +4,6 @@ ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_UsingStatements using Azure.Communication.JobRouter; -using Azure.Communication.JobRouter.Models; ``` ## Create a client @@ -55,17 +54,6 @@ Response updatedDistributionPolicy = await routerAdministrat Console.WriteLine($"Distribution policy successfully update with new distribution mode. Mode Type: {updatedDistributionPolicy.Value.Mode.Kind}"); ``` -## Remove from distribution policy - -```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateDistributionPolicyRemoveProp_Async -Response updatedDistributionPolicyWithoutName = await routerAdministrationClient.UpdateDistributionPolicyAsync(distributionPolicyId, - RequestContent.Create(new { Name = (string?)null })); - -Response queriedDistributionPolicyWithoutName = await routerAdministrationClient.GetDistributionPolicyAsync(distributionPolicyId); - -Console.WriteLine($"Distribution policy successfully updated: 'Name' has been removed. Status: Status: {string.IsNullOrWhiteSpace(queriedDistributionPolicyWithoutName.Value.Name)}"); -``` - ## List distribution policies ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetDistributionPolicies_Async diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/ExceptionPolicyCrud.md b/sdk/communication/Azure.Communication.JobRouter/samples/ExceptionPolicyCrud.md index 370169557aba..f66d5afd430a 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/ExceptionPolicyCrud.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/ExceptionPolicyCrud.md @@ -4,7 +4,6 @@ ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_UsingStatements using Azure.Communication.JobRouter; -using Azure.Communication.JobRouter.Models; ``` ## Create a client @@ -143,18 +142,6 @@ Console.WriteLine($"`EscalateJobOnWaitTimeExceededTrigger` rule has been success Console.WriteLine($"`EscalateJobOnWaitTimeExceededTrigger2Min` rule has been successfully added: {updateExceptionPolicy.Value.ExceptionRules.ContainsKey("EscalateJobOnWaitTimeExceededTrigger2Min")}"); ``` -## Remove from exception policy - -```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateExceptionPolicyRemoveProp -// we are going to remove Name -Response updateExceptionPolicyWithoutName = routerClient.UpdateExceptionPolicy(exceptionPolicyId, - RequestContent.Create(new { Name = (string?)null })); - -Response queriedExceptionPolicyWithoutName = routerClient.GetExceptionPolicy(exceptionPolicyId); - -Console.WriteLine($"Exception policy successfully updated: 'Name' has been removed. Status: {string.IsNullOrWhiteSpace(queriedExceptionPolicyWithoutName.Value.Name)}"); -``` - ## List exception policies ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetExceptionPolicies diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/ExceptionPolicyCrudAsync.md b/sdk/communication/Azure.Communication.JobRouter/samples/ExceptionPolicyCrudAsync.md index 10ef749381f1..f9c3efaab3e5 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/ExceptionPolicyCrudAsync.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/ExceptionPolicyCrudAsync.md @@ -4,7 +4,6 @@ ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_UsingStatements using Azure.Communication.JobRouter; -using Azure.Communication.JobRouter.Models; ``` ## Create a client @@ -143,18 +142,6 @@ Console.WriteLine($"`EscalateJobOnWaitTimeExceededTrigger` rule has been success Console.WriteLine($"`EscalateJobOnWaitTimeExceededTrigger2Min` rule has been successfully added: {updateExceptionPolicy.Value.ExceptionRules.ContainsKey("EscalateJobOnWaitTimeExceededTrigger2Min")}"); ``` -## Remove from exception policy - -```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateExceptionPolicyRemoveProp_Async -// we are going to remove Name -Response updateExceptionPolicyWithoutName = await routerClient.UpdateExceptionPolicyAsync(exceptionPolicyId, - RequestContent.Create(new { Name = (string?)null })); - -Response queriedExceptionPolicyWithoutName = await routerClient.GetExceptionPolicyAsync(exceptionPolicyId); - -Console.WriteLine($"Exception policy successfully updated: 'Name' has been removed. Status: {string.IsNullOrWhiteSpace(queriedExceptionPolicyWithoutName.Value.Name)}"); -``` - ## List exception policies ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetExceptionPolicies_Async diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/JobQueueCrud.md b/sdk/communication/Azure.Communication.JobRouter/samples/JobQueueCrud.md index d777180b141d..f530cebe25c4 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/JobQueueCrud.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/JobQueueCrud.md @@ -4,7 +4,6 @@ ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_UsingStatements using Azure.Communication.JobRouter; -using Azure.Communication.JobRouter.Models; ``` ## Create a client @@ -22,7 +21,7 @@ JobRouterAdministrationClient routerAdministrationClient = new JobRouterAdminist // set `distributionPolicyId` to an existing distribution policy string jobQueueId = "job-queue-id"; -Response jobQueue = routerAdministrationClient.CreateQueue( +Response jobQueue = routerAdministrationClient.CreateQueue( options: new CreateQueueOptions(jobQueueId, distributionPolicyId) // this is optional { Name = "My job queue" @@ -34,7 +33,7 @@ Console.WriteLine($"Job queue successfully create with id: {jobQueue.Value.Id}") ## Get a job queue ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetJobQueue -Response queriedJobQueue = routerAdministrationClient.GetQueue(jobQueueId); +Response queriedJobQueue = routerAdministrationClient.GetQueue(jobQueueId); Console.WriteLine($"Successfully fetched queue with id: {queriedJobQueue.Value.Id}"); ``` @@ -42,7 +41,7 @@ Console.WriteLine($"Successfully fetched queue with id: {queriedJobQueue.Value.I ## Get queue statistics ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetJobQueueStat -Response queueStatistics = routerClient.GetQueueStatistics(queueId: jobQueueId); +Response queueStatistics = routerClient.GetQueueStatistics(jobQueueId); Console.WriteLine($"Queue statistics successfully retrieved for queue: {JsonSerializer.Serialize(queueStatistics.Value)}"); ``` @@ -50,31 +49,20 @@ Console.WriteLine($"Queue statistics successfully retrieved for queue: {JsonSeri ## Update a job queue ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateGetJobQueue -Response updatedJobQueue = routerAdministrationClient.UpdateQueue( +Response updatedJobQueue = routerAdministrationClient.UpdateQueue( options: new UpdateQueueOptions(jobQueueId) { Labels = { ["Additional-Queue-Label"] = new LabelValue("ChatQueue") } }); ``` -## Remove from queue - -```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateQueueRemoveProp -Response updatedJobQueueWithoutName = routerAdministrationClient.UpdateQueue(jobQueueId, - RequestContent.Create(new { Name = (string?)null })); - -Response queriedJobQueueWithoutName = routerAdministrationClient.GetQueue(jobQueueId); - -Console.WriteLine($"Queue successfully updated: 'Name' has been removed. Status: {string.IsNullOrWhiteSpace(queriedJobQueueWithoutName.Value.Name)}"); -``` - ## List job queues ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetJobQueues -Pageable jobQueues = routerAdministrationClient.GetQueues(); -foreach (Page asPage in jobQueues.AsPages(pageSizeHint: 10)) +Pageable jobQueues = routerAdministrationClient.GetQueues(); +foreach (Page asPage in jobQueues.AsPages(pageSizeHint: 10)) { - foreach (Models.RouterQueueItem? policy in asPage.Values) + foreach (RouterQueueItem? policy in asPage.Values) { Console.WriteLine($"Listing job queue with id: {policy.Queue.Id}"); } diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/JobQueueCrudAsync.md b/sdk/communication/Azure.Communication.JobRouter/samples/JobQueueCrudAsync.md index ee2a71f42d07..d765bc0a2bfe 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/JobQueueCrudAsync.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/JobQueueCrudAsync.md @@ -4,7 +4,6 @@ ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_UsingStatements using Azure.Communication.JobRouter; -using Azure.Communication.JobRouter.Models; ``` ## Create a client @@ -22,7 +21,7 @@ JobRouterAdministrationClient routerAdministrationClient = new JobRouterAdminist // set `distributionPolicyId` to an existing distribution policy string jobQueueId = "job-queue-id"; -Response jobQueue = await routerAdministrationClient.CreateQueueAsync( +Response jobQueue = await routerAdministrationClient.CreateQueueAsync( options: new CreateQueueOptions(jobQueueId, distributionPolicyId) { Name = "My job queue" @@ -34,7 +33,7 @@ Console.WriteLine($"Job queue successfully create with id: {jobQueue.Value.Id}") ## Get a job queue ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetJobQueue_Async -Response queriedJobQueue = await routerAdministrationClient.GetQueueAsync(jobQueueId); +Response queriedJobQueue = await routerAdministrationClient.GetQueueAsync(jobQueueId); Console.WriteLine($"Successfully fetched queue with id: {queriedJobQueue.Value.Id}"); ``` @@ -42,7 +41,7 @@ Console.WriteLine($"Successfully fetched queue with id: {queriedJobQueue.Value.I ## Get queue statistics ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetJobQueueStat_Async -Response queueStatistics = await routerClient.GetQueueStatisticsAsync(queueId: jobQueueId); +Response queueStatistics = await routerClient.GetQueueStatisticsAsync(jobQueueId); Console.WriteLine($"Queue statistics successfully retrieved for queue: {JsonSerializer.Serialize(queueStatistics.Value)}"); ``` @@ -51,31 +50,20 @@ Console.WriteLine($"Queue statistics successfully retrieved for queue: {JsonSeri ## Update a job queue ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateGetJobQueue_Async -Response updatedJobQueue = await routerAdministrationClient.UpdateQueueAsync( +Response updatedJobQueue = await routerAdministrationClient.UpdateQueueAsync( options: new UpdateQueueOptions(jobQueueId) { Labels = { ["Additional-Queue-Label"] = new LabelValue("ChatQueue") } }); ``` -## Remove from queue - -```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateQueueRemoveProp_Async -Response updatedJobQueueWithoutName = await routerAdministrationClient.UpdateQueueAsync(jobQueueId, - RequestContent.Create(new { Name = (string?)null })); - -Response queriedJobQueueWithoutName = await routerAdministrationClient.GetQueueAsync(jobQueueId); - -Console.WriteLine($"Queue successfully updated: 'Name' has been removed. Status: {string.IsNullOrWhiteSpace(queriedJobQueueWithoutName.Value.Name)}"); -``` - ## List job queues ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetJobQueues_Async -AsyncPageable jobQueues = routerAdministrationClient.GetQueuesAsync(); -await foreach (Page asPage in jobQueues.AsPages(pageSizeHint: 10)) +AsyncPageable jobQueues = routerAdministrationClient.GetQueuesAsync(); +await foreach (Page asPage in jobQueues.AsPages(pageSizeHint: 10)) { - foreach (Models.RouterQueueItem? policy in asPage.Values) + foreach (RouterQueueItem? policy in asPage.Values) { Console.WriteLine($"Listing job queue with id: {policy.Queue.Id}"); } diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/RouterJobCrud.md b/sdk/communication/Azure.Communication.JobRouter/samples/RouterJobCrud.md index ab15e90bc7a1..3f5852ec0a69 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/RouterJobCrud.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/RouterJobCrud.md @@ -4,7 +4,6 @@ ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_UsingStatements using Azure.Communication.JobRouter; -using Azure.Communication.JobRouter.Models; ``` ## Create a client @@ -24,7 +23,7 @@ JobRouterAdministrationClient routerAdministrationClient = new JobRouterAdminist Response distributionPolicy = routerAdministrationClient.CreateDistributionPolicy(new CreateDistributionPolicyOptions("distribution-policy-id", TimeSpan.FromMinutes(5), new LongestIdleMode())); -Response jobQueue = routerAdministrationClient.CreateQueue(new CreateQueueOptions("job-queue-id", distributionPolicy.Value.Id)); +Response jobQueue = routerAdministrationClient.CreateQueue(new CreateQueueOptions("job-queue-id", distributionPolicy.Value.Id)); string jobId = "router-job-id"; @@ -78,7 +77,7 @@ Console.WriteLine($"Successfully retrieved job with id: {queriedJob.Value.Id}"); ## Get a job position ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetRouterJobPosition -Response jobPositionDetails = routerClient.GetQueuePosition(jobId); +Response jobPositionDetails = routerClient.GetQueuePosition(jobId); Console.WriteLine($"Job position for id `{jobPositionDetails.Value.JobId}` successfully retrieved. JobPosition: {jobPositionDetails.Value.Position}"); ``` @@ -96,21 +95,10 @@ Response updatedJob = routerClient.UpdateJob( Console.WriteLine($"Job has been successfully updated. Current value of channelReference: {updatedJob.Value.ChannelReference}"); // "45678" ``` -## Remove from job - -```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateJobRemoveProp -Response updatedJobWithoutChannelReference = routerClient.UpdateJob(jobId, - RequestContent.Create(new { ChannelReference = (string?)null })); - -Response queriedJobWithoutChannelReference = routerClient.GetJob(jobId); - -Console.WriteLine($"Job has been successfully updated. 'ChannelReference' has been removed: {string.IsNullOrWhiteSpace(queriedJobWithoutChannelReference.Value.ChannelReference)}"); -``` - ## Reclassify a job ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_ReclassifyRouterJob -Response reclassifyJob = routerClient.ReclassifyJob(jobWithCpId); +Response reclassifyJob = routerClient.ReclassifyJob(jobWithCpId, CancellationToken.None); ``` ## Accept a job offer @@ -135,7 +123,7 @@ while (routerClient.GetWorker(worker.Value.Id).Value.Offers.All(offer => offer.J Response queriedWorker = routerClient.GetWorker(worker.Value.Id); -Models.RouterJobOffer? issuedOffer = queriedWorker.Value.Offers.First(offer => offer.JobId == jobId); +RouterJobOffer? issuedOffer = queriedWorker.Value.Offers.First(offer => offer.JobId == jobId); Console.WriteLine($"Worker has been successfully issued to worker with offerId: {issuedOffer.OfferId} and offer expiry time: {issuedOffer.ExpiresAt}"); diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/RouterJobCrudAsync.md b/sdk/communication/Azure.Communication.JobRouter/samples/RouterJobCrudAsync.md index c3796b3603d2..f41b4a598778 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/RouterJobCrudAsync.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/RouterJobCrudAsync.md @@ -4,7 +4,6 @@ ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_UsingStatements using Azure.Communication.JobRouter; -using Azure.Communication.JobRouter.Models; ``` ## Create a client @@ -25,7 +24,7 @@ Response distributionPolicy = await routerAdministrationClient.CreateDistributionPolicyAsync(new CreateDistributionPolicyOptions( "distribution-policy-id", TimeSpan.FromMinutes(5), new LongestIdleMode())); -Response jobQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions("job-queue-id", distributionPolicy.Value.Id)); +Response jobQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions("job-queue-id", distributionPolicy.Value.Id)); string jobId = "router-job-id"; @@ -79,7 +78,7 @@ Console.WriteLine($"Successfully retrieved job with id: {queriedJob.Value.Id}"); ## Get a job position ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetRouterJobPosition_Async -Response jobPositionDetails = await routerClient.GetQueuePositionAsync(jobId); +Response jobPositionDetails = await routerClient.GetQueuePositionAsync(jobId); Console.WriteLine($"Job position for id `{jobPositionDetails.Value.JobId}` successfully retrieved. JobPosition: {jobPositionDetails.Value.Position}"); ``` @@ -97,21 +96,10 @@ Response updatedJob = await routerClient.UpdateJobAsync( Console.WriteLine($"Job has been successfully updated. Current value of channelReference: {updatedJob.Value.ChannelReference}"); // "45678" ``` -## Remove from job - -```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateJobRemoveProp_Async -Response updatedJobWithoutChannelReference = await routerClient.UpdateJobAsync(jobId, - RequestContent.Create(new { ChannelReference = (string?)null })); - -Response queriedJobWithoutChannelReference = await routerClient.GetJobAsync(jobId); - -Console.WriteLine($"Job has been successfully updated. 'ChannelReference' has been removed: {string.IsNullOrWhiteSpace(queriedJobWithoutChannelReference.Value.ChannelReference)}"); -``` - ## Reclassify a job ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_ReclassifyRouterJob_Async -Response reclassifyJob = await routerClient.ReclassifyJobAsync(jobWithCpId); +Response reclassifyJob = await routerClient.ReclassifyJobAsync(jobWithCpId, CancellationToken.None); ``` ## Accept a job offer @@ -136,7 +124,7 @@ while ((await routerClient.GetWorkerAsync(worker.Value.Id)).Value.Offers.All(off Response queriedWorker = await routerClient.GetWorkerAsync(worker.Value.Id); -Models.RouterJobOffer? issuedOffer = queriedWorker.Value.Offers.First(offer => offer.JobId == jobId); +RouterJobOffer? issuedOffer = queriedWorker.Value.Offers.First(offer => offer.JobId == jobId); Console.WriteLine($"Worker has been successfully issued to worker with offerId: {issuedOffer.OfferId} and offer expiry time: {issuedOffer.ExpiresAt}"); diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/RouterWorkerCrud.md b/sdk/communication/Azure.Communication.JobRouter/samples/RouterWorkerCrud.md index 98f0d1876ff7..1f5dd8fa7dee 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/RouterWorkerCrud.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/RouterWorkerCrud.md @@ -4,7 +4,6 @@ ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_UsingStatements using Azure.Communication.JobRouter; -using Azure.Communication.JobRouter.Models; ``` ## Create a client @@ -120,10 +119,7 @@ foreach (Page asPage in workers.AsPages(pageSizeHint: 10)) } // Additionally workers can be queried with several filters like queueId, capacity, state etc. -workers = routerClient.GetWorkers(new GetWorkersOptions() -{ - ChannelId = "Voip", State = RouterWorkerStateSelector.All -}); +workers = routerClient.GetWorkers(channelId: "Voip", state: RouterWorkerStateSelector.All); foreach (Page asPage in workers.AsPages(pageSizeHint: 10)) { diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/RouterWorkerCrudAsync.md b/sdk/communication/Azure.Communication.JobRouter/samples/RouterWorkerCrudAsync.md index 34f6abbe19a4..e5701c4e5882 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/RouterWorkerCrudAsync.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/RouterWorkerCrudAsync.md @@ -4,7 +4,6 @@ ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_UsingStatements using Azure.Communication.JobRouter; -using Azure.Communication.JobRouter.Models; ``` ## Create a client @@ -122,10 +121,7 @@ await foreach (Page asPage in workers.AsPages(pageSizeHint: 10 } // Additionally workers can be queried with several filters like queueId, capacity, state etc. -workers = routerClient.GetWorkersAsync(new GetWorkersOptions() -{ - ChannelId = "Voip", State = RouterWorkerStateSelector.All -}); +workers = routerClient.GetWorkersAsync(channelId: "Voip", state: RouterWorkerStateSelector.All); await foreach (Page asPage in workers.AsPages(pageSizeHint: 10)) { diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/Sample1_HelloWorld.md b/sdk/communication/Azure.Communication.JobRouter/samples/Sample1_HelloWorld.md index 3d3d8f257840..a3ed6c6db1b9 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/Sample1_HelloWorld.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/Sample1_HelloWorld.md @@ -4,7 +4,6 @@ ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_UsingStatements using Azure.Communication.JobRouter; -using Azure.Communication.JobRouter.Models; ``` ## Create a client @@ -36,7 +35,7 @@ Response distributionPolicy = routerAdministrationClient.Cre Use `RouterClient` to create a [Queue](https://docs.microsoft.com/azure/communication-services/concepts/router/concepts#queue). ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_CreateQueue -Response queue = routerAdministrationClient.CreateQueue( +Response queue = routerAdministrationClient.CreateQueue( new CreateQueueOptions( queueId: "queue-1", distributionPolicyId: distributionPolicy.Value.Id) @@ -121,7 +120,7 @@ However, we could also wait a few seconds and then query the worker directly aga ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_QueryWorker Response result = routerClient.GetWorker(worker.Value.Id); -foreach (Models.RouterJobOffer? offer in result.Value.Offers) +foreach (RouterJobOffer? offer in result.Value.Offers) { Console.WriteLine($"Worker {worker.Value.Id} has an active offer for job {offer.JobId}"); } @@ -133,7 +132,7 @@ Once a worker receives an offer, it can take two possible actions: accept or dec ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_AcceptOffer // fetching the offer id -Models.RouterJobOffer jobOffer = result.Value.Offers.First(x => x.JobId == job.Value.Id); +RouterJobOffer jobOffer = result.Value.Offers.First(x => x.JobId == job.Value.Id); string offerId = jobOffer.OfferId; // `OfferId` can be retrieved directly from consuming event from Event grid diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/Sample1_HelloWorldAsync.md b/sdk/communication/Azure.Communication.JobRouter/samples/Sample1_HelloWorldAsync.md index f5a8e6656043..bcbecd6c97ad 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/Sample1_HelloWorldAsync.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/Sample1_HelloWorldAsync.md @@ -4,7 +4,6 @@ ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_UsingStatements_Async using Azure.Communication.JobRouter; -using Azure.Communication.JobRouter.Models; ``` ## Create a client @@ -36,7 +35,7 @@ Response distributionPolicy = await routerAdministrationClie Use `RouterClient` to create a [Queue](https://docs.microsoft.com/azure/communication-services/concepts/router/concepts#queue). ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_CreateQueue_Async -Response queue = await routerAdministrationClient.CreateQueueAsync( +Response queue = await routerAdministrationClient.CreateQueueAsync( new CreateQueueOptions( queueId: "queue-1", distributionPolicyId: distributionPolicy.Value.Id) @@ -121,7 +120,7 @@ However, we could also wait a few seconds and then query the worker directly aga ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_QueryWorker_Async Response result = await routerClient.GetWorkerAsync(worker.Value.Id); -foreach (Models.RouterJobOffer? offer in result.Value.Offers) +foreach (RouterJobOffer? offer in result.Value.Offers) { Console.WriteLine($"Worker {worker.Value.Id} has an active offer for job {offer.JobId}"); } @@ -133,7 +132,7 @@ Once a worker receives an offer, it can take two possible actions: accept or dec ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_AcceptOffer_Async // fetching the offer id -Models.RouterJobOffer jobOffer = result.Value.Offers.First(x => x.JobId == job.Value.Id); +RouterJobOffer jobOffer = result.Value.Offers.First(x => x.JobId == job.Value.Id); string offerId = jobOffer.OfferId; // `OfferId` can be retrieved directly from consuming event from Event grid diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/Sample2_ClassificationWithPriorityRuleAsync.md b/sdk/communication/Azure.Communication.JobRouter/samples/Sample2_ClassificationWithPriorityRuleAsync.md index 63f7d96af178..7575b8136295 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/Sample2_ClassificationWithPriorityRuleAsync.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/Sample2_ClassificationWithPriorityRuleAsync.md @@ -4,7 +4,6 @@ ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_UsingStatements using Azure.Communication.JobRouter; -using Azure.Communication.JobRouter.Models; ``` ## Create a client @@ -47,7 +46,7 @@ Console.WriteLine($"Distribution policy successfully created with id: {distribut // Create queue string jobQueueId = "my-default-queue"; -Response jobQueue = +Response jobQueue = await routerAdministration.CreateQueueAsync(new CreateQueueOptions(queueId: jobQueueId, distributionPolicyId: distributionPolicyId)); Console.WriteLine($"Queue has been successfully created with id: {jobQueue.Value.Id}"); @@ -106,7 +105,7 @@ Console.WriteLine($"Distribution policy successfully created with id: {distribut // Create queue string jobQueueId = "my-default-queue"; -Response jobQueue = +Response jobQueue = await routerAdministration.CreateQueueAsync(new CreateQueueOptions(queueId: jobQueueId, distributionPolicyId: distributionPolicyId)); Console.WriteLine($"Queue has been successfully created with id: {jobQueue.Value.Id}"); @@ -218,7 +217,7 @@ Console.WriteLine($"Distribution policy successfully created with id: {distribut // Create queue string jobQueueId = "my-default-queue"; -Response jobQueue = +Response jobQueue = await routerAdministration.CreateQueueAsync(new CreateQueueOptions(queueId: jobQueueId, distributionPolicyId: distributionPolicyId)); Console.WriteLine($"Queue has been successfully created with id: {jobQueue.Value.Id}"); diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/Sample2_ClassificationWithQueueSelectorAsync.md b/sdk/communication/Azure.Communication.JobRouter/samples/Sample2_ClassificationWithQueueSelectorAsync.md index 259c81898f7d..609df62b0c97 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/Sample2_ClassificationWithQueueSelectorAsync.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/Sample2_ClassificationWithQueueSelectorAsync.md @@ -4,7 +4,6 @@ ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_UsingStatements using Azure.Communication.JobRouter; -using Azure.Communication.JobRouter.Models; ``` ## Create a client @@ -39,13 +38,13 @@ Response distributionPolicy = await routerAdministrationClie } ); -Response queue1 = await routerAdministrationClient.CreateQueueAsync( +Response queue1 = await routerAdministrationClient.CreateQueueAsync( new CreateQueueOptions(queueId: "Queue-1", distributionPolicyId: distributionPolicy.Value.Id) { Name = "Queue_365", }); -Response queue2 = await routerAdministrationClient.CreateQueueAsync( +Response queue2 = await routerAdministrationClient.CreateQueueAsync( new CreateQueueOptions(queueId: "Queue-2", distributionPolicyId: distributionPolicy.Value.Id) { Name = "Queue_XBox", @@ -129,7 +128,7 @@ Response distributionPolicy = await routerAdministrationClie } ); -Response queue1 = await routerAdministrationClient.CreateQueueAsync( +Response queue1 = await routerAdministrationClient.CreateQueueAsync( new CreateQueueOptions( queueId: "Queue-1", distributionPolicyId: distributionPolicy.Value.Id) @@ -141,7 +140,7 @@ Response queue1 = await routerAdministrationClient.CreateQue } }); -Response queue2 = await routerAdministrationClient.CreateQueueAsync( +Response queue2 = await routerAdministrationClient.CreateQueueAsync( new CreateQueueOptions( queueId: "Queue-2", distributionPolicyId: distributionPolicy.Value.Id) @@ -246,7 +245,7 @@ Response distributionPolicy = await routerAdministrationClie } ); -Response queue1 = await routerAdministrationClient.CreateQueueAsync( +Response queue1 = await routerAdministrationClient.CreateQueueAsync( new CreateQueueOptions( queueId: "Queue-1", distributionPolicyId: distributionPolicy.Value.Id) @@ -260,7 +259,7 @@ Response queue1 = await routerAdministrationClient.CreateQue }, }); -Response queue2 = await routerAdministrationClient.CreateQueueAsync( +Response queue2 = await routerAdministrationClient.CreateQueueAsync( new CreateQueueOptions( queueId: "Queue-2", distributionPolicyId: distributionPolicy.Value.Id) @@ -274,7 +273,7 @@ Response queue2 = await routerAdministrationClient.CreateQue }, }); -Response queue3 = await routerAdministrationClient.CreateQueueAsync( +Response queue3 = await routerAdministrationClient.CreateQueueAsync( new CreateQueueOptions( queueId: "Queue-3", distributionPolicyId: distributionPolicy.Value.Id) diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/Sample2_ClassificationWithWorkerSelectorAsync.md b/sdk/communication/Azure.Communication.JobRouter/samples/Sample2_ClassificationWithWorkerSelectorAsync.md index ecea5bb37541..ac5056d74c4f 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/Sample2_ClassificationWithWorkerSelectorAsync.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/Sample2_ClassificationWithWorkerSelectorAsync.md @@ -4,7 +4,6 @@ ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_UsingStatements using Azure.Communication.JobRouter; -using Azure.Communication.JobRouter.Models; ``` ## Create a client @@ -51,7 +50,7 @@ Response distributionPolicy = await routerAdministrationClie ); string queueId = "Queue-1"; -Response queue1 = await routerAdministrationClient.CreateQueueAsync( +Response queue1 = await routerAdministrationClient.CreateQueueAsync( new CreateQueueOptions(queueId: queueId, distributionPolicyId: distributionPolicy.Value.Id) { Name = "Queue_365", @@ -165,7 +164,7 @@ Response distributionPolicy = await routerAdministrationClie ); string queueId = "Queue-1"; -Response queue1 = await routerAdministrationClient.CreateQueueAsync( +Response queue1 = await routerAdministrationClient.CreateQueueAsync( new CreateQueueOptions(queueId: queueId, distributionPolicyId: distributionPolicy.Value.Id) { Name = "Queue_365", @@ -292,7 +291,7 @@ Response distributionPolicy = await routerAdministrationClie ); string queueId = "Queue-1"; -Response queue1 = await routerAdministrationClient.CreateQueueAsync( +Response queue1 = await routerAdministrationClient.CreateQueueAsync( new CreateQueueOptions( queueId: queueId, distributionPolicyId: distributionPolicy.Value.Id) diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/Sample3_AdvancedDistributionAsync.md b/sdk/communication/Azure.Communication.JobRouter/samples/Sample3_AdvancedDistributionAsync.md index 24b2b4640cfd..e42980a7ba23 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/Sample3_AdvancedDistributionAsync.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/Sample3_AdvancedDistributionAsync.md @@ -4,7 +4,6 @@ ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_UsingStatements using Azure.Communication.JobRouter; -using Azure.Communication.JobRouter.Models; ``` ## Create a client @@ -32,7 +31,7 @@ Response distributionPolicy = await routerAdministrationClie // Create job queue string jobQueueId = "job-queue-id-2"; -Response jobQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions( +Response jobQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions( queueId: jobQueueId, distributionPolicyId: distributionPolicyId)); @@ -259,7 +258,7 @@ Response distributionPolicy = await routerAdministrationClie // Create job queue string queueId = "job-queue-id-1"; -Response jobQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions( +Response jobQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions( queueId: queueId, distributionPolicyId: distributionPolicyId)); diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/Sample3_SimpleDistributionAsync.md b/sdk/communication/Azure.Communication.JobRouter/samples/Sample3_SimpleDistributionAsync.md index d72c5ff52f29..ad9d9c4b93d2 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/Sample3_SimpleDistributionAsync.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/Sample3_SimpleDistributionAsync.md @@ -4,7 +4,6 @@ ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_UsingStatements using Azure.Communication.JobRouter; -using Azure.Communication.JobRouter.Models; ``` ## Create a client @@ -38,7 +37,7 @@ Response distributionPolicy = await routerAdministrationClie // Create queue string queueId = "queue-id-1"; -Response jobQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions( +Response jobQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions( queueId: queueId, distributionPolicyId: distributionPolicyId)); @@ -108,7 +107,7 @@ Response distributionPolicy = await routerAdministrationClie // Create queue string queueId = "queue-id-1"; -Response jobQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions(queueId: queueId, distributionPolicyId: distributionPolicyId)); +Response jobQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions(queueId: queueId, distributionPolicyId: distributionPolicyId)); // Setting up 2 identical workers string worker1Id = "worker-id-1"; @@ -181,7 +180,7 @@ Response distributionPolicy = await routerAdministrationClie // Create queue string queueId = "queue-id-1"; -Response jobQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions( +Response jobQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions( queueId: queueId, distributionPolicyId: distributionPolicyId)); @@ -296,7 +295,7 @@ Response distributionPolicy = // Create queue string queueId = "queue-id-1"; -Response jobQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions( +Response jobQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions( queueId: queueId, distributionPolicyId: distributionPolicyId)); diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/Sample4_QueueLengthExceptionTriggerAsync.md b/sdk/communication/Azure.Communication.JobRouter/samples/Sample4_QueueLengthExceptionTriggerAsync.md index c47ad3063845..ea867b45782d 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/Sample4_QueueLengthExceptionTriggerAsync.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/Sample4_QueueLengthExceptionTriggerAsync.md @@ -4,7 +4,6 @@ ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_UsingStatements using Azure.Communication.JobRouter; -using Azure.Communication.JobRouter.Models; ``` ## Create a client @@ -43,7 +42,7 @@ Response distributionPolicy = await routerAdministrationClie // create backup queue string backupJobQueueId = "job-queue-2"; -Response backupJobQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions( +Response backupJobQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions( queueId: backupJobQueueId, distributionPolicyId: distributionPolicyId)); @@ -80,7 +79,7 @@ Response exceptionPolicy = await routerAdministrationClient.Cre string activeJobQueueId = "active-job-queue"; -Response activeJobQueue = await routerAdministrationClient.CreateQueueAsync( +Response activeJobQueue = await routerAdministrationClient.CreateQueueAsync( options: new CreateQueueOptions(queueId: activeJobQueueId, distributionPolicyId: distributionPolicyId) { ExceptionPolicyId = exceptionPolicyId }); // create 10 jobs to fill in primary queue diff --git a/sdk/communication/Azure.Communication.JobRouter/samples/Sample4_WaitTimeExceptionAsync.md b/sdk/communication/Azure.Communication.JobRouter/samples/Sample4_WaitTimeExceptionAsync.md index be6056140cbb..cc9f4601be7c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/samples/Sample4_WaitTimeExceptionAsync.md +++ b/sdk/communication/Azure.Communication.JobRouter/samples/Sample4_WaitTimeExceptionAsync.md @@ -4,7 +4,6 @@ ```C# Snippet:Azure_Communication_JobRouter_Tests_Samples_UsingStatements using Azure.Communication.JobRouter; -using Azure.Communication.JobRouter.Models; ``` ## Create a client @@ -39,7 +38,7 @@ Response distributionPolicy = await routerAdministrationClie // Create fallback queue string fallbackQueueId = "fallback-q-id"; -Response fallbackQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions( +Response fallbackQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions( queueId: fallbackQueueId, distributionPolicyId: distributionPolicyId)); @@ -70,7 +69,7 @@ Response exceptionPolicy = await routerAdministrationClient.Cre // Create initial queue string jobQueueId = "job-queue-id"; -Response jobQueue = await routerAdministrationClient.CreateQueueAsync( +Response jobQueue = await routerAdministrationClient.CreateQueueAsync( options: new CreateQueueOptions( queueId: jobQueueId, distributionPolicyId: distributionPolicyId) 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 73% 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 a5ee0a0c7bd1..54912358412e 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,8 +6,9 @@ #nullable disable using System.Text.Json; +using Azure; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { public partial class AcceptJobOfferResult { @@ -40,5 +41,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 89% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/AcceptJobOfferResult.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/AcceptJobOfferResult.cs index 04b884341c6f..7040e62fb768 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/AcceptJobOfferResult.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/AcceptJobOfferResult.cs @@ -8,9 +8,12 @@ using System; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { - /// 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/Models/BestWorkerMode.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/BestWorkerMode.Serialization.cs similarity index 66% 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 adc65b52b795..50c3a0421747 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,13 @@ #nullable disable using System.Text.Json; -using Azure.Communication.JobRouter.Models; +using Azure; 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) @@ -75,7 +42,7 @@ internal static BestWorkerMode DeserializeBestWorkerMode(JsonElement element) { continue; } - scoringRuleOptions = Models.ScoringRuleOptions.DeserializeScoringRuleOptions(property.Value); + scoringRuleOptions = ScoringRuleOptions.DeserializeScoringRuleOptions(property.Value); continue; } if (property.NameEquals("kind"u8)) @@ -113,5 +80,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/BestWorkerMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/BestWorkerMode.cs new file mode 100644 index 000000000000..ed62c9500a1a --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/BestWorkerMode.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.JobRouter +{ + /// Jobs are distributed to the worker with the strongest abilities available. + public partial class BestWorkerMode : DistributionMode + { + /// Initializes a new instance of BestWorkerMode. + /// 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 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 + /// + internal BestWorkerMode(string kind, int minConcurrentOffers, int maxConcurrentOffers, bool? bypassSelectors, RouterRule scoringRule, ScoringRuleOptions scoringRuleOptions) : base(kind, minConcurrentOffers, maxConcurrentOffers, bypassSelectors) + { + ScoringRule = scoringRule; + ScoringRuleOptions = scoringRuleOptions; + } + + /// + /// 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 ScoringRule { get; } + /// + /// Encapsulates all options that can be passed as parameters for scoring rule with + /// BestWorkerMode + /// + public ScoringRuleOptions ScoringRuleOptions { get; } + } +} 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 44edd3617395..52491f6438e6 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 000000000000..263b0bd975bf --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelExceptionAction.cs @@ -0,0 +1,35 @@ +// 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; + } + } +} 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 68% 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 d9e66366ab15..51d188a8cbc5 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelJobRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CancelJobRequest.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.Communication.JobRouter { - internal partial class CancelJobRequest : IUtf8JsonSerializable + public partial class CancelJobRequest : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -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 000000000000..c3adddfa4d4b --- /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. + public 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 0f005a0aad59..f6b0c5890eb5 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 55% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ChannelConfiguration.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ChannelConfiguration.cs index 37e35196027f..06086cb90081 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,10 @@ 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 maximum number of jobs that can be supported concurrently for this channel. - public int? MaxNumberOfJobs { 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; } } } 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 a9daab64bb03..293451a564c5 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 000000000000..5ebe1877a881 --- /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 64% 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 45d3876403fa..f539b800dd54 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,9 +6,9 @@ #nullable disable using System.Text.Json; -using Azure.Core; +using Azure; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { public partial class ClassificationPolicyItem { @@ -18,16 +18,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 +33,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 71% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyItem.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ClassificationPolicyItem.cs index 53d52d7f8dc0..bddd0fd08eb9 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,23 @@ #nullable disable -namespace Azure.Communication.JobRouter.Models +using System; +using Azure.Core; + +namespace Azure.Communication.JobRouter { /// 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 74% 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 6b151616a3f0..a4e2db01ac01 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CloseJobRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CloseJobRequest.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.Communication.JobRouter { - internal partial class CloseJobRequest : IUtf8JsonSerializable + public partial class CloseJobRequest : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -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 000000000000..74680e2863d0 --- /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. + public 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 000000000000..1351535df783 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterClientBuilderExtensions.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Communication.JobRouter; +using Azure.Core.Extensions; + +namespace Microsoft.Extensions.Azure +{ + /// Extension methods to add , to client builder. + public static partial class CommunicationJobRouterClientBuilderExtensions + { + /// Registers a instance. + /// The builder to register with. + /// The Uri to use. + public static IAzureClientBuilder AddJobRouterAdministrationClient(this TBuilder builder, Uri endpoint) + where TBuilder : IAzureClientFactoryBuilder + { + return builder.RegisterClientFactory((options) => new JobRouterAdministrationClient(endpoint, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// The Uri to use. + public static IAzureClientBuilder AddJobRouterClient(this TBuilder builder, Uri endpoint) + where TBuilder : IAzureClientFactoryBuilder + { + return builder.RegisterClientFactory((options) => new JobRouterClient(endpoint, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// The configuration values. + public static IAzureClientBuilder AddJobRouterAdministrationClient(this TBuilder builder, TConfiguration configuration) + where TBuilder : IAzureClientFactoryBuilderWithConfiguration + { + return builder.RegisterClientFactory(configuration); + } + /// Registers a instance. + /// The builder to register with. + /// The configuration values. + public static IAzureClientBuilder AddJobRouterClient(this TBuilder builder, TConfiguration configuration) + where TBuilder : IAzureClientFactoryBuilderWithConfiguration + { + return builder.RegisterClientFactory(configuration); + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterModelFactory.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterModelFactory.cs index fdde257d0563..929978e9cebb 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterModelFactory.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterModelFactory.cs @@ -7,29 +7,357 @@ using System; using System.Collections.Generic; +using System.Linq; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { /// Model factory for models. public static partial class CommunicationJobRouterModelFactory { + /// 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 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 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 = default) + { + return new ScheduleAndSuspendMode("schedule-and-suspend", 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. /// is null. - /// A new instance for mocking. + /// A new instance for mocking. public static UnassignJobResult UnassignJobResult(string jobId = null, int unassignmentCount = default) { if (jobId == null) @@ -45,7 +373,7 @@ public static UnassignJobResult UnassignJobResult(string jobId = null, int unass /// The Id of the job assigned. /// The Id of the worker that has been assigned this job. /// , or is null. - /// A new instance for mocking. + /// A new instance for mocking. public static AcceptJobOfferResult AcceptJobOfferResult(string assignmentId = null, string jobId = null, string workerId = null) { if (assignmentId == null) @@ -67,9 +395,12 @@ 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. + /// A new instance for mocking. public static RouterQueueStatistics RouterQueueStatistics(string queueId = null, int length = default, IReadOnlyDictionary estimatedWaitTimeMinutes = null, double? longestJobWaitTimeMinutes = null) { estimatedWaitTimeMinutes ??= new Dictionary(); @@ -77,13 +408,25 @@ 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. /// The capacity cost consumed by the job offer. /// The time the offer was created in UTC. /// The time that the offer will expire in UTC. - /// A new instance for mocking. + /// A new instance for mocking. public static RouterJobOffer RouterJobOffer(string offerId = null, string jobId = null, int capacityCost = default, DateTimeOffset? offeredAt = null, DateTimeOffset? expiresAt = null) { return new RouterJobOffer(offerId, jobId, capacityCost, offeredAt, expiresAt); @@ -95,7 +438,7 @@ public static RouterJobOffer RouterJobOffer(string offerId = null, string jobId /// The amount of capacity this assignment has consumed on the worker. /// The assignment time of the job in UTC. /// or is null. - /// A new instance for mocking. + /// A new instance for mocking. public static RouterWorkerAssignment RouterWorkerAssignment(string assignmentId = null, string jobId = null, int capacityCost = default, DateTimeOffset assignedAt = default) { if (assignmentId == null) 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 65% 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 f3b60b47d21a..16737f117b9b 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CompleteJobRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CompleteJobRequest.Serialization.cs @@ -10,7 +10,7 @@ namespace Azure.Communication.JobRouter { - internal partial class CompleteJobRequest : IUtf8JsonSerializable + public partial class CompleteJobRequest : IUtf8JsonSerializable { void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { @@ -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 56% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CompleteJobRequest.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/CompleteJobRequest.cs index 5ccc3b36b8b7..f45bde2d3974 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CompleteJobRequest.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CompleteJobRequest.cs @@ -11,7 +11,7 @@ namespace Azure.Communication.JobRouter { /// Request payload for completing jobs. - internal partial class CompleteJobRequest + public partial class CompleteJobRequest { /// Initializes a new instance of CompleteJobRequest. /// The assignment within the job to complete. @@ -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 68% 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 72d1abc86558..25817661672d 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,12 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; 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 +20,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 +47,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 000000000000..3518611c8b82 --- /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 68% 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 6feaaba94f2c..7a669af53141 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,12 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; 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 +20,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 +47,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 000000000000..a3051bde4479 --- /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 000000000000..924c7e0303b7 --- /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 69% 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 e865afcce73e..ebf36a41bf6a 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DeclineJobOfferRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DeclineJobOfferRequest.Serialization.cs @@ -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 000000000000..48b0facbed18 --- /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. + public 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 64% 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 daef8caee0d2..f732686b0ccc 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,12 @@ #nullable disable using System.Text.Json; -using Azure.Core; +using Azure; 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 +29,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 61% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DirectMapRouterRule.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/DirectMapRouterRule.cs index 353584682545..c884c50eaa4a 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,9 @@ namespace Azure.Communication.JobRouter public partial class DirectMapRouterRule : RouterRule { /// Initializes a new instance of DirectMapRouterRule. - public 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 f393cfc3ad71..0b8916b71436 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 66% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionMode.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionMode.cs index 6267ec74677f..94f9538c018b 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,7 @@ 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. - /// By default, set to false. - /// - public bool? BypassSelectors { get; set; } } } 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 63% 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 c1e9ce5b1a94..f2fd9c7ccd9d 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,20 @@ #nullable disable 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 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 +54,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 56% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicy.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicy.cs index db3ac9175cdb..add1cb5bcc15 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicy.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicy.cs @@ -5,9 +5,7 @@ #nullable disable -using Azure.Communication.JobRouter; - -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { /// Policy governing how jobs are distributed to workers. public partial class DistributionPolicy @@ -15,12 +13,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 64% 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 0a2b5a4f8eda..cda8b479e4f8 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,9 +6,9 @@ #nullable disable using System.Text.Json; -using Azure.Core; +using Azure; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { public partial class DistributionPolicyItem { @@ -18,16 +18,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 +33,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 71% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyItem.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/DistributionPolicyItem.cs index bb862e636db2..2a48b6536009 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 -namespace Azure.Communication.JobRouter.Models +using System; +using Azure.Core; + +namespace Azure.Communication.JobRouter { /// 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/JobRouterAdministrationClient.xml b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Docs/JobRouterAdministrationClient.xml new file mode 100644 index 000000000000..bf8289c6776b --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Docs/JobRouterAdministrationClient.xml @@ -0,0 +1,949 @@ + + + + + +This sample shows how to call GetDistributionPolicyAsync. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = await client.GetDistributionPolicyAsync(""); +]]> +This sample shows how to call GetDistributionPolicyAsync with all parameters. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = await client.GetDistributionPolicyAsync(""); +]]> + + + +This sample shows how to call GetDistributionPolicy. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = client.GetDistributionPolicy(""); +]]> +This sample shows how to call GetDistributionPolicy with all parameters. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = client.GetDistributionPolicy(""); +]]> + + + +This sample shows how to call GetDistributionPolicyAsync and parse the result. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = await client.GetDistributionPolicyAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call GetDistributionPolicyAsync with all parameters and parse the result. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = await client.GetDistributionPolicyAsync("", 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 GetDistributionPolicy and parse the result. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = client.GetDistributionPolicy("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call GetDistributionPolicy with all parameters and parse the result. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = client.GetDistributionPolicy("", 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 DeleteDistributionPolicyAsync. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = await client.DeleteDistributionPolicyAsync(""); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call DeleteDistributionPolicyAsync with all parameters. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = await client.DeleteDistributionPolicyAsync(""); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call DeleteDistributionPolicy. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = client.DeleteDistributionPolicy(""); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call DeleteDistributionPolicy with all parameters. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = client.DeleteDistributionPolicy(""); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call GetClassificationPolicyAsync. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = await client.GetClassificationPolicyAsync(""); +]]> +This sample shows how to call GetClassificationPolicyAsync with all parameters. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = await client.GetClassificationPolicyAsync(""); +]]> + + + +This sample shows how to call GetClassificationPolicy. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = client.GetClassificationPolicy(""); +]]> +This sample shows how to call GetClassificationPolicy with all parameters. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = client.GetClassificationPolicy(""); +]]> + + + +This sample shows how to call GetClassificationPolicyAsync and parse the result. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = await client.GetClassificationPolicyAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call GetClassificationPolicyAsync with all parameters and parse the result. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = await client.GetClassificationPolicyAsync("", 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 GetClassificationPolicy and parse the result. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = client.GetClassificationPolicy("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call GetClassificationPolicy with all parameters and parse the result. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = client.GetClassificationPolicy("", 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 DeleteClassificationPolicyAsync. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = await client.DeleteClassificationPolicyAsync(""); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call DeleteClassificationPolicyAsync with all parameters. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = await client.DeleteClassificationPolicyAsync(""); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call DeleteClassificationPolicy. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = client.DeleteClassificationPolicy(""); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call DeleteClassificationPolicy with all parameters. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = client.DeleteClassificationPolicy(""); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call GetExceptionPolicyAsync. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = await client.GetExceptionPolicyAsync(""); +]]> +This sample shows how to call GetExceptionPolicyAsync with all parameters. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = await client.GetExceptionPolicyAsync(""); +]]> + + + +This sample shows how to call GetExceptionPolicy. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = client.GetExceptionPolicy(""); +]]> +This sample shows how to call GetExceptionPolicy with all parameters. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = client.GetExceptionPolicy(""); +]]> + + + +This sample shows how to call GetExceptionPolicyAsync and parse the result. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = await client.GetExceptionPolicyAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call GetExceptionPolicyAsync with all parameters and parse the result. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = await client.GetExceptionPolicyAsync("", 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 GetExceptionPolicy and parse the result. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = client.GetExceptionPolicy("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call GetExceptionPolicy with all parameters and parse the result. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = client.GetExceptionPolicy("", 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 DeleteExceptionPolicyAsync. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = await client.DeleteExceptionPolicyAsync(""); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call DeleteExceptionPolicyAsync with all parameters. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = await client.DeleteExceptionPolicyAsync(""); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call DeleteExceptionPolicy. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = client.DeleteExceptionPolicy(""); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call DeleteExceptionPolicy with all parameters. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = client.DeleteExceptionPolicy(""); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call GetQueueAsync. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = await client.GetQueueAsync(""); +]]> +This sample shows how to call GetQueueAsync with all parameters. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = await client.GetQueueAsync(""); +]]> + + + +This sample shows how to call GetQueue. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = client.GetQueue(""); +]]> +This sample shows how to call GetQueue with all parameters. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = client.GetQueue(""); +]]> + + + +This sample shows how to call GetQueueAsync and parse the result. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = await client.GetQueueAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call GetQueueAsync with all parameters and parse the result. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = await client.GetQueueAsync("", 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 GetQueue and parse the result. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = client.GetQueue("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call GetQueue with all parameters and parse the result. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = client.GetQueue("", 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 DeleteQueueAsync. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = await client.DeleteQueueAsync(""); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call DeleteQueueAsync with all parameters. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = await client.DeleteQueueAsync(""); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call DeleteQueue. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = client.DeleteQueue(""); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call DeleteQueue with all parameters. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +Response response = client.DeleteQueue(""); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call GetDistributionPoliciesAsync. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +await foreach (DistributionPolicyItem item in client.GetDistributionPoliciesAsync()) +{ +} +]]> +This sample shows how to call GetDistributionPoliciesAsync with all parameters. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +await foreach (DistributionPolicyItem item in client.GetDistributionPoliciesAsync(maxpagesize: 1234)) +{ +} +]]> + + + +This sample shows how to call GetDistributionPolicies. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +foreach (DistributionPolicyItem item in client.GetDistributionPolicies()) +{ +} +]]> +This sample shows how to call GetDistributionPolicies with all parameters. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +foreach (DistributionPolicyItem item in client.GetDistributionPolicies(maxpagesize: 1234)) +{ +} +]]> + + + +This sample shows how to call GetDistributionPoliciesAsync and parse the result. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +await foreach (BinaryData item in client.GetDistributionPoliciesAsync(null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); +} +]]> +This sample shows how to call GetDistributionPoliciesAsync with all parameters and parse the result. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +await foreach (BinaryData item in client.GetDistributionPoliciesAsync(1234, null)) +{ + 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 and parse the result. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +foreach (BinaryData item in client.GetDistributionPolicies(null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); +} +]]> +This sample shows how to call GetDistributionPolicies with all parameters and parse the result. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +foreach (BinaryData item in client.GetDistributionPolicies(1234, null)) +{ + 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. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +await foreach (ClassificationPolicyItem item in client.GetClassificationPoliciesAsync()) +{ +} +]]> +This sample shows how to call GetClassificationPoliciesAsync with all parameters. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +await foreach (ClassificationPolicyItem item in client.GetClassificationPoliciesAsync(maxpagesize: 1234)) +{ +} +]]> + + + +This sample shows how to call GetClassificationPolicies. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +foreach (ClassificationPolicyItem item in client.GetClassificationPolicies()) +{ +} +]]> +This sample shows how to call GetClassificationPolicies with all parameters. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +foreach (ClassificationPolicyItem item in client.GetClassificationPolicies(maxpagesize: 1234)) +{ +} +]]> + + + +This sample shows how to call GetClassificationPoliciesAsync and parse the result. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +await foreach (BinaryData item in client.GetClassificationPoliciesAsync(null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); +} +]]> +This sample shows how to call GetClassificationPoliciesAsync with all parameters and parse the result. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +await foreach (BinaryData item in client.GetClassificationPoliciesAsync(1234, null)) +{ + 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 and parse the result. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +foreach (BinaryData item in client.GetClassificationPolicies(null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); +} +]]> +This sample shows how to call GetClassificationPolicies with all parameters and parse the result. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +foreach (BinaryData item in client.GetClassificationPolicies(1234, null)) +{ + 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. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +await foreach (ExceptionPolicyItem item in client.GetExceptionPoliciesAsync()) +{ +} +]]> +This sample shows how to call GetExceptionPoliciesAsync with all parameters. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +await foreach (ExceptionPolicyItem item in client.GetExceptionPoliciesAsync(maxpagesize: 1234)) +{ +} +]]> + + + +This sample shows how to call GetExceptionPolicies. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +foreach (ExceptionPolicyItem item in client.GetExceptionPolicies()) +{ +} +]]> +This sample shows how to call GetExceptionPolicies with all parameters. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +foreach (ExceptionPolicyItem item in client.GetExceptionPolicies(maxpagesize: 1234)) +{ +} +]]> + + + +This sample shows how to call GetExceptionPoliciesAsync and parse the result. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +await foreach (BinaryData item in client.GetExceptionPoliciesAsync(null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); +} +]]> +This sample shows how to call GetExceptionPoliciesAsync with all parameters and parse the result. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +await foreach (BinaryData item in client.GetExceptionPoliciesAsync(1234, null)) +{ + 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 and parse the result. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +foreach (BinaryData item in client.GetExceptionPolicies(null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); +} +]]> +This sample shows how to call GetExceptionPolicies with all parameters and parse the result. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +foreach (BinaryData item in client.GetExceptionPolicies(1234, null)) +{ + 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. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +await foreach (RouterQueueItem item in client.GetQueuesAsync()) +{ +} +]]> +This sample shows how to call GetQueuesAsync with all parameters. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +await foreach (RouterQueueItem item in client.GetQueuesAsync(maxpagesize: 1234)) +{ +} +]]> + + + +This sample shows how to call GetQueues. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +foreach (RouterQueueItem item in client.GetQueues()) +{ +} +]]> +This sample shows how to call GetQueues with all parameters. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +foreach (RouterQueueItem item in client.GetQueues(maxpagesize: 1234)) +{ +} +]]> + + + +This sample shows how to call GetQueuesAsync and parse the result. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +await foreach (BinaryData item in client.GetQueuesAsync(null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("queue").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); +} +]]> +This sample shows how to call GetQueuesAsync with all parameters and parse the result. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +await foreach (BinaryData item in client.GetQueuesAsync(1234, null)) +{ + 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 and parse the result. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +foreach (BinaryData item in client.GetQueues(null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("queue").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); +} +]]> +This sample shows how to call GetQueues with all parameters and parse the result. +"); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + +foreach (BinaryData item in client.GetQueues(1234, null)) +{ + 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/JobRouterClient.xml b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Docs/JobRouterClient.xml new file mode 100644 index 000000000000..bd02e68a9c34 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Docs/JobRouterClient.xml @@ -0,0 +1,1423 @@ + + + + + +This sample shows how to call GetJobAsync. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = await client.GetJobAsync(""); +]]> +This sample shows how to call GetJobAsync with all parameters. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = await client.GetJobAsync(""); +]]> + + + +This sample shows how to call GetJob. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = client.GetJob(""); +]]> +This sample shows how to call GetJob with all parameters. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = client.GetJob(""); +]]> + + + +This sample shows how to call GetJobAsync and parse the result. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = await client.GetJobAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call GetJobAsync with all parameters and parse the result. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = await client.GetJobAsync("", 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("kind").ToString()); +]]> + + + +This sample shows how to call GetJob and parse the result. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = client.GetJob("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call GetJob with all parameters and parse the result. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = client.GetJob("", 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("kind").ToString()); +]]> + + + +This sample shows how to call DeleteJobAsync. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = await client.DeleteJobAsync(""); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call DeleteJobAsync with all parameters. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = await client.DeleteJobAsync(""); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call DeleteJob. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = client.DeleteJob(""); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call DeleteJob with all parameters. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = client.DeleteJob(""); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call CancelJobAsync. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = await client.CancelJobAsync(""); +]]> +This sample shows how to call CancelJobAsync with all parameters. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +CancelJobRequest cancelJobRequest = new CancelJobRequest +{ + Note = "", + DispositionCode = "", +}; +Response response = await client.CancelJobAsync("", cancelJobRequest: cancelJobRequest); +]]> + + + +This sample shows how to call CancelJob. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = client.CancelJob(""); +]]> +This sample shows how to call CancelJob with all parameters. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +CancelJobRequest cancelJobRequest = new CancelJobRequest +{ + Note = "", + DispositionCode = "", +}; +Response response = client.CancelJob("", cancelJobRequest: cancelJobRequest); +]]> + + + +This sample shows how to call CancelJobAsync. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +using RequestContent content = null; +Response response = await client.CancelJobAsync("", content); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call CancelJobAsync with all parameters and request content. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +using RequestContent content = RequestContent.Create(new +{ + note = "", + dispositionCode = "", +}); +Response response = await client.CancelJobAsync("", content); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call CancelJob. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +using RequestContent content = null; +Response response = client.CancelJob("", content); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call CancelJob with all parameters and request content. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +using RequestContent content = RequestContent.Create(new +{ + note = "", + dispositionCode = "", +}); +Response response = client.CancelJob("", content); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call CompleteJobAsync. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +CompleteJobRequest completeJobRequest = new CompleteJobRequest(""); +Response response = await client.CompleteJobAsync("", completeJobRequest); +]]> +This sample shows how to call CompleteJobAsync with all parameters. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +CompleteJobRequest completeJobRequest = new CompleteJobRequest("") +{ + Note = "", +}; +Response response = await client.CompleteJobAsync("", completeJobRequest); +]]> + + + +This sample shows how to call CompleteJob. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +CompleteJobRequest completeJobRequest = new CompleteJobRequest(""); +Response response = client.CompleteJob("", completeJobRequest); +]]> +This sample shows how to call CompleteJob with all parameters. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +CompleteJobRequest completeJobRequest = new CompleteJobRequest("") +{ + Note = "", +}; +Response response = client.CompleteJob("", completeJobRequest); +]]> + + + +This sample shows how to call CompleteJobAsync. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +using RequestContent content = RequestContent.Create(new +{ + assignmentId = "", +}); +Response response = await client.CompleteJobAsync("", content); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call CompleteJobAsync with all parameters and request content. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +using RequestContent content = RequestContent.Create(new +{ + assignmentId = "", + note = "", +}); +Response response = await client.CompleteJobAsync("", content); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call CompleteJob. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +using RequestContent content = RequestContent.Create(new +{ + assignmentId = "", +}); +Response response = client.CompleteJob("", content); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call CompleteJob with all parameters and request content. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +using RequestContent content = RequestContent.Create(new +{ + assignmentId = "", + note = "", +}); +Response response = client.CompleteJob("", content); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call CloseJobAsync. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +CloseJobRequest closeJobRequest = new CloseJobRequest(""); +Response response = await client.CloseJobAsync("", closeJobRequest); +]]> +This sample shows how to call CloseJobAsync with all parameters. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +CloseJobRequest closeJobRequest = new CloseJobRequest("") +{ + DispositionCode = "", + CloseAt = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + Note = "", +}; +Response response = await client.CloseJobAsync("", closeJobRequest); +]]> + + + +This sample shows how to call CloseJob. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +CloseJobRequest closeJobRequest = new CloseJobRequest(""); +Response response = client.CloseJob("", closeJobRequest); +]]> +This sample shows how to call CloseJob with all parameters. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +CloseJobRequest closeJobRequest = new CloseJobRequest("") +{ + DispositionCode = "", + CloseAt = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + Note = "", +}; +Response response = client.CloseJob("", closeJobRequest); +]]> + + + +This sample shows how to call CloseJobAsync. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +using RequestContent content = RequestContent.Create(new +{ + assignmentId = "", +}); +Response response = await client.CloseJobAsync("", content); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call CloseJobAsync with all parameters and request content. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +using RequestContent content = RequestContent.Create(new +{ + assignmentId = "", + dispositionCode = "", + closeAt = "2022-05-10T14:57:31.2311892-04:00", + note = "", +}); +Response response = await client.CloseJobAsync("", content); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call CloseJob. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +using RequestContent content = RequestContent.Create(new +{ + assignmentId = "", +}); +Response response = client.CloseJob("", content); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call CloseJob with all parameters and request content. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +using RequestContent content = RequestContent.Create(new +{ + assignmentId = "", + dispositionCode = "", + closeAt = "2022-05-10T14:57:31.2311892-04:00", + note = "", +}); +Response response = client.CloseJob("", content); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call GetQueuePositionAsync. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = await client.GetQueuePositionAsync(""); +]]> +This sample shows how to call GetQueuePositionAsync with all parameters. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = await client.GetQueuePositionAsync(""); +]]> + + + +This sample shows how to call GetQueuePosition. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = client.GetQueuePosition(""); +]]> +This sample shows how to call GetQueuePosition with all parameters. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = client.GetQueuePosition(""); +]]> + + + +This sample shows how to call GetQueuePositionAsync and parse the result. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = await client.GetQueuePositionAsync("", null); + +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 GetQueuePositionAsync with all parameters and parse the result. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = await client.GetQueuePositionAsync("", null); + +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 and parse the result. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = client.GetQueuePosition("", null); + +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 all parameters and parse the result. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = client.GetQueuePosition("", null); + +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. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = await client.UnassignJobAsync("", ""); +]]> +This sample shows how to call UnassignJobAsync with all parameters. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +UnassignJobRequest unassignJobRequest = new UnassignJobRequest +{ + SuspendMatching = true, +}; +Response response = await client.UnassignJobAsync("", "", unassignJobRequest: unassignJobRequest); +]]> + + + +This sample shows how to call UnassignJob. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = client.UnassignJob("", ""); +]]> +This sample shows how to call UnassignJob with all parameters. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +UnassignJobRequest unassignJobRequest = new UnassignJobRequest +{ + SuspendMatching = true, +}; +Response response = client.UnassignJob("", "", unassignJobRequest: unassignJobRequest); +]]> + + + +This sample shows how to call UnassignJobAsync and parse the result. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +using RequestContent content = null; +Response response = await client.UnassignJobAsync("", "", content); + +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 parse the result. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +using RequestContent content = RequestContent.Create(new +{ + suspendMatching = true, +}); +Response response = await client.UnassignJobAsync("", "", content); + +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 and parse the result. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +using RequestContent content = null; +Response response = client.UnassignJob("", "", content); + +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 parse the result. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +using RequestContent content = RequestContent.Create(new +{ + suspendMatching = true, +}); +Response response = client.UnassignJob("", "", content); + +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 AcceptJobOfferAsync. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = await client.AcceptJobOfferAsync("", ""); +]]> +This sample shows how to call AcceptJobOfferAsync with all parameters. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = await client.AcceptJobOfferAsync("", ""); +]]> + + + +This sample shows how to call AcceptJobOffer. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = client.AcceptJobOffer("", ""); +]]> +This sample shows how to call AcceptJobOffer with all parameters. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = client.AcceptJobOffer("", ""); +]]> + + + +This sample shows how to call AcceptJobOfferAsync and parse the result. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = await client.AcceptJobOfferAsync("", "", null); + +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 AcceptJobOfferAsync with all parameters and parse the result. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = await client.AcceptJobOfferAsync("", "", null); + +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 AcceptJobOffer and parse the result. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = client.AcceptJobOffer("", "", null); + +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 AcceptJobOffer with all parameters and parse the result. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = client.AcceptJobOffer("", "", null); + +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 DeclineJobOfferAsync. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = await client.DeclineJobOfferAsync("", ""); +]]> +This sample shows how to call DeclineJobOfferAsync with all parameters. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +DeclineJobOfferRequest declineJobOfferRequest = new DeclineJobOfferRequest +{ + RetryOfferAt = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), +}; +Response response = await client.DeclineJobOfferAsync("", "", declineJobOfferRequest: declineJobOfferRequest); +]]> + + + +This sample shows how to call DeclineJobOffer. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = client.DeclineJobOffer("", ""); +]]> +This sample shows how to call DeclineJobOffer with all parameters. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +DeclineJobOfferRequest declineJobOfferRequest = new DeclineJobOfferRequest +{ + RetryOfferAt = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), +}; +Response response = client.DeclineJobOffer("", "", declineJobOfferRequest: declineJobOfferRequest); +]]> + + + +This sample shows how to call DeclineJobOfferAsync. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +using RequestContent content = null; +Response response = await client.DeclineJobOfferAsync("", "", content); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call DeclineJobOfferAsync with all parameters and request content. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +using RequestContent content = RequestContent.Create(new +{ + retryOfferAt = "2022-05-10T14:57:31.2311892-04:00", +}); +Response response = await client.DeclineJobOfferAsync("", "", content); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call DeclineJobOffer. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +using RequestContent content = null; +Response response = client.DeclineJobOffer("", "", content); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call DeclineJobOffer with all parameters and request content. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +using RequestContent content = RequestContent.Create(new +{ + retryOfferAt = "2022-05-10T14:57:31.2311892-04:00", +}); +Response response = client.DeclineJobOffer("", "", content); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call GetQueueStatisticsAsync. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = await client.GetQueueStatisticsAsync(""); +]]> +This sample shows how to call GetQueueStatisticsAsync with all parameters. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = await client.GetQueueStatisticsAsync(""); +]]> + + + +This sample shows how to call GetQueueStatistics. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = client.GetQueueStatistics(""); +]]> +This sample shows how to call GetQueueStatistics with all parameters. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = client.GetQueueStatistics(""); +]]> + + + +This sample shows how to call GetQueueStatisticsAsync and parse the result. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = await client.GetQueueStatisticsAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("queueId").ToString()); +Console.WriteLine(result.GetProperty("length").ToString()); +]]> +This sample shows how to call GetQueueStatisticsAsync with all parameters and parse the result. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = await client.GetQueueStatisticsAsync("", null); + +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 and parse the result. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = client.GetQueueStatistics("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("queueId").ToString()); +Console.WriteLine(result.GetProperty("length").ToString()); +]]> +This sample shows how to call GetQueueStatistics with all parameters and parse the result. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = client.GetQueueStatistics("", null); + +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 GetWorkerAsync. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = await client.GetWorkerAsync(""); +]]> +This sample shows how to call GetWorkerAsync with all parameters. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = await client.GetWorkerAsync(""); +]]> + + + +This sample shows how to call GetWorker. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = client.GetWorker(""); +]]> +This sample shows how to call GetWorker with all parameters. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = client.GetWorker(""); +]]> + + + +This sample shows how to call GetWorkerAsync and parse the result. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = await client.GetWorkerAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call GetWorkerAsync with all parameters and parse the result. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = await client.GetWorkerAsync("", 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 GetWorker and parse the result. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = client.GetWorker("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call GetWorker with all parameters and parse the result. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = client.GetWorker("", 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 DeleteWorkerAsync. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = await client.DeleteWorkerAsync(""); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call DeleteWorkerAsync with all parameters. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = await client.DeleteWorkerAsync(""); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call DeleteWorker. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = client.DeleteWorker(""); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call DeleteWorker with all parameters. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +Response response = client.DeleteWorker(""); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call GetJobsAsync. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +await foreach (RouterJobItem item in client.GetJobsAsync()) +{ +} +]]> +This sample shows how to call GetJobsAsync with all parameters. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +await foreach (RouterJobItem item in client.GetJobsAsync(maxpagesize: 1234, status: RouterJobStatusSelector.All, queueId: "", channelId: "", classificationPolicyId: "", scheduledBefore: DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), scheduledAfter: DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"))) +{ +} +]]> + + + +This sample shows how to call GetJobs. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +foreach (RouterJobItem item in client.GetJobs()) +{ +} +]]> +This sample shows how to call GetJobs with all parameters. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +foreach (RouterJobItem item in client.GetJobs(maxpagesize: 1234, status: RouterJobStatusSelector.All, queueId: "", channelId: "", classificationPolicyId: "", scheduledBefore: DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), scheduledAfter: DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"))) +{ +} +]]> + + + +This sample shows how to call GetJobsAsync and parse the result. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +await foreach (BinaryData item in client.GetJobsAsync(null, null, null, null, null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("job").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); +} +]]> +This sample shows how to call GetJobsAsync with all parameters and parse the result. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +await foreach (BinaryData item in client.GetJobsAsync(1234, "all", "", "", "", DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), null)) +{ + 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("kind").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); +} +]]> + + + +This sample shows how to call GetJobs and parse the result. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +foreach (BinaryData item in client.GetJobs(null, null, null, null, null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("job").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); +} +]]> +This sample shows how to call GetJobs with all parameters and parse the result. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +foreach (BinaryData item in client.GetJobs(1234, "all", "", "", "", DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), null)) +{ + 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("kind").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); +} +]]> + + + +This sample shows how to call GetWorkersAsync. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +await foreach (RouterWorkerItem item in client.GetWorkersAsync()) +{ +} +]]> +This sample shows how to call GetWorkersAsync with all parameters. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +await foreach (RouterWorkerItem item in client.GetWorkersAsync(maxpagesize: 1234, state: RouterWorkerStateSelector.Active, channelId: "", queueId: "", hasCapacity: true)) +{ +} +]]> + + + +This sample shows how to call GetWorkers. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +foreach (RouterWorkerItem item in client.GetWorkers()) +{ +} +]]> +This sample shows how to call GetWorkers with all parameters. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +foreach (RouterWorkerItem item in client.GetWorkers(maxpagesize: 1234, state: RouterWorkerStateSelector.Active, channelId: "", queueId: "", hasCapacity: true)) +{ +} +]]> + + + +This sample shows how to call GetWorkersAsync and parse the result. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +await foreach (BinaryData item in client.GetWorkersAsync(null, null, null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("worker").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); +} +]]> +This sample shows how to call GetWorkersAsync with all parameters and parse the result. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +await foreach (BinaryData item in client.GetWorkersAsync(1234, "active", "", "", true, null)) +{ + 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 and parse the result. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +foreach (BinaryData item in client.GetWorkers(null, null, null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("worker").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); +} +]]> +This sample shows how to call GetWorkers with all parameters and parse the result. +"); +JobRouterClient client = new JobRouterClient(endpoint); + +foreach (BinaryData item in client.GetWorkers(1234, "active", "", "", true, null)) +{ + 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 58d63c875aa3..1071df715173 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 04f932639c9e..cc41005a23af 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 62% 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 53945af79ba5..b64a63d33be1 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,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 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 +50,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 78% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicy.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicy.cs index 7e5330581818..b2e161daf701 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicy.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicy.cs @@ -6,10 +6,9 @@ #nullable disable using System.Collections.Generic; -using Azure.Communication.JobRouter; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { /// A policy that defines actions to execute when exception are triggered. public partial class ExceptionPolicy @@ -17,7 +16,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 60% 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 597ed20fa80e..0f20fa78f79d 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,9 +6,9 @@ #nullable disable using System.Text.Json; -using Azure.Core; +using Azure; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { public partial class ExceptionPolicyItem { @@ -18,16 +18,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 +33,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 71% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyItem.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ExceptionPolicyItem.cs index eb0e17f4d974..d927c358eb57 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 -namespace Azure.Communication.JobRouter.Models +using System; +using Azure.Core; + +namespace Azure.Communication.JobRouter { /// 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 70% 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 0e02d1e33937..77e2b5c8f04b 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,12 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; 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 +41,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 5b2dd805d7a1..74245ac57ad4 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 a722b95af3f8..02be16d62778 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 a4092743f281..a060787cfd53 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 512472b165cb..f48caf3880e6 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 658f0c6a463f..a5c32dbb509b 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 cb40ec95479a..688f830a662f 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 4e04e254b9c3..a74af384a51b 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 74% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/FunctionRouterRule.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/FunctionRouterRule.cs index 5d1750a5d34f..e7fa933fc92f 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,16 @@ 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; } + + /// URL for Azure Function. + public Uri FunctionUri { 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 7d7958ac9c54..2b98e06f9c9c 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 76b54979463b..de1d09283948 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/JobMatchingMode.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobMatchingMode.Serialization.cs new file mode 100644 index 000000000000..85e5c08254e0 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobMatchingMode.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure; + +namespace Azure.Communication.JobRouter +{ + public partial class JobMatchingMode + { + internal static JobMatchingMode DeserializeJobMatchingMode(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("kind", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "schedule-and-suspend": return ScheduleAndSuspendMode.DeserializeScheduleAndSuspendMode(element); + case "queue-and-match": return QueueAndMatchMode.DeserializeQueueAndMatchMode(element); + case "suspend": return SuspendMode.DeserializeSuspendMode(element); + } + } + return UnknownJobMatchingMode.DeserializeUnknownJobMatchingMode(element); + } + + /// 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 000000000000..89704cc32f84 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobMatchingMode.cs @@ -0,0 +1,38 @@ +// 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. + /// 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 abstract partial class JobMatchingMode + { + /// Initializes a new instance of JobMatchingMode. + /// Discriminator. + internal JobMatchingMode(string kind) + { + Kind = kind; + } + + /// Discriminator. + internal string Kind { get; set; } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterAdministrationClient.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterAdministrationClient.cs new file mode 100644 index 000000000000..649cab686303 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterAdministrationClient.cs @@ -0,0 +1,1708 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Communication.JobRouter +{ + // Data plane generated client. + /// The JobRouterAdministration service client. + public partial class JobRouterAdministrationClient + { + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline => _pipeline; + + /// Initializes a new instance of JobRouterAdministrationClient. + /// The Uri to use. + /// is null. + public JobRouterAdministrationClient(Uri endpoint) : this(endpoint, new JobRouterClientOptions()) + { + } + + /// Initializes a new instance of JobRouterAdministrationClient. + /// The Uri to use. + /// The options for configuring the client. + /// is null. + public JobRouterAdministrationClient(Uri endpoint, JobRouterClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + options ??= new JobRouterClientOptions(); + + 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 distribution policy. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// 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. + internal virtual async Task UpsertDistributionPolicyAsync(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = 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("JobRouterAdministrationClient.UpsertDistributionPolicy"); + scope.Start(); + try + { + using HttpMessage message = CreateUpsertDistributionPolicyRequest(id, content, requestConditions, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Creates or updates a distribution policy. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// 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. + internal virtual Response UpsertDistributionPolicy(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = 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("JobRouterAdministrationClient.UpsertDistributionPolicy"); + scope.Start(); + try + { + using HttpMessage message = CreateUpsertDistributionPolicyRequest(id, content, requestConditions, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieves an existing distribution policy by Id. + /// The unique identifier of the policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetDistributionPolicyAsync(string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetDistributionPolicyAsync(id, context).ConfigureAwait(false); + return Response.FromValue(DistributionPolicy.FromResponse(response), response); + } + + /// Retrieves an existing distribution policy by Id. + /// The unique identifier of the policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetDistributionPolicy(string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetDistributionPolicy(id, context); + return Response.FromValue(DistributionPolicy.FromResponse(response), response); + } + + /// + /// [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 async Task GetDistributionPolicyAsync(string id, RequestContext context) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationClient.GetDistributionPolicy"); + scope.Start(); + try + { + using HttpMessage message = CreateGetDistributionPolicyRequest(id, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [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) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationClient.GetDistributionPolicy"); + scope.Start(); + try + { + using HttpMessage message = CreateGetDistributionPolicyRequest(id, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // 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) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationClient.DeleteDistributionPolicy"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteDistributionPolicyRequest(id, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // 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 Response DeleteDistributionPolicy(string id, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationClient.DeleteDistributionPolicy"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteDistributionPolicyRequest(id, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [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. + internal virtual async Task UpsertClassificationPolicyAsync(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = 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("JobRouterAdministrationClient.UpsertClassificationPolicy"); + scope.Start(); + try + { + using HttpMessage message = CreateUpsertClassificationPolicyRequest(id, content, requestConditions, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [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. + internal virtual Response UpsertClassificationPolicy(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = 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("JobRouterAdministrationClient.UpsertClassificationPolicy"); + scope.Start(); + try + { + using HttpMessage message = CreateUpsertClassificationPolicyRequest(id, content, requestConditions, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieves an existing classification policy by Id. + /// Unique identifier of this policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetClassificationPolicyAsync(string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetClassificationPolicyAsync(id, context).ConfigureAwait(false); + return Response.FromValue(ClassificationPolicy.FromResponse(response), response); + } + + /// Retrieves an existing classification policy by Id. + /// Unique identifier of this policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetClassificationPolicy(string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetClassificationPolicy(id, context); + return Response.FromValue(ClassificationPolicy.FromResponse(response), response); + } + + /// + /// [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 async Task GetClassificationPolicyAsync(string id, RequestContext context) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationClient.GetClassificationPolicy"); + scope.Start(); + try + { + using HttpMessage message = CreateGetClassificationPolicyRequest(id, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [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) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationClient.GetClassificationPolicy"); + scope.Start(); + try + { + using HttpMessage message = CreateGetClassificationPolicyRequest(id, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // 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) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationClient.DeleteClassificationPolicy"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteClassificationPolicyRequest(id, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // 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) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationClient.DeleteClassificationPolicy"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteClassificationPolicyRequest(id, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Creates or updates a exception policy. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// 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. + internal virtual async Task UpsertExceptionPolicyAsync(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = 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("JobRouterAdministrationClient.UpsertExceptionPolicy"); + scope.Start(); + try + { + using HttpMessage message = CreateUpsertExceptionPolicyRequest(id, content, requestConditions, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Creates or updates a exception policy. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// 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. + internal virtual Response UpsertExceptionPolicy(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = 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("JobRouterAdministrationClient.UpsertExceptionPolicy"); + scope.Start(); + try + { + using HttpMessage message = CreateUpsertExceptionPolicyRequest(id, content, requestConditions, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieves an existing exception policy by Id. + /// The Id of the exception policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetExceptionPolicyAsync(string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + 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. + /// The Id of the exception policy. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetExceptionPolicy(string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetExceptionPolicy(id, context); + return Response.FromValue(ExceptionPolicy.FromResponse(response), response); + } + + /// + /// [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 async Task GetExceptionPolicyAsync(string id, RequestContext context) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationClient.GetExceptionPolicy"); + scope.Start(); + try + { + using HttpMessage message = CreateGetExceptionPolicyRequest(id, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [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) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationClient.GetExceptionPolicy"); + scope.Start(); + try + { + using HttpMessage message = CreateGetExceptionPolicyRequest(id, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // 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) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationClient.DeleteExceptionPolicy"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteExceptionPolicyRequest(id, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // 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) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationClient.DeleteExceptionPolicy"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteExceptionPolicyRequest(id, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Creates or updates a queue. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// 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. + internal virtual async Task UpsertQueueAsync(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = 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("JobRouterAdministrationClient.UpsertQueue"); + scope.Start(); + try + { + using HttpMessage message = CreateUpsertQueueRequest(id, content, requestConditions, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Creates or updates a queue. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// 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. + internal virtual Response UpsertQueue(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = 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("JobRouterAdministrationClient.UpsertQueue"); + scope.Start(); + try + { + using HttpMessage message = CreateUpsertQueueRequest(id, content, requestConditions, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieves an existing queue by Id. + /// The Id of this queue. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetQueueAsync(string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + 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. + /// The Id of this queue. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetQueue(string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetQueue(id, context); + return Response.FromValue(RouterQueue.FromResponse(response), response); + } + + /// + /// [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. + /// 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) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationClient.GetQueue"); + scope.Start(); + try + { + using HttpMessage message = CreateGetQueueRequest(id, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [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. + /// 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) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationClient.GetQueue"); + scope.Start(); + try + { + using HttpMessage message = CreateGetQueueRequest(id, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // 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("JobRouterAdministrationClient.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; + } + } + + // 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) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterAdministrationClient.DeleteQueue"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteQueueRequest(id, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieves existing distribution policies. + /// Number of objects to return per page. + /// The cancellation token to use. + /// + public virtual AsyncPageable GetDistributionPoliciesAsync(int? maxpagesize = null, CancellationToken cancellationToken = default) + { + 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, "JobRouterAdministrationClient.GetDistributionPolicies", "value", "nextLink", context); + } + + /// Retrieves existing distribution policies. + /// Number of objects to return per page. + /// The cancellation token to use. + /// + public virtual Pageable GetDistributionPolicies(int? maxpagesize = null, CancellationToken cancellationToken = default) + { + 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, "JobRouterAdministrationClient.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. + /// + /// + /// + /// + /// 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 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, "JobRouterAdministrationClient.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. + /// + /// + /// + /// + /// 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 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, "JobRouterAdministrationClient.GetDistributionPolicies", "value", "nextLink", context); + } + + /// Retrieves existing classification policies. + /// Number of objects to return per page. + /// The cancellation token to use. + /// + public virtual AsyncPageable GetClassificationPoliciesAsync(int? maxpagesize = null, CancellationToken cancellationToken = default) + { + 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, "JobRouterAdministrationClient.GetClassificationPolicies", "value", "nextLink", context); + } + + /// Retrieves existing classification policies. + /// Number of objects to return per page. + /// The cancellation token to use. + /// + public virtual Pageable GetClassificationPolicies(int? maxpagesize = null, CancellationToken cancellationToken = default) + { + 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, "JobRouterAdministrationClient.GetClassificationPolicies", "value", "nextLink", context); + } + + /// + /// [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. + /// + /// + /// + /// + /// 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 GetClassificationPoliciesAsync(int? maxpagesize, RequestContext context) + { + 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, "JobRouterAdministrationClient.GetClassificationPolicies", "value", "nextLink", context); + } + + /// + /// [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. + /// + /// + /// + /// + /// 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 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, "JobRouterAdministrationClient.GetClassificationPolicies", "value", "nextLink", context); + } + + /// Retrieves existing exception policies. + /// Number of objects to return per page. + /// The cancellation token to use. + /// + public virtual AsyncPageable GetExceptionPoliciesAsync(int? maxpagesize = null, CancellationToken cancellationToken = default) + { + 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, "JobRouterAdministrationClient.GetExceptionPolicies", "value", "nextLink", context); + } + + /// Retrieves existing exception policies. + /// Number of objects to return per page. + /// The cancellation token to use. + /// + public virtual Pageable GetExceptionPolicies(int? maxpagesize = null, CancellationToken cancellationToken = default) + { + 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, "JobRouterAdministrationClient.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 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, "JobRouterAdministrationClient.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, "JobRouterAdministrationClient.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 = null, 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, "JobRouterAdministrationClient.GetQueues", "value", "nextLink", context); + } + + /// Retrieves existing queues. + /// Number of objects to return per page. + /// The cancellation token to use. + /// + public virtual Pageable GetQueues(int? maxpagesize = null, 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.CreatePageable(FirstPageRequest, NextPageRequest, RouterQueueItem.DeserializeRouterQueueItem, ClientDiagnostics, _pipeline, "JobRouterAdministrationClient.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, "JobRouterAdministrationClient.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, "JobRouterAdministrationClient.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) + { + 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; + } + + 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("api-version", _apiVersion, true); + if (maxpagesize != null) + { + uri.AppendQuery("maxpagesize", maxpagesize.Value, 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) + { + request.Headers.Add(requestConditions, "R"); + } + request.Headers.Add("Content-Type", "application/merge-patch+json"); + request.Content = content; + return message; + } + + 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("api-version", _apiVersion, true); + if (maxpagesize != null) + { + uri.AppendQuery("maxpagesize", maxpagesize.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateDeleteClassificationPolicyRequest(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/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("api-version", _apiVersion, true); + if (maxpagesize != null) + { + uri.AppendQuery("maxpagesize", maxpagesize.Value, 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) + { + 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("api-version", _apiVersion, true); + if (maxpagesize != null) + { + uri.AppendQuery("maxpagesize", maxpagesize.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + 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) + { + 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/JobRouterAdministrationRestClient.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterAdministrationRestClient.cs deleted file mode 100644 index c484f7d1c336..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterAdministrationRestClient.cs +++ /dev/null @@ -1,1717 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Communication.JobRouter.Models; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.Communication.JobRouter -{ - internal partial class JobRouterAdministrationRestClient - { - private readonly HttpPipeline _pipeline; - private readonly string _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)); - } - - internal HttpMessage CreateUpsertClassificationPolicyRequest(string id, ClassificationPolicy patch) - { - 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) - { - 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) - { - 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); - } - } - - 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; - } - - /// - /// [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. - /// - /// - /// - /// - /// Id of the classification policy. - /// The content to send as the body 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) - { - Argument.AssertNotNullOrEmpty(id, nameof(id)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("JobRouterAdministration.UpsertClassificationPolicy"); - scope.Start(); - try - { - using HttpMessage message = CreateUpsertClassificationPolicyRequest(id, content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [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. - /// - /// - /// - /// - /// Id of the classification policy. - /// The content to send as the body 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) - { - Argument.AssertNotNullOrEmpty(id, nameof(id)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("JobRouterAdministration.UpsertClassificationPolicy"); - scope.Start(); - try - { - using HttpMessage message = CreateUpsertClassificationPolicyRequest(id, content, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - 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. - /// The cancellation token to use. - /// is null. - public async Task> GetClassificationPolicyAsync(string id, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(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); - } - } - - /// Retrieves an existing classification policy by Id. - /// Id of the classification policy. - /// The cancellation token to use. - /// is null. - public Response GetClassificationPolicy(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); - } - } - - 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; - } - - /// Delete a classification policy by Id. - /// Id of the classification policy. - /// The cancellation token to use. - /// is null. - public async Task DeleteClassificationPolicyAsync(string id, CancellationToken cancellationToken = default) - { - 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); - } - } - - /// 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) - { - throw new ArgumentNullException(nameof(id)); - } - - using var message = CreateDeleteClassificationPolicyRequest(id); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListClassificationPoliciesRequest(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/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; - } - - /// 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) - { - 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); - } - } - - /// 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) - { - 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); - } - } - - 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) - { - 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); - } - } - - /// 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) - { - throw new ArgumentNullException(nameof(patch)); - } - - using var message = CreateUpsertDistributionPolicyRequest(id, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - 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); - } - } - - 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; - } - - /// - /// [Protocol Method] Creates or updates a distribution policy. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Id of the distribution policy. - /// The content to send as the body 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 UpsertDistributionPolicyAsync(string id, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(id, nameof(id)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("JobRouterAdministration.UpsertDistributionPolicy"); - scope.Start(); - try - { - using HttpMessage message = CreateUpsertDistributionPolicyRequest(id, content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Creates or updates a distribution policy. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Id of the distribution policy. - /// The content to send as the body 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) - { - Argument.AssertNotNullOrEmpty(id, nameof(id)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("JobRouterAdministration.UpsertDistributionPolicy"); - scope.Start(); - try - { - using HttpMessage message = CreateUpsertDistributionPolicyRequest(id, content, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - 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) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - - using var message = CreateGetDistributionPolicyRequest(id); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - 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); - } - } - - /// Retrieves an existing distribution policy by Id. - /// Id of the distribution policy. - /// The cancellation token to use. - /// is null. - public Response GetDistributionPolicy(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); - } - } - - 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; - } - - /// Delete a distribution policy by Id. - /// Id of the distribution policy. - /// The cancellation token to use. - /// is null. - public async Task DeleteDistributionPolicyAsync(string id, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(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); - } - } - - /// Delete a distribution policy by Id. - /// Id of the distribution policy. - /// The cancellation token to use. - /// is null. - public Response DeleteDistributionPolicy(string id, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - - using var message = CreateDeleteDistributionPolicyRequest(id); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - 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) - { - uri.AppendQuery("maxpagesize", maxpagesize.Value, true); - } - 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) - { - using var message = CreateListDistributionPoliciesRequest(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); - } - } - - /// 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) - { - 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); - } - } - - internal HttpMessage CreateUpsertExceptionPolicyRequest(string id, ExceptionPolicy patch) - { - 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; - } - - /// 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) - { - throw new ArgumentNullException(nameof(patch)); - } - - using var message = CreateUpsertExceptionPolicyRequest(id, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - 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); - } - } - - /// 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) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - if (patch == null) - { - throw new ArgumentNullException(nameof(patch)); - } - - using var message = CreateUpsertExceptionPolicyRequest(id, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - 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); - } - } - - 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. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Id of the exception policy. - /// The content to send as the body 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) - { - Argument.AssertNotNullOrEmpty(id, nameof(id)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("JobRouterAdministration.UpsertExceptionPolicy"); - scope.Start(); - try - { - using HttpMessage message = CreateUpsertExceptionPolicyRequest(id, content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Creates or updates a exception policy. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Id of the exception policy. - /// The content to send as the body 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) - { - Argument.AssertNotNullOrEmpty(id, nameof(id)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("JobRouterAdministration.UpsertExceptionPolicy"); - scope.Start(); - try - { - using HttpMessage message = CreateUpsertExceptionPolicyRequest(id, content, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - 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 cancellation token to use. - /// is null. - public async Task> GetExceptionPolicyAsync(string id, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(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); - } - } - - /// Retrieves an existing exception policy by Id. - /// Id of the exception policy to retrieve. - /// The cancellation token to use. - /// is null. - public 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); - } - } - - 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; - } - - /// 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. - /// is null. - public Response DeleteExceptionPolicy(string id, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - - using var message = CreateDeleteExceptionPolicyRequest(id); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - 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) - { - uri.AppendQuery("maxpagesize", maxpagesize.Value, true); - } - 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) - { - using var message = CreateListExceptionPoliciesRequest(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); - } - } - - /// 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) - { - 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); - } - } - - internal HttpMessage CreateUpsertQueueRequest(string id, RouterQueue patch) - { - 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; - } - - /// 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) - { - throw new ArgumentNullException(nameof(patch)); - } - - using var message = CreateUpsertQueueRequest(id, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - 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); - } - } - - /// 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) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - if (patch == null) - { - throw new ArgumentNullException(nameof(patch)); - } - - using var message = CreateUpsertQueueRequest(id, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - 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); - } - } - - 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. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Id of the queue. - /// The content to send as the body 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) - { - Argument.AssertNotNullOrEmpty(id, nameof(id)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("JobRouterAdministration.UpsertQueue"); - scope.Start(); - try - { - using HttpMessage message = CreateUpsertQueueRequest(id, content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Creates or updates a queue. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Id of the queue. - /// The content to send as the body 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) - { - Argument.AssertNotNullOrEmpty(id, nameof(id)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("JobRouterAdministration.UpsertQueue"); - scope.Start(); - try - { - using HttpMessage message = CreateUpsertQueueRequest(id, content, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - 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 cancellation token to use. - /// is null. - public async Task> GetQueueAsync(string id, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(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); - } - } - - /// Retrieves an existing queue by Id. - /// Id of the queue to retrieve. - /// The cancellation token to use. - /// is null. - public 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); - } - } - - 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; - } - - /// Deletes a queue by Id. - /// Id of the queue to delete. - /// The cancellation token to use. - /// is null. - public async Task DeleteQueueAsync(string id, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - - using var message = CreateDeleteQueueRequest(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 queue by Id. - /// Id of the queue to delete. - /// The cancellation token to use. - /// is null. - public Response DeleteQueue(string id, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - - using var message = CreateDeleteQueueRequest(id); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - 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); - } - 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) - { - using var message = CreateListQueuesRequest(maxpagesize); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - 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); - } - } - - /// Retrieves existing queues. - /// Number of objects to return per page. - /// The cancellation token to use. - public Response ListQueues(int? maxpagesize = null, 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); - } - } - - /// Retrieves existing classification policies. - /// The URL to the next page of results. - /// Maximum page size. - /// The cancellation token to use. - /// is null. - public async Task> ListClassificationPoliciesNextPageAsync(string nextLink, int? maxpagesize = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - - 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); - } - } - - /// 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) - { - 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); - } - } - - /// Retrieves existing distribution policies. - /// The URL to the next page of results. - /// Maximum page size. - /// The cancellation token to use. - /// is null. - public async Task> ListDistributionPoliciesNextPageAsync(string nextLink, int? maxpagesize = null, 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); - } - } - - /// Retrieves existing distribution policies. - /// The URL to the next page of results. - /// Maximum page size. - /// The cancellation token to use. - /// is null. - public Response ListDistributionPoliciesNextPage(string nextLink, int? maxpagesize = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - - 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); - } - } - - /// 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) - { - 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); - } - } - - /// 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) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - - 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); - } - } - - /// 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) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - - using var message = CreateListQueuesNextPageRequest(nextLink, maxpagesize); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - 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); - } - } - - /// 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) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - - using var message = CreateListQueuesNextPageRequest(nextLink, 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); - } - } - - private static ResponseClassifier _responseClassifier200201; - private static ResponseClassifier ResponseClassifier200201 => _responseClassifier200201 ??= new StatusCodeClassifier(stackalloc ushort[] { 200, 201 }); - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterClient.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterClient.cs new file mode 100644 index 000000000000..6cfcdf8db878 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterClient.cs @@ -0,0 +1,2211 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Communication.JobRouter +{ + // Data plane generated client. + /// The JobRouter service client. + public partial class JobRouterClient + { + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline => _pipeline; + + /// Initializes a new instance of JobRouterClient. + /// The Uri to use. + /// is null. + public JobRouterClient(Uri endpoint) : this(endpoint, new JobRouterClientOptions()) + { + } + + /// Initializes a new instance of JobRouterClient. + /// The Uri to use. + /// The options for configuring the client. + /// is null. + public JobRouterClient(Uri endpoint, JobRouterClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + options ??= new JobRouterClientOptions(); + + 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 router job. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// 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. + internal virtual async Task UpsertJobAsync(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = 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("JobRouterClient.UpsertJob"); + scope.Start(); + try + { + using HttpMessage message = CreateUpsertJobRequest(id, content, requestConditions, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Creates or updates a router job. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// 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. + internal virtual Response UpsertJob(string id, RequestContent content, RequestConditions requestConditions = null, RequestContext context = 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("JobRouterClient.UpsertJob"); + scope.Start(); + try + { + using HttpMessage message = CreateUpsertJobRequest(id, content, requestConditions, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieves an existing job by Id. + /// The id of the job. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetJobAsync(string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + 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. + /// The id of the job. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetJob(string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetJob(id, context); + return Response.FromValue(RouterJob.FromResponse(response), response); + } + + /// + /// [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. + /// 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) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterClient.GetJob"); + scope.Start(); + try + { + using HttpMessage message = CreateGetJobRequest(id, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [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. + /// 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) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterClient.GetJob"); + scope.Start(); + try + { + using HttpMessage message = CreateGetJobRequest(id, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // 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. + /// 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) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterClient.DeleteJob"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteJobRequest(id, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // 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. + /// 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 DeleteJob(string id, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterClient.DeleteJob"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteJobRequest(id, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Reclassify a job. + /// Id of the job. + /// Request object for reclassifying a job. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + internal virtual async Task ReclassifyJobAsync(string id, IDictionary reclassifyJobRequest = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = RequestContentHelper.FromDictionary(reclassifyJobRequest); + Response response = await ReclassifyJobAsync(id, content, context).ConfigureAwait(false); + return response; + } + + /// Reclassify a job. + /// Id of the job. + /// Request object for reclassifying a job. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + internal virtual Response ReclassifyJob(string id, IDictionary reclassifyJobRequest = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = RequestContentHelper.FromDictionary(reclassifyJobRequest); + Response response = ReclassifyJob(id, content, context); + return response; + } + + /// + /// [Protocol Method] Reclassify a job. + /// + /// + /// + /// 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. + /// + /// + /// + /// + /// Id of the job. + /// The content to send as the body of the request. + /// 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. + internal virtual async Task ReclassifyJobAsync(string id, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterClient.ReclassifyJob"); + scope.Start(); + try + { + using HttpMessage message = CreateReclassifyJobRequest(id, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Reclassify a job. + /// + /// + /// + /// 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. + /// + /// + /// + /// + /// Id of the job. + /// The content to send as the body of the request. + /// 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. + internal virtual Response ReclassifyJob(string id, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterClient.ReclassifyJob"); + scope.Start(); + try + { + using HttpMessage message = CreateReclassifyJobRequest(id, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Submits request to cancel an existing job by Id while supplying free-form + /// cancellation reason. + /// + /// Id of the job. + /// Request model for cancelling job. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task CancelJobAsync(string id, CancelJobRequest cancelJobRequest = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = cancelJobRequest?.ToRequestContent(); + Response response = await CancelJobAsync(id, content, context).ConfigureAwait(false); + return response; + } + + /// + /// Submits request to cancel an existing job by Id while supplying free-form + /// cancellation reason. + /// + /// Id of the job. + /// Request model for cancelling job. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response CancelJob(string id, CancelJobRequest cancelJobRequest = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = cancelJobRequest?.ToRequestContent(); + Response response = CancelJob(id, content, context); + return response; + } + + /// + /// [Protocol Method] Submits request to cancel an existing job by Id while supplying free-form + /// cancellation reason. + /// + /// + /// + /// 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. + /// + /// + /// + /// + /// Id of the job. + /// The content to send as the body of the request. + /// 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 CancelJobAsync(string id, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterClient.CancelJob"); + scope.Start(); + try + { + using HttpMessage message = CreateCancelJobRequest(id, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Submits request to cancel an existing job by Id while supplying free-form + /// cancellation reason. + /// + /// + /// + /// 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. + /// + /// + /// + /// + /// Id of the job. + /// The content to send as the body of the request. + /// 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 CancelJob(string id, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterClient.CancelJob"); + scope.Start(); + try + { + using HttpMessage message = CreateCancelJobRequest(id, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Completes an assigned job. + /// Id of the job. + /// Request model for completing job. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task CompleteJobAsync(string id, CompleteJobRequest completeJobRequest, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(completeJobRequest, nameof(completeJobRequest)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = completeJobRequest.ToRequestContent(); + Response response = await CompleteJobAsync(id, content, context).ConfigureAwait(false); + return response; + } + + /// Completes an assigned job. + /// Id of the job. + /// Request model for completing job. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response CompleteJob(string id, CompleteJobRequest completeJobRequest, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(completeJobRequest, nameof(completeJobRequest)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = completeJobRequest.ToRequestContent(); + Response response = CompleteJob(id, content, context); + return response; + } + + /// + /// [Protocol Method] Completes an assigned job. + /// + /// + /// + /// 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. + /// + /// + /// + /// + /// Id of the job. + /// The content to send as the body 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 CompleteJobAsync(string id, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterClient.CompleteJob"); + scope.Start(); + try + { + using HttpMessage message = CreateCompleteJobRequest(id, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Completes an assigned job. + /// + /// + /// + /// 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. + /// + /// + /// + /// + /// Id of the job. + /// The content to send as the body 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 CompleteJob(string id, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterClient.CompleteJob"); + scope.Start(); + try + { + using HttpMessage message = CreateCompleteJobRequest(id, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Closes a completed job. + /// Id of the job. + /// Request model for closing job. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task CloseJobAsync(string id, CloseJobRequest closeJobRequest, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(closeJobRequest, nameof(closeJobRequest)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = closeJobRequest.ToRequestContent(); + Response response = await CloseJobAsync(id, content, context).ConfigureAwait(false); + return response; + } + + /// Closes a completed job. + /// Id of the job. + /// Request model for closing job. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response CloseJob(string id, CloseJobRequest closeJobRequest, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(closeJobRequest, nameof(closeJobRequest)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = closeJobRequest.ToRequestContent(); + Response response = CloseJob(id, content, context); + return response; + } + + /// + /// [Protocol Method] Closes a completed job. + /// + /// + /// + /// 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. + /// + /// + /// + /// + /// Id of the job. + /// The content to send as the body 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 CloseJobAsync(string id, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterClient.CloseJob"); + scope.Start(); + try + { + using HttpMessage message = CreateCloseJobRequest(id, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Closes a completed job. + /// + /// + /// + /// 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. + /// + /// + /// + /// + /// Id of the job. + /// The content to send as the body 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 CloseJob(string id, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterClient.CloseJob"); + scope.Start(); + try + { + using HttpMessage message = CreateCloseJobRequest(id, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets a job's position details. + /// Id of the job. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetQueuePositionAsync(string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetQueuePositionAsync(id, context).ConfigureAwait(false); + return Response.FromValue(RouterJobPositionDetails.FromResponse(response), response); + } + + /// Gets a job's position details. + /// Id of the job. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetQueuePosition(string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetQueuePosition(id, context); + return Response.FromValue(RouterJobPositionDetails.FromResponse(response), response); + } + + /// + /// [Protocol Method] Gets a job's position details. + /// + /// + /// + /// 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. + /// + /// + /// + /// + /// Id of the job. + /// 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 GetQueuePositionAsync(string id, RequestContext context) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterClient.GetQueuePosition"); + scope.Start(); + try + { + using HttpMessage message = CreateGetQueuePositionRequest(id, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Gets a job's position details. + /// + /// + /// + /// 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. + /// + /// + /// + /// + /// Id of the job. + /// 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 GetQueuePosition(string id, RequestContext context) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterClient.GetQueuePosition"); + scope.Start(); + try + { + using HttpMessage message = CreateGetQueuePositionRequest(id, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Un-assign a job. + /// + /// + /// + /// 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. + /// + /// + /// + /// + /// Id of the job to un-assign. + /// Id of the assignment to un-assign. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or 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 UnassignJobAsync(string id, string assignmentId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(assignmentId, nameof(assignmentId)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterClient.UnassignJob"); + scope.Start(); + try + { + using HttpMessage message = CreateUnassignJobRequest(id, assignmentId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Un-assign a job. + /// + /// + /// + /// 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. + /// + /// + /// + /// + /// Id of the job to un-assign. + /// Id of the assignment to un-assign. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or 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 UnassignJob(string id, string assignmentId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(assignmentId, nameof(assignmentId)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterClient.UnassignJob"); + scope.Start(); + try + { + using HttpMessage message = CreateUnassignJobRequest(id, assignmentId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// Accepts an offer to work on a job and returns a 409/Conflict if another agent + /// accepted the job already. + /// + /// Id of the worker. + /// Id of the offer. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual async Task> AcceptJobOfferAsync(string workerId, string offerId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + Argument.AssertNotNullOrEmpty(offerId, nameof(offerId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await AcceptJobOfferAsync(workerId, offerId, context).ConfigureAwait(false); + return Response.FromValue(AcceptJobOfferResult.FromResponse(response), response); + } + + /// + /// Accepts an offer to work on a job and returns a 409/Conflict if another agent + /// accepted the job already. + /// + /// Id of the worker. + /// Id of the offer. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Response AcceptJobOffer(string workerId, string offerId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + Argument.AssertNotNullOrEmpty(offerId, nameof(offerId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = AcceptJobOffer(workerId, offerId, context); + return Response.FromValue(AcceptJobOfferResult.FromResponse(response), response); + } + + /// + /// [Protocol Method] Accepts an offer to work on a job and returns a 409/Conflict if another agent + /// accepted the job already. + /// + /// + /// + /// 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. + /// + /// + /// + /// + /// Id of the worker. + /// Id of the offer. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or 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 AcceptJobOfferAsync(string workerId, string offerId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + Argument.AssertNotNullOrEmpty(offerId, nameof(offerId)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterClient.AcceptJobOffer"); + scope.Start(); + try + { + using HttpMessage message = CreateAcceptJobOfferRequest(workerId, offerId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Accepts an offer to work on a job and returns a 409/Conflict if another agent + /// accepted the job already. + /// + /// + /// + /// 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. + /// + /// + /// + /// + /// Id of the worker. + /// Id of the offer. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or 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 AcceptJobOffer(string workerId, string offerId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + Argument.AssertNotNullOrEmpty(offerId, nameof(offerId)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterClient.AcceptJobOffer"); + scope.Start(); + try + { + using HttpMessage message = CreateAcceptJobOfferRequest(workerId, offerId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Declines an offer to work on a job. + /// Id of the worker. + /// Id of the offer. + /// Request model for declining offer. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual async Task DeclineJobOfferAsync(string workerId, string offerId, DeclineJobOfferRequest declineJobOfferRequest = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + Argument.AssertNotNullOrEmpty(offerId, nameof(offerId)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = declineJobOfferRequest?.ToRequestContent(); + Response response = await DeclineJobOfferAsync(workerId, offerId, content, context).ConfigureAwait(false); + return response; + } + + /// Declines an offer to work on a job. + /// Id of the worker. + /// Id of the offer. + /// Request model for declining offer. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + public virtual Response DeclineJobOffer(string workerId, string offerId, DeclineJobOfferRequest declineJobOfferRequest = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + Argument.AssertNotNullOrEmpty(offerId, nameof(offerId)); + + RequestContext context = FromCancellationToken(cancellationToken); + using RequestContent content = declineJobOfferRequest?.ToRequestContent(); + Response response = DeclineJobOffer(workerId, offerId, content, context); + return response; + } + + /// + /// [Protocol Method] Declines an offer to work on a job. + /// + /// + /// + /// 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. + /// + /// + /// + /// + /// Id of the worker. + /// Id of the offer. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or 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 DeclineJobOfferAsync(string workerId, string offerId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + Argument.AssertNotNullOrEmpty(offerId, nameof(offerId)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterClient.DeclineJobOffer"); + scope.Start(); + try + { + using HttpMessage message = CreateDeclineJobOfferRequest(workerId, offerId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Declines an offer to work on a job. + /// + /// + /// + /// 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. + /// + /// + /// + /// + /// Id of the worker. + /// Id of the offer. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// or 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 DeclineJobOffer(string workerId, string offerId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + Argument.AssertNotNullOrEmpty(offerId, nameof(offerId)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterClient.DeclineJobOffer"); + scope.Start(); + try + { + using HttpMessage message = CreateDeclineJobOfferRequest(workerId, offerId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieves a queue's statistics. + /// Id of the queue to retrieve statistics. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetQueueStatisticsAsync(string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetQueueStatisticsAsync(id, context).ConfigureAwait(false); + return Response.FromValue(RouterQueueStatistics.FromResponse(response), response); + } + + /// Retrieves a queue's statistics. + /// Id of the queue to retrieve statistics. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetQueueStatistics(string id, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetQueueStatistics(id, context); + return Response.FromValue(RouterQueueStatistics.FromResponse(response), response); + } + + /// + /// [Protocol Method] Retrieves a queue's statistics. + /// + /// + /// + /// 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. + /// + /// + /// + /// + /// Id of the queue to retrieve statistics. + /// 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 GetQueueStatisticsAsync(string id, RequestContext context) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterClient.GetQueueStatistics"); + scope.Start(); + try + { + using HttpMessage message = CreateGetQueueStatisticsRequest(id, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Retrieves a queue's statistics. + /// + /// + /// + /// 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. + /// + /// + /// + /// + /// Id of the queue to retrieve statistics. + /// 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 GetQueueStatistics(string id, RequestContext context) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterClient.GetQueueStatistics"); + scope.Start(); + try + { + using HttpMessage message = CreateGetQueueStatisticsRequest(id, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Creates or updates a worker. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Id of the worker. + /// 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. + internal virtual async Task UpsertWorkerAsync(string workerId, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + 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("JobRouterClient.UpsertWorker"); + scope.Start(); + try + { + using HttpMessage message = CreateUpsertWorkerRequest(workerId, content, requestConditions, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Creates or updates a worker. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Id of the worker. + /// 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. + internal virtual Response UpsertWorker(string workerId, RequestContent content, RequestConditions requestConditions = null, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + 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("JobRouterClient.UpsertWorker"); + scope.Start(); + try + { + using HttpMessage message = CreateUpsertWorkerRequest(workerId, content, requestConditions, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieves an existing worker by Id. + /// Id of the worker. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetWorkerAsync(string workerId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetWorkerAsync(workerId, context).ConfigureAwait(false); + return Response.FromValue(RouterWorker.FromResponse(response), response); + } + + /// Retrieves an existing worker by Id. + /// Id of the worker. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetWorker(string workerId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetWorker(workerId, context); + return Response.FromValue(RouterWorker.FromResponse(response), response); + } + + /// + /// [Protocol Method] Retrieves an existing worker 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. + /// + /// + /// + /// + /// Id of the worker. + /// 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 GetWorkerAsync(string workerId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterClient.GetWorker"); + scope.Start(); + try + { + using HttpMessage message = CreateGetWorkerRequest(workerId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Retrieves an existing worker 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. + /// + /// + /// + /// + /// Id of the worker. + /// 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 GetWorker(string workerId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterClient.GetWorker"); + scope.Start(); + try + { + using HttpMessage message = CreateGetWorkerRequest(workerId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Deletes a worker and all of its traces. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Id of the worker. + /// 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 DeleteWorkerAsync(string workerId, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterClient.DeleteWorker"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteWorkerRequest(workerId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Deletes a worker and all of its traces. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Id of the worker. + /// 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 DeleteWorker(string workerId, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); + + using var scope = ClientDiagnostics.CreateScope("JobRouterClient.DeleteWorker"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteWorkerRequest(workerId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieves list of jobs based on filter parameters. + /// Number of objects to return per page. + /// If specified, filter jobs by status. + /// If specified, filter jobs by queue. + /// If specified, filter jobs by channel. + /// If specified, filter jobs by classificationPolicy. + /// + /// If specified, filter on jobs that was scheduled before or at given timestamp. + /// Range: (-Inf, scheduledBefore]. + /// + /// + /// If specified, filter on jobs that was scheduled at or after given value. Range: + /// [scheduledAfter, +Inf). + /// + /// The cancellation token to use. + /// + public virtual AsyncPageable GetJobsAsync(int? maxpagesize = null, RouterJobStatusSelector? status = null, string queueId = null, string channelId = null, string classificationPolicyId = null, DateTimeOffset? scheduledBefore = null, DateTimeOffset? scheduledAfter = null, CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetJobsRequest(maxpagesize, status?.ToString(), queueId, channelId, classificationPolicyId, scheduledBefore, scheduledAfter, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetJobsNextPageRequest(nextLink, maxpagesize, status?.ToString(), queueId, channelId, classificationPolicyId, scheduledBefore, scheduledAfter, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, RouterJobItem.DeserializeRouterJobItem, ClientDiagnostics, _pipeline, "JobRouterClient.GetJobs", "value", "nextLink", context); + } + + /// Retrieves list of jobs based on filter parameters. + /// Number of objects to return per page. + /// If specified, filter jobs by status. + /// If specified, filter jobs by queue. + /// If specified, filter jobs by channel. + /// If specified, filter jobs by classificationPolicy. + /// + /// If specified, filter on jobs that was scheduled before or at given timestamp. + /// Range: (-Inf, scheduledBefore]. + /// + /// + /// If specified, filter on jobs that was scheduled at or after given value. Range: + /// [scheduledAfter, +Inf). + /// + /// The cancellation token to use. + /// + public virtual Pageable GetJobs(int? maxpagesize = null, RouterJobStatusSelector? status = null, string queueId = null, string channelId = null, string classificationPolicyId = null, DateTimeOffset? scheduledBefore = null, DateTimeOffset? scheduledAfter = null, CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetJobsRequest(maxpagesize, status?.ToString(), queueId, channelId, classificationPolicyId, scheduledBefore, scheduledAfter, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetJobsNextPageRequest(nextLink, maxpagesize, status?.ToString(), queueId, channelId, classificationPolicyId, scheduledBefore, scheduledAfter, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, RouterJobItem.DeserializeRouterJobItem, ClientDiagnostics, _pipeline, "JobRouterClient.GetJobs", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieves list of jobs based on filter parameters. + /// + /// + /// + /// 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. + /// If specified, filter jobs by status. Allowed values: "all" | "pendingClassification" | "queued" | "assigned" | "completed" | "closed" | "cancelled" | "classificationFailed" | "created" | "pendingSchedule" | "scheduled" | "scheduleFailed" | "waitingForActivation" | "active". + /// If specified, filter jobs by queue. + /// If specified, filter jobs by channel. + /// If specified, filter jobs by classificationPolicy. + /// + /// If specified, filter on jobs that was scheduled before or at given timestamp. + /// Range: (-Inf, scheduledBefore]. + /// + /// + /// If specified, filter on jobs that was scheduled at or after given value. Range: + /// [scheduledAfter, +Inf). + /// + /// 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 GetJobsAsync(int? maxpagesize, string status, string queueId, string channelId, string classificationPolicyId, DateTimeOffset? scheduledBefore, DateTimeOffset? scheduledAfter, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetJobsRequest(maxpagesize, status, queueId, channelId, classificationPolicyId, scheduledBefore, scheduledAfter, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetJobsNextPageRequest(nextLink, maxpagesize, status, queueId, channelId, classificationPolicyId, scheduledBefore, scheduledAfter, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "JobRouterClient.GetJobs", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieves list of jobs based on filter parameters. + /// + /// + /// + /// 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. + /// If specified, filter jobs by status. Allowed values: "all" | "pendingClassification" | "queued" | "assigned" | "completed" | "closed" | "cancelled" | "classificationFailed" | "created" | "pendingSchedule" | "scheduled" | "scheduleFailed" | "waitingForActivation" | "active". + /// If specified, filter jobs by queue. + /// If specified, filter jobs by channel. + /// If specified, filter jobs by classificationPolicy. + /// + /// If specified, filter on jobs that was scheduled before or at given timestamp. + /// Range: (-Inf, scheduledBefore]. + /// + /// + /// If specified, filter on jobs that was scheduled at or after given value. Range: + /// [scheduledAfter, +Inf). + /// + /// 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 GetJobs(int? maxpagesize, string status, string queueId, string channelId, string classificationPolicyId, DateTimeOffset? scheduledBefore, DateTimeOffset? scheduledAfter, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetJobsRequest(maxpagesize, status, queueId, channelId, classificationPolicyId, scheduledBefore, scheduledAfter, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetJobsNextPageRequest(nextLink, maxpagesize, status, queueId, channelId, classificationPolicyId, scheduledBefore, scheduledAfter, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "JobRouterClient.GetJobs", "value", "nextLink", context); + } + + /// Retrieves existing workers. + /// Number of objects to return per page. + /// If specified, select workers by worker state. + /// If specified, select workers who have a channel configuration with this channel. + /// If specified, select workers who are assigned to this queue. + /// + /// If set to true, select only workers who have capacity for the channel specified + /// by `channelId` or for any channel if `channelId` not specified. If set to + /// false, then will return all workers including workers without any capacity for + /// jobs. Defaults to false. + /// + /// The cancellation token to use. + /// + public virtual AsyncPageable GetWorkersAsync(int? maxpagesize = null, RouterWorkerStateSelector? state = null, string channelId = null, string queueId = null, bool? hasCapacity = null, CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetWorkersRequest(maxpagesize, state?.ToString(), channelId, queueId, hasCapacity, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetWorkersNextPageRequest(nextLink, maxpagesize, state?.ToString(), channelId, queueId, hasCapacity, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, RouterWorkerItem.DeserializeRouterWorkerItem, ClientDiagnostics, _pipeline, "JobRouterClient.GetWorkers", "value", "nextLink", context); + } + + /// Retrieves existing workers. + /// Number of objects to return per page. + /// If specified, select workers by worker state. + /// If specified, select workers who have a channel configuration with this channel. + /// If specified, select workers who are assigned to this queue. + /// + /// If set to true, select only workers who have capacity for the channel specified + /// by `channelId` or for any channel if `channelId` not specified. If set to + /// false, then will return all workers including workers without any capacity for + /// jobs. Defaults to false. + /// + /// The cancellation token to use. + /// + public virtual Pageable GetWorkers(int? maxpagesize = null, RouterWorkerStateSelector? state = null, string channelId = null, string queueId = null, bool? hasCapacity = null, CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetWorkersRequest(maxpagesize, state?.ToString(), channelId, queueId, hasCapacity, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetWorkersNextPageRequest(nextLink, maxpagesize, state?.ToString(), channelId, queueId, hasCapacity, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, RouterWorkerItem.DeserializeRouterWorkerItem, ClientDiagnostics, _pipeline, "JobRouterClient.GetWorkers", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieves existing workers. + /// + /// + /// + /// 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. + /// If specified, select workers by worker state. Allowed values: "active" | "draining" | "inactive" | "all". + /// If specified, select workers who have a channel configuration with this channel. + /// If specified, select workers who are assigned to this queue. + /// + /// If set to true, select only workers who have capacity for the channel specified + /// by `channelId` or for any channel if `channelId` not specified. If set to + /// false, then will return all workers including workers without any capacity for + /// jobs. Defaults to false. + /// + /// 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 GetWorkersAsync(int? maxpagesize, string state, string channelId, string queueId, bool? hasCapacity, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetWorkersRequest(maxpagesize, state, channelId, queueId, hasCapacity, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetWorkersNextPageRequest(nextLink, maxpagesize, state, channelId, queueId, hasCapacity, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "JobRouterClient.GetWorkers", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieves existing workers. + /// + /// + /// + /// 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. + /// If specified, select workers by worker state. Allowed values: "active" | "draining" | "inactive" | "all". + /// If specified, select workers who have a channel configuration with this channel. + /// If specified, select workers who are assigned to this queue. + /// + /// If set to true, select only workers who have capacity for the channel specified + /// by `channelId` or for any channel if `channelId` not specified. If set to + /// false, then will return all workers including workers without any capacity for + /// jobs. Defaults to false. + /// + /// 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 GetWorkers(int? maxpagesize, string state, string channelId, string queueId, bool? hasCapacity, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetWorkersRequest(maxpagesize, state, channelId, queueId, hasCapacity, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetWorkersNextPageRequest(nextLink, maxpagesize, state, channelId, queueId, hasCapacity, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "JobRouterClient.GetWorkers", "value", "nextLink", context); + } + + internal HttpMessage CreateUpsertJobRequest(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/jobs/", 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 CreateGetJobRequest(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/jobs/", false); + uri.AppendPath(id, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateDeleteJobRequest(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/jobs/", false); + uri.AppendPath(id, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateReclassifyJobRequest(string id, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + 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"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateCancelJobRequest(string id, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/routing/jobs/", false); + uri.AppendPath(id, true); + uri.AppendPath(":cancel", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateCompleteJobRequest(string id, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/routing/jobs/", false); + uri.AppendPath(id, true); + uri.AppendPath(":complete", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateCloseJobRequest(string id, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200202); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/routing/jobs/", false); + uri.AppendPath(id, true); + uri.AppendPath(":close", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateGetJobsRequest(int? maxpagesize, string status, string queueId, string channelId, string classificationPolicyId, DateTimeOffset? scheduledBefore, DateTimeOffset? scheduledAfter, 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/jobs", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (maxpagesize != null) + { + uri.AppendQuery("maxpagesize", maxpagesize.Value, true); + } + if (status != null) + { + uri.AppendQuery("status", status, true); + } + if (queueId != null) + { + uri.AppendQuery("queueId", queueId, true); + } + if (channelId != null) + { + uri.AppendQuery("channelId", channelId, true); + } + if (classificationPolicyId != null) + { + uri.AppendQuery("classificationPolicyId", classificationPolicyId, true); + } + if (scheduledBefore != null) + { + uri.AppendQuery("scheduledBefore", scheduledBefore.Value, "O", true); + } + if (scheduledAfter != null) + { + uri.AppendQuery("scheduledAfter", scheduledAfter.Value, "O", true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetQueuePositionRequest(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/jobs/", false); + uri.AppendPath(id, true); + uri.AppendPath("/position", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateUnassignJobRequest(string id, string assignmentId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/routing/jobs/", false); + uri.AppendPath(id, true); + uri.AppendPath("/assignments/", false); + uri.AppendPath(assignmentId, true); + uri.AppendPath(":unassign", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateAcceptJobOfferRequest(string workerId, string offerId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/routing/workers/", false); + uri.AppendPath(workerId, true); + uri.AppendPath("/offers/", false); + uri.AppendPath(offerId, true); + uri.AppendPath(":accept", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateDeclineJobOfferRequest(string workerId, string offerId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/routing/workers/", false); + uri.AppendPath(workerId, true); + uri.AppendPath("/offers/", false); + uri.AppendPath(offerId, true); + uri.AppendPath(":decline", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateGetQueueStatisticsRequest(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.AppendPath("/statistics", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateUpsertWorkerRequest(string workerId, 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/workers/", false); + uri.AppendPath(workerId, 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 CreateGetWorkerRequest(string workerId, 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/workers/", false); + uri.AppendPath(workerId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateDeleteWorkerRequest(string workerId, 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/workers/", false); + uri.AppendPath(workerId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetWorkersRequest(int? maxpagesize, string state, string channelId, string queueId, bool? hasCapacity, 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/workers", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (maxpagesize != null) + { + uri.AppendQuery("maxpagesize", maxpagesize.Value, true); + } + if (state != null) + { + uri.AppendQuery("state", state, true); + } + if (channelId != null) + { + uri.AppendQuery("channelId", channelId, true); + } + if (queueId != null) + { + uri.AppendQuery("queueId", queueId, true); + } + if (hasCapacity != null) + { + uri.AppendQuery("hasCapacity", hasCapacity.Value, 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) + { + 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 }); + private static ResponseClassifier _responseClassifier200202; + private static ResponseClassifier ResponseClassifier200202 => _responseClassifier200202 ??= new StatusCodeClassifier(stackalloc ushort[] { 200, 202 }); + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterClientOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterClientOptions.cs new file mode 100644 index 000000000000..7fd9674962fc --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterClientOptions.cs @@ -0,0 +1,25 @@ +// 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 JobRouterClientOptions : ClientOptions + { + /// The version of the service to use. + public enum ServiceVersion + { + /// Service version "2023-11-01". + V2023_11_01 = 1, + } + + internal string Version { get; } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterRestClient.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterRestClient.cs deleted file mode 100644 index 15694ece3888..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterRestClient.cs +++ /dev/null @@ -1,1739 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Text.Json; -using System.Threading; -using System.Threading.Tasks; -using Azure; -using Azure.Communication.JobRouter.Models; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.Communication.JobRouter -{ - internal partial class JobRouterRestClient - { - private readonly HttpPipeline _pipeline; - private readonly string _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)); - } - - internal HttpMessage CreateUpsertJobRequest(string id, RouterJob patch) - { - 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) - { - 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) - { - 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); - } - } - - 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; - } - - /// - /// [Protocol Method] Creates or updates a router job. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Id of the job. - /// The content to send as the body 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) - { - Argument.AssertNotNullOrEmpty(id, nameof(id)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("JobRouter.UpsertJob"); - scope.Start(); - try - { - using HttpMessage message = CreateUpsertJobRequest(id, content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Creates or updates a router job. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Id of the job. - /// The content to send as the body 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) - { - Argument.AssertNotNullOrEmpty(id, nameof(id)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("JobRouter.UpsertJob"); - scope.Start(); - try - { - using HttpMessage message = CreateUpsertJobRequest(id, content, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - 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 cancellation token to use. - /// is null. - public async Task> GetJobAsync(string id, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(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); - } - } - - /// Retrieves an existing job by Id. - /// Id of the job to retrieve. - /// The cancellation token to use. - /// is null. - public 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); - } - } - - 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; - } - - /// Deletes a job and all of its traces. - /// Id of the job. - /// The cancellation token to use. - /// is null. - public async Task DeleteJobAsync(string id, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - - using var message = CreateDeleteJobRequest(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 job and all of its traces. - /// Id of the job. - /// The cancellation token to use. - /// is null. - public Response DeleteJob(string id, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - - using var message = CreateDeleteJobRequest(id); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - 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) - { - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(reclassifyJobRequest); - request.Content = content; - } - return message; - } - - /// Reclassify a job. - /// Id of the job. - /// Request object for reclassifying a job. - /// The cancellation token to use. - /// is null. - public async Task> ReclassifyJobActionAsync(string id, object reclassifyJobRequest = null, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - - using var message = CreateReclassifyJobActionRequest(id, reclassifyJobRequest); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - 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); - } - } - - /// Reclassify a job. - /// Id of the job. - /// Request object for reclassifying a job. - /// The cancellation token to use. - /// is null. - public Response ReclassifyJobAction(string id, object reclassifyJobRequest = null, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - - using var message = CreateReclassifyJobActionRequest(id, reclassifyJobRequest); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - object value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = document.RootElement.GetObject(); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateCancelJobActionRequest(string id, string note, string dispositionCode) - { - 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(":cancel", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var model = new CancelJobRequest() - { - Note = note, - DispositionCode = dispositionCode - }; - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(model); - request.Content = content; - return message; - } - - /// Submits request to cancel an existing job by Id while supplying free-form cancellation reason. - /// Id of the job. - /// (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. - /// - /// The cancellation token to use. - /// is null. - public async Task> CancelJobActionAsync(string id, string note = null, string dispositionCode = null, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - - using var message = CreateCancelJobActionRequest(id, note, dispositionCode); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - 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); - } - } - - /// Submits request to cancel an existing job by Id while supplying free-form cancellation reason. - /// Id of the job. - /// (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. - /// - /// The cancellation token to use. - /// is null. - public Response CancelJobAction(string id, string note = null, string dispositionCode = null, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - - using var message = CreateCancelJobActionRequest(id, note, dispositionCode); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - object value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = document.RootElement.GetObject(); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateCompleteJobActionRequest(string id, string assignmentId, string note) - { - 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(":complete", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var model = new CompleteJobRequest(assignmentId) - { - Note = note - }; - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(model); - request.Content = content; - return message; - } - - /// Completes an assigned job. - /// Id of the job. - /// The assignment within the job to complete. - /// (Optional) A note that will be appended to the jobs' Notes collection with the current timestamp. - /// The cancellation token to use. - /// or is null. - public async Task> CompleteJobActionAsync(string id, string assignmentId, string note = null, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - if (assignmentId == null) - { - throw new ArgumentNullException(nameof(assignmentId)); - } - - using var message = CreateCompleteJobActionRequest(id, assignmentId, note); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - 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); - } - } - - /// Completes an assigned job. - /// Id of the job. - /// The assignment within the job to complete. - /// (Optional) A note that will be appended to the jobs' Notes collection with the current timestamp. - /// The cancellation token to use. - /// or is null. - public Response CompleteJobAction(string id, string assignmentId, string note = null, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - if (assignmentId == null) - { - throw new ArgumentNullException(nameof(assignmentId)); - } - - using var message = CreateCompleteJobActionRequest(id, assignmentId, note); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - object value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = document.RootElement.GetObject(); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateCloseJobActionRequest(string id, string assignmentId, string dispositionCode, DateTimeOffset? closeAt, string note) - { - 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(":close", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - request.Headers.Add("Content-Type", "application/json"); - var model = new CloseJobRequest(assignmentId) - { - DispositionCode = dispositionCode, - CloseAt = closeAt, - Note = note - }; - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(model); - request.Content = content; - return message; - } - - /// Closes a completed job. - /// Id of the job. - /// 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. - /// The cancellation token to use. - /// or is null. - public async Task> CloseJobActionAsync(string id, string assignmentId, string dispositionCode = null, DateTimeOffset? closeAt = null, string note = null, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - if (assignmentId == null) - { - throw new ArgumentNullException(nameof(assignmentId)); - } - - using var message = CreateCloseJobActionRequest(id, assignmentId, dispositionCode, closeAt, note); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 202: - { - 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); - } - } - - /// Closes a completed job. - /// Id of the job. - /// 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. - /// The cancellation token to use. - /// or is null. - public Response CloseJobAction(string id, string assignmentId, string dispositionCode = null, DateTimeOffset? closeAt = null, string note = null, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - if (assignmentId == null) - { - throw new ArgumentNullException(nameof(assignmentId)); - } - - using var message = CreateCloseJobActionRequest(id, assignmentId, dispositionCode, closeAt, note); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 202: - { - object value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = document.RootElement.GetObject(); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListJobsRequest(RouterJobStatusSelector? status, string queueId, string channelId, string classificationPolicyId, DateTimeOffset? scheduledBefore, DateTimeOffset? scheduledAfter, 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/jobs", false); - if (status != null) - { - uri.AppendQuery("status", status.Value.ToString(), true); - } - if (queueId != null) - { - uri.AppendQuery("queueId", queueId, true); - } - if (channelId != null) - { - uri.AppendQuery("channelId", channelId, true); - } - if (classificationPolicyId != null) - { - uri.AppendQuery("classificationPolicyId", classificationPolicyId, true); - } - if (scheduledBefore != null) - { - uri.AppendQuery("scheduledBefore", scheduledBefore.Value, "O", true); - } - if (scheduledAfter != null) - { - uri.AppendQuery("scheduledAfter", scheduledAfter.Value, "O", true); - } - 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; - } - - /// Retrieves list of jobs based on filter parameters. - /// If specified, filter jobs by status. - /// If specified, filter jobs by queue. - /// If specified, filter jobs by channel. - /// If specified, filter jobs by classificationPolicy. - /// If specified, filter on jobs that was scheduled before or at given timestamp. Range: (-Inf, scheduledBefore]. - /// If specified, filter on jobs that was scheduled at or after given value. Range: [scheduledAfter, +Inf). - /// Number of objects to return per page. - /// The cancellation token to use. - public async Task> ListJobsAsync(RouterJobStatusSelector? status = null, string queueId = null, string channelId = null, string classificationPolicyId = null, DateTimeOffset? scheduledBefore = null, DateTimeOffset? scheduledAfter = null, int? maxpagesize = null, CancellationToken cancellationToken = default) - { - using var message = CreateListJobsRequest(status, queueId, channelId, classificationPolicyId, scheduledBefore, scheduledAfter, maxpagesize); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RouterJobCollection value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RouterJobCollection.DeserializeRouterJobCollection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Retrieves list of jobs based on filter parameters. - /// If specified, filter jobs by status. - /// If specified, filter jobs by queue. - /// If specified, filter jobs by channel. - /// If specified, filter jobs by classificationPolicy. - /// If specified, filter on jobs that was scheduled before or at given timestamp. Range: (-Inf, scheduledBefore]. - /// If specified, filter on jobs that was scheduled at or after given value. Range: [scheduledAfter, +Inf). - /// Number of objects to return per page. - /// The cancellation token to use. - public Response ListJobs(RouterJobStatusSelector? status = null, string queueId = null, string channelId = null, string classificationPolicyId = null, DateTimeOffset? scheduledBefore = null, DateTimeOffset? scheduledAfter = null, int? maxpagesize = null, CancellationToken cancellationToken = default) - { - using var message = CreateListJobsRequest(status, queueId, channelId, classificationPolicyId, scheduledBefore, scheduledAfter, maxpagesize); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RouterJobCollection value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RouterJobCollection.DeserializeRouterJobCollection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateGetInQueuePositionRequest(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.AppendPath("/position", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Gets a job's position details. - /// Id of the job. - /// The cancellation token to use. - /// is null. - public async Task> GetInQueuePositionAsync(string id, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - - using var message = CreateGetInQueuePositionRequest(id); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RouterJobPositionDetails value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RouterJobPositionDetails.DeserializeRouterJobPositionDetails(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Gets a job's position details. - /// Id of the job. - /// The cancellation token to use. - /// is null. - public Response GetInQueuePosition(string id, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - - using var message = CreateGetInQueuePositionRequest(id); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RouterJobPositionDetails value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RouterJobPositionDetails.DeserializeRouterJobPositionDetails(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateUnassignJobActionRequest(string id, string assignmentId, UnassignJobRequest unassignJobRequest) - { - 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("/assignments/", false); - uri.AppendPath(assignmentId, true); - uri.AppendPath(":unassign", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - if (unassignJobRequest != null) - { - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(unassignJobRequest); - request.Content = content; - } - return message; - } - - /// Un-assign a job. - /// Id of the job to un-assign. - /// Id of the assignment to un-assign. - /// Request body for unassign route. - /// The cancellation token to use. - /// or is null. - public async Task> UnassignJobActionAsync(string id, string assignmentId, UnassignJobRequest unassignJobRequest = null, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - if (assignmentId == null) - { - throw new ArgumentNullException(nameof(assignmentId)); - } - - using var message = CreateUnassignJobActionRequest(id, assignmentId, unassignJobRequest); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - UnassignJobResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = UnassignJobResult.DeserializeUnassignJobResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Un-assign a job. - /// Id of the job to un-assign. - /// Id of the assignment to un-assign. - /// Request body for unassign route. - /// The cancellation token to use. - /// or is null. - public Response UnassignJobAction(string id, string assignmentId, UnassignJobRequest unassignJobRequest = null, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - if (assignmentId == null) - { - throw new ArgumentNullException(nameof(assignmentId)); - } - - using var message = CreateUnassignJobActionRequest(id, assignmentId, unassignJobRequest); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - UnassignJobResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = UnassignJobResult.DeserializeUnassignJobResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateAcceptJobActionRequest(string workerId, string offerId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/workers/", false); - uri.AppendPath(workerId, true); - uri.AppendPath("/offers/", false); - uri.AppendPath(offerId, true); - uri.AppendPath(":accept", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Accepts an offer to work on a job and returns a 409/Conflict if another agent accepted the job already. - /// Id of the worker. - /// Id of the offer. - /// The cancellation token to use. - /// or is null. - public async Task> AcceptJobActionAsync(string workerId, string offerId, CancellationToken cancellationToken = default) - { - if (workerId == null) - { - throw new ArgumentNullException(nameof(workerId)); - } - if (offerId == null) - { - throw new ArgumentNullException(nameof(offerId)); - } - - using var message = CreateAcceptJobActionRequest(workerId, offerId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - AcceptJobOfferResult value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = AcceptJobOfferResult.DeserializeAcceptJobOfferResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Accepts an offer to work on a job and returns a 409/Conflict if another agent accepted the job already. - /// Id of the worker. - /// Id of the offer. - /// The cancellation token to use. - /// or is null. - public Response AcceptJobAction(string workerId, string offerId, CancellationToken cancellationToken = default) - { - if (workerId == null) - { - throw new ArgumentNullException(nameof(workerId)); - } - if (offerId == null) - { - throw new ArgumentNullException(nameof(offerId)); - } - - using var message = CreateAcceptJobActionRequest(workerId, offerId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - AcceptJobOfferResult value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = AcceptJobOfferResult.DeserializeAcceptJobOfferResult(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateDeclineJobActionRequest(string workerId, string offerId, DeclineJobOfferRequest declineJobOfferRequest) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Post; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/workers/", false); - uri.AppendPath(workerId, true); - uri.AppendPath("/offers/", false); - uri.AppendPath(offerId, true); - uri.AppendPath(":decline", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - if (declineJobOfferRequest != null) - { - request.Headers.Add("Content-Type", "application/json"); - var content = new Utf8JsonRequestContent(); - content.JsonWriter.WriteObjectValue(declineJobOfferRequest); - request.Content = content; - } - return message; - } - - /// Declines an offer to work on a job. - /// Id of the worker. - /// Id of the offer. - /// Request model for declining offer. - /// The cancellation token to use. - /// or is null. - public async Task> DeclineJobActionAsync(string workerId, string offerId, DeclineJobOfferRequest declineJobOfferRequest = null, CancellationToken cancellationToken = default) - { - if (workerId == null) - { - throw new ArgumentNullException(nameof(workerId)); - } - if (offerId == null) - { - throw new ArgumentNullException(nameof(offerId)); - } - - using var message = CreateDeclineJobActionRequest(workerId, offerId, declineJobOfferRequest); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - 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); - } - } - - /// Declines an offer to work on a job. - /// Id of the worker. - /// Id of the offer. - /// Request model for declining offer. - /// The cancellation token to use. - /// or is null. - public Response DeclineJobAction(string workerId, string offerId, DeclineJobOfferRequest declineJobOfferRequest = null, CancellationToken cancellationToken = default) - { - if (workerId == null) - { - throw new ArgumentNullException(nameof(workerId)); - } - if (offerId == null) - { - throw new ArgumentNullException(nameof(offerId)); - } - - using var message = CreateDeclineJobActionRequest(workerId, offerId, declineJobOfferRequest); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - object value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = document.RootElement.GetObject(); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateGetQueueStatisticsRequest(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.AppendPath("/statistics", false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Retrieves a queue's statistics. - /// Id of the queue to retrieve statistics. - /// The cancellation token to use. - /// is null. - public async Task> GetQueueStatisticsAsync(string id, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - - using var message = CreateGetQueueStatisticsRequest(id); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RouterQueueStatistics value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RouterQueueStatistics.DeserializeRouterQueueStatistics(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Retrieves a queue's statistics. - /// Id of the queue to retrieve statistics. - /// The cancellation token to use. - /// is null. - public Response GetQueueStatistics(string id, CancellationToken cancellationToken = default) - { - if (id == null) - { - throw new ArgumentNullException(nameof(id)); - } - - using var message = CreateGetQueueStatisticsRequest(id); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RouterQueueStatistics value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RouterQueueStatistics.DeserializeRouterQueueStatistics(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateUpsertWorkerRequest(string workerId, RouterWorker patch) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Patch; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/workers/", false); - uri.AppendPath(workerId, 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 worker. - /// Id of the worker. - /// Model of worker 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> UpsertWorkerAsync(string workerId, RouterWorker patch, CancellationToken cancellationToken = default) - { - if (workerId == null) - { - throw new ArgumentNullException(nameof(workerId)); - } - if (patch == null) - { - throw new ArgumentNullException(nameof(patch)); - } - - using var message = CreateUpsertWorkerRequest(workerId, patch); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - case 201: - { - RouterWorker value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RouterWorker.DeserializeRouterWorker(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Creates or updates a worker. - /// Id of the worker. - /// Model of worker 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 UpsertWorker(string workerId, RouterWorker patch, CancellationToken cancellationToken = default) - { - if (workerId == null) - { - throw new ArgumentNullException(nameof(workerId)); - } - if (patch == null) - { - throw new ArgumentNullException(nameof(patch)); - } - - using var message = CreateUpsertWorkerRequest(workerId, patch); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - case 201: - { - RouterWorker value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RouterWorker.DeserializeRouterWorker(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateUpsertWorkerRequest(string workerId, 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/workers/", false); - uri.AppendPath(workerId, 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 worker. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Id of the worker. - /// The content to send as the body 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 UpsertWorkerAsync(string workerId, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("JobRouter.UpsertWorker"); - scope.Start(); - try - { - using HttpMessage message = CreateUpsertWorkerRequest(workerId, content, context); - return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - /// - /// [Protocol Method] Creates or updates a worker. - /// - /// - /// - /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. - /// - /// - /// - /// - /// Id of the worker. - /// The content to send as the body 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 UpsertWorker(string workerId, RequestContent content, RequestContext context = null) - { - Argument.AssertNotNullOrEmpty(workerId, nameof(workerId)); - Argument.AssertNotNull(content, nameof(content)); - - using var scope = ClientDiagnostics.CreateScope("JobRouter.UpsertWorker"); - scope.Start(); - try - { - using HttpMessage message = CreateUpsertWorkerRequest(workerId, content, context); - return _pipeline.ProcessMessage(message, context); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - internal HttpMessage CreateGetWorkerRequest(string workerId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/workers/", false); - uri.AppendPath(workerId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Retrieves an existing worker by Id. - /// Id of the worker to retrieve. - /// The cancellation token to use. - /// is null. - public async Task> GetWorkerAsync(string workerId, CancellationToken cancellationToken = default) - { - if (workerId == null) - { - throw new ArgumentNullException(nameof(workerId)); - } - - using var message = CreateGetWorkerRequest(workerId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RouterWorker value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RouterWorker.DeserializeRouterWorker(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Retrieves an existing worker by Id. - /// Id of the worker to retrieve. - /// The cancellation token to use. - /// is null. - public Response GetWorker(string workerId, CancellationToken cancellationToken = default) - { - if (workerId == null) - { - throw new ArgumentNullException(nameof(workerId)); - } - - using var message = CreateGetWorkerRequest(workerId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RouterWorker value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RouterWorker.DeserializeRouterWorker(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateDeleteWorkerRequest(string workerId) - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Delete; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendPath("/routing/workers/", false); - uri.AppendPath(workerId, true); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - - /// Deletes a worker and all of its traces. - /// Id of the worker to delete. - /// The cancellation token to use. - /// is null. - public async Task DeleteWorkerAsync(string workerId, CancellationToken cancellationToken = default) - { - if (workerId == null) - { - throw new ArgumentNullException(nameof(workerId)); - } - - using var message = CreateDeleteWorkerRequest(workerId); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - /// Deletes a worker and all of its traces. - /// Id of the worker to delete. - /// The cancellation token to use. - /// is null. - public Response DeleteWorker(string workerId, CancellationToken cancellationToken = default) - { - if (workerId == null) - { - throw new ArgumentNullException(nameof(workerId)); - } - - using var message = CreateDeleteWorkerRequest(workerId); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 204: - return message.Response; - default: - throw new RequestFailedException(message.Response); - } - } - - internal HttpMessage CreateListWorkersRequest(RouterWorkerStateSelector? state, string channelId, string queueId, bool? hasCapacity, 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/workers", false); - if (state != null) - { - uri.AppendQuery("state", state.Value.ToString(), true); - } - if (channelId != null) - { - uri.AppendQuery("channelId", channelId, true); - } - if (queueId != null) - { - uri.AppendQuery("queueId", queueId, true); - } - if (hasCapacity != null) - { - uri.AppendQuery("hasCapacity", hasCapacity.Value, true); - } - 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; - } - - /// Retrieves existing workers. - /// If specified, select workers by worker state. - /// If specified, select workers who have a channel configuration with this channel. - /// If specified, select workers who are assigned to this queue. - /// - /// If set to true, select only workers who have capacity for the channel specified by `channelId` or for any channel - /// if `channelId` not specified. If set to false, then will return all workers including workers without any capacity for jobs. Defaults to false. - /// - /// Number of objects to return per page. - /// The cancellation token to use. - public async Task> ListWorkersAsync(RouterWorkerStateSelector? state = null, string channelId = null, string queueId = null, bool? hasCapacity = null, int? maxpagesize = null, CancellationToken cancellationToken = default) - { - using var message = CreateListWorkersRequest(state, channelId, queueId, hasCapacity, maxpagesize); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RouterWorkerCollection value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RouterWorkerCollection.DeserializeRouterWorkerCollection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Retrieves existing workers. - /// If specified, select workers by worker state. - /// If specified, select workers who have a channel configuration with this channel. - /// If specified, select workers who are assigned to this queue. - /// - /// If set to true, select only workers who have capacity for the channel specified by `channelId` or for any channel - /// if `channelId` not specified. If set to false, then will return all workers including workers without any capacity for jobs. Defaults to false. - /// - /// Number of objects to return per page. - /// The cancellation token to use. - public Response ListWorkers(RouterWorkerStateSelector? state = null, string channelId = null, string queueId = null, bool? hasCapacity = null, int? maxpagesize = null, CancellationToken cancellationToken = default) - { - using var message = CreateListWorkersRequest(state, channelId, queueId, hasCapacity, maxpagesize); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RouterWorkerCollection value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RouterWorkerCollection.DeserializeRouterWorkerCollection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Retrieves list of jobs based on filter parameters. - /// The URL to the next page of results. - /// If specified, filter jobs by status. - /// If specified, filter jobs by queue. - /// If specified, filter jobs by channel. - /// If specified, filter jobs by classificationPolicy. - /// If specified, filter on jobs that was scheduled before or at given timestamp. Range: (-Inf, scheduledBefore]. - /// If specified, filter on jobs that was scheduled at or after given value. Range: [scheduledAfter, +Inf). - /// Number of objects to return per page. - /// The cancellation token to use. - /// is null. - public async Task> ListJobsNextPageAsync(string nextLink, RouterJobStatusSelector? status = null, string queueId = null, string channelId = null, string classificationPolicyId = null, DateTimeOffset? scheduledBefore = null, DateTimeOffset? scheduledAfter = null, int? maxpagesize = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - - using var message = CreateListJobsNextPageRequest(nextLink, status, queueId, channelId, classificationPolicyId, scheduledBefore, scheduledAfter, maxpagesize); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RouterJobCollection value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RouterJobCollection.DeserializeRouterJobCollection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Retrieves list of jobs based on filter parameters. - /// The URL to the next page of results. - /// If specified, filter jobs by status. - /// If specified, filter jobs by queue. - /// If specified, filter jobs by channel. - /// If specified, filter jobs by classificationPolicy. - /// If specified, filter on jobs that was scheduled before or at given timestamp. Range: (-Inf, scheduledBefore]. - /// If specified, filter on jobs that was scheduled at or after given value. Range: [scheduledAfter, +Inf). - /// Number of objects to return per page. - /// The cancellation token to use. - /// is null. - public Response ListJobsNextPage(string nextLink, RouterJobStatusSelector? status = null, string queueId = null, string channelId = null, string classificationPolicyId = null, DateTimeOffset? scheduledBefore = null, DateTimeOffset? scheduledAfter = null, int? maxpagesize = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - - using var message = CreateListJobsNextPageRequest(nextLink, status, queueId, channelId, classificationPolicyId, scheduledBefore, scheduledAfter, maxpagesize); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RouterJobCollection value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RouterJobCollection.DeserializeRouterJobCollection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Retrieves existing workers. - /// The URL to the next page of results. - /// If specified, select workers by worker state. - /// If specified, select workers who have a channel configuration with this channel. - /// If specified, select workers who are assigned to this queue. - /// - /// If set to true, select only workers who have capacity for the channel specified by `channelId` or for any channel - /// if `channelId` not specified. If set to false, then will return all workers including workers without any capacity for jobs. Defaults to false. - /// - /// Number of objects to return per page. - /// The cancellation token to use. - /// is null. - public async Task> ListWorkersNextPageAsync(string nextLink, RouterWorkerStateSelector? state = null, string channelId = null, string queueId = null, bool? hasCapacity = null, int? maxpagesize = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - - using var message = CreateListWorkersNextPageRequest(nextLink, state, channelId, queueId, hasCapacity, maxpagesize); - await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); - switch (message.Response.Status) - { - case 200: - { - RouterWorkerCollection value = default; - using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, default, cancellationToken).ConfigureAwait(false); - value = RouterWorkerCollection.DeserializeRouterWorkerCollection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - /// Retrieves existing workers. - /// The URL to the next page of results. - /// If specified, select workers by worker state. - /// If specified, select workers who have a channel configuration with this channel. - /// If specified, select workers who are assigned to this queue. - /// - /// If set to true, select only workers who have capacity for the channel specified by `channelId` or for any channel - /// if `channelId` not specified. If set to false, then will return all workers including workers without any capacity for jobs. Defaults to false. - /// - /// Number of objects to return per page. - /// The cancellation token to use. - /// is null. - public Response ListWorkersNextPage(string nextLink, RouterWorkerStateSelector? state = null, string channelId = null, string queueId = null, bool? hasCapacity = null, int? maxpagesize = null, CancellationToken cancellationToken = default) - { - if (nextLink == null) - { - throw new ArgumentNullException(nameof(nextLink)); - } - - using var message = CreateListWorkersNextPageRequest(nextLink, state, channelId, queueId, hasCapacity, maxpagesize); - _pipeline.Send(message, cancellationToken); - switch (message.Response.Status) - { - case 200: - { - RouterWorkerCollection value = default; - using var document = JsonDocument.Parse(message.Response.ContentStream); - value = RouterWorkerCollection.DeserializeRouterWorkerCollection(document.RootElement); - return Response.FromValue(value, message.Response); - } - default: - throw new RequestFailedException(message.Response); - } - } - - private static ResponseClassifier _responseClassifier200201; - private static ResponseClassifier ResponseClassifier200201 => _responseClassifier200201 ??= new StatusCodeClassifier(stackalloc ushort[] { 200, 201 }); - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/LabelOperator.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/LabelOperator.cs similarity index 88% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/LabelOperator.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/LabelOperator.cs index c801400b0395..37821aec0006 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/LabelOperator.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/LabelOperator.cs @@ -10,7 +10,7 @@ namespace Azure.Communication.JobRouter { - /// Describes how the value of the label is compared to the value pass through. + /// Describes supported operations on label values. public readonly partial struct LabelOperator : IEquatable { private readonly string _value; @@ -29,17 +29,17 @@ public LabelOperator(string value) private const string GreaterThanValue = "greaterThan"; private const string GreaterThanEqualValue = "greaterThanEqual"; - /// equal. + /// Equal. public static LabelOperator Equal { get; } = new LabelOperator(EqualValue); - /// notEqual. + /// Not Equal. public static LabelOperator NotEqual { get; } = new LabelOperator(NotEqualValue); - /// lessThan. + /// Less than. public static LabelOperator LessThan { get; } = new LabelOperator(LessThanValue); - /// lessThanEqual. + /// Less than or equal. public static LabelOperator LessThanEqual { get; } = new LabelOperator(LessThanEqualValue); - /// greaterThan. + /// Greater than. public static LabelOperator GreaterThan { get; } = new LabelOperator(GreaterThanValue); - /// greaterThanEqual. + /// Greater than or equal. public static LabelOperator GreaterThanEqual { get; } = new LabelOperator(GreaterThanEqualValue); /// Determines if two values are the same. public static bool operator ==(LabelOperator left, LabelOperator right) => left.Equals(right); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/LongestIdleMode.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/LongestIdleMode.Serialization.cs similarity index 69% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/LongestIdleMode.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/LongestIdleMode.Serialization.cs index 2eead67d7af9..bbf151268ae4 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/LongestIdleMode.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/LongestIdleMode.Serialization.cs @@ -6,35 +6,13 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class LongestIdleMode : IUtf8JsonSerializable + public partial class LongestIdleMode { - 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 LongestIdleMode DeserializeLongestIdleMode(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -82,5 +60,13 @@ internal static LongestIdleMode DeserializeLongestIdleMode(JsonElement element) } return new LongestIdleMode(kind, minConcurrentOffers, maxConcurrentOffers, Optional.ToNullable(bypassSelectors)); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new LongestIdleMode FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeLongestIdleMode(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/LongestIdleMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/LongestIdleMode.cs similarity index 74% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/LongestIdleMode.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/LongestIdleMode.cs index a1286abc7871..3ec5c0b8ae0c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/LongestIdleMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/LongestIdleMode.cs @@ -11,19 +11,21 @@ namespace Azure.Communication.JobRouter public partial class LongestIdleMode : DistributionMode { /// Initializes a new instance of LongestIdleMode. - /// 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 LongestIdleMode(string kind, int minConcurrentOffers, int maxConcurrentOffers, bool? bypassSelectors) : base(kind, minConcurrentOffers, maxConcurrentOffers, bypassSelectors) { - Kind = kind ?? "longest-idle"; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ManualReclassifyExceptionAction.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ManualReclassifyExceptionAction.Serialization.cs similarity index 66% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ManualReclassifyExceptionAction.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ManualReclassifyExceptionAction.Serialization.cs index aa1024d136eb..7565c4c96130 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ManualReclassifyExceptionAction.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ManualReclassifyExceptionAction.Serialization.cs @@ -7,40 +7,13 @@ using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class ManualReclassifyExceptionAction : IUtf8JsonSerializable + public partial class ManualReclassifyExceptionAction { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(QueueId)) - { - writer.WritePropertyName("queueId"u8); - writer.WriteStringValue(QueueId); - } - if (Optional.IsDefined(Priority)) - { - writer.WritePropertyName("priority"u8); - writer.WriteNumberValue(Priority.Value); - } - if (Optional.IsCollectionDefined(WorkerSelectors)) - { - 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 ManualReclassifyExceptionAction DeserializeManualReclassifyExceptionAction(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -49,7 +22,7 @@ internal static ManualReclassifyExceptionAction DeserializeManualReclassifyExcep } Optional queueId = default; Optional priority = default; - Optional> workerSelectors = default; + Optional> workerSelectors = default; string kind = default; foreach (var property in element.EnumerateObject()) { @@ -89,5 +62,13 @@ internal static ManualReclassifyExceptionAction DeserializeManualReclassifyExcep } return new ManualReclassifyExceptionAction(kind, queueId.Value, Optional.ToNullable(priority), Optional.ToList(workerSelectors)); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new ManualReclassifyExceptionAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeManualReclassifyExceptionAction(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ManualReclassifyExceptionAction.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ManualReclassifyExceptionAction.cs similarity index 51% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ManualReclassifyExceptionAction.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ManualReclassifyExceptionAction.cs index d4cd4a08f106..c6a6a5b911d6 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ManualReclassifyExceptionAction.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ManualReclassifyExceptionAction.cs @@ -10,27 +10,22 @@ namespace Azure.Communication.JobRouter { - /// An action that manually reclassifies a job by providing the queue, priority and worker selectors. + /// + /// An action that manually reclassifies a job by providing the queue, priority and + /// worker selectors. + /// public partial class ManualReclassifyExceptionAction : ExceptionAction { /// Initializes a new instance of ManualReclassifyExceptionAction. - /// The type discriminator describing a sub-type of ExceptionAction. + /// Discriminator. /// Updated QueueId. /// Updated Priority. /// Updated WorkerSelectors. - internal ManualReclassifyExceptionAction(string kind, string queueId, int? priority, IList workerSelectors) : base(kind) + internal ManualReclassifyExceptionAction(string kind, string queueId, int? priority, IReadOnlyList workerSelectors) : base(kind) { QueueId = queueId; Priority = priority; - WorkerSelectors = workerSelectors; - Kind = kind ?? "manual-reclassify"; + _workerSelectors = workerSelectors; } - - /// Updated QueueId. - public string QueueId { get; set; } - /// Updated Priority. - public int? Priority { get; set; } - /// Updated WorkerSelectors. - public IList WorkerSelectors { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/BestWorkerMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/BestWorkerMode.cs deleted file mode 100644 index 3cb41b46f2a5..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/BestWorkerMode.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using Azure.Communication.JobRouter.Models; - -namespace Azure.Communication.JobRouter -{ - /// Jobs are distributed to the worker with the strongest abilities available. - public partial class BestWorkerMode : DistributionMode - { - /// Initializes a new instance of BestWorkerMode. - /// The type discriminator describing a sub-type of Mode. - /// 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. - /// 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 . - /// - /// 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.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelExceptionAction.cs deleted file mode 100644 index 42eb31dfe482..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelExceptionAction.cs +++ /dev/null @@ -1,35 +0,0 @@ -// 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. - public CancelExceptionAction() - { - Kind = "cancel"; - } - - /// Initializes a new instance of CancelExceptionAction. - /// The type discriminator describing a sub-type of ExceptionAction. - /// (Optional) A note that will be appended to the jobs' Notes collection with th 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; - Kind = kind ?? "cancel"; - } - - /// (Optional) A note that will be appended to the jobs' Notes collection with th current timestamp. - public string Note { get; set; } - /// (Optional) Indicates the outcome of the job, populate this field with your own custom values. - public string DispositionCode { get; set; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelJobRequest.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelJobRequest.cs deleted file mode 100644 index 9b18b0cce910..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CancelJobRequest.cs +++ /dev/null @@ -1,26 +0,0 @@ -// 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() - { - } - - /// (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/ClassificationPolicy.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicy.cs deleted file mode 100644 index cb984d54490a..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicy.cs +++ /dev/null @@ -1,55 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Communication.JobRouter; -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - /// 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. - /// 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 . - /// - /// - /// 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 . - /// - /// - /// The worker label selectors to attach to a given job. - /// 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 . - /// - 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/ClassificationPolicyCollection.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyCollection.Serialization.cs deleted file mode 100644 index 6652a5ef1178..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyCollection.Serialization.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - internal partial class ClassificationPolicyCollection - { - internal static ClassificationPolicyCollection DeserializeClassificationPolicyCollection(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList value = default; - Optional nextLink = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ClassificationPolicyItem.DeserializeClassificationPolicyItem(item)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink"u8)) - { - nextLink = property.Value.GetString(); - continue; - } - } - return new ClassificationPolicyCollection(value, nextLink.Value); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyCollection.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyCollection.cs deleted file mode 100644 index 0a9c01641853..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ClassificationPolicyCollection.cs +++ /dev/null @@ -1,42 +0,0 @@ -// 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.Models -{ - /// A paged collection of classification policies. - internal partial class ClassificationPolicyCollection - { - /// Initializes a new instance of ClassificationPolicyCollection. - /// - /// is null. - internal ClassificationPolicyCollection(IEnumerable value) - { - Argument.AssertNotNull(value, nameof(value)); - - Value = value.ToList(); - } - - /// Initializes a new instance of ClassificationPolicyCollection. - /// - /// - internal ClassificationPolicyCollection(IReadOnlyList value, string nextLink) - { - Value = value; - NextLink = nextLink; - } - - /// Gets the value. - public IReadOnlyList Value { get; } - /// Gets the next link. - public string NextLink { get; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CloseJobRequest.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CloseJobRequest.cs deleted file mode 100644 index 7e98c345de30..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CloseJobRequest.cs +++ /dev/null @@ -1,38 +0,0 @@ -// 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; - } - - /// 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/Models/CommunicationError.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationError.Serialization.cs deleted file mode 100644 index e25a471186de..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationError.Serialization.cs +++ /dev/null @@ -1,71 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - internal partial class CommunicationError - { - internal static CommunicationError DeserializeCommunicationError(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - string code = default; - string message = default; - Optional target = default; - Optional> details = default; - Optional innererror = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("code"u8)) - { - code = property.Value.GetString(); - continue; - } - if (property.NameEquals("message"u8)) - { - message = property.Value.GetString(); - continue; - } - if (property.NameEquals("target"u8)) - { - target = property.Value.GetString(); - continue; - } - if (property.NameEquals("details"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(DeserializeCommunicationError(item)); - } - details = array; - continue; - } - if (property.NameEquals("innererror"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - innererror = DeserializeCommunicationError(property.Value); - continue; - } - } - return new CommunicationError(code, message, target.Value, Optional.ToList(details), innererror.Value); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationError.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationError.cs deleted file mode 100644 index dc84a9b221a8..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationError.cs +++ /dev/null @@ -1,57 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.Collections.Generic; -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - /// The Communication Services error. - internal partial class CommunicationError - { - /// Initializes a new instance of CommunicationError. - /// The error code. - /// The error message. - /// or is null. - internal CommunicationError(string code, string message) - { - Argument.AssertNotNull(code, nameof(code)); - Argument.AssertNotNull(message, nameof(message)); - - Code = code; - Message = message; - Details = new ChangeTrackingList(); - } - - /// Initializes a new instance of CommunicationError. - /// The error code. - /// The error message. - /// The error target. - /// Further details about specific errors that led to this error. - /// The inner error if any. - internal CommunicationError(string code, string message, string target, IReadOnlyList details, CommunicationError innerError) - { - Code = code; - Message = message; - Target = target; - Details = details; - InnerError = innerError; - } - - /// The error code. - public string Code { get; } - /// The error message. - public string Message { get; } - /// The error target. - public string Target { get; } - /// Further details about specific errors that led to this error. - public IReadOnlyList Details { get; } - /// The inner error if any. - public CommunicationError InnerError { get; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationErrorResponse.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationErrorResponse.Serialization.cs deleted file mode 100644 index a1511e81afec..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationErrorResponse.Serialization.cs +++ /dev/null @@ -1,33 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Communication.JobRouter.Models; - -namespace Azure.Communication.JobRouter -{ - internal partial class CommunicationErrorResponse - { - internal static CommunicationErrorResponse DeserializeCommunicationErrorResponse(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - CommunicationError error = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("error"u8)) - { - error = CommunicationError.DeserializeCommunicationError(property.Value); - continue; - } - } - return new CommunicationErrorResponse(error); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationErrorResponse.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationErrorResponse.cs deleted file mode 100644 index a36c24212d0c..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/CommunicationErrorResponse.cs +++ /dev/null @@ -1,30 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure.Communication.JobRouter.Models; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - /// The Communication Services error. - internal partial class CommunicationErrorResponse - { - /// Initializes a new instance of CommunicationErrorResponse. - /// The Communication Services error. - /// is null. - internal CommunicationErrorResponse(CommunicationError error) - { - Argument.AssertNotNull(error, nameof(error)); - - Error = error; - } - - /// The Communication Services error. - public CommunicationError Error { get; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalQueueSelectorAttachment.cs deleted file mode 100644 index b3f43c4218d3..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalQueueSelectorAttachment.cs +++ /dev/null @@ -1,78 +0,0 @@ -// 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. - /// 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 . - /// - /// The queue selectors to attach. - /// or is null. - public ConditionalQueueSelectorAttachment(RouterRule condition, IEnumerable queueSelectors) - { - Argument.AssertNotNull(condition, nameof(condition)); - Argument.AssertNotNull(queueSelectors, nameof(queueSelectors)); - - Condition = condition; - QueueSelectors = queueSelectors.ToList(); - Kind = "conditional"; - } - - /// Initializes a new instance of ConditionalQueueSelectorAttachment. - /// The type discriminator describing the type of queue selector attachment. - /// - /// 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 . - /// - /// The queue selectors to attach. - internal ConditionalQueueSelectorAttachment(string kind, RouterRule condition, IList queueSelectors) : base(kind) - { - Condition = condition; - QueueSelectors = queueSelectors; - Kind = kind ?? "conditional"; - } - - /// - /// 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 . - /// - public RouterRule Condition { get; set; } - /// The queue selectors to attach. - public IList QueueSelectors { get; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalWorkerSelectorAttachment.cs deleted file mode 100644 index 74d82d55228a..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ConditionalWorkerSelectorAttachment.cs +++ /dev/null @@ -1,78 +0,0 @@ -// 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. - /// 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 . - /// - /// The worker selectors to attach. - /// or is null. - public ConditionalWorkerSelectorAttachment(RouterRule condition, IEnumerable workerSelectors) - { - Argument.AssertNotNull(condition, nameof(condition)); - Argument.AssertNotNull(workerSelectors, nameof(workerSelectors)); - - Condition = condition; - WorkerSelectors = workerSelectors.ToList(); - Kind = "conditional"; - } - - /// Initializes a new instance of ConditionalWorkerSelectorAttachment. - /// The type discriminator describing the type of worker selector attachment. - /// - /// 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 . - /// - /// The worker selectors to attach. - internal ConditionalWorkerSelectorAttachment(string kind, RouterRule condition, IList workerSelectors) : base(kind) - { - Condition = condition; - WorkerSelectors = workerSelectors; - Kind = kind ?? "conditional"; - } - - /// - /// 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 . - /// - public RouterRule Condition { get; set; } - /// The worker selectors to attach. - public IList WorkerSelectors { get; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DeclineJobOfferRequest.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DeclineJobOfferRequest.cs deleted file mode 100644 index fd876e060478..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DeclineJobOfferRequest.cs +++ /dev/null @@ -1,27 +0,0 @@ -// 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. - public partial class DeclineJobOfferRequest - { - /// Initializes a new instance of DeclineJobOfferRequest. - public 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. - /// - public DateTimeOffset? RetryOfferAt { get; set; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyCollection.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyCollection.Serialization.cs deleted file mode 100644 index 839b2a80c35c..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyCollection.Serialization.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - internal partial class DistributionPolicyCollection - { - internal static DistributionPolicyCollection DeserializeDistributionPolicyCollection(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList value = default; - Optional nextLink = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(DistributionPolicyItem.DeserializeDistributionPolicyItem(item)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink"u8)) - { - nextLink = property.Value.GetString(); - continue; - } - } - return new DistributionPolicyCollection(value, nextLink.Value); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyCollection.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyCollection.cs deleted file mode 100644 index e7b8722ec798..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/DistributionPolicyCollection.cs +++ /dev/null @@ -1,42 +0,0 @@ -// 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.Models -{ - /// A paged collection of distribution policies. - internal partial class DistributionPolicyCollection - { - /// Initializes a new instance of DistributionPolicyCollection. - /// - /// is null. - internal DistributionPolicyCollection(IEnumerable value) - { - Argument.AssertNotNull(value, nameof(value)); - - Value = value.ToList(); - } - - /// Initializes a new instance of DistributionPolicyCollection. - /// - /// - internal DistributionPolicyCollection(IReadOnlyList value, string nextLink) - { - Value = value; - NextLink = nextLink; - } - - /// Gets the value. - public IReadOnlyList Value { get; } - /// Gets the next link. - public string NextLink { get; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyCollection.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyCollection.Serialization.cs deleted file mode 100644 index b9241b4e8c6f..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyCollection.Serialization.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - internal partial class ExceptionPolicyCollection - { - internal static ExceptionPolicyCollection DeserializeExceptionPolicyCollection(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList value = default; - Optional nextLink = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(ExceptionPolicyItem.DeserializeExceptionPolicyItem(item)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink"u8)) - { - nextLink = property.Value.GetString(); - continue; - } - } - return new ExceptionPolicyCollection(value, nextLink.Value); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyCollection.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyCollection.cs deleted file mode 100644 index 3212f5c1a48b..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ExceptionPolicyCollection.cs +++ /dev/null @@ -1,42 +0,0 @@ -// 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.Models -{ - /// A paged collection of exception policies. - internal partial class ExceptionPolicyCollection - { - /// Initializes a new instance of ExceptionPolicyCollection. - /// - /// is null. - internal ExceptionPolicyCollection(IEnumerable value) - { - Argument.AssertNotNull(value, nameof(value)); - - Value = value.ToList(); - } - - /// Initializes a new instance of ExceptionPolicyCollection. - /// - /// - internal ExceptionPolicyCollection(IReadOnlyList value, string nextLink) - { - Value = value; - NextLink = nextLink; - } - - /// Gets the value. - public IReadOnlyList Value { get; } - /// Gets the next link. - public string NextLink { get; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchModeType.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchModeType.cs deleted file mode 100644 index 0398c4518b36..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchModeType.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using System.ComponentModel; - -namespace Azure.Communication.JobRouter -{ - /// The JobMatchModeType. - public readonly partial struct JobMatchModeType : IEquatable - { - private readonly string _value; - - /// Initializes a new instance of . - /// is null. - public JobMatchModeType(string value) - { - _value = value ?? throw new ArgumentNullException(nameof(value)); - } - - private const string QueueAndMatchModeValue = "queueAndMatchMode"; - private const string ScheduleAndSuspendModeValue = "scheduleAndSuspendMode"; - private const string SuspendModeValue = "suspendMode"; - - /// queueAndMatchMode. - public static JobMatchModeType QueueAndMatchMode { get; } = new JobMatchModeType(QueueAndMatchModeValue); - /// scheduleAndSuspendMode. - public static JobMatchModeType ScheduleAndSuspendMode { get; } = new JobMatchModeType(ScheduleAndSuspendModeValue); - /// suspendMode. - 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); - /// Determines if two values are not the same. - public static bool operator !=(JobMatchModeType left, JobMatchModeType right) => !left.Equals(right); - /// Converts a string to a . - public static implicit operator JobMatchModeType(string value) => new JobMatchModeType(value); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override bool Equals(object obj) => obj is JobMatchModeType other && Equals(other); - /// - public bool Equals(JobMatchModeType other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); - - /// - [EditorBrowsable(EditorBrowsableState.Never)] - public override int GetHashCode() => _value?.GetHashCode() ?? 0; - /// - public override string ToString() => _value; - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchingMode.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchingMode.Serialization.cs deleted file mode 100644 index 0717ffcb5c16..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchingMode.Serialization.cs +++ /dev/null @@ -1,67 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Text.Json; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - public partial class JobMatchingMode : IUtf8JsonSerializable - { - internal static JobMatchingMode DeserializeJobMatchingMode(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - Optional modeType = default; - Optional queueAndMatchMode = default; - Optional scheduleAndSuspendMode = default; - Optional suspendMode = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("modeType"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - modeType = new JobMatchModeType(property.Value.GetString()); - continue; - } - if (property.NameEquals("queueAndMatchMode"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - queueAndMatchMode = property.Value.GetObject(); - continue; - } - if (property.NameEquals("scheduleAndSuspendMode"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - scheduleAndSuspendMode = JobRouter.ScheduleAndSuspendMode.DeserializeScheduleAndSuspendMode(property.Value); - continue; - } - if (property.NameEquals("suspendMode"u8)) - { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } - suspendMode = property.Value.GetObject(); - continue; - } - } - return new JobMatchingMode(Optional.ToNullable(modeType), queueAndMatchMode.Value, scheduleAndSuspendMode.Value, suspendMode.Value); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchingMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchingMode.cs deleted file mode 100644 index 84205d1b33a5..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/JobMatchingMode.cs +++ /dev/null @@ -1,26 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.Communication.JobRouter -{ - /// The JobMatchingMode. - public partial class JobMatchingMode - { - /// Initializes a new instance of JobMatchingMode. - /// - /// Any object. - /// - /// Any object. - 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/Models/PassThroughQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughQueueSelectorAttachment.cs deleted file mode 100644 index 39482420243a..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughQueueSelectorAttachment.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - /// Attaches a queue selector where the value is passed through from the job label with the same key. - public partial class PassThroughQueueSelectorAttachment : QueueSelectorAttachment - { - /// 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. - /// is null. - public PassThroughQueueSelectorAttachment(string key, LabelOperator labelOperator) - { - Argument.AssertNotNull(key, nameof(key)); - - Key = key; - LabelOperator = labelOperator; - Kind = "pass-through"; - } - - /// Initializes a new instance of PassThroughQueueSelectorAttachment. - /// The type discriminator describing the type of queue selector attachment. - /// The label key to query against. - /// Describes how the value of the label is compared to the value pass through. - internal PassThroughQueueSelectorAttachment(string kind, string key, LabelOperator labelOperator) : base(kind) - { - Key = key; - LabelOperator = labelOperator; - Kind = kind ?? "pass-through"; - } - - /// The label key to query against. - public string Key { get; set; } - /// Describes how the value of the label is compared to the value pass through. - public LabelOperator LabelOperator { get; set; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobCollection.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobCollection.Serialization.cs deleted file mode 100644 index e678674f3ba7..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobCollection.Serialization.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - internal partial class RouterJobCollection - { - internal static RouterJobCollection DeserializeRouterJobCollection(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList value = default; - Optional nextLink = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(RouterJobItem.DeserializeRouterJobItem(item)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink"u8)) - { - nextLink = property.Value.GetString(); - continue; - } - } - return new RouterJobCollection(value, nextLink.Value); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobCollection.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobCollection.cs deleted file mode 100644 index 6328876bca3a..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobCollection.cs +++ /dev/null @@ -1,42 +0,0 @@ -// 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.Models -{ - /// A paged collection of jobs. - internal partial class RouterJobCollection - { - /// Initializes a new instance of RouterJobCollection. - /// - /// is null. - internal RouterJobCollection(IEnumerable value) - { - Argument.AssertNotNull(value, nameof(value)); - - Value = value.ToList(); - } - - /// Initializes a new instance of RouterJobCollection. - /// - /// - internal RouterJobCollection(IReadOnlyList value, string nextLink) - { - Value = value; - NextLink = nextLink; - } - - /// Gets the value. - public IReadOnlyList Value { get; } - /// Gets the next link. - public string NextLink { get; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueCollection.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueCollection.Serialization.cs deleted file mode 100644 index 560cee718b5a..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueCollection.Serialization.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - internal partial class RouterQueueCollection - { - internal static RouterQueueCollection DeserializeRouterQueueCollection(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList value = default; - Optional nextLink = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(RouterQueueItem.DeserializeRouterQueueItem(item)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink"u8)) - { - nextLink = property.Value.GetString(); - continue; - } - } - return new RouterQueueCollection(value, nextLink.Value); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueCollection.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueCollection.cs deleted file mode 100644 index d6b977f711a0..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueCollection.cs +++ /dev/null @@ -1,42 +0,0 @@ -// 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.Models -{ - /// A paged collection of queues. - internal partial class RouterQueueCollection - { - /// Initializes a new instance of RouterQueueCollection. - /// - /// is null. - internal RouterQueueCollection(IEnumerable value) - { - Argument.AssertNotNull(value, nameof(value)); - - Value = value.ToList(); - } - - /// Initializes a new instance of RouterQueueCollection. - /// - /// - internal RouterQueueCollection(IReadOnlyList value, string nextLink) - { - Value = value; - NextLink = nextLink; - } - - /// Gets the value. - public IReadOnlyList Value { get; } - /// Gets the next link. - public string NextLink { get; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerCollection.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerCollection.Serialization.cs deleted file mode 100644 index 3735293d80d2..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerCollection.Serialization.cs +++ /dev/null @@ -1,45 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using System.Text.Json; -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - internal partial class RouterWorkerCollection - { - internal static RouterWorkerCollection DeserializeRouterWorkerCollection(JsonElement element) - { - if (element.ValueKind == JsonValueKind.Null) - { - return null; - } - IReadOnlyList value = default; - Optional nextLink = default; - foreach (var property in element.EnumerateObject()) - { - if (property.NameEquals("value"u8)) - { - List array = new List(); - foreach (var item in property.Value.EnumerateArray()) - { - array.Add(RouterWorkerItem.DeserializeRouterWorkerItem(item)); - } - value = array; - continue; - } - if (property.NameEquals("nextLink"u8)) - { - nextLink = property.Value.GetString(); - continue; - } - } - return new RouterWorkerCollection(value, nextLink.Value); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerCollection.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerCollection.cs deleted file mode 100644 index e2c66e639b38..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerCollection.cs +++ /dev/null @@ -1,42 +0,0 @@ -// 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.Models -{ - /// A paged collection of workers. - internal partial class RouterWorkerCollection - { - /// Initializes a new instance of RouterWorkerCollection. - /// - /// is null. - internal RouterWorkerCollection(IEnumerable value) - { - Argument.AssertNotNull(value, nameof(value)); - - Value = value.ToList(); - } - - /// Initializes a new instance of RouterWorkerCollection. - /// - /// - internal RouterWorkerCollection(IReadOnlyList value, string nextLink) - { - Value = value; - NextLink = nextLink; - } - - /// Gets the value. - public IReadOnlyList Value { get; } - /// Gets the next link. - public string NextLink { get; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineQueueSelectorAttachment.cs deleted file mode 100644 index fac53692e8a6..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineQueueSelectorAttachment.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - /// Attaches queue selectors to a job when the RouterRule is resolved. - public partial class RuleEngineQueueSelectorAttachment : QueueSelectorAttachment - { - /// 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. - /// 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 . - /// - /// is null. - public RuleEngineQueueSelectorAttachment(RouterRule rule) - { - Argument.AssertNotNull(rule, nameof(rule)); - - Rule = rule; - Kind = "rule-engine"; - } - - /// Initializes a new instance of RuleEngineQueueSelectorAttachment. - /// The type discriminator describing the type of queue selector attachment. - /// - /// 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 . - /// - internal RuleEngineQueueSelectorAttachment(string kind, RouterRule rule) : base(kind) - { - Rule = rule; - Kind = kind ?? "rule-engine"; - } - - /// - /// 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 . - /// - public RouterRule Rule { get; set; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineWorkerSelectorAttachment.cs deleted file mode 100644 index f7d17afe7719..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineWorkerSelectorAttachment.cs +++ /dev/null @@ -1,69 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - /// Attaches worker selectors to a job when a RouterRule is resolved. - public partial class RuleEngineWorkerSelectorAttachment : WorkerSelectorAttachment - { - /// 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. - /// 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 . - /// - /// is null. - public RuleEngineWorkerSelectorAttachment(RouterRule rule) - { - Argument.AssertNotNull(rule, nameof(rule)); - - Rule = rule; - Kind = "rule-engine"; - } - - /// Initializes a new instance of RuleEngineWorkerSelectorAttachment. - /// The type discriminator describing the type of worker selector attachment. - /// - /// 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 . - /// - internal RuleEngineWorkerSelectorAttachment(string kind, RouterRule rule) : base(kind) - { - Rule = rule; - Kind = kind ?? "rule-engine"; - } - - /// - /// 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 . - /// - public RouterRule Rule { get; set; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScoringRuleOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScoringRuleOptions.cs deleted file mode 100644 index e92ce48766ad..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScoringRuleOptions.cs +++ /dev/null @@ -1,58 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -using System.Collections.Generic; -using Azure.Communication.JobRouter; -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - /// Encapsulates all options that can be passed as parameters for scoring rule with BestWorkerMode. - public partial class ScoringRuleOptions - { - /// 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. - /// - internal ScoringRuleOptions(int? batchSize, IList scoringParameters, bool? allowScoringBatchOfWorkers, bool? descendingOrder) - { - BatchSize = batchSize; - ScoringParameters = scoringParameters; - AllowScoringBatchOfWorkers = allowScoringBatchOfWorkers; - DescendingOrder = descendingOrder; - } - - /// (Optional) Set batch size when AllowScoringBatchOfWorkers is set to true. Defaults to 20 if not configured. - public int? BatchSize { get; set; } - /// - /// (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. - /// - public bool? AllowScoringBatchOfWorkers { get; set; } - /// - /// (Optional) - /// If false, will sort scores by ascending order. By default, set to true. - /// - public bool? DescendingOrder { get; set; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobRequest.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobRequest.cs deleted file mode 100644 index 5d16a85f8c18..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobRequest.cs +++ /dev/null @@ -1,21 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -// - -#nullable disable - -namespace Azure.Communication.JobRouter -{ - /// Request payload for unassigning a job. - internal partial class UnassignJobRequest - { - /// Initializes a new instance of UnassignJobRequest. - public UnassignJobRequest() - { - } - - /// If WaitForActivation is true, then the job is not queued for re-matching with a worker. - public bool? SuspendMatching { get; set; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/Oauth2ClientCredential.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Oauth2ClientCredential.Serialization.cs similarity index 66% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/Oauth2ClientCredential.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/Oauth2ClientCredential.Serialization.cs index 55802736c7d0..dd0c64fee6a3 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/Oauth2ClientCredential.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Oauth2ClientCredential.Serialization.cs @@ -6,28 +6,13 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class Oauth2ClientCredential : IUtf8JsonSerializable + public partial class Oauth2ClientCredential { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(ClientId)) - { - writer.WritePropertyName("clientId"u8); - writer.WriteStringValue(ClientId); - } - if (Optional.IsDefined(ClientSecret)) - { - writer.WritePropertyName("clientSecret"u8); - writer.WriteStringValue(ClientSecret); - } - writer.WriteEndObject(); - } - internal static Oauth2ClientCredential DeserializeOauth2ClientCredential(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -51,5 +36,13 @@ internal static Oauth2ClientCredential DeserializeOauth2ClientCredential(JsonEle } return new Oauth2ClientCredential(clientId.Value, clientSecret.Value); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static Oauth2ClientCredential FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeOauth2ClientCredential(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/Oauth2ClientCredential.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Oauth2ClientCredential.cs similarity index 82% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/Oauth2ClientCredential.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/Oauth2ClientCredential.cs index 4721bad448df..6f5dac058549 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/Oauth2ClientCredential.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Oauth2ClientCredential.cs @@ -9,12 +9,13 @@ namespace Azure.Communication.JobRouter { /// /// OAuth2.0 Credentials used to Contoso's Authorization server. - /// Reference: https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/ + /// Reference: + /// https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/ /// public partial class Oauth2ClientCredential { /// Initializes a new instance of Oauth2ClientCredential. - public Oauth2ClientCredential() + internal Oauth2ClientCredential() { } @@ -28,8 +29,8 @@ internal Oauth2ClientCredential(string clientId, string clientSecret) } /// ClientId for Contoso Authorization server. - public string ClientId { get; set; } + public string ClientId { get; } /// Client secret for Contoso Authorization server. - public string ClientSecret { get; set; } + public string ClientSecret { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughQueueSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/PassThroughQueueSelectorAttachment.Serialization.cs similarity index 71% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughQueueSelectorAttachment.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/PassThroughQueueSelectorAttachment.Serialization.cs index a9a92874e708..04294a9e52c3 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughQueueSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/PassThroughQueueSelectorAttachment.Serialization.cs @@ -6,24 +6,12 @@ #nullable disable using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.Communication.JobRouter { - public partial class PassThroughQueueSelectorAttachment : IUtf8JsonSerializable + public partial class PassThroughQueueSelectorAttachment { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("key"u8); - writer.WriteStringValue(Key); - writer.WritePropertyName("labelOperator"u8); - writer.WriteStringValue(LabelOperator.ToString()); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static PassThroughQueueSelectorAttachment DeserializePassThroughQueueSelectorAttachment(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -53,5 +41,13 @@ internal static PassThroughQueueSelectorAttachment DeserializePassThroughQueueSe } return new PassThroughQueueSelectorAttachment(kind, key, labelOperator); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new PassThroughQueueSelectorAttachment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializePassThroughQueueSelectorAttachment(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/PassThroughQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/PassThroughQueueSelectorAttachment.cs new file mode 100644 index 000000000000..9bfa2074a608 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/PassThroughQueueSelectorAttachment.cs @@ -0,0 +1,32 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + /// + /// Attaches a queue selector where the value is passed through from the job label + /// with the same key + /// + public partial class PassThroughQueueSelectorAttachment : QueueSelectorAttachment + { + /// Initializes a new instance of PassThroughQueueSelectorAttachment. + /// Discriminator. + /// The label key to query against. + /// Describes how the value of the label is compared to the value pass through. + internal PassThroughQueueSelectorAttachment(string kind, string key, LabelOperator labelOperator) : base(kind) + { + Key = key; + LabelOperator = labelOperator; + } + + /// The label key to query against. + public string Key { get; } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughWorkerSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/PassThroughWorkerSelectorAttachment.Serialization.cs similarity index 70% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughWorkerSelectorAttachment.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/PassThroughWorkerSelectorAttachment.Serialization.cs index 211f9d123e05..cdf94f115c0a 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughWorkerSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/PassThroughWorkerSelectorAttachment.Serialization.cs @@ -6,29 +6,13 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class PassThroughWorkerSelectorAttachment : IUtf8JsonSerializable + public partial class PassThroughWorkerSelectorAttachment { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("key"u8); - writer.WriteStringValue(Key); - writer.WritePropertyName("labelOperator"u8); - writer.WriteStringValue(LabelOperator.ToString()); - if (Optional.IsDefined(_expiresAfterSeconds)) - { - writer.WritePropertyName("expiresAfterSeconds"u8); - writer.WriteNumberValue(_expiresAfterSeconds.Value); - } - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static PassThroughWorkerSelectorAttachment DeserializePassThroughWorkerSelectorAttachment(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -68,5 +52,13 @@ internal static PassThroughWorkerSelectorAttachment DeserializePassThroughWorker } return new PassThroughWorkerSelectorAttachment(kind, key, labelOperator, Optional.ToNullable(expiresAfterSeconds)); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new PassThroughWorkerSelectorAttachment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializePassThroughWorkerSelectorAttachment(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/PassThroughWorkerSelectorAttachment.cs similarity index 74% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughWorkerSelectorAttachment.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/PassThroughWorkerSelectorAttachment.cs index e964b31767f7..1119e4a585a9 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/PassThroughWorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/PassThroughWorkerSelectorAttachment.cs @@ -10,24 +10,27 @@ namespace Azure.Communication.JobRouter { - /// Attaches a worker selector where the value is passed through from the job label with the same key. + /// + /// Attaches a worker selector where the value is passed through from the job label + /// with the same key + /// public partial class PassThroughWorkerSelectorAttachment : WorkerSelectorAttachment { /// Initializes a new instance of PassThroughWorkerSelectorAttachment. /// The label key to query against. /// Describes how the value of the label is compared to the value pass through. /// is null. - public PassThroughWorkerSelectorAttachment(string key, LabelOperator labelOperator) + internal PassThroughWorkerSelectorAttachment(string key, LabelOperator labelOperator) { Argument.AssertNotNull(key, nameof(key)); + Kind = "pass-through"; Key = key; LabelOperator = labelOperator; - Kind = "pass-through"; } /// Initializes a new instance of PassThroughWorkerSelectorAttachment. - /// The type discriminator describing the type of worker selector attachment. + /// Discriminator. /// The label key to query against. /// Describes how the value of the label is compared to the value pass through. /// Describes how long the attached label selector is valid in seconds. @@ -36,12 +39,9 @@ internal PassThroughWorkerSelectorAttachment(string kind, string key, LabelOpera Key = key; LabelOperator = labelOperator; _expiresAfterSeconds = expiresAfterSeconds; - Kind = kind ?? "pass-through"; } /// The label key to query against. - public string Key { get; set; } - /// Describes how the value of the label is compared to the value pass through. - public LabelOperator LabelOperator { get; set; } + public string Key { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueAndMatchMode.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueAndMatchMode.Serialization.cs new file mode 100644 index 000000000000..f94edffd90f8 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueAndMatchMode.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure; + +namespace Azure.Communication.JobRouter +{ + public partial class QueueAndMatchMode + { + internal static QueueAndMatchMode DeserializeQueueAndMatchMode(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string kind = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + } + return new QueueAndMatchMode(kind); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new QueueAndMatchMode FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeQueueAndMatchMode(document.RootElement); + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueAndMatchMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueAndMatchMode.cs new file mode 100644 index 000000000000..8068c75ce685 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueAndMatchMode.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.JobRouter +{ + /// Describes a matching mode where matching worker to a job is automatically started after job is queued successfully. + public partial class QueueAndMatchMode : JobMatchingMode + { + /// Initializes a new instance of QueueAndMatchMode. + /// Discriminator. + internal QueueAndMatchMode(string kind) : base(kind) + { + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueLengthExceptionTrigger.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueLengthExceptionTrigger.Serialization.cs similarity index 69% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueLengthExceptionTrigger.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueLengthExceptionTrigger.Serialization.cs index 2dde905ad99a..f0e8bb16bede 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueLengthExceptionTrigger.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueLengthExceptionTrigger.Serialization.cs @@ -6,22 +6,12 @@ #nullable disable using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.Communication.JobRouter { - public partial class QueueLengthExceptionTrigger : IUtf8JsonSerializable + public partial class QueueLengthExceptionTrigger { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("threshold"u8); - writer.WriteNumberValue(Threshold); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static QueueLengthExceptionTrigger DeserializeQueueLengthExceptionTrigger(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -45,5 +35,13 @@ internal static QueueLengthExceptionTrigger DeserializeQueueLengthExceptionTrigg } return new QueueLengthExceptionTrigger(kind, threshold); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new QueueLengthExceptionTrigger FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeQueueLengthExceptionTrigger(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueLengthExceptionTrigger.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueLengthExceptionTrigger.cs similarity index 80% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueLengthExceptionTrigger.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueLengthExceptionTrigger.cs index 0ec31d1af709..65c2a215a7fa 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueLengthExceptionTrigger.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueLengthExceptionTrigger.cs @@ -11,15 +11,14 @@ namespace Azure.Communication.JobRouter public partial class QueueLengthExceptionTrigger : ExceptionTrigger { /// Initializes a new instance of QueueLengthExceptionTrigger. - /// The type discriminator describing a sub-type of ExceptionTrigger. + /// Discriminator. /// Threshold of number of jobs ahead in the queue to for this trigger to fire. internal QueueLengthExceptionTrigger(string kind, int threshold) : base(kind) { Threshold = threshold; - Kind = kind ?? "queue-length"; } /// Threshold of number of jobs ahead in the queue to for this trigger to fire. - public int Threshold { get; set; } + public int Threshold { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueSelectorAttachment.Serialization.cs similarity index 76% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueSelectorAttachment.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueSelectorAttachment.Serialization.cs index 0d715f56708e..51a3f0767034 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueSelectorAttachment.Serialization.cs @@ -6,20 +6,12 @@ #nullable disable using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.Communication.JobRouter { - public partial class QueueSelectorAttachment : IUtf8JsonSerializable + public partial class QueueSelectorAttachment { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static QueueSelectorAttachment DeserializeQueueSelectorAttachment(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -39,5 +31,13 @@ internal static QueueSelectorAttachment DeserializeQueueSelectorAttachment(JsonE } return UnknownQueueSelectorAttachment.DeserializeUnknownQueueSelectorAttachment(element); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static QueueSelectorAttachment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeQueueSelectorAttachment(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueSelectorAttachment.cs similarity index 75% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueSelectorAttachment.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueSelectorAttachment.cs index 6c7db5219912..7e90dfcddcda 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueSelectorAttachment.cs @@ -8,17 +8,26 @@ namespace Azure.Communication.JobRouter { /// - /// An attachment of queue selectors to resolve a queue to a job from a classification policy + /// An attachment of queue selectors to resolve a queue to a job from a + /// classification policy /// 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 abstract partial class QueueSelectorAttachment { /// Initializes a new instance of QueueSelectorAttachment. - /// The type discriminator describing the type of queue selector attachment. + protected QueueSelectorAttachment() + { + } + + /// Initializes a new instance of QueueSelectorAttachment. + /// Discriminator. internal QueueSelectorAttachment(string kind) { Kind = kind; } + + /// Discriminator. + internal string Kind { get; set; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueWeightedAllocation.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueWeightedAllocation.Serialization.cs similarity index 67% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueWeightedAllocation.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueWeightedAllocation.Serialization.cs index c513707f2998..515e70f1303e 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueWeightedAllocation.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueWeightedAllocation.Serialization.cs @@ -7,27 +7,12 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.Communication.JobRouter { - public partial class QueueWeightedAllocation : IUtf8JsonSerializable + public partial class QueueWeightedAllocation { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("weight"u8); - writer.WriteNumberValue(Weight); - writer.WritePropertyName("queueSelectors"u8); - writer.WriteStartArray(); - foreach (var item in QueueSelectors) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WriteEndObject(); - } - internal static QueueWeightedAllocation DeserializeQueueWeightedAllocation(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -35,7 +20,7 @@ internal static QueueWeightedAllocation DeserializeQueueWeightedAllocation(JsonE return null; } double weight = default; - IList queueSelectors = default; + IReadOnlyList queueSelectors = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("weight"u8)) @@ -56,5 +41,13 @@ internal static QueueWeightedAllocation DeserializeQueueWeightedAllocation(JsonE } return new QueueWeightedAllocation(weight, queueSelectors); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static QueueWeightedAllocation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeQueueWeightedAllocation(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueWeightedAllocation.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueWeightedAllocation.cs similarity index 54% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueWeightedAllocation.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueWeightedAllocation.cs index bf55da81d188..eef8faa92f87 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/QueueWeightedAllocation.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/QueueWeightedAllocation.cs @@ -12,14 +12,20 @@ namespace Azure.Communication.JobRouter { - /// Contains the weight percentage and queue selectors to be applied if selected for weighted distributions. + /// + /// Contains the weight percentage and queue selectors to be applied if selected + /// for weighted distributions. + /// public partial class QueueWeightedAllocation { /// 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 collection of queue selectors that will be applied if this allocation is + /// selected. + /// /// is null. - public QueueWeightedAllocation(double weight, IEnumerable queueSelectors) + internal QueueWeightedAllocation(double weight, IEnumerable queueSelectors) { Argument.AssertNotNull(queueSelectors, nameof(queueSelectors)); @@ -29,16 +35,22 @@ public QueueWeightedAllocation(double weight, IEnumerable q /// 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. - internal QueueWeightedAllocation(double weight, IList queueSelectors) + /// + /// A collection of queue selectors that will be applied if this allocation is + /// selected. + /// + internal QueueWeightedAllocation(double weight, IReadOnlyList queueSelectors) { Weight = weight; QueueSelectors = queueSelectors; } /// The percentage of this weight, expressed as a fraction of 1. - public double Weight { get; set; } - /// A collection of queue selectors that will be applied if this allocation is selected. - public IList QueueSelectors { get; } + public double Weight { get; } + /// + /// A collection of queue selectors that will be applied if this allocation is + /// selected. + /// + public IReadOnlyList QueueSelectors { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ReclassifyExceptionAction.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ReclassifyExceptionAction.Serialization.cs similarity index 66% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ReclassifyExceptionAction.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ReclassifyExceptionAction.Serialization.cs index 6d002947efcf..346af55b8c08 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ReclassifyExceptionAction.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ReclassifyExceptionAction.Serialization.cs @@ -7,41 +7,13 @@ using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class ReclassifyExceptionAction : IUtf8JsonSerializable + public partial class ReclassifyExceptionAction { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(ClassificationPolicyId)) - { - writer.WritePropertyName("classificationPolicyId"u8); - writer.WriteStringValue(ClassificationPolicyId); - } - if (Optional.IsCollectionDefined(_labelsToUpsert)) - { - writer.WritePropertyName("labelsToUpsert"u8); - writer.WriteStartObject(); - foreach (var item in _labelsToUpsert) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } - writer.WriteObjectValue(item.Value); - } - writer.WriteEndObject(); - } - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static ReclassifyExceptionAction DeserializeReclassifyExceptionAction(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -87,5 +59,13 @@ internal static ReclassifyExceptionAction DeserializeReclassifyExceptionAction(J } return new ReclassifyExceptionAction(kind, classificationPolicyId.Value, Optional.ToDictionary(labelsToUpsert)); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new ReclassifyExceptionAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeReclassifyExceptionAction(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ReclassifyExceptionAction.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ReclassifyExceptionAction.cs similarity index 54% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ReclassifyExceptionAction.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ReclassifyExceptionAction.cs index 14036bed516f..ac97bdb8a8a1 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ReclassifyExceptionAction.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ReclassifyExceptionAction.cs @@ -14,17 +14,25 @@ namespace Azure.Communication.JobRouter public partial class ReclassifyExceptionAction : ExceptionAction { /// Initializes a new instance of ReclassifyExceptionAction. - /// The type discriminator describing a sub-type of ExceptionAction. - /// (optional) The new classification policy that will determine queue, priority and worker selectors. - /// (optional) Dictionary containing the labels to update (or add if not existing) in key-value pairs. + /// Discriminator. + /// + /// (optional) The new classification policy that will determine queue, priority + /// and worker selectors. + /// + /// + /// (optional) Dictionary containing the labels to update (or add if not existing) + /// in key-value pairs + /// internal ReclassifyExceptionAction(string kind, string classificationPolicyId, IDictionary labelsToUpsert) : base(kind) { ClassificationPolicyId = classificationPolicyId; _labelsToUpsert = labelsToUpsert; - Kind = kind ?? "reclassify"; } - /// (optional) The new classification policy that will determine queue, priority and worker selectors. - public string ClassificationPolicyId { get; set; } + /// + /// (optional) The new classification policy that will determine queue, priority + /// and worker selectors. + /// + public string ClassificationPolicyId { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RoundRobinMode.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RoundRobinMode.Serialization.cs similarity index 69% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RoundRobinMode.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RoundRobinMode.Serialization.cs index a678e2c74982..cc520870d602 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RoundRobinMode.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RoundRobinMode.Serialization.cs @@ -6,35 +6,13 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class RoundRobinMode : IUtf8JsonSerializable + public partial class RoundRobinMode { - 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 RoundRobinMode DeserializeRoundRobinMode(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -82,5 +60,13 @@ internal static RoundRobinMode DeserializeRoundRobinMode(JsonElement element) } return new RoundRobinMode(kind, minConcurrentOffers, maxConcurrentOffers, Optional.ToNullable(bypassSelectors)); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new RoundRobinMode FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRoundRobinMode(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RoundRobinMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RoundRobinMode.cs similarity index 65% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RoundRobinMode.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RoundRobinMode.cs index eac5da7ef27d..d0d4ecbb85e4 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RoundRobinMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RoundRobinMode.cs @@ -7,23 +7,28 @@ namespace Azure.Communication.JobRouter { - /// Jobs are distributed in order to workers, starting with the worker that is after the last worker to receive a job. + /// + /// Jobs are distributed in order to workers, starting with the worker that is + /// after the last worker to receive a job. + /// public partial class RoundRobinMode : DistributionMode { /// Initializes a new instance of RoundRobinMode. - /// 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 RoundRobinMode(string kind, int minConcurrentOffers, int maxConcurrentOffers, bool? bypassSelectors) : base(kind, minConcurrentOffers, maxConcurrentOffers, bypassSelectors) { - Kind = kind ?? "round-robin"; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJob.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJob.Serialization.cs similarity index 63% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJob.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJob.Serialization.cs index e2009385449a..0c0e020728ae 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJob.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJob.Serialization.cs @@ -8,114 +8,20 @@ using System; 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 RouterJob : IUtf8JsonSerializable + public partial class RouterJob { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(ChannelReference)) - { - writer.WritePropertyName("channelReference"u8); - writer.WriteStringValue(ChannelReference); - } - if (Optional.IsDefined(ChannelId)) - { - writer.WritePropertyName("channelId"u8); - writer.WriteStringValue(ChannelId); - } - if (Optional.IsDefined(ClassificationPolicyId)) - { - writer.WritePropertyName("classificationPolicyId"u8); - writer.WriteStringValue(ClassificationPolicyId); - } - if (Optional.IsDefined(QueueId)) - { - writer.WritePropertyName("queueId"u8); - writer.WriteStringValue(QueueId); - } - if (Optional.IsDefined(Priority)) - { - writer.WritePropertyName("priority"u8); - writer.WriteNumberValue(Priority.Value); - } - if (Optional.IsDefined(DispositionCode)) - { - writer.WritePropertyName("dispositionCode"u8); - writer.WriteStringValue(DispositionCode); - } - if (Optional.IsCollectionDefined(_requestedWorkerSelectors)) - { - writer.WritePropertyName("requestedWorkerSelectors"u8); - writer.WriteStartArray(); - foreach (var item in _requestedWorkerSelectors) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - } - if (Optional.IsCollectionDefined(_labels)) - { - writer.WritePropertyName("labels"u8); - writer.WriteStartObject(); - foreach (var item in _labels) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } - writer.WriteObjectValue(item.Value); - } - writer.WriteEndObject(); - } - if (Optional.IsCollectionDefined(_tags)) - { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in _tags) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } - writer.WriteObjectValue(item.Value); - } - writer.WriteEndObject(); - } - if (Optional.IsCollectionDefined(_notes)) - { - writer.WritePropertyName("notes"u8); - writer.WriteStartObject(); - foreach (var item in _notes) - { - writer.WritePropertyName(item.Key); - writer.WriteStringValue(item.Value); - } - writer.WriteEndObject(); - } - if (Optional.IsDefined(MatchingMode)) - { - writer.WritePropertyName("matchingMode"u8); - writer.WriteObjectValue(MatchingMode); - } - writer.WriteEndObject(); - } - internal static RouterJob DeserializeRouterJob(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - Optional id = default; + string id = default; Optional channelReference = default; Optional status = default; Optional enqueuedAt = default; @@ -126,9 +32,9 @@ internal static RouterJob DeserializeRouterJob(JsonElement element) Optional dispositionCode = default; Optional> requestedWorkerSelectors = default; Optional> attachedWorkerSelectors = default; - Optional> labels = default; + Optional> labels = default; Optional> assignments = default; - Optional> tags = default; + Optional> tags = default; Optional> notes = default; Optional scheduledAt = default; Optional matchingMode = default; @@ -225,7 +131,7 @@ internal static RouterJob DeserializeRouterJob(JsonElement element) { continue; } - Dictionary dictionary = new Dictionary(); + Dictionary dictionary = new Dictionary(); foreach (var property0 in property.Value.EnumerateObject()) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -234,7 +140,7 @@ internal static RouterJob DeserializeRouterJob(JsonElement element) } else { - dictionary.Add(property0.Name, property0.Value.GetObject()); + dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); } } labels = dictionary; @@ -260,7 +166,7 @@ internal static RouterJob DeserializeRouterJob(JsonElement element) { continue; } - Dictionary dictionary = new Dictionary(); + Dictionary dictionary = new Dictionary(); foreach (var property0 in property.Value.EnumerateObject()) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -269,7 +175,7 @@ internal static RouterJob DeserializeRouterJob(JsonElement element) } else { - dictionary.Add(property0.Name, property0.Value.GetObject()); + dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); } } tags = dictionary; @@ -308,7 +214,15 @@ internal static RouterJob DeserializeRouterJob(JsonElement element) continue; } } - return new RouterJob(id.Value, channelReference.Value, Optional.ToNullable(status), Optional.ToNullable(enqueuedAt), channelId.Value, classificationPolicyId.Value, queueId.Value, Optional.ToNullable(priority), dispositionCode.Value, Optional.ToList(requestedWorkerSelectors), Optional.ToList(attachedWorkerSelectors), Optional.ToDictionary(labels), Optional.ToDictionary(assignments), Optional.ToDictionary(tags), Optional.ToDictionary(notes), Optional.ToNullable(scheduledAt), matchingMode.Value); + return new RouterJob(id, channelReference.Value, Optional.ToNullable(status), Optional.ToNullable(enqueuedAt), channelId.Value, classificationPolicyId.Value, queueId.Value, Optional.ToNullable(priority), dispositionCode.Value, Optional.ToList(requestedWorkerSelectors), Optional.ToList(attachedWorkerSelectors), Optional.ToDictionary(labels), Optional.ToDictionary(assignments), Optional.ToDictionary(tags), Optional.ToDictionary(notes), Optional.ToNullable(scheduledAt), matchingMode.Value); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RouterJob FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRouterJob(document.RootElement); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJob.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJob.cs similarity index 59% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJob.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJob.cs index 9f9f34901fe6..0edb0ccbc8a5 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJob.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJob.cs @@ -7,14 +7,24 @@ using System; using System.Collections.Generic; -using Azure.Communication.JobRouter; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { /// A unit of work to be routed. public partial class RouterJob { + /// Initializes a new instance of RouterJob. + internal RouterJob() + { + _requestedWorkerSelectors = new ChangeTrackingList(); + AttachedWorkerSelectors = new ChangeTrackingList(); + _labels = new ChangeTrackingDictionary(); + Assignments = new ChangeTrackingDictionary(); + _tags = new ChangeTrackingDictionary(); + _notes = new ChangeTrackingDictionary(); + } + /// Initializes a new instance of RouterJob. /// The id of the job. /// Reference to an external parent context, eg. call ID. @@ -25,9 +35,18 @@ public partial class RouterJob /// The Id of the Queue that this job is queued to. /// The priority of this job. /// Reason code for cancelled or closed jobs. - /// A collection of manually specified label selectors, which a worker must satisfy in order to process this job. - /// A collection of label selectors attached by a classification policy, which a worker must satisfy in order to process this job. - /// A set of key/value pairs that are identifying attributes used by the rules engines to make decisions. + /// + /// A collection of manually specified label selectors, which a worker must satisfy + /// in order to process this job. + /// + /// + /// A collection of label selectors attached by a classification policy, which a + /// worker must satisfy in order to process this job. + /// + /// + /// A set of key/value pairs that are identifying attributes used by the rules + /// engines to make decisions. + /// /// /// A collection of the assignments of the job. /// Key is AssignmentId. @@ -35,8 +54,21 @@ public partial class RouterJob /// A set of non-identifying attributes attached to this job. /// Notes attached to a job, sorted by timestamp. /// If set, job will be scheduled to be enqueued at a given time. - /// - internal RouterJob(string id, string channelReference, RouterJobStatus? status, DateTimeOffset? enqueuedAt, string channelId, string classificationPolicyId, string queueId, int? priority, string dispositionCode, IList requestedWorkerSelectors, IReadOnlyList attachedWorkerSelectors, IDictionary labels, IReadOnlyDictionary assignments, IDictionary tags, IDictionary notes, DateTimeOffset? scheduledAt, JobMatchingMode matchingMode) + /// + /// 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. + /// + internal RouterJob(string id, string channelReference, RouterJobStatus? status, DateTimeOffset? enqueuedAt, string channelId, string classificationPolicyId, string queueId, int? priority, string dispositionCode, IList requestedWorkerSelectors, IReadOnlyList attachedWorkerSelectors, IDictionary labels, IReadOnlyDictionary assignments, IDictionary tags, IDictionary notes, DateTimeOffset? scheduledAt, JobMatchingMode matchingMode) { Id = id; ChannelReference = channelReference; @@ -63,7 +95,10 @@ internal RouterJob(string id, string channelReference, RouterJobStatus? status, public RouterJobStatus? Status { get; } /// The time a job was queued in UTC. public DateTimeOffset? EnqueuedAt { get; } - /// A collection of label selectors attached by a classification policy, which a worker must satisfy in order to process this job. + /// + /// A collection of label selectors attached by a classification policy, which a + /// worker must satisfy in order to process this job. + /// public IReadOnlyList AttachedWorkerSelectors { get; } /// /// A collection of the assignments of the job. diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobAssignment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobAssignment.Serialization.cs similarity index 82% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobAssignment.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobAssignment.Serialization.cs index ded886157399..690cb61a0a81 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobAssignment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobAssignment.Serialization.cs @@ -7,9 +7,10 @@ using System; using System.Text.Json; +using Azure; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { public partial class RouterJobAssignment { @@ -62,5 +63,13 @@ internal static RouterJobAssignment DeserializeRouterJobAssignment(JsonElement e } return new RouterJobAssignment(assignmentId, workerId.Value, assignedAt, Optional.ToNullable(completedAt), Optional.ToNullable(closedAt)); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RouterJobAssignment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRouterJobAssignment(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobAssignment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobAssignment.cs similarity index 98% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobAssignment.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobAssignment.cs index 4c3f4fb5f8fe..ad680e8d62ed 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobAssignment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobAssignment.cs @@ -8,7 +8,7 @@ using System; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { /// Assignment details of a job to a worker. public partial class RouterJobAssignment diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobItem.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobItem.Serialization.cs similarity index 61% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobItem.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobItem.Serialization.cs index f36b43a30ef5..41d159d99d3f 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobItem.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobItem.Serialization.cs @@ -6,9 +6,9 @@ #nullable disable using System.Text.Json; -using Azure.Core; +using Azure; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { public partial class RouterJobItem { @@ -18,16 +18,12 @@ internal static RouterJobItem DeserializeRouterJobItem(JsonElement element) { return null; } - Optional job = default; - Optional etag = default; + RouterJob job = default; + string etag = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("job"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } job = RouterJob.DeserializeRouterJob(property.Value); continue; } @@ -37,7 +33,15 @@ internal static RouterJobItem DeserializeRouterJobItem(JsonElement element) continue; } } - return new RouterJobItem(job.Value, etag.Value); + return new RouterJobItem(job, etag); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RouterJobItem FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRouterJobItem(document.RootElement); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobItem.cs similarity index 69% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobItem.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobItem.cs index 164f65bc9730..9dd31bb31a5e 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobItem.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobItem.cs @@ -5,21 +5,23 @@ #nullable disable -namespace Azure.Communication.JobRouter.Models +using System; +using Azure.Core; + +namespace Azure.Communication.JobRouter { /// Paged instance of RouterJob. public partial class RouterJobItem { - /// Initializes a new instance of RouterJobItem. - internal RouterJobItem() - { - } - /// Initializes a new instance of RouterJobItem. /// A unit of work to be routed. /// (Optional) The Concurrency Token. + /// or is null. internal RouterJobItem(RouterJob job, string etag) { + Argument.AssertNotNull(job, nameof(job)); + Argument.AssertNotNull(etag, nameof(etag)); + Job = job; _etag = etag; } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobOffer.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobOffer.Serialization.cs similarity index 82% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobOffer.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobOffer.Serialization.cs index f361747e7be1..e2da35f86d2e 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobOffer.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobOffer.Serialization.cs @@ -7,9 +7,10 @@ using System; using System.Text.Json; +using Azure; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { public partial class RouterJobOffer { @@ -62,5 +63,13 @@ internal static RouterJobOffer DeserializeRouterJobOffer(JsonElement element) } return new RouterJobOffer(offerId, jobId, capacityCost, Optional.ToNullable(offeredAt), Optional.ToNullable(expiresAt)); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RouterJobOffer FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRouterJobOffer(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobOffer.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobOffer.cs similarity index 98% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobOffer.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobOffer.cs index 9ec25f951242..0100d141d8c5 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobOffer.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobOffer.cs @@ -8,7 +8,7 @@ using System; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { /// An offer of a job to a worker. public partial class RouterJobOffer diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobPositionDetails.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobPositionDetails.Serialization.cs similarity index 79% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobPositionDetails.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobPositionDetails.Serialization.cs index 13ba2bc1ba01..09ea6eb0c062 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobPositionDetails.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobPositionDetails.Serialization.cs @@ -6,8 +6,9 @@ #nullable disable using System.Text.Json; +using Azure; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { public partial class RouterJobPositionDetails { @@ -52,5 +53,13 @@ internal static RouterJobPositionDetails DeserializeRouterJobPositionDetails(Jso } return new RouterJobPositionDetails(jobId, position, queueId, queueLength, estimatedWaitTimeMinutes); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RouterJobPositionDetails FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRouterJobPositionDetails(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobPositionDetails.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobPositionDetails.cs similarity index 97% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobPositionDetails.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobPositionDetails.cs index 4acc58846209..7587344d812f 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobPositionDetails.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobPositionDetails.cs @@ -8,7 +8,7 @@ using System; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { /// Position and estimated wait time for a job. public partial class RouterJobPositionDetails diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobStatus.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobStatus.cs similarity index 82% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobStatus.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobStatus.cs index af78cdc21ca2..db941c41ac46 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobStatus.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobStatus.cs @@ -8,7 +8,7 @@ using System; using System.ComponentModel; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { /// The status of the Job. public readonly partial struct RouterJobStatus : IEquatable @@ -35,29 +35,29 @@ public RouterJobStatus(string value) private const string ScheduleFailedValue = "scheduleFailed"; private const string WaitingForActivationValue = "waitingForActivation"; - /// pendingClassification. + /// Job is waiting to be classified. public static RouterJobStatus PendingClassification { get; } = new RouterJobStatus(PendingClassificationValue); - /// queued. + /// Job has been queued. public static RouterJobStatus Queued { get; } = new RouterJobStatus(QueuedValue); - /// assigned. + /// Job has been assigned to a worker. public static RouterJobStatus Assigned { get; } = new RouterJobStatus(AssignedValue); - /// completed. + /// Job has been completed by a worker. public static RouterJobStatus Completed { get; } = new RouterJobStatus(CompletedValue); - /// closed. + /// Job has been closed by a worker. public static RouterJobStatus Closed { get; } = new RouterJobStatus(ClosedValue); - /// cancelled. + /// Job has been cancelled. public static RouterJobStatus Cancelled { get; } = new RouterJobStatus(CancelledValue); - /// classificationFailed. + /// Classification process failed for the job. public static RouterJobStatus ClassificationFailed { get; } = new RouterJobStatus(ClassificationFailedValue); - /// created. + /// Job has been created. public static RouterJobStatus Created { get; } = new RouterJobStatus(CreatedValue); - /// pendingSchedule. + /// Job has been created but not been scheduled yet. public static RouterJobStatus PendingSchedule { get; } = new RouterJobStatus(PendingScheduleValue); - /// scheduled. + /// Job has been scheduled successfully. public static RouterJobStatus Scheduled { get; } = new RouterJobStatus(ScheduledValue); - /// scheduleFailed. + /// Job scheduling failed. public static RouterJobStatus ScheduleFailed { get; } = new RouterJobStatus(ScheduleFailedValue); - /// waitingForActivation. + /// Job is in a suspended state and waiting for an update. public static RouterJobStatus WaitingForActivation { get; } = new RouterJobStatus(WaitingForActivationValue); /// Determines if two values are the same. public static bool operator ==(RouterJobStatus left, RouterJobStatus right) => left.Equals(right); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobStatusSelector.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobStatusSelector.cs similarity index 80% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobStatusSelector.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobStatusSelector.cs index c3bf7ecb224f..e154c07929bf 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterJobStatusSelector.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterJobStatusSelector.cs @@ -10,7 +10,7 @@ namespace Azure.Communication.JobRouter { - /// The RouterJobStatusSelector. + /// Enums used to filters jobs by state. public readonly partial struct RouterJobStatusSelector : IEquatable { private readonly string _value; @@ -37,33 +37,33 @@ public RouterJobStatusSelector(string value) private const string WaitingForActivationValue = "waitingForActivation"; private const string ActiveValue = "active"; - /// all. + /// Default. public static RouterJobStatusSelector All { get; } = new RouterJobStatusSelector(AllValue); - /// pendingClassification. + /// Job is waiting to be classified. public static RouterJobStatusSelector PendingClassification { get; } = new RouterJobStatusSelector(PendingClassificationValue); - /// queued. + /// Job has been queued. public static RouterJobStatusSelector Queued { get; } = new RouterJobStatusSelector(QueuedValue); - /// assigned. + /// Job has been assigned to a worker. public static RouterJobStatusSelector Assigned { get; } = new RouterJobStatusSelector(AssignedValue); - /// completed. + /// Job has been completed by a worker. public static RouterJobStatusSelector Completed { get; } = new RouterJobStatusSelector(CompletedValue); - /// closed. + /// Job has been closed by a worker. public static RouterJobStatusSelector Closed { get; } = new RouterJobStatusSelector(ClosedValue); - /// cancelled. + /// Job has been cancelled. public static RouterJobStatusSelector Cancelled { get; } = new RouterJobStatusSelector(CancelledValue); - /// classificationFailed. + /// Classification process failed for the job. public static RouterJobStatusSelector ClassificationFailed { get; } = new RouterJobStatusSelector(ClassificationFailedValue); - /// created. + /// Job has been created. public static RouterJobStatusSelector Created { get; } = new RouterJobStatusSelector(CreatedValue); - /// pendingSchedule. + /// Job has been created but not been scheduled yet. public static RouterJobStatusSelector PendingSchedule { get; } = new RouterJobStatusSelector(PendingScheduleValue); - /// scheduled. + /// Job has been scheduled successfully. public static RouterJobStatusSelector Scheduled { get; } = new RouterJobStatusSelector(ScheduledValue); - /// scheduleFailed. + /// Job scheduling failed. public static RouterJobStatusSelector ScheduleFailed { get; } = new RouterJobStatusSelector(ScheduleFailedValue); - /// waitingForActivation. + /// Job is in a suspended state and waiting for an update. public static RouterJobStatusSelector WaitingForActivation { get; } = new RouterJobStatusSelector(WaitingForActivationValue); - /// active. + /// Job is in a state of PendingClassification or Queued or Assigned or ClassificationFailed or Completed or PendingSchedule or Scheduled or ScheduleFailed or WaitingForActivation. public static RouterJobStatusSelector Active { get; } = new RouterJobStatusSelector(ActiveValue); /// Determines if two values are the same. public static bool operator ==(RouterJobStatusSelector left, RouterJobStatusSelector right) => left.Equals(right); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueue.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueue.Serialization.cs similarity index 60% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueue.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueue.Serialization.cs index 942f13e0b1bb..c5d1590c2eee 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueue.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueue.Serialization.cs @@ -7,56 +7,20 @@ using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { - public partial class RouterQueue : IUtf8JsonSerializable + public partial class RouterQueue { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(Name)) - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - if (Optional.IsDefined(DistributionPolicyId)) - { - writer.WritePropertyName("distributionPolicyId"u8); - writer.WriteStringValue(DistributionPolicyId); - } - if (Optional.IsCollectionDefined(_labels)) - { - writer.WritePropertyName("labels"u8); - writer.WriteStartObject(); - foreach (var item in _labels) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } - writer.WriteObjectValue(item.Value); - } - writer.WriteEndObject(); - } - if (Optional.IsDefined(ExceptionPolicyId)) - { - writer.WritePropertyName("exceptionPolicyId"u8); - writer.WriteStringValue(ExceptionPolicyId); - } - writer.WriteEndObject(); - } - internal static RouterQueue DeserializeRouterQueue(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - Optional id = default; + string id = default; Optional name = default; Optional distributionPolicyId = default; Optional> labels = default; @@ -105,7 +69,15 @@ internal static RouterQueue DeserializeRouterQueue(JsonElement element) continue; } } - return new RouterQueue(id.Value, name.Value, distributionPolicyId.Value, Optional.ToDictionary(labels), exceptionPolicyId.Value); + return new RouterQueue(id, name.Value, distributionPolicyId.Value, Optional.ToDictionary(labels), exceptionPolicyId.Value); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RouterQueue FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRouterQueue(document.RootElement); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueue.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueue.cs similarity index 62% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueue.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueue.cs index 0345ead4dbb1..2fa297be9673 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueue.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueue.cs @@ -8,7 +8,7 @@ using System.Collections.Generic; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { /// A queue that can contain jobs to be routed. public partial class RouterQueue @@ -16,9 +16,18 @@ public partial class RouterQueue /// Initializes a new instance of RouterQueue. /// The Id of this queue. /// The name of this queue. - /// The ID of the distribution policy that will determine how a job is distributed to workers. - /// A set of key/value pairs that are identifying attributes used by the rules engines to make decisions. - /// (Optional) The ID of the exception policy that determines various job escalation rules. + /// + /// The ID of the distribution policy that will determine how a job is distributed + /// to workers. + /// + /// + /// A set of key/value pairs that are identifying attributes used by the rules + /// engines to make decisions. + /// + /// + /// (Optional) The ID of the exception policy that determines various job + /// escalation rules. + /// internal RouterQueue(string id, string name, string distributionPolicyId, IDictionary labels, string exceptionPolicyId) { Id = id; diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueAssignment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueAssignment.Serialization.cs new file mode 100644 index 000000000000..a39e27fbe7a8 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueAssignment.Serialization.cs @@ -0,0 +1,35 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure; + +namespace Azure.Communication.JobRouter +{ + public partial class RouterQueueAssignment + { + internal static RouterQueueAssignment DeserializeRouterQueueAssignment(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + foreach (var property in element.EnumerateObject()) + { + } + return new RouterQueueAssignment(); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RouterQueueAssignment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRouterQueueAssignment(document.RootElement); + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScheduleAndSuspendMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueAssignment.cs similarity index 61% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScheduleAndSuspendMode.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueAssignment.cs index b4ab199fe3a0..57c8a315d25c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScheduleAndSuspendMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueAssignment.cs @@ -5,12 +5,10 @@ #nullable disable -using System; - namespace Azure.Communication.JobRouter { - /// The ScheduleAndSuspendMode. - public partial class ScheduleAndSuspendMode + /// An assignment of a worker to a queue. + public partial class RouterQueueAssignment { } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueItem.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueItem.Serialization.cs similarity index 60% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueItem.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueItem.Serialization.cs index c83b801be6e9..32b9f9f74575 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueItem.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueItem.Serialization.cs @@ -6,9 +6,9 @@ #nullable disable using System.Text.Json; -using Azure.Core; +using Azure; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { public partial class RouterQueueItem { @@ -18,16 +18,12 @@ internal static RouterQueueItem DeserializeRouterQueueItem(JsonElement element) { return null; } - Optional queue = default; - Optional etag = default; + RouterQueue queue = default; + string etag = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("queue"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } queue = RouterQueue.DeserializeRouterQueue(property.Value); continue; } @@ -37,7 +33,15 @@ internal static RouterQueueItem DeserializeRouterQueueItem(JsonElement element) continue; } } - return new RouterQueueItem(queue.Value, etag.Value); + return new RouterQueueItem(queue, etag); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RouterQueueItem FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRouterQueueItem(document.RootElement); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueItem.cs similarity index 70% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueItem.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueItem.cs index 500f148cb411..d828055c04bf 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueItem.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueItem.cs @@ -5,21 +5,23 @@ #nullable disable -namespace Azure.Communication.JobRouter.Models +using System; +using Azure.Core; + +namespace Azure.Communication.JobRouter { /// Paged instance of RouterQueue. public partial class RouterQueueItem { - /// Initializes a new instance of RouterQueueItem. - internal RouterQueueItem() - { - } - /// Initializes a new instance of RouterQueueItem. /// A queue that can contain jobs to be routed. /// (Optional) The Concurrency Token. + /// or is null. internal RouterQueueItem(RouterQueue queue, string etag) { + Argument.AssertNotNull(queue, nameof(queue)); + Argument.AssertNotNull(etag, nameof(etag)); + Queue = queue; _etag = etag; } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueSelector.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueSelector.Serialization.cs similarity index 66% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueSelector.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueSelector.Serialization.cs index 3e7a657830bb..549ea1c648f3 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueSelector.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueSelector.Serialization.cs @@ -5,28 +5,15 @@ #nullable disable +using System; using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class RouterQueueSelector : IUtf8JsonSerializable + public partial class RouterQueueSelector { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("key"u8); - writer.WriteStringValue(Key); - writer.WritePropertyName("labelOperator"u8); - writer.WriteStringValue(LabelOperator.ToString()); - if (Optional.IsDefined(_value)) - { - writer.WritePropertyName("value"u8); - writer.WriteObjectValue(_value); - } - writer.WriteEndObject(); - } - internal static RouterQueueSelector DeserializeRouterQueueSelector(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -35,7 +22,7 @@ internal static RouterQueueSelector DeserializeRouterQueueSelector(JsonElement e } string key = default; LabelOperator labelOperator = default; - Optional value = default; + Optional value = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("key"u8)) @@ -54,11 +41,19 @@ internal static RouterQueueSelector DeserializeRouterQueueSelector(JsonElement e { continue; } - value = property.Value.GetObject(); + value = BinaryData.FromString(property.Value.GetRawText()); continue; } } return new RouterQueueSelector(key, labelOperator, value.Value); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RouterQueueSelector FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRouterQueueSelector(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueSelector.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueSelector.cs similarity index 57% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueSelector.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueSelector.cs index dc22889395e6..5845fa71a7cc 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueSelector.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueSelector.cs @@ -10,14 +10,20 @@ namespace Azure.Communication.JobRouter { - /// Describes a condition that must be met against a set of labels for queue selection. + /// + /// Describes a condition that must be met against a set of labels for queue + /// selection + /// public partial class RouterQueueSelector { /// Initializes a new instance of RouterQueueSelector. /// The label key to query against. - /// Describes how the value of the label is compared to the value defined on the label selector. + /// + /// Describes how the value of the label is compared to the value defined on the + /// label selector + /// /// The value to compare against the actual label value with the given operator. - internal RouterQueueSelector(string key, LabelOperator labelOperator, object value) + internal RouterQueueSelector(string key, LabelOperator labelOperator, BinaryData value) { Key = key; LabelOperator = labelOperator; @@ -25,8 +31,11 @@ internal RouterQueueSelector(string key, LabelOperator labelOperator, object val } /// The label key to query against. - public string Key { get; set; } - /// Describes how the value of the label is compared to the value defined on the label selector. - public LabelOperator LabelOperator { get; set; } + public string Key { get; } + /// + /// Describes how the value of the label is compared to the value defined on the + /// label selector + /// + public LabelOperator LabelOperator { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueStatistics.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueStatistics.Serialization.cs similarity index 83% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueStatistics.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueStatistics.Serialization.cs index fcb2fe001737..16b6ffd33481 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueStatistics.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueStatistics.Serialization.cs @@ -7,9 +7,10 @@ using System.Collections.Generic; using System.Text.Json; +using Azure; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { public partial class RouterQueueStatistics { @@ -61,5 +62,13 @@ internal static RouterQueueStatistics DeserializeRouterQueueStatistics(JsonEleme } return new RouterQueueStatistics(queueId, length, Optional.ToDictionary(estimatedWaitTimeMinutes), Optional.ToNullable(longestJobWaitTimeMinutes)); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RouterQueueStatistics FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRouterQueueStatistics(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueStatistics.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueStatistics.cs similarity index 85% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueStatistics.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueStatistics.cs index c1ab84bb27d2..bc62aaf791bf 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterQueueStatistics.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterQueueStatistics.cs @@ -9,7 +9,7 @@ using System.Collections.Generic; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { /// Statistics for the queue. public partial class RouterQueueStatistics @@ -30,7 +30,10 @@ internal RouterQueueStatistics(string queueId, int length) /// 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. internal RouterQueueStatistics(string queueId, int length, IReadOnlyDictionary estimatedWaitTimeMinutes, double? longestJobWaitTimeMinutes) { @@ -44,7 +47,10 @@ internal RouterQueueStatistics(string queueId, int length, IReadOnlyDictionary Length of the queue: total number of enqueued jobs. public int Length { get; } - /// 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 + /// public IReadOnlyDictionary EstimatedWaitTimeMinutes { get; } /// The wait time of the job that has been enqueued in this queue for the longest. public double? LongestJobWaitTimeMinutes { get; } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterRule.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterRule.Serialization.cs similarity index 75% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterRule.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterRule.Serialization.cs index 23fc431e3c0c..c677ae8f2783 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterRule.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterRule.Serialization.cs @@ -6,20 +6,12 @@ #nullable disable using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.Communication.JobRouter { - public partial class RouterRule : IUtf8JsonSerializable + public partial class RouterRule { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static RouterRule DeserializeRouterRule(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -30,14 +22,22 @@ internal static RouterRule DeserializeRouterRule(JsonElement element) { switch (discriminator.GetString()) { - case "azure-function-rule": return FunctionRouterRule.DeserializeFunctionRouterRule(element); case "direct-map-rule": return DirectMapRouterRule.DeserializeDirectMapRouterRule(element); case "expression-rule": return ExpressionRouterRule.DeserializeExpressionRouterRule(element); + case "azure-function-rule": return FunctionRouterRule.DeserializeFunctionRouterRule(element); case "static-rule": return StaticRouterRule.DeserializeStaticRouterRule(element); case "webhook-rule": return WebhookRouterRule.DeserializeWebhookRouterRule(element); } } return UnknownRouterRule.DeserializeUnknownRouterRule(element); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RouterRule FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRouterRule(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterRule.cs similarity index 55% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterRule.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterRule.cs index 23e1b33de56d..4aeb6381642b 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterRule.cs @@ -10,21 +10,30 @@ namespace Azure.Communication.JobRouter /// /// 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. + /// 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 . + /// The available derived classes include , , , and . /// public abstract partial class RouterRule { /// Initializes a new instance of RouterRule. - /// The type discriminator describing a sub-type of Rule. + /// Discriminator. internal RouterRule(string kind) { Kind = kind; } + + /// Discriminator. + internal string Kind { get; set; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorker.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorker.Serialization.cs similarity index 59% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorker.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorker.Serialization.cs index e6acdf529900..9a99cab4598e 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorker.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorker.Serialization.cs @@ -5,102 +5,28 @@ #nullable disable +using System; 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 RouterWorker : IUtf8JsonSerializable + public partial class RouterWorker { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsCollectionDefined(_queueAssignments)) - { - writer.WritePropertyName("queueAssignments"u8); - writer.WriteStartObject(); - foreach (var item in _queueAssignments) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } - writer.WriteObjectValue(item.Value); - } - writer.WriteEndObject(); - } - if (Optional.IsDefined(TotalCapacity)) - { - writer.WritePropertyName("totalCapacity"u8); - writer.WriteNumberValue(TotalCapacity.Value); - } - if (Optional.IsCollectionDefined(_labels)) - { - writer.WritePropertyName("labels"u8); - writer.WriteStartObject(); - foreach (var item in _labels) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } - writer.WriteObjectValue(item.Value); - } - writer.WriteEndObject(); - } - if (Optional.IsCollectionDefined(_tags)) - { - writer.WritePropertyName("tags"u8); - writer.WriteStartObject(); - foreach (var item in _tags) - { - writer.WritePropertyName(item.Key); - if (item.Value == null) - { - writer.WriteNullValue(); - continue; - } - writer.WriteObjectValue(item.Value); - } - writer.WriteEndObject(); - } - if (Optional.IsCollectionDefined(_channelConfigurations)) - { - writer.WritePropertyName("channelConfigurations"u8); - writer.WriteStartObject(); - foreach (var item in _channelConfigurations) - { - writer.WritePropertyName(item.Key); - writer.WriteObjectValue(item.Value); - } - writer.WriteEndObject(); - } - if (Optional.IsDefined(AvailableForOffers)) - { - writer.WritePropertyName("availableForOffers"u8); - writer.WriteBooleanValue(AvailableForOffers.Value); - } - writer.WriteEndObject(); - } - internal static RouterWorker DeserializeRouterWorker(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - Optional id = default; + string id = default; Optional state = default; - Optional> queueAssignments = default; + Optional> queueAssignments = default; Optional totalCapacity = default; - Optional> labels = default; - Optional> tags = default; + Optional> labels = default; + Optional> tags = default; Optional> channelConfigurations = default; Optional> offers = default; Optional> assignedJobs = default; @@ -128,17 +54,10 @@ internal static RouterWorker DeserializeRouterWorker(JsonElement element) { continue; } - Dictionary dictionary = new Dictionary(); + Dictionary dictionary = new Dictionary(); foreach (var property0 in property.Value.EnumerateObject()) { - if (property0.Value.ValueKind == JsonValueKind.Null) - { - dictionary.Add(property0.Name, null); - } - else - { - dictionary.Add(property0.Name, property0.Value.GetObject()); - } + dictionary.Add(property0.Name, RouterQueueAssignment.DeserializeRouterQueueAssignment(property0.Value)); } queueAssignments = dictionary; continue; @@ -158,7 +77,7 @@ internal static RouterWorker DeserializeRouterWorker(JsonElement element) { continue; } - Dictionary dictionary = new Dictionary(); + Dictionary dictionary = new Dictionary(); foreach (var property0 in property.Value.EnumerateObject()) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -167,7 +86,7 @@ internal static RouterWorker DeserializeRouterWorker(JsonElement element) } else { - dictionary.Add(property0.Name, property0.Value.GetObject()); + dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); } } labels = dictionary; @@ -179,7 +98,7 @@ internal static RouterWorker DeserializeRouterWorker(JsonElement element) { continue; } - Dictionary dictionary = new Dictionary(); + Dictionary dictionary = new Dictionary(); foreach (var property0 in property.Value.EnumerateObject()) { if (property0.Value.ValueKind == JsonValueKind.Null) @@ -188,7 +107,7 @@ internal static RouterWorker DeserializeRouterWorker(JsonElement element) } else { - dictionary.Add(property0.Name, property0.Value.GetObject()); + dictionary.Add(property0.Name, BinaryData.FromString(property0.Value.GetRawText())); } } tags = dictionary; @@ -255,7 +174,15 @@ internal static RouterWorker DeserializeRouterWorker(JsonElement element) continue; } } - return new RouterWorker(id.Value, Optional.ToNullable(state), Optional.ToDictionary(queueAssignments), Optional.ToNullable(totalCapacity), Optional.ToDictionary(labels), Optional.ToDictionary(tags), Optional.ToDictionary(channelConfigurations), Optional.ToList(offers), Optional.ToList(assignedJobs), Optional.ToNullable(loadRatio), Optional.ToNullable(availableForOffers)); + return new RouterWorker(id, Optional.ToNullable(state), Optional.ToDictionary(queueAssignments), Optional.ToNullable(totalCapacity), Optional.ToDictionary(labels), Optional.ToDictionary(tags), Optional.ToDictionary(channelConfigurations), Optional.ToList(offers), Optional.ToList(assignedJobs), Optional.ToNullable(loadRatio), Optional.ToNullable(availableForOffers)); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RouterWorker FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRouterWorker(document.RootElement); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorker.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorker.cs similarity index 55% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorker.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorker.cs index 16667760d9e9..8705ccd21428 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorker.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorker.cs @@ -5,28 +5,45 @@ #nullable disable +using System; using System.Collections.Generic; -using Azure.Communication.JobRouter; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { /// An entity for jobs to be routed to. public partial class RouterWorker { /// Initializes a new instance of RouterWorker. - /// + internal RouterWorker() + { + _queueAssignments = new ChangeTrackingDictionary(); + _labels = new ChangeTrackingDictionary(); + _tags = new ChangeTrackingDictionary(); + _channelConfigurations = new ChangeTrackingDictionary(); + Offers = new ChangeTrackingList(); + AssignedJobs = new ChangeTrackingList(); + } + + /// Initializes a new instance of RouterWorker. + /// Id of the worker. /// The current state of the worker. /// The queue(s) that this worker can receive work from. /// The total capacity score this worker has to manage multiple concurrent jobs. - /// A set of key/value pairs that are identifying attributes used by the rules engines to make decisions. + /// + /// A set of key/value pairs that are identifying attributes used by the rules + /// engines to make decisions. + /// /// A set of non-identifying attributes attached to this worker. /// The channel(s) this worker can handle and their impact on the workers capacity. /// A list of active offers issued to this worker. /// A list of assigned jobs attached to this worker. - /// A value indicating the workers capacity. A value of '1' means all capacity is consumed. A value of '0' means no capacity is currently consumed. + /// + /// A value indicating the workers capacity. A value of '1' means all capacity is + /// consumed. A value of '0' means no capacity is currently consumed. + /// /// A flag indicating this worker is open to receive offers or not. - internal RouterWorker(string id, RouterWorkerState? state, IDictionary queueAssignments, int? totalCapacity, IDictionary labels, IDictionary tags, IDictionary channelConfigurations, IReadOnlyList offers, IReadOnlyList assignedJobs, double? loadRatio, bool? availableForOffers) + internal RouterWorker(string id, RouterWorkerState? state, IReadOnlyDictionary queueAssignments, int? totalCapacity, IDictionary labels, IDictionary tags, IDictionary channelConfigurations, IReadOnlyList offers, IReadOnlyList assignedJobs, double? loadRatio, bool? availableForOffers) { Id = id; State = state; @@ -41,7 +58,7 @@ internal RouterWorker(string id, RouterWorkerState? state, IDictionary Gets the id. + /// Id of the worker. public string Id { get; } /// The current state of the worker. public RouterWorkerState? State { get; } @@ -49,7 +66,10 @@ internal RouterWorker(string id, RouterWorkerState? state, IDictionary Offers { get; } /// A list of assigned jobs attached to this worker. public IReadOnlyList AssignedJobs { get; } - /// A value indicating the workers capacity. A value of '1' means all capacity is consumed. A value of '0' means no capacity is currently consumed. + /// + /// A value indicating the workers capacity. A value of '1' means all capacity is + /// consumed. A value of '0' means no capacity is currently consumed. + /// public double? LoadRatio { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerAssignment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerAssignment.Serialization.cs similarity index 77% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerAssignment.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerAssignment.Serialization.cs index 1e6728c1de31..6285817aa66a 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerAssignment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerAssignment.Serialization.cs @@ -7,9 +7,10 @@ using System; using System.Text.Json; +using Azure; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { public partial class RouterWorkerAssignment { @@ -48,5 +49,13 @@ internal static RouterWorkerAssignment DeserializeRouterWorkerAssignment(JsonEle } return new RouterWorkerAssignment(assignmentId, jobId, capacityCost, assignedAt); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RouterWorkerAssignment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRouterWorkerAssignment(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerAssignment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerAssignment.cs similarity index 97% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerAssignment.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerAssignment.cs index d96459495c0d..ed77ff0b75f7 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerAssignment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerAssignment.cs @@ -8,7 +8,7 @@ using System; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { /// The assignment for a worker to a job. public partial class RouterWorkerAssignment diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerItem.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerItem.Serialization.cs similarity index 60% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerItem.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerItem.Serialization.cs index 2cb770535513..3b959c106672 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerItem.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerItem.Serialization.cs @@ -6,9 +6,9 @@ #nullable disable using System.Text.Json; -using Azure.Core; +using Azure; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { public partial class RouterWorkerItem { @@ -18,16 +18,12 @@ internal static RouterWorkerItem DeserializeRouterWorkerItem(JsonElement element { return null; } - Optional worker = default; - Optional etag = default; + RouterWorker worker = default; + string etag = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("worker"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } worker = RouterWorker.DeserializeRouterWorker(property.Value); continue; } @@ -37,7 +33,15 @@ internal static RouterWorkerItem DeserializeRouterWorkerItem(JsonElement element continue; } } - return new RouterWorkerItem(worker.Value, etag.Value); + return new RouterWorkerItem(worker, etag); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RouterWorkerItem FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRouterWorkerItem(document.RootElement); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerItem.cs similarity index 70% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerItem.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerItem.cs index 4dcce17c844b..616b79fd04fc 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerItem.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerItem.cs @@ -5,21 +5,23 @@ #nullable disable -namespace Azure.Communication.JobRouter.Models +using System; +using Azure.Core; + +namespace Azure.Communication.JobRouter { /// Paged instance of RouterWorker. public partial class RouterWorkerItem { - /// Initializes a new instance of RouterWorkerItem. - internal RouterWorkerItem() - { - } - /// Initializes a new instance of RouterWorkerItem. /// An entity for jobs to be routed to. /// (Optional) The Concurrency Token. + /// or is null. internal RouterWorkerItem(RouterWorker worker, string etag) { + Argument.AssertNotNull(worker, nameof(worker)); + Argument.AssertNotNull(etag, nameof(etag)); + Worker = worker; _etag = etag; } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerSelector.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerSelector.Serialization.cs similarity index 73% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerSelector.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerSelector.Serialization.cs index e9325552eff8..9957f5be7d94 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerSelector.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerSelector.Serialization.cs @@ -7,38 +7,13 @@ using System; using System.Text.Json; -using Azure.Communication.JobRouter.Models; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class RouterWorkerSelector : IUtf8JsonSerializable + public partial class RouterWorkerSelector { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("key"u8); - writer.WriteStringValue(Key); - writer.WritePropertyName("labelOperator"u8); - writer.WriteStringValue(LabelOperator.ToString()); - if (Optional.IsDefined(_value)) - { - writer.WritePropertyName("value"u8); - writer.WriteObjectValue(_value); - } - if (Optional.IsDefined(_expiresAfterSeconds)) - { - writer.WritePropertyName("expiresAfterSeconds"u8); - writer.WriteNumberValue(_expiresAfterSeconds.Value); - } - if (Optional.IsDefined(Expedite)) - { - writer.WritePropertyName("expedite"u8); - writer.WriteBooleanValue(Expedite.Value); - } - writer.WriteEndObject(); - } - internal static RouterWorkerSelector DeserializeRouterWorkerSelector(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -47,7 +22,7 @@ internal static RouterWorkerSelector DeserializeRouterWorkerSelector(JsonElement } string key = default; LabelOperator labelOperator = default; - Optional value = default; + Optional value = default; Optional expiresAfterSeconds = default; Optional expedite = default; Optional status = default; @@ -70,7 +45,7 @@ internal static RouterWorkerSelector DeserializeRouterWorkerSelector(JsonElement { continue; } - value = property.Value.GetObject(); + value = BinaryData.FromString(property.Value.GetRawText()); continue; } if (property.NameEquals("expiresAfterSeconds"u8)) @@ -112,5 +87,13 @@ internal static RouterWorkerSelector DeserializeRouterWorkerSelector(JsonElement } return new RouterWorkerSelector(key, labelOperator, value.Value, Optional.ToNullable(expiresAfterSeconds), Optional.ToNullable(expedite), Optional.ToNullable(status), Optional.ToNullable(expiresAt)); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RouterWorkerSelector FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRouterWorkerSelector(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerSelector.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerSelector.cs similarity index 65% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerSelector.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerSelector.cs index 05552a8b8051..599149768029 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerSelector.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerSelector.cs @@ -6,23 +6,28 @@ #nullable disable using System; -using Azure.Communication.JobRouter.Models; using Azure.Core; namespace Azure.Communication.JobRouter { - /// Describes a condition that must be met against a set of labels for worker selection. + /// + /// Describes a condition that must be met against a set of labels for worker + /// selection + /// public partial class RouterWorkerSelector { /// Initializes a new instance of RouterWorkerSelector. /// The label key to query against. - /// Describes how the value of the label is compared to the value defined on the label selector. + /// + /// Describes how the value of the label is compared to the value defined on the + /// label selector + /// /// The value to compare against the actual label value with the given operator. /// Describes how long this label selector is valid in seconds. /// Pushes the job to the front of the queue as long as this selector is active. /// The status of the worker selector. /// The time at which this worker selector expires in UTC. - internal RouterWorkerSelector(string key, LabelOperator labelOperator, object value, double? expiresAfterSeconds, bool? expedite, RouterWorkerSelectorStatus? status, DateTimeOffset? expiresAt) + internal RouterWorkerSelector(string key, LabelOperator labelOperator, BinaryData value, double? expiresAfterSeconds, bool? expedite, RouterWorkerSelectorStatus? status, DateTimeOffset? expiresAt) { Key = key; LabelOperator = labelOperator; @@ -34,14 +39,15 @@ internal RouterWorkerSelector(string key, LabelOperator labelOperator, object va } /// The label key to query against. - public string Key { get; set; } - /// Describes how the value of the label is compared to the value defined on the label selector. - public LabelOperator LabelOperator { get; set; } + public string Key { get; } + /// + /// Describes how the value of the label is compared to the value defined on the + /// label selector + /// + public LabelOperator LabelOperator { get; } /// Pushes the job to the front of the queue as long as this selector is active. - public bool? Expedite { get; set; } + public bool? Expedite { get; } /// The status of the worker selector. public RouterWorkerSelectorStatus? Status { get; } - /// The time at which this worker selector expires in UTC. - public DateTimeOffset? ExpiresAt { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerSelectorStatus.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerSelectorStatus.cs similarity index 94% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerSelectorStatus.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerSelectorStatus.cs index e3cb273b0b25..4f8b793e1c3a 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerSelectorStatus.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerSelectorStatus.cs @@ -8,7 +8,7 @@ using System; using System.ComponentModel; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { /// The status of the worker selector. public readonly partial struct RouterWorkerSelectorStatus : IEquatable @@ -25,9 +25,9 @@ public RouterWorkerSelectorStatus(string value) private const string ActiveValue = "active"; private const string ExpiredValue = "expired"; - /// active. + /// Active. public static RouterWorkerSelectorStatus Active { get; } = new RouterWorkerSelectorStatus(ActiveValue); - /// expired. + /// Expired. public static RouterWorkerSelectorStatus Expired { get; } = new RouterWorkerSelectorStatus(ExpiredValue); /// Determines if two values are the same. public static bool operator ==(RouterWorkerSelectorStatus left, RouterWorkerSelectorStatus right) => left.Equals(right); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerState.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerState.cs similarity index 87% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerState.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerState.cs index 1b2ffe255577..35b83c044214 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerState.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerState.cs @@ -10,7 +10,7 @@ namespace Azure.Communication.JobRouter { - /// The current state of the worker. + /// Enums for worker status. public readonly partial struct RouterWorkerState : IEquatable { private readonly string _value; @@ -26,11 +26,11 @@ public RouterWorkerState(string value) private const string DrainingValue = "draining"; private const string InactiveValue = "inactive"; - /// active. + /// Worker is active and available to take offers. public static RouterWorkerState Active { get; } = new RouterWorkerState(ActiveValue); - /// draining. + /// Worker is not active, if there are existing offers they are being revoked. No new offers are sent. public static RouterWorkerState Draining { get; } = new RouterWorkerState(DrainingValue); - /// inactive. + /// Worker is not active. No new offers are sent. public static RouterWorkerState Inactive { get; } = new RouterWorkerState(InactiveValue); /// Determines if two values are the same. public static bool operator ==(RouterWorkerState left, RouterWorkerState right) => left.Equals(right); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerStateSelector.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerStateSelector.cs similarity index 86% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerStateSelector.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerStateSelector.cs index 363479c7c260..3329716d9604 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RouterWorkerStateSelector.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RouterWorkerStateSelector.cs @@ -10,7 +10,7 @@ namespace Azure.Communication.JobRouter { - /// The RouterWorkerStateSelector. + /// Enums used to filters workers by state. public readonly partial struct RouterWorkerStateSelector : IEquatable { private readonly string _value; @@ -27,13 +27,13 @@ public RouterWorkerStateSelector(string value) private const string InactiveValue = "inactive"; private const string AllValue = "all"; - /// active. + /// Worker is active and available to take offers. public static RouterWorkerStateSelector Active { get; } = new RouterWorkerStateSelector(ActiveValue); - /// draining. + /// Worker is not active, if there are existing offers they are being revoked. No new offers are sent. public static RouterWorkerStateSelector Draining { get; } = new RouterWorkerStateSelector(DrainingValue); - /// inactive. + /// Worker is not active. No new offers are sent. public static RouterWorkerStateSelector Inactive { get; } = new RouterWorkerStateSelector(InactiveValue); - /// all. + /// Worker is active or draining or inactive. public static RouterWorkerStateSelector All { get; } = new RouterWorkerStateSelector(AllValue); /// Determines if two values are the same. public static bool operator ==(RouterWorkerStateSelector left, RouterWorkerStateSelector right) => left.Equals(right); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineQueueSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RuleEngineQueueSelectorAttachment.Serialization.cs similarity index 69% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineQueueSelectorAttachment.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RuleEngineQueueSelectorAttachment.Serialization.cs index 714d96bd0e8d..516ace269d66 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineQueueSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RuleEngineQueueSelectorAttachment.Serialization.cs @@ -6,22 +6,12 @@ #nullable disable using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.Communication.JobRouter { - public partial class RuleEngineQueueSelectorAttachment : IUtf8JsonSerializable + public partial class RuleEngineQueueSelectorAttachment { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("rule"u8); - writer.WriteObjectValue(Rule); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static RuleEngineQueueSelectorAttachment DeserializeRuleEngineQueueSelectorAttachment(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -45,5 +35,13 @@ internal static RuleEngineQueueSelectorAttachment DeserializeRuleEngineQueueSele } return new RuleEngineQueueSelectorAttachment(kind, rule); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new RuleEngineQueueSelectorAttachment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRuleEngineQueueSelectorAttachment(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RuleEngineQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RuleEngineQueueSelectorAttachment.cs new file mode 100644 index 000000000000..cb56981ecf8a --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RuleEngineQueueSelectorAttachment.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + /// Attaches queue selectors to a job when the RouterRule is resolved. + public partial class RuleEngineQueueSelectorAttachment : QueueSelectorAttachment + { + /// 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. + /// + /// is null. + internal RuleEngineQueueSelectorAttachment(RouterRule rule) + { + Argument.AssertNotNull(rule, nameof(rule)); + + Kind = "rule-engine"; + Rule = rule; + } + + /// Initializes a new instance of RuleEngineQueueSelectorAttachment. + /// 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. + /// + internal RuleEngineQueueSelectorAttachment(string kind, RouterRule rule) : base(kind) + { + Rule = rule; + } + + /// + /// 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 Rule { get; } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineWorkerSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RuleEngineWorkerSelectorAttachment.Serialization.cs similarity index 69% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineWorkerSelectorAttachment.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/RuleEngineWorkerSelectorAttachment.Serialization.cs index 0b2db2ff0c89..f11d8ec75374 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/RuleEngineWorkerSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RuleEngineWorkerSelectorAttachment.Serialization.cs @@ -6,22 +6,12 @@ #nullable disable using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.Communication.JobRouter { - public partial class RuleEngineWorkerSelectorAttachment : IUtf8JsonSerializable + public partial class RuleEngineWorkerSelectorAttachment { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("rule"u8); - writer.WriteObjectValue(Rule); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static RuleEngineWorkerSelectorAttachment DeserializeRuleEngineWorkerSelectorAttachment(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -45,5 +35,13 @@ internal static RuleEngineWorkerSelectorAttachment DeserializeRuleEngineWorkerSe } return new RuleEngineWorkerSelectorAttachment(kind, rule); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new RuleEngineWorkerSelectorAttachment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeRuleEngineWorkerSelectorAttachment(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/RuleEngineWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RuleEngineWorkerSelectorAttachment.cs new file mode 100644 index 000000000000..ad23a454d56b --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/RuleEngineWorkerSelectorAttachment.cs @@ -0,0 +1,82 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + /// Attaches worker selectors to a job when a RouterRule is resolved. + public partial class RuleEngineWorkerSelectorAttachment : WorkerSelectorAttachment + { + /// 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. + /// + /// is null. + internal RuleEngineWorkerSelectorAttachment(RouterRule rule) + { + Argument.AssertNotNull(rule, nameof(rule)); + + Kind = "rule-engine"; + Rule = rule; + } + + /// Initializes a new instance of RuleEngineWorkerSelectorAttachment. + /// 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. + /// + internal RuleEngineWorkerSelectorAttachment(string kind, RouterRule rule) : base(kind) + { + Rule = rule; + } + + /// + /// 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 Rule { get; } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScheduleAndSuspendMode.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScheduleAndSuspendMode.Serialization.cs similarity index 50% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScheduleAndSuspendMode.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ScheduleAndSuspendMode.Serialization.cs index 96abdd31f9f3..e7ebbc22d3d7 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScheduleAndSuspendMode.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScheduleAndSuspendMode.Serialization.cs @@ -7,43 +7,43 @@ using System; using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class ScheduleAndSuspendMode : IUtf8JsonSerializable + public partial class ScheduleAndSuspendMode { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(ScheduleAt)) - { - writer.WritePropertyName("scheduleAt"u8); - writer.WriteStringValue(ScheduleAt, "O"); - } - writer.WriteEndObject(); - } - internal static ScheduleAndSuspendMode DeserializeScheduleAndSuspendMode(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - Optional scheduleAt = default; + DateTimeOffset scheduleAt = default; + string kind = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("scheduleAt"u8)) { - if (property.Value.ValueKind == JsonValueKind.Null) - { - continue; - } scheduleAt = property.Value.GetDateTimeOffset("O"); continue; } + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } } - return new ScheduleAndSuspendMode(scheduleAt); + return new ScheduleAndSuspendMode(kind, scheduleAt); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new ScheduleAndSuspendMode FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeScheduleAndSuspendMode(document.RootElement); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScheduleAndSuspendMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScheduleAndSuspendMode.cs new file mode 100644 index 000000000000..fa76bd05a83b --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScheduleAndSuspendMode.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; + +namespace Azure.Communication.JobRouter +{ + /// + /// 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. + /// + public partial class ScheduleAndSuspendMode : JobMatchingMode + { + /// Initializes a new instance of ScheduleAndSuspendMode. + /// Discriminator. + /// Scheduled time. + internal ScheduleAndSuspendMode(string kind, DateTimeOffset scheduleAt) : base(kind) + { + ScheduleAt = scheduleAt; + } + + /// Scheduled time. + public DateTimeOffset ScheduleAt { get; } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScoringRuleOptions.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScoringRuleOptions.Serialization.cs similarity index 67% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScoringRuleOptions.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ScoringRuleOptions.Serialization.cs index 02012cc87f00..6a4746579c67 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScoringRuleOptions.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScoringRuleOptions.Serialization.cs @@ -7,44 +7,13 @@ 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 ScoringRuleOptions : IUtf8JsonSerializable + public partial class ScoringRuleOptions { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(BatchSize)) - { - writer.WritePropertyName("batchSize"u8); - writer.WriteNumberValue(BatchSize.Value); - } - if (Optional.IsCollectionDefined(ScoringParameters)) - { - writer.WritePropertyName("scoringParameters"u8); - writer.WriteStartArray(); - foreach (var item in ScoringParameters) - { - writer.WriteStringValue(item.ToString()); - } - writer.WriteEndArray(); - } - if (Optional.IsDefined(AllowScoringBatchOfWorkers)) - { - writer.WritePropertyName("allowScoringBatchOfWorkers"u8); - writer.WriteBooleanValue(AllowScoringBatchOfWorkers.Value); - } - if (Optional.IsDefined(DescendingOrder)) - { - writer.WritePropertyName("descendingOrder"u8); - writer.WriteBooleanValue(DescendingOrder.Value); - } - writer.WriteEndObject(); - } - internal static ScoringRuleOptions DeserializeScoringRuleOptions(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -101,5 +70,13 @@ internal static ScoringRuleOptions DeserializeScoringRuleOptions(JsonElement ele } return new ScoringRuleOptions(Optional.ToNullable(batchSize), Optional.ToList(scoringParameters), Optional.ToNullable(allowScoringBatchOfWorkers), Optional.ToNullable(descendingOrder)); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ScoringRuleOptions FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeScoringRuleOptions(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScoringRuleOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScoringRuleOptions.cs new file mode 100644 index 000000000000..c787062c2c68 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScoringRuleOptions.cs @@ -0,0 +1,84 @@ +// 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 +{ + /// + /// Encapsulates all options that can be passed as parameters for scoring rule with + /// BestWorkerMode + /// + public partial class ScoringRuleOptions + { + /// Initializes a new instance of ScoringRuleOptions. + internal ScoringRuleOptions() + { + ScoringParameters = new ChangeTrackingList(); + } + + /// 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. + /// + internal ScoringRuleOptions(int? batchSize, IList scoringParameters, bool? allowScoringBatchOfWorkers, bool? descendingOrder) + { + BatchSize = batchSize; + ScoringParameters = scoringParameters; + AllowScoringBatchOfWorkers = allowScoringBatchOfWorkers; + DescendingOrder = descendingOrder; + } + + /// + /// (Optional) Set batch size when AllowScoringBatchOfWorkers is set to true. + /// Defaults to 20 if not configured. + /// + public int? BatchSize { get; } + /// + /// (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. + /// + public bool? AllowScoringBatchOfWorkers { get; } + /// + /// (Optional) + /// If false, will sort scores by ascending order. By default, set to + /// true. + /// + public bool? DescendingOrder { get; } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScoringRuleParameterSelector.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScoringRuleParameterSelector.cs similarity index 91% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScoringRuleParameterSelector.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/ScoringRuleParameterSelector.cs index 17a9209a264d..892d4c801296 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/ScoringRuleParameterSelector.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/ScoringRuleParameterSelector.cs @@ -25,9 +25,9 @@ public ScoringRuleParameterSelector(string value) private const string JobLabelsValue = "jobLabels"; private const string WorkerSelectorsValue = "workerSelectors"; - /// jobLabels. + /// Parameter to add job labels to scoring payload. Property is sent as `job`. public static ScoringRuleParameterSelector JobLabels { get; } = new ScoringRuleParameterSelector(JobLabelsValue); - /// workerSelectors. + /// Parameter to add worker selectors from the job to scoring payload. Property is sent as `selectors`. public static ScoringRuleParameterSelector WorkerSelectors { get; } = new ScoringRuleParameterSelector(WorkerSelectorsValue); /// Determines if two values are the same. public static bool operator ==(ScoringRuleParameterSelector left, ScoringRuleParameterSelector right) => left.Equals(right); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticQueueSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticQueueSelectorAttachment.Serialization.cs similarity index 70% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticQueueSelectorAttachment.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticQueueSelectorAttachment.Serialization.cs index 08c2ea517a42..704916d2f857 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticQueueSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticQueueSelectorAttachment.Serialization.cs @@ -6,22 +6,12 @@ #nullable disable using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.Communication.JobRouter { - public partial class StaticQueueSelectorAttachment : IUtf8JsonSerializable + public partial class StaticQueueSelectorAttachment { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("queueSelector"u8); - writer.WriteObjectValue(QueueSelector); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static StaticQueueSelectorAttachment DeserializeStaticQueueSelectorAttachment(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -45,5 +35,13 @@ internal static StaticQueueSelectorAttachment DeserializeStaticQueueSelectorAtta } return new StaticQueueSelectorAttachment(kind, queueSelector); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new StaticQueueSelectorAttachment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeStaticQueueSelectorAttachment(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticQueueSelectorAttachment.cs similarity index 60% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticQueueSelectorAttachment.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticQueueSelectorAttachment.cs index 278e5cc7c70d..491eb4335cde 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticQueueSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticQueueSelectorAttachment.cs @@ -14,26 +14,34 @@ namespace Azure.Communication.JobRouter public partial class StaticQueueSelectorAttachment : QueueSelectorAttachment { /// Initializes a new instance of StaticQueueSelectorAttachment. - /// Describes a condition that must be met against a set of labels for queue selection. + /// + /// Describes a condition that must be met against a set of labels for queue + /// selection + /// /// is null. - public StaticQueueSelectorAttachment(RouterQueueSelector queueSelector) + internal StaticQueueSelectorAttachment(RouterQueueSelector queueSelector) { Argument.AssertNotNull(queueSelector, nameof(queueSelector)); - QueueSelector = queueSelector; Kind = "static"; + QueueSelector = queueSelector; } /// Initializes a new instance of StaticQueueSelectorAttachment. - /// The type discriminator describing the type of queue selector attachment. - /// Describes a condition that must be met against a set of labels for queue selection. + /// Discriminator. + /// + /// Describes a condition that must be met against a set of labels for queue + /// selection + /// internal StaticQueueSelectorAttachment(string kind, RouterQueueSelector queueSelector) : base(kind) { QueueSelector = queueSelector; - Kind = kind ?? "static"; } - /// Describes a condition that must be met against a set of labels for queue selection. - public RouterQueueSelector QueueSelector { get; set; } + /// + /// Describes a condition that must be met against a set of labels for queue + /// selection + /// + public RouterQueueSelector QueueSelector { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticRouterRule.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticRouterRule.Serialization.cs similarity index 65% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticRouterRule.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticRouterRule.Serialization.cs index cea28aad59aa..2b2a3bedbb94 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticRouterRule.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticRouterRule.Serialization.cs @@ -5,33 +5,22 @@ #nullable disable +using System; using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class StaticRouterRule : IUtf8JsonSerializable + public partial class StaticRouterRule { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(_value)) - { - writer.WritePropertyName("value"u8); - writer.WriteObjectValue(_value); - } - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static StaticRouterRule DeserializeStaticRouterRule(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - Optional value = default; + Optional value = default; string kind = default; foreach (var property in element.EnumerateObject()) { @@ -41,7 +30,7 @@ internal static StaticRouterRule DeserializeStaticRouterRule(JsonElement element { continue; } - value = property.Value.GetObject(); + value = BinaryData.FromString(property.Value.GetRawText()); continue; } if (property.NameEquals("kind"u8)) @@ -52,5 +41,13 @@ internal static StaticRouterRule DeserializeStaticRouterRule(JsonElement element } return new StaticRouterRule(kind, value.Value); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new StaticRouterRule FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeStaticRouterRule(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticRouterRule.cs similarity index 58% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticRouterRule.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticRouterRule.cs index d5ad0339475d..5357c58403f6 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticRouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticRouterRule.cs @@ -5,18 +5,22 @@ #nullable disable +using System; + namespace Azure.Communication.JobRouter { - /// A rule providing static rules that always return the same result, regardless of input. + /// + /// A rule providing static rules that always return the same result, regardless of + /// input. + /// public partial class StaticRouterRule : RouterRule { /// Initializes a new instance of StaticRouterRule. - /// The type discriminator describing a sub-type of Rule. + /// Discriminator. /// The static value this rule always returns. - internal StaticRouterRule(string kind, object value) : base(kind) + internal StaticRouterRule(string kind, BinaryData value) : base(kind) { _value = value; - Kind = kind ?? "static-rule"; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticWorkerSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticWorkerSelectorAttachment.Serialization.cs similarity index 70% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticWorkerSelectorAttachment.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticWorkerSelectorAttachment.Serialization.cs index 3d43861eae32..603c696598ac 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticWorkerSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticWorkerSelectorAttachment.Serialization.cs @@ -6,22 +6,12 @@ #nullable disable using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.Communication.JobRouter { - public partial class StaticWorkerSelectorAttachment : IUtf8JsonSerializable + public partial class StaticWorkerSelectorAttachment { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("workerSelector"u8); - writer.WriteObjectValue(WorkerSelector); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static StaticWorkerSelectorAttachment DeserializeStaticWorkerSelectorAttachment(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -45,5 +35,13 @@ internal static StaticWorkerSelectorAttachment DeserializeStaticWorkerSelectorAt } return new StaticWorkerSelectorAttachment(kind, workerSelector); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new StaticWorkerSelectorAttachment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeStaticWorkerSelectorAttachment(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticWorkerSelectorAttachment.cs similarity index 60% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticWorkerSelectorAttachment.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticWorkerSelectorAttachment.cs index e82a89e46132..31d1a60e47a1 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/StaticWorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/StaticWorkerSelectorAttachment.cs @@ -14,26 +14,34 @@ namespace Azure.Communication.JobRouter public partial class StaticWorkerSelectorAttachment : WorkerSelectorAttachment { /// Initializes a new instance of StaticWorkerSelectorAttachment. - /// Describes a condition that must be met against a set of labels for worker selection. + /// + /// Describes a condition that must be met against a set of labels for worker + /// selection + /// /// is null. - public StaticWorkerSelectorAttachment(RouterWorkerSelector workerSelector) + internal StaticWorkerSelectorAttachment(RouterWorkerSelector workerSelector) { Argument.AssertNotNull(workerSelector, nameof(workerSelector)); - WorkerSelector = workerSelector; Kind = "static"; + WorkerSelector = workerSelector; } /// Initializes a new instance of StaticWorkerSelectorAttachment. - /// The type discriminator describing the type of worker selector attachment. - /// Describes a condition that must be met against a set of labels for worker selection. + /// Discriminator. + /// + /// Describes a condition that must be met against a set of labels for worker + /// selection + /// internal StaticWorkerSelectorAttachment(string kind, RouterWorkerSelector workerSelector) : base(kind) { WorkerSelector = workerSelector; - Kind = kind ?? "static"; } - /// Describes a condition that must be met against a set of labels for worker selection. - public RouterWorkerSelector WorkerSelector { get; set; } + /// + /// Describes a condition that must be met against a set of labels for worker + /// selection + /// + public RouterWorkerSelector WorkerSelector { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/SuspendMode.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/SuspendMode.Serialization.cs new file mode 100644 index 000000000000..d70f77354cf5 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/SuspendMode.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure; + +namespace Azure.Communication.JobRouter +{ + public partial class SuspendMode + { + internal static SuspendMode DeserializeSuspendMode(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string kind = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + } + return new SuspendMode(kind); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new SuspendMode FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeSuspendMode(document.RootElement); + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/SuspendMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/SuspendMode.cs new file mode 100644 index 000000000000..816ab3927353 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/SuspendMode.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.JobRouter +{ + /// Describes a matching mode where matching worker to a job is suspended. + public partial class SuspendMode : JobMatchingMode + { + /// Initializes a new instance of SuspendMode. + /// Discriminator. + internal SuspendMode(string kind) : base(kind) + { + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobRequest.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobRequest.Serialization.cs similarity index 69% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobRequest.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobRequest.Serialization.cs index 83225de58018..4c14246a8a3d 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobRequest.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobRequest.Serialization.cs @@ -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/UnassignJobRequest.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobRequest.cs new file mode 100644 index 000000000000..5ae1aa9119f3 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobRequest.cs @@ -0,0 +1,34 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.JobRouter +{ + /// Request payload for unassigning a job. + internal partial class UnassignJobRequest + { + /// Initializes a new instance of UnassignJobRequest. + public UnassignJobRequest() + { + } + + /// Initializes a new instance of UnassignJobRequest. + /// + /// If SuspendMatching is true, then the job is not queued for re-matching with a + /// worker. + /// + internal UnassignJobRequest(bool? suspendMatching) + { + SuspendMatching = suspendMatching; + } + + /// + /// If SuspendMatching is true, then the job is not queued for re-matching with a + /// worker. + /// + public bool? SuspendMatching { get; set; } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobResult.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobResult.Serialization.cs similarity index 69% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobResult.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobResult.Serialization.cs index bfd131a74e0d..85a06611cf20 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobResult.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobResult.Serialization.cs @@ -6,8 +6,9 @@ #nullable disable using System.Text.Json; +using Azure; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { public partial class UnassignJobResult { @@ -34,5 +35,13 @@ internal static UnassignJobResult DeserializeUnassignJobResult(JsonElement eleme } return new UnassignJobResult(jobId, unassignmentCount); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static UnassignJobResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnassignJobResult(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobResult.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobResult.cs similarity index 96% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobResult.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobResult.cs index d0665686417a..aec541824a5c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnassignJobResult.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnassignJobResult.cs @@ -8,7 +8,7 @@ using System; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { /// Response payload after a job has been successfully unassigned. public partial class UnassignJobResult diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownDistributionMode.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownDistributionMode.Serialization.cs similarity index 69% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownDistributionMode.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownDistributionMode.Serialization.cs index 93c905cd442f..1092d82b0577 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownDistributionMode.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownDistributionMode.Serialization.cs @@ -6,35 +6,13 @@ #nullable disable using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - internal partial class UnknownDistributionMode : IUtf8JsonSerializable + internal partial class UnknownDistributionMode { - 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 UnknownDistributionMode DeserializeUnknownDistributionMode(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -82,5 +60,13 @@ internal static UnknownDistributionMode DeserializeUnknownDistributionMode(JsonE } return new UnknownDistributionMode(kind, minConcurrentOffers, maxConcurrentOffers, Optional.ToNullable(bypassSelectors)); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownDistributionMode FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownDistributionMode(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownDistributionMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownDistributionMode.cs similarity index 65% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownDistributionMode.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownDistributionMode.cs index d981b091109f..ae426ad8ff33 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownDistributionMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownDistributionMode.cs @@ -7,23 +7,30 @@ namespace Azure.Communication.JobRouter { - /// The UnknownDistributionMode. + /// Unknown version of DistributionMode. internal partial class UnknownDistributionMode : DistributionMode { /// Initializes a new instance of UnknownDistributionMode. - /// The type discriminator describing a sub-type of Mode. + internal UnknownDistributionMode() + { + } + + /// Initializes a new instance of UnknownDistributionMode. + /// 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 UnknownDistributionMode(string kind, int minConcurrentOffers, int maxConcurrentOffers, bool? bypassSelectors) : base(kind, minConcurrentOffers, maxConcurrentOffers, bypassSelectors) { - Kind = kind ?? "Unknown"; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionAction.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionAction.Serialization.cs similarity index 64% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionAction.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionAction.Serialization.cs index 1cd0e49c19ef..6a148641e730 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionAction.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionAction.Serialization.cs @@ -6,20 +6,12 @@ #nullable disable using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.Communication.JobRouter { - internal partial class UnknownExceptionAction : IUtf8JsonSerializable + internal partial class UnknownExceptionAction { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static UnknownExceptionAction DeserializeUnknownExceptionAction(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -37,5 +29,13 @@ internal static UnknownExceptionAction DeserializeUnknownExceptionAction(JsonEle } return new UnknownExceptionAction(kind); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownExceptionAction FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownExceptionAction(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionAction.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionAction.cs similarity index 61% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionAction.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionAction.cs index 087f6eb8b9ec..a336aa38e90f 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionAction.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionAction.cs @@ -7,14 +7,18 @@ namespace Azure.Communication.JobRouter { - /// The UnknownExceptionAction. + /// Unknown version of ExceptionAction. internal partial class UnknownExceptionAction : ExceptionAction { /// Initializes a new instance of UnknownExceptionAction. - /// The type discriminator describing a sub-type of ExceptionAction. + internal UnknownExceptionAction() + { + } + + /// Initializes a new instance of UnknownExceptionAction. + /// Discriminator. internal UnknownExceptionAction(string kind) : base(kind) { - Kind = kind ?? "Unknown"; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionTrigger.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionTrigger.Serialization.cs similarity index 64% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionTrigger.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionTrigger.Serialization.cs index 4298ee82cfc5..d7b1a483bddc 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionTrigger.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionTrigger.Serialization.cs @@ -6,20 +6,12 @@ #nullable disable using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.Communication.JobRouter { - internal partial class UnknownExceptionTrigger : IUtf8JsonSerializable + internal partial class UnknownExceptionTrigger { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static UnknownExceptionTrigger DeserializeUnknownExceptionTrigger(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -37,5 +29,13 @@ internal static UnknownExceptionTrigger DeserializeUnknownExceptionTrigger(JsonE } return new UnknownExceptionTrigger(kind); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownExceptionTrigger FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownExceptionTrigger(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionTrigger.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionTrigger.cs similarity index 61% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionTrigger.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionTrigger.cs index 9640b811683f..18efc690d360 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownExceptionTrigger.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownExceptionTrigger.cs @@ -7,14 +7,18 @@ namespace Azure.Communication.JobRouter { - /// The UnknownExceptionTrigger. + /// Unknown version of ExceptionTrigger. internal partial class UnknownExceptionTrigger : ExceptionTrigger { /// Initializes a new instance of UnknownExceptionTrigger. - /// The type discriminator describing a sub-type of ExceptionTrigger. + internal UnknownExceptionTrigger() + { + } + + /// Initializes a new instance of UnknownExceptionTrigger. + /// Discriminator. internal UnknownExceptionTrigger(string kind) : base(kind) { - Kind = kind ?? "Unknown"; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownJobMatchingMode.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownJobMatchingMode.Serialization.cs new file mode 100644 index 000000000000..7364844c8326 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownJobMatchingMode.Serialization.cs @@ -0,0 +1,41 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System.Text.Json; +using Azure; + +namespace Azure.Communication.JobRouter +{ + internal partial class UnknownJobMatchingMode + { + internal static UnknownJobMatchingMode DeserializeUnknownJobMatchingMode(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string kind = "Unknown"; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = property.Value.GetString(); + continue; + } + } + return new UnknownJobMatchingMode(kind); + } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownJobMatchingMode FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownJobMatchingMode(document.RootElement); + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownJobMatchingMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownJobMatchingMode.cs new file mode 100644 index 000000000000..63b8e665d6e6 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownJobMatchingMode.cs @@ -0,0 +1,19 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +namespace Azure.Communication.JobRouter +{ + /// Unknown version of JobMatchingMode. + internal partial class UnknownJobMatchingMode : JobMatchingMode + { + /// Initializes a new instance of UnknownJobMatchingMode. + /// Discriminator. + internal UnknownJobMatchingMode(string kind) : base(kind) + { + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownQueueSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownQueueSelectorAttachment.Serialization.cs similarity index 63% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownQueueSelectorAttachment.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownQueueSelectorAttachment.Serialization.cs index 6ee8c8edd9fd..75817496b047 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownQueueSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownQueueSelectorAttachment.Serialization.cs @@ -6,20 +6,12 @@ #nullable disable using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.Communication.JobRouter { - internal partial class UnknownQueueSelectorAttachment : IUtf8JsonSerializable + internal partial class UnknownQueueSelectorAttachment { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static UnknownQueueSelectorAttachment DeserializeUnknownQueueSelectorAttachment(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -37,5 +29,13 @@ internal static UnknownQueueSelectorAttachment DeserializeUnknownQueueSelectorAt } return new UnknownQueueSelectorAttachment(kind); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownQueueSelectorAttachment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownQueueSelectorAttachment(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownQueueSelectorAttachment.cs similarity index 61% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownQueueSelectorAttachment.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownQueueSelectorAttachment.cs index f2b29cc725df..8fba081e56f7 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownQueueSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownQueueSelectorAttachment.cs @@ -7,14 +7,18 @@ namespace Azure.Communication.JobRouter { - /// The UnknownQueueSelectorAttachment. + /// Unknown version of QueueSelectorAttachment. internal partial class UnknownQueueSelectorAttachment : QueueSelectorAttachment { /// Initializes a new instance of UnknownQueueSelectorAttachment. - /// The type discriminator describing the type of queue selector attachment. + internal UnknownQueueSelectorAttachment() + { + } + + /// Initializes a new instance of UnknownQueueSelectorAttachment. + /// Discriminator. internal UnknownQueueSelectorAttachment(string kind) : base(kind) { - Kind = kind ?? "Unknown"; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownRouterRule.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownRouterRule.Serialization.cs similarity index 64% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownRouterRule.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownRouterRule.Serialization.cs index 4ba98c5546c9..b0c802c9a978 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownRouterRule.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownRouterRule.Serialization.cs @@ -6,20 +6,12 @@ #nullable disable using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.Communication.JobRouter { - internal partial class UnknownRouterRule : IUtf8JsonSerializable + internal partial class UnknownRouterRule { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static UnknownRouterRule DeserializeUnknownRouterRule(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -37,5 +29,13 @@ internal static UnknownRouterRule DeserializeUnknownRouterRule(JsonElement eleme } return new UnknownRouterRule(kind); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownRouterRule FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownRouterRule(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownRouterRule.cs similarity index 69% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownRouterRule.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownRouterRule.cs index 7800194d4c9c..22c6e23ad602 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownRouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownRouterRule.cs @@ -7,14 +7,13 @@ namespace Azure.Communication.JobRouter { - /// The UnknownRouterRule. + /// Unknown version of RouterRule. internal partial class UnknownRouterRule : RouterRule { /// Initializes a new instance of UnknownRouterRule. - /// The type discriminator describing a sub-type of Rule. + /// Discriminator. internal UnknownRouterRule(string kind) : base(kind) { - Kind = kind ?? "Unknown"; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownWorkerSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownWorkerSelectorAttachment.Serialization.cs similarity index 63% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownWorkerSelectorAttachment.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownWorkerSelectorAttachment.Serialization.cs index 85bf372c8d2c..75bb03f30c0a 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownWorkerSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownWorkerSelectorAttachment.Serialization.cs @@ -6,20 +6,12 @@ #nullable disable using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.Communication.JobRouter { - internal partial class UnknownWorkerSelectorAttachment : IUtf8JsonSerializable + internal partial class UnknownWorkerSelectorAttachment { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static UnknownWorkerSelectorAttachment DeserializeUnknownWorkerSelectorAttachment(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -37,5 +29,13 @@ internal static UnknownWorkerSelectorAttachment DeserializeUnknownWorkerSelector } return new UnknownWorkerSelectorAttachment(kind); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownWorkerSelectorAttachment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeUnknownWorkerSelectorAttachment(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownWorkerSelectorAttachment.cs similarity index 61% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownWorkerSelectorAttachment.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownWorkerSelectorAttachment.cs index cd671a758fab..7c1d37def27c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/UnknownWorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/UnknownWorkerSelectorAttachment.cs @@ -7,14 +7,18 @@ namespace Azure.Communication.JobRouter { - /// The UnknownWorkerSelectorAttachment. + /// Unknown version of WorkerSelectorAttachment. internal partial class UnknownWorkerSelectorAttachment : WorkerSelectorAttachment { /// Initializes a new instance of UnknownWorkerSelectorAttachment. - /// The type discriminator describing the type of worker selector attachment. + internal UnknownWorkerSelectorAttachment() + { + } + + /// Initializes a new instance of UnknownWorkerSelectorAttachment. + /// Discriminator. internal UnknownWorkerSelectorAttachment(string kind) : base(kind) { - Kind = kind ?? "Unknown"; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WaitTimeExceptionTrigger.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WaitTimeExceptionTrigger.Serialization.cs similarity index 70% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WaitTimeExceptionTrigger.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/WaitTimeExceptionTrigger.Serialization.cs index 0cfa0a7227ed..69da787c9a2e 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WaitTimeExceptionTrigger.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WaitTimeExceptionTrigger.Serialization.cs @@ -6,22 +6,12 @@ #nullable disable using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.Communication.JobRouter { - public partial class WaitTimeExceptionTrigger : IUtf8JsonSerializable + public partial class WaitTimeExceptionTrigger { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("thresholdSeconds"u8); - writer.WriteNumberValue(_thresholdSeconds); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static WaitTimeExceptionTrigger DeserializeWaitTimeExceptionTrigger(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -45,5 +35,13 @@ internal static WaitTimeExceptionTrigger DeserializeWaitTimeExceptionTrigger(Jso } return new WaitTimeExceptionTrigger(kind, thresholdSeconds); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new WaitTimeExceptionTrigger FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeWaitTimeExceptionTrigger(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WaitTimeExceptionTrigger.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WaitTimeExceptionTrigger.cs similarity index 82% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WaitTimeExceptionTrigger.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/WaitTimeExceptionTrigger.cs index 8442b67c6755..dd5cc19ce2d2 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WaitTimeExceptionTrigger.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WaitTimeExceptionTrigger.cs @@ -11,12 +11,11 @@ namespace Azure.Communication.JobRouter public partial class WaitTimeExceptionTrigger : ExceptionTrigger { /// Initializes a new instance of WaitTimeExceptionTrigger. - /// The type discriminator describing a sub-type of ExceptionTrigger. + /// Discriminator. /// Threshold for wait time for this trigger. internal WaitTimeExceptionTrigger(string kind, double thresholdSeconds) : base(kind) { _thresholdSeconds = thresholdSeconds; - Kind = kind ?? "wait-time"; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WebhookRouterRule.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WebhookRouterRule.Serialization.cs similarity index 70% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WebhookRouterRule.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/WebhookRouterRule.Serialization.cs index 752d885c8323..f1fa3ddc265d 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WebhookRouterRule.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WebhookRouterRule.Serialization.cs @@ -7,35 +7,13 @@ using System; using System.Text.Json; +using Azure; using Azure.Core; namespace Azure.Communication.JobRouter { - public partial class WebhookRouterRule : IUtf8JsonSerializable + public partial class WebhookRouterRule { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - if (Optional.IsDefined(AuthorizationServerUri)) - { - writer.WritePropertyName("authorizationServerUri"u8); - writer.WriteStringValue(AuthorizationServerUri.AbsoluteUri); - } - if (Optional.IsDefined(ClientCredential)) - { - writer.WritePropertyName("clientCredential"u8); - writer.WriteObjectValue(ClientCredential); - } - if (Optional.IsDefined(WebhookUri)) - { - writer.WritePropertyName("webhookUri"u8); - writer.WriteStringValue(WebhookUri.AbsoluteUri); - } - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static WebhookRouterRule DeserializeWebhookRouterRule(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -83,5 +61,13 @@ internal static WebhookRouterRule DeserializeWebhookRouterRule(JsonElement eleme } return new WebhookRouterRule(kind, authorizationServerUri.Value, clientCredential.Value, webhookUri.Value); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new WebhookRouterRule FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeWebhookRouterRule(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WebhookRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WebhookRouterRule.cs similarity index 65% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WebhookRouterRule.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/WebhookRouterRule.cs index 1a187ccf2eaa..161a7c1b9545 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WebhookRouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WebhookRouterRule.cs @@ -13,17 +13,12 @@ namespace Azure.Communication.JobRouter public partial class WebhookRouterRule : RouterRule { /// Initializes a new instance of WebhookRouterRule. - public WebhookRouterRule() - { - Kind = "webhook-rule"; - } - - /// Initializes a new instance of WebhookRouterRule. - /// The type discriminator describing a sub-type of Rule. + /// Discriminator. /// Uri for Authorization Server. /// /// OAuth2.0 Credentials used to Contoso's Authorization server. - /// Reference: https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/ + /// Reference: + /// https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/ /// /// Uri for Contoso's Web Server. internal WebhookRouterRule(string kind, Uri authorizationServerUri, Oauth2ClientCredential clientCredential, Uri webhookUri) : base(kind) @@ -31,17 +26,17 @@ internal WebhookRouterRule(string kind, Uri authorizationServerUri, Oauth2Client AuthorizationServerUri = authorizationServerUri; ClientCredential = clientCredential; WebhookUri = webhookUri; - Kind = kind ?? "webhook-rule"; } /// Uri for Authorization Server. - public Uri AuthorizationServerUri { get; set; } + public Uri AuthorizationServerUri { get; } /// /// OAuth2.0 Credentials used to Contoso's Authorization server. - /// Reference: https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/ + /// Reference: + /// https://www.oauth.com/oauth2-servers/access-tokens/client-credentials/ /// - public Oauth2ClientCredential ClientCredential { get; set; } + public Oauth2ClientCredential ClientCredential { get; } /// Uri for Contoso's Web Server. - public Uri WebhookUri { get; set; } + public Uri WebhookUri { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationQueueSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WeightedAllocationQueueSelectorAttachment.Serialization.cs similarity index 71% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationQueueSelectorAttachment.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/WeightedAllocationQueueSelectorAttachment.Serialization.cs index 5fca27cd4c56..f07cfb54dddf 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationQueueSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WeightedAllocationQueueSelectorAttachment.Serialization.cs @@ -7,34 +7,19 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.Communication.JobRouter { - public partial class WeightedAllocationQueueSelectorAttachment : IUtf8JsonSerializable + public partial class WeightedAllocationQueueSelectorAttachment { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("allocations"u8); - writer.WriteStartArray(); - foreach (var item in Allocations) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static WeightedAllocationQueueSelectorAttachment DeserializeWeightedAllocationQueueSelectorAttachment(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - IList allocations = default; + IReadOnlyList allocations = default; string kind = default; foreach (var property in element.EnumerateObject()) { @@ -56,5 +41,13 @@ internal static WeightedAllocationQueueSelectorAttachment DeserializeWeightedAll } return new WeightedAllocationQueueSelectorAttachment(kind, allocations); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new WeightedAllocationQueueSelectorAttachment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeWeightedAllocationQueueSelectorAttachment(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WeightedAllocationQueueSelectorAttachment.cs similarity index 69% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationQueueSelectorAttachment.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/WeightedAllocationQueueSelectorAttachment.cs index 6f943be27048..078afe0b3ce5 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationQueueSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WeightedAllocationQueueSelectorAttachment.cs @@ -12,30 +12,32 @@ namespace Azure.Communication.JobRouter { - /// Describes multiple sets of queue selectors, of which one will be selected and attached according to a weighting. + /// + /// Describes multiple sets of queue selectors, of which one will be selected and + /// attached according to a weighting + /// public partial class WeightedAllocationQueueSelectorAttachment : QueueSelectorAttachment { /// Initializes a new instance of WeightedAllocationQueueSelectorAttachment. /// A collection of percentage based weighted allocations. /// is null. - public WeightedAllocationQueueSelectorAttachment(IEnumerable allocations) + internal WeightedAllocationQueueSelectorAttachment(IEnumerable allocations) { Argument.AssertNotNull(allocations, nameof(allocations)); - Allocations = allocations.ToList(); Kind = "weighted-allocation-queue-selector"; + Allocations = allocations.ToList(); } /// Initializes a new instance of WeightedAllocationQueueSelectorAttachment. - /// The type discriminator describing the type of queue selector attachment. + /// Discriminator. /// A collection of percentage based weighted allocations. - internal WeightedAllocationQueueSelectorAttachment(string kind, IList allocations) : base(kind) + internal WeightedAllocationQueueSelectorAttachment(string kind, IReadOnlyList allocations) : base(kind) { Allocations = allocations; - Kind = kind ?? "weighted-allocation-queue-selector"; } /// A collection of percentage based weighted allocations. - public IList Allocations { get; } + public IReadOnlyList Allocations { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationWorkerSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WeightedAllocationWorkerSelectorAttachment.Serialization.cs similarity index 71% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationWorkerSelectorAttachment.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/WeightedAllocationWorkerSelectorAttachment.Serialization.cs index f6850f96f9dd..eb0214d8166c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationWorkerSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WeightedAllocationWorkerSelectorAttachment.Serialization.cs @@ -7,34 +7,19 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.Communication.JobRouter { - public partial class WeightedAllocationWorkerSelectorAttachment : IUtf8JsonSerializable + public partial class WeightedAllocationWorkerSelectorAttachment { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("allocations"u8); - writer.WriteStartArray(); - foreach (var item in Allocations) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static WeightedAllocationWorkerSelectorAttachment DeserializeWeightedAllocationWorkerSelectorAttachment(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) { return null; } - IList allocations = default; + IReadOnlyList allocations = default; string kind = default; foreach (var property in element.EnumerateObject()) { @@ -56,5 +41,13 @@ internal static WeightedAllocationWorkerSelectorAttachment DeserializeWeightedAl } return new WeightedAllocationWorkerSelectorAttachment(kind, allocations); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new WeightedAllocationWorkerSelectorAttachment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeWeightedAllocationWorkerSelectorAttachment(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WeightedAllocationWorkerSelectorAttachment.cs similarity index 69% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationWorkerSelectorAttachment.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/WeightedAllocationWorkerSelectorAttachment.cs index ffc4e566a9ca..bc1aa5d2f7b3 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WeightedAllocationWorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WeightedAllocationWorkerSelectorAttachment.cs @@ -12,30 +12,32 @@ namespace Azure.Communication.JobRouter { - /// Describes multiple sets of worker selectors, of which one will be selected and attached according to a weighting. + /// + /// Describes multiple sets of worker selectors, of which one will be selected and + /// attached according to a weighting + /// public partial class WeightedAllocationWorkerSelectorAttachment : WorkerSelectorAttachment { /// Initializes a new instance of WeightedAllocationWorkerSelectorAttachment. /// A collection of percentage based weighted allocations. /// is null. - public WeightedAllocationWorkerSelectorAttachment(IEnumerable allocations) + internal WeightedAllocationWorkerSelectorAttachment(IEnumerable allocations) { Argument.AssertNotNull(allocations, nameof(allocations)); - Allocations = allocations.ToList(); Kind = "weighted-allocation-worker-selector"; + Allocations = allocations.ToList(); } /// Initializes a new instance of WeightedAllocationWorkerSelectorAttachment. - /// The type discriminator describing the type of worker selector attachment. + /// Discriminator. /// A collection of percentage based weighted allocations. - internal WeightedAllocationWorkerSelectorAttachment(string kind, IList allocations) : base(kind) + internal WeightedAllocationWorkerSelectorAttachment(string kind, IReadOnlyList allocations) : base(kind) { Allocations = allocations; - Kind = kind ?? "weighted-allocation-worker-selector"; } /// A collection of percentage based weighted allocations. - public IList Allocations { get; } + public IReadOnlyList Allocations { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerSelectorAttachment.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WorkerSelectorAttachment.Serialization.cs similarity index 76% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerSelectorAttachment.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/WorkerSelectorAttachment.Serialization.cs index 5cb29f56a143..ae2dbafa91b7 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerSelectorAttachment.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WorkerSelectorAttachment.Serialization.cs @@ -6,20 +6,12 @@ #nullable disable using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.Communication.JobRouter { - public partial class WorkerSelectorAttachment : IUtf8JsonSerializable + public partial class WorkerSelectorAttachment { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind); - writer.WriteEndObject(); - } - internal static WorkerSelectorAttachment DeserializeWorkerSelectorAttachment(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -39,5 +31,13 @@ internal static WorkerSelectorAttachment DeserializeWorkerSelectorAttachment(Jso } return UnknownWorkerSelectorAttachment.DeserializeUnknownWorkerSelectorAttachment(element); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static WorkerSelectorAttachment FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeWorkerSelectorAttachment(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WorkerSelectorAttachment.cs similarity index 78% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerSelectorAttachment.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/WorkerSelectorAttachment.cs index 9562cc3084fb..ef1125b80b26 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WorkerSelectorAttachment.cs @@ -15,10 +15,18 @@ namespace Azure.Communication.JobRouter public abstract partial class WorkerSelectorAttachment { /// Initializes a new instance of WorkerSelectorAttachment. - /// The type discriminator describing the type of worker selector attachment. + protected WorkerSelectorAttachment() + { + } + + /// Initializes a new instance of WorkerSelectorAttachment. + /// Discriminator. internal WorkerSelectorAttachment(string kind) { Kind = kind; } + + /// Discriminator. + internal string Kind { get; set; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerWeightedAllocation.Serialization.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WorkerWeightedAllocation.Serialization.cs similarity index 67% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerWeightedAllocation.Serialization.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/WorkerWeightedAllocation.Serialization.cs index 640d4310c86e..314719043e44 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerWeightedAllocation.Serialization.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WorkerWeightedAllocation.Serialization.cs @@ -7,27 +7,12 @@ using System.Collections.Generic; using System.Text.Json; -using Azure.Core; +using Azure; namespace Azure.Communication.JobRouter { - public partial class WorkerWeightedAllocation : IUtf8JsonSerializable + public partial class WorkerWeightedAllocation { - void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WritePropertyName("weight"u8); - writer.WriteNumberValue(Weight); - writer.WritePropertyName("workerSelectors"u8); - writer.WriteStartArray(); - foreach (var item in WorkerSelectors) - { - writer.WriteObjectValue(item); - } - writer.WriteEndArray(); - writer.WriteEndObject(); - } - internal static WorkerWeightedAllocation DeserializeWorkerWeightedAllocation(JsonElement element) { if (element.ValueKind == JsonValueKind.Null) @@ -35,7 +20,7 @@ internal static WorkerWeightedAllocation DeserializeWorkerWeightedAllocation(Jso return null; } double weight = default; - IList workerSelectors = default; + IReadOnlyList workerSelectors = default; foreach (var property in element.EnumerateObject()) { if (property.NameEquals("weight"u8)) @@ -56,5 +41,13 @@ internal static WorkerWeightedAllocation DeserializeWorkerWeightedAllocation(Jso } return new WorkerWeightedAllocation(weight, workerSelectors); } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static WorkerWeightedAllocation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + return DeserializeWorkerWeightedAllocation(document.RootElement); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerWeightedAllocation.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WorkerWeightedAllocation.cs similarity index 54% rename from sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerWeightedAllocation.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Generated/WorkerWeightedAllocation.cs index 6ca21f045df6..5ef90941d049 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/Models/WorkerWeightedAllocation.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/WorkerWeightedAllocation.cs @@ -12,14 +12,20 @@ namespace Azure.Communication.JobRouter { - /// Contains the weight percentage and worker selectors to be applied if selected for weighted distributions. + /// + /// Contains the weight percentage and worker selectors to be applied if selected + /// for weighted distributions. + /// public partial class WorkerWeightedAllocation { /// 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 collection of worker selectors that will be applied if this allocation is + /// selected. + /// /// is null. - public WorkerWeightedAllocation(double weight, IEnumerable workerSelectors) + internal WorkerWeightedAllocation(double weight, IEnumerable workerSelectors) { Argument.AssertNotNull(workerSelectors, nameof(workerSelectors)); @@ -29,16 +35,22 @@ public WorkerWeightedAllocation(double weight, IEnumerable /// 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. - internal WorkerWeightedAllocation(double weight, IList workerSelectors) + /// + /// A collection of worker selectors that will be applied if this allocation is + /// selected. + /// + internal WorkerWeightedAllocation(double weight, IReadOnlyList workerSelectors) { Weight = weight; WorkerSelectors = workerSelectors; } /// The percentage of this weight, expressed as a fraction of 1. - public double Weight { get; set; } - /// A collection of worker selectors that will be applied if this allocation is selected. - public IList WorkerSelectors { get; } + public double Weight { get; } + /// + /// A collection of worker selectors that will be applied if this allocation is + /// selected. + /// + public IReadOnlyList WorkerSelectors { get; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/tspCodeModel.json b/sdk/communication/Azure.Communication.JobRouter/src/Generated/tspCodeModel.json new file mode 100644 index 000000000000..60933b237b21 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/tspCodeModel.json @@ -0,0 +1,8625 @@ +{ + "$id": "1", + "Name": "AzureCommunicationRoutingService", + "Description": "Azure Communication Routing Service", + "ApiVersions": [ + "2023-11-01" + ], + "Enums": [ + { + "$id": "2", + "Name": "ExpressionRouterRuleLanguage", + "EnumValueType": "String", + "AllowedValues": [ + { + "$id": "3", + "Name": "powerFx", + "Value": "powerFx", + "Description": "PowerFx" + } + ], + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "The available expression languages that can be configured", + "IsExtensible": true, + "IsNullable": false, + "Usage": "Output" + }, + { + "$id": "4", + "Name": "ScoringRuleParameterSelector", + "EnumValueType": "String", + "AllowedValues": [ + { + "$id": "5", + "Name": "jobLabels", + "Value": "jobLabels", + "Description": "Parameter to add job labels to scoring payload. Property is sent as `job`." + }, + { + "$id": "6", + "Name": "workerSelectors", + "Value": "workerSelectors", + "Description": "Parameter to add worker selectors from the job to scoring payload. Property is sent as `selectors`." + } + ], + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "Supported parameters for scoring workers", + "IsExtensible": true, + "IsNullable": false, + "Usage": "Output" + }, + { + "$id": "7", + "Name": "LabelOperator", + "EnumValueType": "String", + "AllowedValues": [ + { + "$id": "8", + "Name": "equal", + "Value": "equal", + "Description": "Equal" + }, + { + "$id": "9", + "Name": "notEqual", + "Value": "notEqual", + "Description": "Not Equal" + }, + { + "$id": "10", + "Name": "lessThan", + "Value": "lessThan", + "Description": "Less than" + }, + { + "$id": "11", + "Name": "lessThanEqual", + "Value": "lessThanEqual", + "Description": "Less than or equal" + }, + { + "$id": "12", + "Name": "greaterThan", + "Value": "greaterThan", + "Description": "Greater than" + }, + { + "$id": "13", + "Name": "greaterThanEqual", + "Value": "greaterThanEqual", + "Description": "Greater than or equal" + } + ], + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "Describes supported operations on label values.", + "IsExtensible": true, + "IsNullable": false, + "Usage": "Output" + }, + { + "$id": "14", + "Name": "RouterWorkerSelectorStatus", + "EnumValueType": "String", + "AllowedValues": [ + { + "$id": "15", + "Name": "active", + "Value": "active", + "Description": "Active" + }, + { + "$id": "16", + "Name": "expired", + "Value": "expired", + "Description": "Expired" + } + ], + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "The status of the worker selector.", + "IsExtensible": true, + "IsNullable": false, + "Usage": "Output" + }, + { + "$id": "17", + "Name": "RouterJobStatus", + "EnumValueType": "String", + "AllowedValues": [ + { + "$id": "18", + "Name": "pendingClassification", + "Value": "pendingClassification", + "Description": "Job is waiting to be classified." + }, + { + "$id": "19", + "Name": "queued", + "Value": "queued", + "Description": "Job has been queued." + }, + { + "$id": "20", + "Name": "assigned", + "Value": "assigned", + "Description": "Job has been assigned to a worker." + }, + { + "$id": "21", + "Name": "completed", + "Value": "completed", + "Description": "Job has been completed by a worker." + }, + { + "$id": "22", + "Name": "closed", + "Value": "closed", + "Description": "Job has been closed by a worker." + }, + { + "$id": "23", + "Name": "cancelled", + "Value": "cancelled", + "Description": "Job has been cancelled." + }, + { + "$id": "24", + "Name": "classificationFailed", + "Value": "classificationFailed", + "Description": "Classification process failed for the job." + }, + { + "$id": "25", + "Name": "created", + "Value": "created", + "Description": "Job has been created." + }, + { + "$id": "26", + "Name": "pendingSchedule", + "Value": "pendingSchedule", + "Description": "Job has been created but not been scheduled yet." + }, + { + "$id": "27", + "Name": "scheduled", + "Value": "scheduled", + "Description": "Job has been scheduled successfully." + }, + { + "$id": "28", + "Name": "scheduleFailed", + "Value": "scheduleFailed", + "Description": "Job scheduling failed." + }, + { + "$id": "29", + "Name": "waitingForActivation", + "Value": "waitingForActivation", + "Description": "Job is in a suspended state and waiting for an update." + } + ], + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "The status of the Job.", + "IsExtensible": true, + "IsNullable": false, + "Usage": "Output" + }, + { + "$id": "30", + "Name": "RouterJobStatusSelector", + "EnumValueType": "String", + "AllowedValues": [ + { + "$id": "31", + "Name": "all", + "Value": "all", + "Description": "Default" + }, + { + "$id": "32", + "Name": "pendingClassification", + "Value": "pendingClassification", + "Description": "Job is waiting to be classified." + }, + { + "$id": "33", + "Name": "queued", + "Value": "queued", + "Description": "Job has been queued." + }, + { + "$id": "34", + "Name": "assigned", + "Value": "assigned", + "Description": "Job has been assigned to a worker." + }, + { + "$id": "35", + "Name": "completed", + "Value": "completed", + "Description": "Job has been completed by a worker." + }, + { + "$id": "36", + "Name": "closed", + "Value": "closed", + "Description": "Job has been closed by a worker." + }, + { + "$id": "37", + "Name": "cancelled", + "Value": "cancelled", + "Description": "Job has been cancelled." + }, + { + "$id": "38", + "Name": "classificationFailed", + "Value": "classificationFailed", + "Description": "Classification process failed for the job." + }, + { + "$id": "39", + "Name": "created", + "Value": "created", + "Description": "Job has been created." + }, + { + "$id": "40", + "Name": "pendingSchedule", + "Value": "pendingSchedule", + "Description": "Job has been created but not been scheduled yet." + }, + { + "$id": "41", + "Name": "scheduled", + "Value": "scheduled", + "Description": "Job has been scheduled successfully." + }, + { + "$id": "42", + "Name": "scheduleFailed", + "Value": "scheduleFailed", + "Description": "Job scheduling failed." + }, + { + "$id": "43", + "Name": "waitingForActivation", + "Value": "waitingForActivation", + "Description": "Job is in a suspended state and waiting for an update." + }, + { + "$id": "44", + "Name": "active", + "Value": "active", + "Description": "Job is in a state of PendingClassification or Queued or Assigned or ClassificationFailed or Completed or PendingSchedule or Scheduled or ScheduleFailed or WaitingForActivation." + } + ], + "Namespace": "AzureCommunicationRoutingService", + "Description": "Enums used to filters jobs by state", + "IsExtensible": true, + "IsNullable": false, + "Usage": "Input" + }, + { + "$id": "45", + "Name": "RouterWorkerState", + "EnumValueType": "String", + "AllowedValues": [ + { + "$id": "46", + "Name": "active", + "Value": "active", + "Description": "Worker is active and available to take offers." + }, + { + "$id": "47", + "Name": "draining", + "Value": "draining", + "Description": "Worker is not active, if there are existing offers they are being revoked. No new offers are sent." + }, + { + "$id": "48", + "Name": "inactive", + "Value": "inactive", + "Description": "Worker is not active. No new offers are sent." + } + ], + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "Enums for worker status", + "IsExtensible": true, + "IsNullable": false, + "Usage": "Output" + }, + { + "$id": "49", + "Name": "RouterWorkerStateSelector", + "EnumValueType": "String", + "AllowedValues": [ + { + "$id": "50", + "Name": "active", + "Value": "active", + "Description": "Worker is active and available to take offers." + }, + { + "$id": "51", + "Name": "draining", + "Value": "draining", + "Description": "Worker is not active, if there are existing offers they are being revoked. No new offers are sent." + }, + { + "$id": "52", + "Name": "inactive", + "Value": "inactive", + "Description": "Worker is not active. No new offers are sent." + }, + { + "$id": "53", + "Name": "all", + "Value": "all", + "Description": "Worker is active or draining or inactive." + } + ], + "Namespace": "AzureCommunicationRoutingService", + "Description": "Enums used to filters workers by state", + "IsExtensible": true, + "IsNullable": false, + "Usage": "Input" + }, + { + "$id": "54", + "Name": "Versions", + "EnumValueType": "String", + "AllowedValues": [ + { + "$id": "55", + "Name": "c2023_11_01", + "Value": "2023-11-01", + "Description": "JobRouter 2023-11-01 api version" + } + ], + "Namespace": "AzureCommunicationRoutingService", + "Description": "JobRouter Versions", + "IsExtensible": true, + "IsNullable": false, + "Usage": "None" + } + ], + "Models": [ + { + "$id": "56", + "Name": "DistributionPolicy", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Policy governing how jobs are distributed to workers", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "57", + "Name": "id", + "SerializedName": "id", + "Description": "The unique identifier of the policy.", + "Type": { + "$id": "58", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": true + }, + { + "$id": "59", + "Name": "name", + "SerializedName": "name", + "Description": "The human readable name of the policy.", + "Type": { + "$id": "60", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "61", + "Name": "offerExpiresAfterSeconds", + "SerializedName": "offerExpiresAfterSeconds", + "Description": "The number of seconds after which any offers created under this policy will be\nexpired.", + "Type": { + "$id": "62", + "Name": "float64", + "Kind": "Float64", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "63", + "Name": "mode", + "SerializedName": "mode", + "Description": "Abstract base class for defining a distribution mode", + "Type": { + "$id": "64", + "Name": "DistributionMode", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "Abstract base class for defining a distribution mode", + "IsNullable": false, + "DiscriminatorPropertyName": "kind", + "Usage": "Output", + "Properties": [ + { + "$id": "65", + "Name": "kind", + "SerializedName": "kind", + "Description": "Discriminator", + "IsRequired": true, + "IsReadOnly": false, + "IsNullable": false, + "Type": { + "$id": "66", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsDiscriminator": true + }, + { + "$id": "67", + "Name": "minConcurrentOffers", + "SerializedName": "minConcurrentOffers", + "Description": "Governs the minimum desired number of active concurrent offers a job can have.", + "Type": { + "$id": "68", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "69", + "Name": "maxConcurrentOffers", + "SerializedName": "maxConcurrentOffers", + "Description": "Governs the maximum number of active concurrent offers a job can have.", + "Type": { + "$id": "70", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "71", + "Name": "bypassSelectors", + "SerializedName": "bypassSelectors", + "Description": "(Optional)\nIf set to true, then router will match workers to jobs even if they\ndon't match label selectors.\nWarning: You may get workers that are not\nqualified for the job they are matched with if you set this\nvariable to true.\nThis flag is intended more for temporary usage.\nBy default, set to false.", + "Type": { + "$id": "72", + "Name": "boolean", + "Kind": "Boolean", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ], + "DerivedModels": [ + { + "$id": "73", + "Name": "BestWorkerMode", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "Jobs are distributed to the worker with the strongest abilities available.", + "IsNullable": false, + "DiscriminatorValue": "best-worker", + "BaseModel": { + "$ref": "64" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "74", + "Name": "scoringRule", + "SerializedName": "scoringRule", + "Description": "A rule of one of the following types:\n \nStaticRule: A rule\nproviding static rules that always return the same result, regardless of\ninput.\nDirectMapRule: A rule that return the same labels as the input\nlabels.\nExpressionRule: A rule providing inline expression\nrules.\nFunctionRule: A rule providing a binding to an HTTP Triggered Azure\nFunction.\nWebhookRule: A rule providing a binding to a webserver following\nOAuth2.0 authentication protocol.", + "Type": { + "$id": "75", + "Name": "RouterRule", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "A rule of one of the following types:\n \nStaticRule: A rule\nproviding static rules that always return the same result, regardless of\ninput.\nDirectMapRule: A rule that return the same labels as the input\nlabels.\nExpressionRule: A rule providing inline expression\nrules.\nFunctionRule: A rule providing a binding to an HTTP Triggered Azure\nFunction.\nWebhookRule: A rule providing a binding to a webserver following\nOAuth2.0 authentication protocol.", + "IsNullable": false, + "DiscriminatorPropertyName": "kind", + "Usage": "Output", + "Properties": [ + { + "$id": "76", + "Name": "kind", + "SerializedName": "kind", + "Description": "Discriminator", + "IsRequired": true, + "IsReadOnly": false, + "IsNullable": false, + "Type": { + "$id": "77", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsDiscriminator": true + } + ], + "DerivedModels": [ + { + "$id": "78", + "Name": "DirectMapRouterRule", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "A rule that return the same labels as the input labels.", + "IsNullable": false, + "DiscriminatorValue": "direct-map-rule", + "BaseModel": { + "$ref": "75" + }, + "Usage": "Output", + "Properties": [] + }, + { + "$id": "79", + "Name": "ExpressionRouterRule", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "A rule providing inline expression rules.", + "IsNullable": false, + "DiscriminatorValue": "expression-rule", + "BaseModel": { + "$ref": "75" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "80", + "Name": "language", + "SerializedName": "language", + "Description": "The expression language to compile to and execute", + "Type": { + "$ref": "2" + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "81", + "Name": "expression", + "SerializedName": "expression", + "Description": "The string containing the expression to evaluate. Should contain return\nstatement with calculated values.", + "Type": { + "$id": "82", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + { + "$id": "83", + "Name": "FunctionRouterRule", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "A rule providing a binding to an HTTP Triggered Azure Function.", + "IsNullable": false, + "DiscriminatorValue": "azure-function-rule", + "BaseModel": { + "$ref": "75" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "84", + "Name": "functionUri", + "SerializedName": "functionUri", + "Description": "URL for Azure Function", + "Type": { + "$id": "85", + "Name": "url", + "Kind": "Uri", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "86", + "Name": "credential", + "SerializedName": "credential", + "Description": "Credentials used to access Azure function rule", + "Type": { + "$id": "87", + "Name": "FunctionRouterRuleCredential", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "Credentials used to access Azure function rule", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "88", + "Name": "functionKey", + "SerializedName": "functionKey", + "Description": "(Optional) Access key scoped to a particular function", + "Type": { + "$id": "89", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "90", + "Name": "appKey", + "SerializedName": "appKey", + "Description": "(Optional) Access key scoped to a Azure Function app.\nThis key grants access to\nall functions under the app.", + "Type": { + "$id": "91", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "92", + "Name": "clientId", + "SerializedName": "clientId", + "Description": "(Optional) Client id, when AppKey is provided\nIn context of Azure function,\nthis is usually the name of the key", + "Type": { + "$id": "93", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$id": "94", + "Name": "StaticRouterRule", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "A rule providing static rules that always return the same result, regardless of\ninput.", + "IsNullable": false, + "DiscriminatorValue": "static-rule", + "BaseModel": { + "$ref": "75" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "95", + "Name": "value", + "SerializedName": "value", + "Description": "The static value this rule always returns.", + "Type": { + "$id": "96", + "Name": "Intrinsic", + "Kind": "unknown", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$id": "97", + "Name": "WebhookRouterRule", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "A rule providing a binding to an external web server.", + "IsNullable": false, + "DiscriminatorValue": "webhook-rule", + "BaseModel": { + "$ref": "75" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "98", + "Name": "authorizationServerUri", + "SerializedName": "authorizationServerUri", + "Description": "Uri for Authorization Server.", + "Type": { + "$id": "99", + "Name": "url", + "Kind": "Uri", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "100", + "Name": "clientCredential", + "SerializedName": "clientCredential", + "Description": "OAuth2.0 Credentials used to Contoso's Authorization server.\nReference:\nhttps://www.oauth.com/oauth2-servers/access-tokens/client-credentials/", + "Type": { + "$id": "101", + "Name": "Oauth2ClientCredential", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "OAuth2.0 Credentials used to Contoso's Authorization server.\nReference:\nhttps://www.oauth.com/oauth2-servers/access-tokens/client-credentials/", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "102", + "Name": "clientId", + "SerializedName": "clientId", + "Description": "ClientId for Contoso Authorization server.", + "Type": { + "$id": "103", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "104", + "Name": "clientSecret", + "SerializedName": "clientSecret", + "Description": "Client secret for Contoso Authorization server.", + "Type": { + "$id": "105", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "106", + "Name": "webhookUri", + "SerializedName": "webhookUri", + "Description": "Uri for Contoso's Web Server.", + "Type": { + "$id": "107", + "Name": "url", + "Kind": "Uri", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + } + ] + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "108", + "Name": "scoringRuleOptions", + "SerializedName": "scoringRuleOptions", + "Description": "Encapsulates all options that can be passed as parameters for scoring rule with\nBestWorkerMode", + "Type": { + "$id": "109", + "Name": "ScoringRuleOptions", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "Encapsulates all options that can be passed as parameters for scoring rule with\nBestWorkerMode", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "110", + "Name": "batchSize", + "SerializedName": "batchSize", + "Description": "(Optional) Set batch size when AllowScoringBatchOfWorkers is set to true.\nDefaults to 20 if not configured.", + "Type": { + "$id": "111", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "112", + "Name": "scoringParameters", + "SerializedName": "scoringParameters", + "Description": "(Optional) List of extra parameters from the job that will be sent as part of\nthe payload to scoring rule.\nIf not set, the job's labels (sent in the payload\nas `job`) and the job's worker selectors (sent in the payload as\n`selectors`)\nare added to the payload of the scoring rule by default.\nNote:\nWorker labels are always sent with scoring payload.", + "Type": { + "$id": "113", + "Name": "Array", + "ElementType": { + "$ref": "4" + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "114", + "Name": "allowScoringBatchOfWorkers", + "SerializedName": "allowScoringBatchOfWorkers", + "Description": "(Optional)\nIf set to true, will score workers in batches, and the parameter\nname of the worker labels will be sent as `workers`.\nBy default, set to false\nand the parameter name for the worker labels will be sent as `worker`.\nNote: If\nenabled, use BatchSize to set batch size.", + "Type": { + "$id": "115", + "Name": "boolean", + "Kind": "Boolean", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "116", + "Name": "descendingOrder", + "SerializedName": "descendingOrder", + "Description": "(Optional)\nIf false, will sort scores by ascending order. By default, set to\ntrue.", + "Type": { + "$id": "117", + "Name": "boolean", + "Kind": "Boolean", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$id": "118", + "Name": "LongestIdleMode", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "Jobs are directed to the worker who has been idle longest.", + "IsNullable": false, + "DiscriminatorValue": "longest-idle", + "BaseModel": { + "$ref": "64" + }, + "Usage": "Output", + "Properties": [] + }, + { + "$id": "119", + "Name": "RoundRobinMode", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "Jobs are distributed in order to workers, starting with the worker that is\nafter the last worker to receive a job.", + "IsNullable": false, + "DiscriminatorValue": "round-robin", + "BaseModel": { + "$ref": "64" + }, + "Usage": "Output", + "Properties": [] + } + ] + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$ref": "64" + }, + { + "$ref": "73" + }, + { + "$ref": "75" + }, + { + "$ref": "78" + }, + { + "$ref": "79" + }, + { + "$ref": "83" + }, + { + "$ref": "87" + }, + { + "$ref": "94" + }, + { + "$ref": "97" + }, + { + "$ref": "101" + }, + { + "$ref": "109" + }, + { + "$ref": "118" + }, + { + "$ref": "119" + }, + { + "$id": "120", + "Name": "PagedDistributionPolicyItem", + "Namespace": "AzureCommunicationRoutingService", + "Description": "A paged collection of distribution policies.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "121", + "Name": "value", + "SerializedName": "value", + "Description": "The DistributionPolicyItem items on this page", + "Type": { + "$id": "122", + "Name": "Array", + "ElementType": { + "$id": "123", + "Name": "DistributionPolicyItem", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Paged instance of DistributionPolicy", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "124", + "Name": "distributionPolicy", + "SerializedName": "distributionPolicy", + "Description": "Policy governing how jobs are distributed to workers", + "Type": { + "$ref": "56" + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "125", + "Name": "etag", + "SerializedName": "etag", + "Description": "(Optional) The Concurrency Token.", + "Type": { + "$id": "126", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "127", + "Name": "nextLink", + "SerializedName": "nextLink", + "Description": "The link to the next page of items", + "Type": { + "$id": "128", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$ref": "123" + }, + { + "$id": "129", + "Name": "ClassificationPolicy", + "Namespace": "AzureCommunicationRoutingService", + "Description": "A container for the rules that govern how jobs are classified.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "130", + "Name": "id", + "SerializedName": "id", + "Description": "Unique identifier of this policy.", + "Type": { + "$id": "131", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": true + }, + { + "$id": "132", + "Name": "name", + "SerializedName": "name", + "Description": "Friendly name of this policy.", + "Type": { + "$id": "133", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "134", + "Name": "fallbackQueueId", + "SerializedName": "fallbackQueueId", + "Description": "The fallback queue to select if the queue selector doesn't find a match.", + "Type": { + "$id": "135", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "136", + "Name": "queueSelectors", + "SerializedName": "queueSelectors", + "Description": "The queue selectors to resolve a queue for a given job.", + "Type": { + "$id": "137", + "Name": "Array", + "ElementType": { + "$id": "138", + "Name": "QueueSelectorAttachment", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "An attachment of queue selectors to resolve a queue to a job from a\nclassification policy", + "IsNullable": false, + "DiscriminatorPropertyName": "kind", + "Usage": "Output", + "Properties": [ + { + "$id": "139", + "Name": "kind", + "SerializedName": "kind", + "Description": "Discriminator", + "IsRequired": true, + "IsReadOnly": false, + "IsNullable": false, + "Type": { + "$id": "140", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsDiscriminator": true + } + ], + "DerivedModels": [ + { + "$id": "141", + "Name": "ConditionalQueueSelectorAttachment", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "Describes a set of queue selectors that will be attached if the given condition\nresolves to true", + "IsNullable": false, + "DiscriminatorValue": "conditional", + "BaseModel": { + "$ref": "138" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "142", + "Name": "condition", + "SerializedName": "condition", + "Description": "A rule of one of the following types:\n \nStaticRule: A rule\nproviding static rules that always return the same result, regardless of\ninput.\nDirectMapRule: A rule that return the same labels as the input\nlabels.\nExpressionRule: A rule providing inline expression\nrules.\nFunctionRule: A rule providing a binding to an HTTP Triggered Azure\nFunction.\nWebhookRule: A rule providing a binding to a webserver following\nOAuth2.0 authentication protocol.", + "Type": { + "$ref": "75" + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "143", + "Name": "queueSelectors", + "SerializedName": "queueSelectors", + "Description": "The queue selectors to attach", + "Type": { + "$id": "144", + "Name": "Array", + "ElementType": { + "$id": "145", + "Name": "RouterQueueSelector", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "Describes a condition that must be met against a set of labels for queue\nselection", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "146", + "Name": "key", + "SerializedName": "key", + "Description": "The label key to query against", + "Type": { + "$id": "147", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "148", + "Name": "labelOperator", + "SerializedName": "labelOperator", + "Description": "Describes how the value of the label is compared to the value defined on the\nlabel selector", + "Type": { + "$ref": "7" + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "149", + "Name": "value", + "SerializedName": "value", + "Description": "The value to compare against the actual label value with the given operator", + "Type": { + "$id": "150", + "Name": "Intrinsic", + "Kind": "unknown", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + { + "$id": "151", + "Name": "PassThroughQueueSelectorAttachment", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "Attaches a queue selector where the value is passed through from the job label\nwith the same key", + "IsNullable": false, + "DiscriminatorValue": "pass-through", + "BaseModel": { + "$ref": "138" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "152", + "Name": "key", + "SerializedName": "key", + "Description": "The label key to query against", + "Type": { + "$id": "153", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "154", + "Name": "labelOperator", + "SerializedName": "labelOperator", + "Description": "Describes how the value of the label is compared to the value pass through", + "Type": { + "$ref": "7" + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + { + "$id": "155", + "Name": "RuleEngineQueueSelectorAttachment", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "Attaches queue selectors to a job when the RouterRule is resolved", + "IsNullable": false, + "DiscriminatorValue": "rule-engine", + "BaseModel": { + "$ref": "138" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "156", + "Name": "rule", + "SerializedName": "rule", + "Description": "A rule of one of the following types:\n \nStaticRule: A rule\nproviding static rules that always return the same result, regardless of\ninput.\nDirectMapRule: A rule that return the same labels as the input\nlabels.\nExpressionRule: A rule providing inline expression\nrules.\nFunctionRule: A rule providing a binding to an HTTP Triggered Azure\nFunction.\nWebhookRule: A rule providing a binding to a webserver following\nOAuth2.0 authentication protocol.", + "Type": { + "$ref": "75" + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + { + "$id": "157", + "Name": "StaticQueueSelectorAttachment", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "Describes a queue selector that will be attached to the job", + "IsNullable": false, + "DiscriminatorValue": "static", + "BaseModel": { + "$ref": "138" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "158", + "Name": "queueSelector", + "SerializedName": "queueSelector", + "Description": "Describes a condition that must be met against a set of labels for queue\nselection", + "Type": { + "$ref": "145" + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + { + "$id": "159", + "Name": "WeightedAllocationQueueSelectorAttachment", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "Describes multiple sets of queue selectors, of which one will be selected and\nattached according to a weighting", + "IsNullable": false, + "DiscriminatorValue": "weighted-allocation-queue-selector", + "BaseModel": { + "$ref": "138" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "160", + "Name": "allocations", + "SerializedName": "allocations", + "Description": "A collection of percentage based weighted allocations.", + "Type": { + "$id": "161", + "Name": "Array", + "ElementType": { + "$id": "162", + "Name": "QueueWeightedAllocation", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "Contains the weight percentage and queue selectors to be applied if selected\nfor weighted distributions.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "163", + "Name": "weight", + "SerializedName": "weight", + "Description": "The percentage of this weight, expressed as a fraction of 1.", + "Type": { + "$id": "164", + "Name": "float64", + "Kind": "Float64", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "165", + "Name": "queueSelectors", + "SerializedName": "queueSelectors", + "Description": "A collection of queue selectors that will be applied if this allocation is\nselected.", + "Type": { + "$id": "166", + "Name": "Array", + "ElementType": { + "$ref": "145" + }, + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + } + ] + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "167", + "Name": "prioritizationRule", + "SerializedName": "prioritizationRule", + "Description": "A rule of one of the following types:\n \nStaticRule: A rule\nproviding static rules that always return the same result, regardless of\ninput.\nDirectMapRule: A rule that return the same labels as the input\nlabels.\nExpressionRule: A rule providing inline expression\nrules.\nFunctionRule: A rule providing a binding to an HTTP Triggered Azure\nFunction.\nWebhookRule: A rule providing a binding to a webserver following\nOAuth2.0 authentication protocol.", + "Type": { + "$ref": "75" + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "168", + "Name": "workerSelectors", + "SerializedName": "workerSelectors", + "Description": "The worker label selectors to attach to a given job.", + "Type": { + "$id": "169", + "Name": "Array", + "ElementType": { + "$id": "170", + "Name": "WorkerSelectorAttachment", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "An attachment which attaches worker selectors to a job", + "IsNullable": false, + "DiscriminatorPropertyName": "kind", + "Usage": "Output", + "Properties": [ + { + "$id": "171", + "Name": "kind", + "SerializedName": "kind", + "Description": "Discriminator", + "IsRequired": true, + "IsReadOnly": false, + "IsNullable": false, + "Type": { + "$id": "172", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsDiscriminator": true + } + ], + "DerivedModels": [ + { + "$id": "173", + "Name": "ConditionalWorkerSelectorAttachment", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "Describes a set of worker selectors that will be attached if the given\ncondition resolves to true", + "IsNullable": false, + "DiscriminatorValue": "conditional", + "BaseModel": { + "$ref": "170" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "174", + "Name": "condition", + "SerializedName": "condition", + "Description": "A rule of one of the following types:\n \nStaticRule: A rule\nproviding static rules that always return the same result, regardless of\ninput.\nDirectMapRule: A rule that return the same labels as the input\nlabels.\nExpressionRule: A rule providing inline expression\nrules.\nFunctionRule: A rule providing a binding to an HTTP Triggered Azure\nFunction.\nWebhookRule: A rule providing a binding to a webserver following\nOAuth2.0 authentication protocol.", + "Type": { + "$ref": "75" + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "175", + "Name": "workerSelectors", + "SerializedName": "workerSelectors", + "Description": "The worker selectors to attach", + "Type": { + "$id": "176", + "Name": "Array", + "ElementType": { + "$id": "177", + "Name": "RouterWorkerSelector", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "Describes a condition that must be met against a set of labels for worker\nselection", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "178", + "Name": "key", + "SerializedName": "key", + "Description": "The label key to query against", + "Type": { + "$id": "179", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "180", + "Name": "labelOperator", + "SerializedName": "labelOperator", + "Description": "Describes how the value of the label is compared to the value defined on the\nlabel selector", + "Type": { + "$ref": "7" + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "181", + "Name": "value", + "SerializedName": "value", + "Description": "The value to compare against the actual label value with the given operator", + "Type": { + "$id": "182", + "Name": "Intrinsic", + "Kind": "unknown", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "183", + "Name": "expiresAfterSeconds", + "SerializedName": "expiresAfterSeconds", + "Description": "Describes how long this label selector is valid in seconds.", + "Type": { + "$id": "184", + "Name": "float64", + "Kind": "Float64", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "185", + "Name": "expedite", + "SerializedName": "expedite", + "Description": "Pushes the job to the front of the queue as long as this selector is active.", + "Type": { + "$id": "186", + "Name": "boolean", + "Kind": "Boolean", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "187", + "Name": "status", + "SerializedName": "status", + "Description": "The status of the worker selector.", + "Type": { + "$ref": "14" + }, + "IsRequired": false, + "IsReadOnly": true + }, + { + "$id": "188", + "Name": "expiresAt", + "SerializedName": "expiresAt", + "Description": "The time at which this worker selector expires in UTC", + "Type": { + "$id": "189", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": true + } + ] + }, + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + { + "$id": "190", + "Name": "PassThroughWorkerSelectorAttachment", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "Attaches a worker selector where the value is passed through from the job label\nwith the same key", + "IsNullable": false, + "DiscriminatorValue": "pass-through", + "BaseModel": { + "$ref": "170" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "191", + "Name": "key", + "SerializedName": "key", + "Description": "The label key to query against", + "Type": { + "$id": "192", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "193", + "Name": "labelOperator", + "SerializedName": "labelOperator", + "Description": "Describes how the value of the label is compared to the value pass through", + "Type": { + "$ref": "7" + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "194", + "Name": "expiresAfterSeconds", + "SerializedName": "expiresAfterSeconds", + "Description": "Describes how long the attached label selector is valid in seconds.", + "Type": { + "$id": "195", + "Name": "float64", + "Kind": "Float64", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$id": "196", + "Name": "RuleEngineWorkerSelectorAttachment", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "Attaches worker selectors to a job when a RouterRule is resolved", + "IsNullable": false, + "DiscriminatorValue": "rule-engine", + "BaseModel": { + "$ref": "170" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "197", + "Name": "rule", + "SerializedName": "rule", + "Description": "A rule of one of the following types:\n \nStaticRule: A rule\nproviding static rules that always return the same result, regardless of\ninput.\nDirectMapRule: A rule that return the same labels as the input\nlabels.\nExpressionRule: A rule providing inline expression\nrules.\nFunctionRule: A rule providing a binding to an HTTP Triggered Azure\nFunction.\nWebhookRule: A rule providing a binding to a webserver following\nOAuth2.0 authentication protocol.", + "Type": { + "$ref": "75" + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + { + "$id": "198", + "Name": "StaticWorkerSelectorAttachment", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "Describes a worker selector that will be attached to the job", + "IsNullable": false, + "DiscriminatorValue": "static", + "BaseModel": { + "$ref": "170" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "199", + "Name": "workerSelector", + "SerializedName": "workerSelector", + "Description": "Describes a condition that must be met against a set of labels for worker\nselection", + "Type": { + "$ref": "177" + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + { + "$id": "200", + "Name": "WeightedAllocationWorkerSelectorAttachment", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "Describes multiple sets of worker selectors, of which one will be selected and\nattached according to a weighting", + "IsNullable": false, + "DiscriminatorValue": "weighted-allocation-worker-selector", + "BaseModel": { + "$ref": "170" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "201", + "Name": "allocations", + "SerializedName": "allocations", + "Description": "A collection of percentage based weighted allocations.", + "Type": { + "$id": "202", + "Name": "Array", + "ElementType": { + "$id": "203", + "Name": "WorkerWeightedAllocation", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "Contains the weight percentage and worker selectors to be applied if selected\nfor weighted distributions.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "204", + "Name": "weight", + "SerializedName": "weight", + "Description": "The percentage of this weight, expressed as a fraction of 1.", + "Type": { + "$id": "205", + "Name": "float64", + "Kind": "Float64", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "206", + "Name": "workerSelectors", + "SerializedName": "workerSelectors", + "Description": "A collection of worker selectors that will be applied if this allocation is\nselected.", + "Type": { + "$id": "207", + "Name": "Array", + "ElementType": { + "$ref": "177" + }, + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + } + ] + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$ref": "138" + }, + { + "$ref": "141" + }, + { + "$ref": "145" + }, + { + "$ref": "151" + }, + { + "$ref": "155" + }, + { + "$ref": "157" + }, + { + "$ref": "159" + }, + { + "$ref": "162" + }, + { + "$ref": "170" + }, + { + "$ref": "173" + }, + { + "$ref": "177" + }, + { + "$ref": "190" + }, + { + "$ref": "196" + }, + { + "$ref": "198" + }, + { + "$ref": "200" + }, + { + "$ref": "203" + }, + { + "$id": "208", + "Name": "PagedClassificationPolicyItem", + "Namespace": "AzureCommunicationRoutingService", + "Description": "A paged collection of classification policies.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "209", + "Name": "value", + "SerializedName": "value", + "Description": "The ClassificationPolicyItem items on this page", + "Type": { + "$id": "210", + "Name": "Array", + "ElementType": { + "$id": "211", + "Name": "ClassificationPolicyItem", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Paged instance of ClassificationPolicy", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "212", + "Name": "classificationPolicy", + "SerializedName": "classificationPolicy", + "Description": "A container for the rules that govern how jobs are classified.", + "Type": { + "$ref": "129" + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "213", + "Name": "etag", + "SerializedName": "etag", + "Description": "(Optional) The Concurrency Token.", + "Type": { + "$id": "214", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "215", + "Name": "nextLink", + "SerializedName": "nextLink", + "Description": "The link to the next page of items", + "Type": { + "$id": "216", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$ref": "211" + }, + { + "$id": "217", + "Name": "ExceptionPolicy", + "Namespace": "AzureCommunicationRoutingService", + "Description": "A policy that defines actions to execute when exception are triggered.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "218", + "Name": "id", + "SerializedName": "id", + "Description": "The Id of the exception policy", + "Type": { + "$id": "219", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": true + }, + { + "$id": "220", + "Name": "name", + "SerializedName": "name", + "Description": "(Optional) The name of the exception policy.", + "Type": { + "$id": "221", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "222", + "Name": "exceptionRules", + "SerializedName": "exceptionRules", + "Description": "(Optional) A dictionary collection of exception rules on the exception policy.\nKey is the Id of each exception rule.", + "Type": { + "$id": "223", + "Name": "Dictionary", + "KeyType": { + "$id": "224", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "225", + "Name": "ExceptionRule", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "A rule that defines actions to execute upon a specific trigger.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "226", + "Name": "trigger", + "SerializedName": "trigger", + "Description": "The trigger for this exception rule", + "Type": { + "$id": "227", + "Name": "ExceptionTrigger", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "The trigger for this exception rule", + "IsNullable": false, + "DiscriminatorPropertyName": "kind", + "Usage": "Output", + "Properties": [ + { + "$id": "228", + "Name": "kind", + "SerializedName": "kind", + "Description": "Discriminator", + "IsRequired": true, + "IsReadOnly": false, + "IsNullable": false, + "Type": { + "$id": "229", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsDiscriminator": true + } + ], + "DerivedModels": [ + { + "$id": "230", + "Name": "QueueLengthExceptionTrigger", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "Trigger for an exception action on exceeding queue length", + "IsNullable": false, + "DiscriminatorValue": "queue-length", + "BaseModel": { + "$ref": "227" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "231", + "Name": "threshold", + "SerializedName": "threshold", + "Description": "Threshold of number of jobs ahead in the queue to for this trigger to fire.", + "Type": { + "$id": "232", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + { + "$id": "233", + "Name": "WaitTimeExceptionTrigger", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "Trigger for an exception action on exceeding wait time", + "IsNullable": false, + "DiscriminatorValue": "wait-time", + "BaseModel": { + "$ref": "227" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "234", + "Name": "thresholdSeconds", + "SerializedName": "thresholdSeconds", + "Description": "Threshold for wait time for this trigger.", + "Type": { + "$id": "235", + "Name": "float64", + "Kind": "Float64", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + } + ] + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "236", + "Name": "actions", + "SerializedName": "actions", + "Description": "A dictionary collection of actions to perform once the exception is triggered.\nKey is the Id of each exception action.", + "Type": { + "$id": "237", + "Name": "Dictionary", + "KeyType": { + "$id": "238", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "239", + "Name": "ExceptionAction", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "The action to take when the exception is triggered", + "IsNullable": false, + "DiscriminatorPropertyName": "kind", + "Usage": "Output", + "Properties": [ + { + "$id": "240", + "Name": "kind", + "SerializedName": "kind", + "Description": "Discriminator", + "IsRequired": true, + "IsReadOnly": false, + "IsNullable": false, + "Type": { + "$id": "241", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsDiscriminator": true + } + ], + "DerivedModels": [ + { + "$id": "242", + "Name": "CancelExceptionAction", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "An action that marks a job as cancelled", + "IsNullable": false, + "DiscriminatorValue": "cancel", + "BaseModel": { + "$ref": "239" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "243", + "Name": "note", + "SerializedName": "note", + "Description": "(Optional) A note that will be appended to the jobs' Notes collection with the\ncurrent timestamp.", + "Type": { + "$id": "244", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "245", + "Name": "dispositionCode", + "SerializedName": "dispositionCode", + "Description": "(Optional) Indicates the outcome of the job, populate this field with your own\ncustom values.", + "Type": { + "$id": "246", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$id": "247", + "Name": "ManualReclassifyExceptionAction", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "An action that manually reclassifies a job by providing the queue, priority and\nworker selectors.", + "IsNullable": false, + "DiscriminatorValue": "manual-reclassify", + "BaseModel": { + "$ref": "239" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "248", + "Name": "queueId", + "SerializedName": "queueId", + "Description": "Updated QueueId.", + "Type": { + "$id": "249", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "250", + "Name": "priority", + "SerializedName": "priority", + "Description": "Updated Priority.", + "Type": { + "$id": "251", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "252", + "Name": "workerSelectors", + "SerializedName": "workerSelectors", + "Description": "Updated WorkerSelectors.", + "Type": { + "$id": "253", + "Name": "Array", + "ElementType": { + "$ref": "177" + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$id": "254", + "Name": "ReclassifyExceptionAction", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "An action that modifies labels on a job and then reclassifies it", + "IsNullable": false, + "DiscriminatorValue": "reclassify", + "BaseModel": { + "$ref": "239" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "255", + "Name": "classificationPolicyId", + "SerializedName": "classificationPolicyId", + "Description": "(optional) The new classification policy that will determine queue, priority\nand worker selectors.", + "Type": { + "$id": "256", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "257", + "Name": "labelsToUpsert", + "SerializedName": "labelsToUpsert", + "Description": "(optional) Dictionary containing the labels to update (or add if not existing)\nin key-value pairs", + "Type": { + "$id": "258", + "Name": "Dictionary", + "KeyType": { + "$id": "259", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "260", + "Name": "Intrinsic", + "Kind": "unknown", + "IsNullable": false + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + } + ] + }, + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$ref": "225" + }, + { + "$ref": "227" + }, + { + "$ref": "230" + }, + { + "$ref": "233" + }, + { + "$ref": "239" + }, + { + "$ref": "242" + }, + { + "$ref": "247" + }, + { + "$ref": "254" + }, + { + "$id": "261", + "Name": "PagedExceptionPolicyItem", + "Namespace": "AzureCommunicationRoutingService", + "Description": "A paged collection of exception policies.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "262", + "Name": "value", + "SerializedName": "value", + "Description": "The ExceptionPolicyItem items on this page", + "Type": { + "$id": "263", + "Name": "Array", + "ElementType": { + "$id": "264", + "Name": "ExceptionPolicyItem", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Paged instance of ExceptionPolicy", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "265", + "Name": "exceptionPolicy", + "SerializedName": "exceptionPolicy", + "Description": "A policy that defines actions to execute when exception are triggered.", + "Type": { + "$ref": "217" + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "266", + "Name": "etag", + "SerializedName": "etag", + "Description": "(Optional) The Concurrency Token.", + "Type": { + "$id": "267", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "268", + "Name": "nextLink", + "SerializedName": "nextLink", + "Description": "The link to the next page of items", + "Type": { + "$id": "269", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$ref": "264" + }, + { + "$id": "270", + "Name": "RouterQueue", + "Namespace": "AzureCommunicationRoutingService", + "Description": "A queue that can contain jobs to be routed.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "271", + "Name": "id", + "SerializedName": "id", + "Description": "The Id of this queue", + "Type": { + "$id": "272", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": true + }, + { + "$id": "273", + "Name": "name", + "SerializedName": "name", + "Description": "The name of this queue.", + "Type": { + "$id": "274", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "275", + "Name": "distributionPolicyId", + "SerializedName": "distributionPolicyId", + "Description": "The ID of the distribution policy that will determine how a job is distributed\nto workers.", + "Type": { + "$id": "276", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "277", + "Name": "labels", + "SerializedName": "labels", + "Description": "A set of key/value pairs that are identifying attributes used by the rules\nengines to make decisions.", + "Type": { + "$id": "278", + "Name": "Dictionary", + "KeyType": { + "$id": "279", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "280", + "Name": "Intrinsic", + "Kind": "unknown", + "IsNullable": false + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "281", + "Name": "exceptionPolicyId", + "SerializedName": "exceptionPolicyId", + "Description": "(Optional) The ID of the exception policy that determines various job\nescalation rules.", + "Type": { + "$id": "282", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$id": "283", + "Name": "PagedRouterQueueItem", + "Namespace": "AzureCommunicationRoutingService", + "Description": "A paged collection of queues.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "284", + "Name": "value", + "SerializedName": "value", + "Description": "The RouterQueueItem items on this page", + "Type": { + "$id": "285", + "Name": "Array", + "ElementType": { + "$id": "286", + "Name": "RouterQueueItem", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Paged instance of RouterQueue", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "287", + "Name": "queue", + "SerializedName": "queue", + "Description": "A queue that can contain jobs to be routed.", + "Type": { + "$ref": "270" + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "288", + "Name": "etag", + "SerializedName": "etag", + "Description": "(Optional) The Concurrency Token.", + "Type": { + "$id": "289", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "290", + "Name": "nextLink", + "SerializedName": "nextLink", + "Description": "The link to the next page of items", + "Type": { + "$id": "291", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$ref": "286" + }, + { + "$id": "292", + "Name": "RouterJob", + "Namespace": "AzureCommunicationRoutingService", + "Description": "A unit of work to be routed", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "293", + "Name": "id", + "SerializedName": "id", + "Description": "The id of the job.", + "Type": { + "$id": "294", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": true + }, + { + "$id": "295", + "Name": "channelReference", + "SerializedName": "channelReference", + "Description": "Reference to an external parent context, eg. call ID.", + "Type": { + "$id": "296", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "297", + "Name": "status", + "SerializedName": "status", + "Description": "The status of the Job.", + "Type": { + "$ref": "17" + }, + "IsRequired": false, + "IsReadOnly": true + }, + { + "$id": "298", + "Name": "enqueuedAt", + "SerializedName": "enqueuedAt", + "Description": "The time a job was queued in UTC.", + "Type": { + "$id": "299", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": true + }, + { + "$id": "300", + "Name": "channelId", + "SerializedName": "channelId", + "Description": "The channel identifier. eg. voice, chat, etc.", + "Type": { + "$id": "301", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "302", + "Name": "classificationPolicyId", + "SerializedName": "classificationPolicyId", + "Description": "The Id of the Classification policy used for classifying a job.", + "Type": { + "$id": "303", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "304", + "Name": "queueId", + "SerializedName": "queueId", + "Description": "The Id of the Queue that this job is queued to.", + "Type": { + "$id": "305", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "306", + "Name": "priority", + "SerializedName": "priority", + "Description": "The priority of this job.", + "Type": { + "$id": "307", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "308", + "Name": "dispositionCode", + "SerializedName": "dispositionCode", + "Description": "Reason code for cancelled or closed jobs.", + "Type": { + "$id": "309", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "310", + "Name": "requestedWorkerSelectors", + "SerializedName": "requestedWorkerSelectors", + "Description": "A collection of manually specified label selectors, which a worker must satisfy\nin order to process this job.", + "Type": { + "$id": "311", + "Name": "Array", + "ElementType": { + "$ref": "177" + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "312", + "Name": "attachedWorkerSelectors", + "SerializedName": "attachedWorkerSelectors", + "Description": "A collection of label selectors attached by a classification policy, which a\nworker must satisfy in order to process this job.", + "Type": { + "$id": "313", + "Name": "Array", + "ElementType": { + "$ref": "177" + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": true + }, + { + "$id": "314", + "Name": "labels", + "SerializedName": "labels", + "Description": "A set of key/value pairs that are identifying attributes used by the rules\nengines to make decisions.", + "Type": { + "$id": "315", + "Name": "Dictionary", + "KeyType": { + "$id": "316", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "317", + "Name": "Intrinsic", + "Kind": "unknown", + "IsNullable": false + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "318", + "Name": "assignments", + "SerializedName": "assignments", + "Description": "A collection of the assignments of the job.\nKey is AssignmentId.", + "Type": { + "$id": "319", + "Name": "Dictionary", + "KeyType": { + "$id": "320", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "321", + "Name": "RouterJobAssignment", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "Assignment details of a job to a worker", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "322", + "Name": "assignmentId", + "SerializedName": "assignmentId", + "Description": "The Id of the job assignment.", + "Type": { + "$id": "323", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "324", + "Name": "workerId", + "SerializedName": "workerId", + "Description": "The Id of the Worker assigned to the job.", + "Type": { + "$id": "325", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "326", + "Name": "assignedAt", + "SerializedName": "assignedAt", + "Description": "The assignment time of the job in UTC.", + "Type": { + "$id": "327", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "328", + "Name": "completedAt", + "SerializedName": "completedAt", + "Description": "The time the job was marked as completed after being assigned in UTC.", + "Type": { + "$id": "329", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "330", + "Name": "closedAt", + "SerializedName": "closedAt", + "Description": "The time the job was marked as closed after being completed in UTC.", + "Type": { + "$id": "331", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": true + }, + { + "$id": "332", + "Name": "tags", + "SerializedName": "tags", + "Description": "A set of non-identifying attributes attached to this job", + "Type": { + "$id": "333", + "Name": "Dictionary", + "KeyType": { + "$id": "334", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "335", + "Name": "Intrinsic", + "Kind": "unknown", + "IsNullable": false + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "336", + "Name": "notes", + "SerializedName": "notes", + "Description": "Notes attached to a job, sorted by timestamp", + "Type": { + "$id": "337", + "Name": "Dictionary", + "KeyType": { + "$id": "338", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "339", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "340", + "Name": "scheduledAt", + "SerializedName": "scheduledAt", + "Description": "If set, job will be scheduled to be enqueued at a given time", + "Type": { + "$id": "341", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": true + }, + { + "$id": "342", + "Name": "matchingMode", + "SerializedName": "matchingMode", + "Description": "The matching mode to be applied to this job.\n \nSupported types:\n \n \nQueueAndMatchMode: Used when matching worker to a job is required to be\ndone right after job is queued.\nScheduleAndSuspendMode: Used for scheduling\njobs to be queued at a future time. At specified time, matching of a worker to\nthe job will not start automatically.\nSuspendMode: Used when matching workers\nto a job needs to be suspended.", + "Type": { + "$id": "343", + "Name": "JobMatchingMode", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "The matching mode to be applied to this job.\n \nSupported types:\n \n \nQueueAndMatchMode: Used when matching worker to a job is required to be\ndone right after job is queued.\nScheduleAndSuspendMode: Used for scheduling\njobs to be queued at a future time. At specified time, matching of a worker to\nthe job will not start automatically.\nSuspendMode: Used when matching workers\nto a job needs to be suspended.", + "IsNullable": false, + "DiscriminatorPropertyName": "kind", + "Usage": "Output", + "Properties": [ + { + "$id": "344", + "Name": "kind", + "SerializedName": "kind", + "Description": "Discriminator", + "IsRequired": true, + "IsReadOnly": false, + "IsNullable": false, + "Type": { + "$id": "345", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsDiscriminator": true + } + ], + "DerivedModels": [ + { + "$id": "346", + "Name": "ScheduleAndSuspendMode", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "Describes a matching mode used for scheduling jobs to be queued at a future\ntime.\nAt the specified time, matching worker to a job will not start\nautomatically.", + "IsNullable": false, + "DiscriminatorValue": "schedule-and-suspend", + "BaseModel": { + "$ref": "343" + }, + "Usage": "Output", + "Properties": [ + { + "$id": "347", + "Name": "scheduleAt", + "SerializedName": "scheduleAt", + "Description": "Scheduled time.", + "Type": { + "$id": "348", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + { + "$id": "349", + "Name": "QueueAndMatchMode", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "Describes a matching mode where matching worker to a job is automatically started after job is queued successfully.", + "IsNullable": false, + "DiscriminatorValue": "queue-and-match", + "BaseModel": { + "$ref": "343" + }, + "Usage": "Output", + "Properties": [] + }, + { + "$id": "350", + "Name": "SuspendMode", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "Describes a matching mode where matching worker to a job is suspended.", + "IsNullable": false, + "DiscriminatorValue": "suspend", + "BaseModel": { + "$ref": "343" + }, + "Usage": "Output", + "Properties": [] + } + ] + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$ref": "321" + }, + { + "$ref": "343" + }, + { + "$ref": "346" + }, + { + "$ref": "349" + }, + { + "$ref": "350" + }, + { + "$id": "351", + "Name": "CancelJobRequest", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Request payload for deleting a job", + "IsNullable": false, + "Usage": "Input", + "Properties": [ + { + "$id": "352", + "Name": "note", + "SerializedName": "note", + "Description": "(Optional) A note that will be appended to the jobs' Notes collection with the\ncurrent timestamp.", + "Type": { + "$id": "353", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "354", + "Name": "dispositionCode", + "SerializedName": "dispositionCode", + "Description": "Indicates the outcome of the job, populate this field with your own custom\nvalues.\nIf not provided, default value of \"Cancelled\" is set.", + "Type": { + "$id": "355", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$id": "356", + "Name": "CompleteJobRequest", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Request payload for completing jobs", + "IsNullable": false, + "Usage": "Input", + "Properties": [ + { + "$id": "357", + "Name": "assignmentId", + "SerializedName": "assignmentId", + "Description": "The assignment within the job to complete.", + "Type": { + "$id": "358", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "359", + "Name": "note", + "SerializedName": "note", + "Description": "(Optional) A note that will be appended to the jobs' Notes collection with the\ncurrent timestamp.", + "Type": { + "$id": "360", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$id": "361", + "Name": "CloseJobRequest", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Request payload for closing jobs", + "IsNullable": false, + "Usage": "Input", + "Properties": [ + { + "$id": "362", + "Name": "assignmentId", + "SerializedName": "assignmentId", + "Description": "The assignment within which the job is to be closed.", + "Type": { + "$id": "363", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "364", + "Name": "dispositionCode", + "SerializedName": "dispositionCode", + "Description": "Indicates the outcome of the job, populate this field with your own custom\nvalues.", + "Type": { + "$id": "365", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "366", + "Name": "closeAt", + "SerializedName": "closeAt", + "Description": "If not provided, worker capacity is released immediately along with a\nJobClosedEvent notification.\nIf provided, worker capacity is released along\nwith a JobClosedEvent notification at a future time in UTC.", + "Type": { + "$id": "367", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "368", + "Name": "note", + "SerializedName": "note", + "Description": "(Optional) A note that will be appended to the jobs' Notes collection with the\ncurrent timestamp.", + "Type": { + "$id": "369", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$id": "370", + "Name": "PagedRouterJobItem", + "Namespace": "AzureCommunicationRoutingService", + "Description": "A paged collection of jobs.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "371", + "Name": "value", + "SerializedName": "value", + "Description": "The RouterJobItem items on this page", + "Type": { + "$id": "372", + "Name": "Array", + "ElementType": { + "$id": "373", + "Name": "RouterJobItem", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Paged instance of RouterJob", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "374", + "Name": "job", + "SerializedName": "job", + "Description": "A unit of work to be routed", + "Type": { + "$ref": "292" + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "375", + "Name": "etag", + "SerializedName": "etag", + "Description": "(Optional) The Concurrency Token.", + "Type": { + "$id": "376", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "377", + "Name": "nextLink", + "SerializedName": "nextLink", + "Description": "The link to the next page of items", + "Type": { + "$id": "378", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$ref": "373" + }, + { + "$id": "379", + "Name": "RouterJobPositionDetails", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Position and estimated wait time for a job.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "380", + "Name": "jobId", + "SerializedName": "jobId", + "Description": "Id of the job these details are about.", + "Type": { + "$id": "381", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "382", + "Name": "position", + "SerializedName": "position", + "Description": "Position of the job in question within that queue.", + "Type": { + "$id": "383", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "384", + "Name": "queueId", + "SerializedName": "queueId", + "Description": "Id of the queue this job is enqueued in.", + "Type": { + "$id": "385", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "386", + "Name": "queueLength", + "SerializedName": "queueLength", + "Description": "Length of the queue: total number of enqueued jobs.", + "Type": { + "$id": "387", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "388", + "Name": "estimatedWaitTimeMinutes", + "SerializedName": "estimatedWaitTimeMinutes", + "Description": "Estimated wait time of the job rounded up to the nearest minute", + "Type": { + "$id": "389", + "Name": "float64", + "Kind": "Float64", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + { + "$id": "390", + "Name": "UnassignJobRequest", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Request payload for unassigning a job.", + "IsNullable": false, + "Usage": "Input", + "Properties": [ + { + "$id": "391", + "Name": "suspendMatching", + "SerializedName": "suspendMatching", + "Description": "If SuspendMatching is true, then the job is not queued for re-matching with a\nworker.", + "Type": { + "$id": "392", + "Name": "boolean", + "Kind": "Boolean", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$id": "393", + "Name": "UnassignJobResult", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Response payload after a job has been successfully unassigned.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "394", + "Name": "jobId", + "SerializedName": "jobId", + "Description": "The Id of the job unassigned.", + "Type": { + "$id": "395", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "396", + "Name": "unassignmentCount", + "SerializedName": "unassignmentCount", + "Description": "The number of times a job is unassigned. At a maximum 3.", + "Type": { + "$id": "397", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + { + "$id": "398", + "Name": "AcceptJobOfferResult", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Response containing Id's for the worker, job, and assignment from an accepted\noffer", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "399", + "Name": "assignmentId", + "SerializedName": "assignmentId", + "Description": "The assignment Id that assigns a worker that has accepted an offer to a job.", + "Type": { + "$id": "400", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "401", + "Name": "jobId", + "SerializedName": "jobId", + "Description": "The Id of the job assigned.", + "Type": { + "$id": "402", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "403", + "Name": "workerId", + "SerializedName": "workerId", + "Description": "The Id of the worker that has been assigned this job.", + "Type": { + "$id": "404", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + { + "$id": "405", + "Name": "DeclineJobOfferRequest", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Request payload for declining offers", + "IsNullable": false, + "Usage": "Input", + "Properties": [ + { + "$id": "406", + "Name": "retryOfferAt", + "SerializedName": "retryOfferAt", + "Description": "If the RetryOfferAt is not provided, then this job will not be offered again to\nthe worker who declined this job unless\nthe worker is de-registered and\nre-registered. If a RetryOfferAt time is provided, then the job will be\nre-matched to\neligible workers at the retry time in UTC. The worker that\ndeclined the job will also be eligible for the job at that time.", + "Type": { + "$id": "407", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$id": "408", + "Name": "RouterQueueStatistics", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Statistics for the queue", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "409", + "Name": "queueId", + "SerializedName": "queueId", + "Description": "Id of the queue these details are about.", + "Type": { + "$id": "410", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "411", + "Name": "length", + "SerializedName": "length", + "Description": "Length of the queue: total number of enqueued jobs.", + "Type": { + "$id": "412", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "413", + "Name": "estimatedWaitTimeMinutes", + "SerializedName": "estimatedWaitTimeMinutes", + "Description": "The estimated wait time of this queue rounded up to the nearest minute, grouped\nby job priority", + "Type": { + "$id": "414", + "Name": "Dictionary", + "KeyType": { + "$id": "415", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "416", + "Name": "float64", + "Kind": "Float64", + "IsNullable": false + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "417", + "Name": "longestJobWaitTimeMinutes", + "SerializedName": "longestJobWaitTimeMinutes", + "Description": "The wait time of the job that has been enqueued in this queue for the longest.", + "Type": { + "$id": "418", + "Name": "float64", + "Kind": "Float64", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$id": "419", + "Name": "RouterWorker", + "Namespace": "AzureCommunicationRoutingService", + "Description": "An entity for jobs to be routed to", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "420", + "Name": "id", + "SerializedName": "id", + "Description": "Id of the worker.", + "Type": { + "$id": "421", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": true + }, + { + "$id": "422", + "Name": "state", + "SerializedName": "state", + "Description": "The current state of the worker.", + "Type": { + "$ref": "45" + }, + "IsRequired": false, + "IsReadOnly": true + }, + { + "$id": "423", + "Name": "queueAssignments", + "SerializedName": "queueAssignments", + "Description": "The queue(s) that this worker can receive work from.", + "Type": { + "$id": "424", + "Name": "Dictionary", + "KeyType": { + "$id": "425", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "426", + "Name": "RouterQueueAssignment", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "An assignment of a worker to a queue", + "IsNullable": false, + "Usage": "Output", + "Properties": [] + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "427", + "Name": "totalCapacity", + "SerializedName": "totalCapacity", + "Description": "The total capacity score this worker has to manage multiple concurrent jobs.", + "Type": { + "$id": "428", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "429", + "Name": "labels", + "SerializedName": "labels", + "Description": "A set of key/value pairs that are identifying attributes used by the rules\nengines to make decisions.", + "Type": { + "$id": "430", + "Name": "Dictionary", + "KeyType": { + "$id": "431", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "432", + "Name": "Intrinsic", + "Kind": "unknown", + "IsNullable": false + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "433", + "Name": "tags", + "SerializedName": "tags", + "Description": "A set of non-identifying attributes attached to this worker.", + "Type": { + "$id": "434", + "Name": "Dictionary", + "KeyType": { + "$id": "435", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "436", + "Name": "Intrinsic", + "Kind": "unknown", + "IsNullable": false + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "437", + "Name": "channelConfigurations", + "SerializedName": "channelConfigurations", + "Description": "The channel(s) this worker can handle and their impact on the workers capacity.", + "Type": { + "$id": "438", + "Name": "Dictionary", + "KeyType": { + "$id": "439", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "440", + "Name": "ChannelConfiguration", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "Represents the capacity a job in this channel will consume from a worker", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "441", + "Name": "capacityCostPerJob", + "SerializedName": "capacityCostPerJob", + "Description": "The amount of capacity that an instance of a job of this channel will consume\nof the total worker capacity.", + "Type": { + "$id": "442", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "443", + "Name": "maxNumberOfJobs", + "SerializedName": "maxNumberOfJobs", + "Description": "The maximum number of jobs that can be supported concurrently for this channel.", + "Type": { + "$id": "444", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "445", + "Name": "offers", + "SerializedName": "offers", + "Description": "A list of active offers issued to this worker.", + "Type": { + "$id": "446", + "Name": "Array", + "ElementType": { + "$id": "447", + "Name": "RouterJobOffer", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "An offer of a job to a worker", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "448", + "Name": "offerId", + "SerializedName": "offerId", + "Description": "The Id of the offer.", + "Type": { + "$id": "449", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "450", + "Name": "jobId", + "SerializedName": "jobId", + "Description": "The Id of the job.", + "Type": { + "$id": "451", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "452", + "Name": "capacityCost", + "SerializedName": "capacityCost", + "Description": "The capacity cost consumed by the job offer.", + "Type": { + "$id": "453", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "454", + "Name": "offeredAt", + "SerializedName": "offeredAt", + "Description": "The time the offer was created in UTC.", + "Type": { + "$id": "455", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + }, + { + "$id": "456", + "Name": "expiresAt", + "SerializedName": "expiresAt", + "Description": "The time that the offer will expire in UTC.", + "Type": { + "$id": "457", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": true + }, + { + "$id": "458", + "Name": "assignedJobs", + "SerializedName": "assignedJobs", + "Description": "A list of assigned jobs attached to this worker.", + "Type": { + "$id": "459", + "Name": "Array", + "ElementType": { + "$id": "460", + "Name": "RouterWorkerAssignment", + "Namespace": "AzureCommunicationRoutingService", + "Accessibility": "internal", + "Description": "The assignment for a worker to a job", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "461", + "Name": "assignmentId", + "SerializedName": "assignmentId", + "Description": "The Id of the assignment.", + "Type": { + "$id": "462", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "463", + "Name": "jobId", + "SerializedName": "jobId", + "Description": "The Id of the Job assigned.", + "Type": { + "$id": "464", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "465", + "Name": "capacityCost", + "SerializedName": "capacityCost", + "Description": "The amount of capacity this assignment has consumed on the worker.", + "Type": { + "$id": "466", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "467", + "Name": "assignedAt", + "SerializedName": "assignedAt", + "Description": "The assignment time of the job in UTC.", + "Type": { + "$id": "468", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": true + }, + { + "$id": "469", + "Name": "loadRatio", + "SerializedName": "loadRatio", + "Description": "A value indicating the workers capacity. A value of '1' means all capacity is\nconsumed. A value of '0' means no capacity is currently consumed.", + "Type": { + "$id": "470", + "Name": "float64", + "Kind": "Float64", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": true + }, + { + "$id": "471", + "Name": "availableForOffers", + "SerializedName": "availableForOffers", + "Description": "A flag indicating this worker is open to receive offers or not.", + "Type": { + "$id": "472", + "Name": "boolean", + "Kind": "Boolean", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$ref": "426" + }, + { + "$ref": "440" + }, + { + "$ref": "447" + }, + { + "$ref": "460" + }, + { + "$id": "473", + "Name": "PagedRouterWorkerItem", + "Namespace": "AzureCommunicationRoutingService", + "Description": "A paged collection of workers.", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "474", + "Name": "value", + "SerializedName": "value", + "Description": "The RouterWorkerItem items on this page", + "Type": { + "$id": "475", + "Name": "Array", + "ElementType": { + "$id": "476", + "Name": "RouterWorkerItem", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Paged instance of RouterWorker", + "IsNullable": false, + "Usage": "Output", + "Properties": [ + { + "$id": "477", + "Name": "worker", + "SerializedName": "worker", + "Description": "An entity for jobs to be routed to", + "Type": { + "$ref": "419" + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "478", + "Name": "etag", + "SerializedName": "etag", + "Description": "(Optional) The Concurrency Token.", + "Type": { + "$id": "479", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + } + ] + }, + "IsNullable": false + }, + "IsRequired": true, + "IsReadOnly": false + }, + { + "$id": "480", + "Name": "nextLink", + "SerializedName": "nextLink", + "Description": "The link to the next page of items", + "Type": { + "$id": "481", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsRequired": false, + "IsReadOnly": false + } + ] + }, + { + "$ref": "476" + }, + { + "$id": "482", + "Name": "RouterConditionalRequestHeaders", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Provides the 'If-*' headers to enable conditional (cached) responses for JobRouter.", + "IsNullable": false, + "Usage": "None", + "Properties": [] + }, + { + "$id": "483", + "Name": "LastModifiedResponseEnvelope", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Provides the 'Last-Modified' header to enable conditional (cached) requests", + "IsNullable": false, + "Usage": "None", + "Properties": [] + }, + { + "$id": "484", + "Name": "ListClassificationPoliciesQueryParams", + "Namespace": "AzureCommunicationRoutingService", + "IsNullable": false, + "Usage": "None", + "Properties": [] + }, + { + "$id": "485", + "Name": "ListDistributionPoliciesQueryParams", + "Namespace": "AzureCommunicationRoutingService", + "IsNullable": false, + "Usage": "None", + "Properties": [] + }, + { + "$id": "486", + "Name": "ListExceptionPoliciesQueryParams", + "Namespace": "AzureCommunicationRoutingService", + "IsNullable": false, + "Usage": "None", + "Properties": [] + }, + { + "$id": "487", + "Name": "ListQueuesQueryParams", + "Namespace": "AzureCommunicationRoutingService", + "IsNullable": false, + "Usage": "None", + "Properties": [] + }, + { + "$id": "488", + "Name": "ReclassifyJobResult", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Response payload from reclassifying a job", + "IsNullable": false, + "Usage": "None", + "Properties": [] + }, + { + "$id": "489", + "Name": "CancelJobResult", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Response payload from cancelling a job", + "IsNullable": false, + "Usage": "None", + "Properties": [] + }, + { + "$id": "490", + "Name": "CompleteJobResult", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Response payload from completing a job", + "IsNullable": false, + "Usage": "None", + "Properties": [] + }, + { + "$id": "491", + "Name": "CloseJobResult", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Response payload from closing a job", + "IsNullable": false, + "Usage": "None", + "Properties": [] + }, + { + "$id": "492", + "Name": "ListJobQueryParams", + "Namespace": "AzureCommunicationRoutingService", + "IsNullable": false, + "Usage": "None", + "Properties": [] + }, + { + "$id": "493", + "Name": "DeclineJobOfferResult", + "Namespace": "AzureCommunicationRoutingService", + "Description": "Response payload from declining a job", + "IsNullable": false, + "Usage": "None", + "Properties": [] + }, + { + "$id": "494", + "Name": "ListWorkerQueryParams", + "Namespace": "AzureCommunicationRoutingService", + "IsNullable": false, + "Usage": "None", + "Properties": [] + } + ], + "Clients": [ + { + "$id": "495", + "Name": "JobRouterAdministrationClient", + "Description": "", + "Operations": [ + { + "$id": "496", + "Name": "upsertDistributionPolicy", + "ResourceName": "DistributionPolicy", + "Summary": "Creates or updates a distribution policy.", + "Description": "Creates or updates a distribution policy.", + "Accessibility": "internal", + "Parameters": [ + { + "$id": "497", + "Name": "endpoint", + "NameInRequest": "endpoint", + "Type": { + "$id": "498", + "Name": "Uri", + "Kind": "Uri", + "IsNullable": false + }, + "Location": "Uri", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": true, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Client" + }, + { + "$id": "499", + "Name": "apiVersion", + "NameInRequest": "api-version", + "Description": "", + "Type": { + "$id": "500", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": true, + "IsApiVersion": true, + "IsContentType": false, + "IsEndpoint": false, + "IsResourceParameter": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Client", + "DefaultValue": { + "$id": "501", + "Type": { + "$id": "502", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Value": "2023-11-01" + } + }, + { + "$id": "503", + "Name": "id", + "NameInRequest": "id", + "Description": "The unique identifier of the policy.", + "Type": { + "$id": "504", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "505", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Description": "This request has a JSON Merge Patch body.", + "Type": { + "$id": "506", + "Name": "Literal", + "LiteralValueType": { + "$id": "507", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Value": "application/merge-patch+json", + "IsNullable": false + }, + "Location": "Header", + "DefaultValue": { + "$id": "508", + "Type": { + "$ref": "506" + }, + "Value": "application/merge-patch+json" + }, + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant" + }, + { + "$id": "509", + "Name": "ifMatch", + "NameInRequest": "If-Match", + "Description": "The request should only proceed if an entity matches this string.", + "Type": { + "$id": "510", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "511", + "Name": "ifUnmodifiedSince", + "NameInRequest": "If-Unmodified-Since", + "Description": "The request should only proceed if the entity was not modified after this time.", + "Type": { + "$id": "512", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "Location": "Header", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "513", + "Name": "resource", + "NameInRequest": "resource", + "Description": "The resource instance.", + "Type": { + "$ref": "56" + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "514", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "515", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "516", + "Type": { + "$ref": "515" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "517", + "StatusCodes": [ + 201 + ], + "BodyType": { + "$ref": "56" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "518", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "519", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "520", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "521", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + }, + { + "$id": "522", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "56" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "523", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "524", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "525", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "526", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + } + ], + "HttpMethod": "PATCH", + "RequestBodyMediaType": "Json", + "Uri": "{endpoint}", + "Path": "/routing/distributionPolicies/{id}", + "RequestMediaTypes": [ + "application/merge-patch+json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": false + }, + { + "$id": "527", + "Name": "getDistributionPolicy", + "ResourceName": "DistributionPolicy", + "Summary": "Retrieves an existing distribution policy by Id.", + "Description": "Retrieves an existing distribution policy by Id.", + "Parameters": [ + { + "$ref": "497" + }, + { + "$ref": "499" + }, + { + "$id": "528", + "Name": "id", + "NameInRequest": "id", + "Description": "The unique identifier of the policy.", + "Type": { + "$id": "529", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "530", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "531", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "532", + "Type": { + "$ref": "531" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "533", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "56" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "534", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "535", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "536", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "537", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/distributionPolicies/{id}", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "538", + "Name": "listDistributionPolicies", + "ResourceName": "JobRouterAdministrationRestClient", + "Summary": "Retrieves existing distribution policies.", + "Description": "Retrieves existing distribution policies.", + "Parameters": [ + { + "$ref": "497" + }, + { + "$ref": "499" + }, + { + "$id": "539", + "Name": "maxpagesize", + "NameInRequest": "maxpagesize", + "Description": "Number of objects to return per page.", + "Type": { + "$id": "540", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "541", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "542", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "543", + "Type": { + "$ref": "542" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "544", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "120" + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/distributionPolicies", + "BufferResponse": true, + "Paging": { + "$id": "545", + "NextLinkName": "nextLink", + "ItemName": "value" + }, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "546", + "Name": "deleteDistributionPolicy", + "ResourceName": "DistributionPolicy", + "Summary": "Delete a distribution policy by Id.", + "Description": "Delete a distribution policy by Id.", + "Parameters": [ + { + "$ref": "497" + }, + { + "$ref": "499" + }, + { + "$id": "547", + "Name": "id", + "NameInRequest": "id", + "Description": "The unique identifier of the policy.", + "Type": { + "$id": "548", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "549", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "550", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "551", + "Type": { + "$ref": "550" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "552", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "DELETE", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/distributionPolicies/{id}", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "553", + "Name": "upsertClassificationPolicy", + "ResourceName": "ClassificationPolicy", + "Summary": "Creates or updates a classification policy.", + "Description": "Creates or updates a classification policy.", + "Accessibility": "internal", + "Parameters": [ + { + "$ref": "497" + }, + { + "$ref": "499" + }, + { + "$id": "554", + "Name": "id", + "NameInRequest": "id", + "Description": "Unique identifier of this policy.", + "Type": { + "$id": "555", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "556", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Description": "This request has a JSON Merge Patch body.", + "Type": { + "$id": "557", + "Name": "Literal", + "LiteralValueType": { + "$id": "558", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Value": "application/merge-patch+json", + "IsNullable": false + }, + "Location": "Header", + "DefaultValue": { + "$id": "559", + "Type": { + "$ref": "557" + }, + "Value": "application/merge-patch+json" + }, + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant" + }, + { + "$id": "560", + "Name": "ifMatch", + "NameInRequest": "If-Match", + "Description": "The request should only proceed if an entity matches this string.", + "Type": { + "$id": "561", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "562", + "Name": "ifUnmodifiedSince", + "NameInRequest": "If-Unmodified-Since", + "Description": "The request should only proceed if the entity was not modified after this time.", + "Type": { + "$id": "563", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "Location": "Header", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "564", + "Name": "resource", + "NameInRequest": "resource", + "Description": "The resource instance.", + "Type": { + "$ref": "129" + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "565", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "566", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "567", + "Type": { + "$ref": "566" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "568", + "StatusCodes": [ + 201 + ], + "BodyType": { + "$ref": "129" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "569", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "570", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "571", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "572", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + }, + { + "$id": "573", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "129" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "574", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "575", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "576", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "577", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + } + ], + "HttpMethod": "PATCH", + "RequestBodyMediaType": "Json", + "Uri": "{endpoint}", + "Path": "/routing/classificationPolicies/{id}", + "RequestMediaTypes": [ + "application/merge-patch+json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": false + }, + { + "$id": "578", + "Name": "getClassificationPolicy", + "ResourceName": "ClassificationPolicy", + "Summary": "Retrieves an existing classification policy by Id.", + "Description": "Retrieves an existing classification policy by Id.", + "Parameters": [ + { + "$ref": "497" + }, + { + "$ref": "499" + }, + { + "$id": "579", + "Name": "id", + "NameInRequest": "id", + "Description": "Unique identifier of this policy.", + "Type": { + "$id": "580", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "581", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "582", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "583", + "Type": { + "$ref": "582" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "584", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "129" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "585", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "586", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "587", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "588", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/classificationPolicies/{id}", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "589", + "Name": "listClassificationPolicies", + "ResourceName": "JobRouterAdministrationRestClient", + "Summary": "Retrieves existing classification policies.", + "Description": "Retrieves existing classification policies.", + "Parameters": [ + { + "$ref": "497" + }, + { + "$ref": "499" + }, + { + "$id": "590", + "Name": "maxpagesize", + "NameInRequest": "maxpagesize", + "Description": "Number of objects to return per page.", + "Type": { + "$id": "591", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "592", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "593", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "594", + "Type": { + "$ref": "593" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "595", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "208" + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/classificationPolicies", + "BufferResponse": true, + "Paging": { + "$id": "596", + "NextLinkName": "nextLink", + "ItemName": "value" + }, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "597", + "Name": "deleteClassificationPolicy", + "ResourceName": "ClassificationPolicy", + "Summary": "Delete a classification policy by Id.", + "Description": "Delete a classification policy by Id.", + "Parameters": [ + { + "$ref": "497" + }, + { + "$ref": "499" + }, + { + "$id": "598", + "Name": "id", + "NameInRequest": "id", + "Description": "Unique identifier of this policy.", + "Type": { + "$id": "599", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "600", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "601", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "602", + "Type": { + "$ref": "601" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "603", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "DELETE", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/classificationPolicies/{id}", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "604", + "Name": "upsertExceptionPolicy", + "ResourceName": "ExceptionPolicy", + "Summary": "Creates or updates a exception policy.", + "Description": "Creates or updates a exception policy.", + "Accessibility": "internal", + "Parameters": [ + { + "$ref": "497" + }, + { + "$ref": "499" + }, + { + "$id": "605", + "Name": "id", + "NameInRequest": "id", + "Description": "The Id of the exception policy", + "Type": { + "$id": "606", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "607", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Description": "This request has a JSON Merge Patch body.", + "Type": { + "$id": "608", + "Name": "Literal", + "LiteralValueType": { + "$id": "609", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Value": "application/merge-patch+json", + "IsNullable": false + }, + "Location": "Header", + "DefaultValue": { + "$id": "610", + "Type": { + "$ref": "608" + }, + "Value": "application/merge-patch+json" + }, + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant" + }, + { + "$id": "611", + "Name": "ifMatch", + "NameInRequest": "If-Match", + "Description": "The request should only proceed if an entity matches this string.", + "Type": { + "$id": "612", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "613", + "Name": "ifUnmodifiedSince", + "NameInRequest": "If-Unmodified-Since", + "Description": "The request should only proceed if the entity was not modified after this time.", + "Type": { + "$id": "614", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "Location": "Header", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "615", + "Name": "resource", + "NameInRequest": "resource", + "Description": "The resource instance.", + "Type": { + "$ref": "217" + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "616", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "617", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "618", + "Type": { + "$ref": "617" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "619", + "StatusCodes": [ + 201 + ], + "BodyType": { + "$ref": "217" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "620", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "621", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "622", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "623", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + }, + { + "$id": "624", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "217" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "625", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "626", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "627", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "628", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + } + ], + "HttpMethod": "PATCH", + "RequestBodyMediaType": "Json", + "Uri": "{endpoint}", + "Path": "/routing/exceptionPolicies/{id}", + "RequestMediaTypes": [ + "application/merge-patch+json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": false + }, + { + "$id": "629", + "Name": "getExceptionPolicy", + "ResourceName": "ExceptionPolicy", + "Summary": "Retrieves an existing exception policy by Id.", + "Description": "Retrieves an existing exception policy by Id.", + "Parameters": [ + { + "$ref": "497" + }, + { + "$ref": "499" + }, + { + "$id": "630", + "Name": "id", + "NameInRequest": "id", + "Description": "The Id of the exception policy", + "Type": { + "$id": "631", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "632", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "633", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "634", + "Type": { + "$ref": "633" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "635", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "217" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "636", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "637", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "638", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "639", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/exceptionPolicies/{id}", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "640", + "Name": "listExceptionPolicies", + "ResourceName": "JobRouterAdministrationRestClient", + "Summary": "Retrieves existing exception policies.", + "Description": "Retrieves existing exception policies.", + "Parameters": [ + { + "$ref": "497" + }, + { + "$ref": "499" + }, + { + "$id": "641", + "Name": "maxpagesize", + "NameInRequest": "maxpagesize", + "Description": "Number of objects to return per page.", + "Type": { + "$id": "642", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "643", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "644", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "645", + "Type": { + "$ref": "644" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "646", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "261" + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/exceptionPolicies", + "BufferResponse": true, + "Paging": { + "$id": "647", + "NextLinkName": "nextLink", + "ItemName": "value" + }, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "648", + "Name": "deleteExceptionPolicy", + "ResourceName": "ExceptionPolicy", + "Summary": "Deletes a exception policy by Id.", + "Description": "Deletes a exception policy by Id.", + "Parameters": [ + { + "$ref": "497" + }, + { + "$ref": "499" + }, + { + "$id": "649", + "Name": "id", + "NameInRequest": "id", + "Description": "The Id of the exception policy", + "Type": { + "$id": "650", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "651", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "652", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "653", + "Type": { + "$ref": "652" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "654", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "DELETE", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/exceptionPolicies/{id}", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "655", + "Name": "upsertQueue", + "ResourceName": "RouterQueue", + "Summary": "Creates or updates a queue.", + "Description": "Creates or updates a queue.", + "Accessibility": "internal", + "Parameters": [ + { + "$ref": "497" + }, + { + "$ref": "499" + }, + { + "$id": "656", + "Name": "id", + "NameInRequest": "id", + "Description": "The Id of this queue", + "Type": { + "$id": "657", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "658", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Description": "This request has a JSON Merge Patch body.", + "Type": { + "$id": "659", + "Name": "Literal", + "LiteralValueType": { + "$id": "660", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Value": "application/merge-patch+json", + "IsNullable": false + }, + "Location": "Header", + "DefaultValue": { + "$id": "661", + "Type": { + "$ref": "659" + }, + "Value": "application/merge-patch+json" + }, + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant" + }, + { + "$id": "662", + "Name": "ifMatch", + "NameInRequest": "If-Match", + "Description": "The request should only proceed if an entity matches this string.", + "Type": { + "$id": "663", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "664", + "Name": "ifUnmodifiedSince", + "NameInRequest": "If-Unmodified-Since", + "Description": "The request should only proceed if the entity was not modified after this time.", + "Type": { + "$id": "665", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "Location": "Header", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "666", + "Name": "resource", + "NameInRequest": "resource", + "Description": "The resource instance.", + "Type": { + "$ref": "270" + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "667", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "668", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "669", + "Type": { + "$ref": "668" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "670", + "StatusCodes": [ + 201 + ], + "BodyType": { + "$ref": "270" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "671", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "672", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "673", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "674", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + }, + { + "$id": "675", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "270" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "676", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "677", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "678", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "679", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + } + ], + "HttpMethod": "PATCH", + "RequestBodyMediaType": "Json", + "Uri": "{endpoint}", + "Path": "/routing/queues/{id}", + "RequestMediaTypes": [ + "application/merge-patch+json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": false + }, + { + "$id": "680", + "Name": "getQueue", + "ResourceName": "RouterQueue", + "Summary": "Retrieves an existing queue by Id.", + "Description": "Retrieves an existing queue by Id.", + "Parameters": [ + { + "$ref": "497" + }, + { + "$ref": "499" + }, + { + "$id": "681", + "Name": "id", + "NameInRequest": "id", + "Description": "The Id of this queue", + "Type": { + "$id": "682", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "683", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "684", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "685", + "Type": { + "$ref": "684" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "686", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "270" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "687", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "688", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "689", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "690", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/queues/{id}", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "691", + "Name": "listQueues", + "ResourceName": "JobRouterAdministrationRestClient", + "Summary": "Retrieves existing queues.", + "Description": "Retrieves existing queues.", + "Parameters": [ + { + "$ref": "497" + }, + { + "$ref": "499" + }, + { + "$id": "692", + "Name": "maxpagesize", + "NameInRequest": "maxpagesize", + "Description": "Number of objects to return per page.", + "Type": { + "$id": "693", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "694", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "695", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "696", + "Type": { + "$ref": "695" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "697", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "283" + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/queues", + "BufferResponse": true, + "Paging": { + "$id": "698", + "NextLinkName": "nextLink", + "ItemName": "value" + }, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "699", + "Name": "deleteQueue", + "ResourceName": "RouterQueue", + "Summary": "Deletes a queue by Id.", + "Description": "Deletes a queue by Id.", + "Parameters": [ + { + "$ref": "497" + }, + { + "$ref": "499" + }, + { + "$id": "700", + "Name": "id", + "NameInRequest": "id", + "Description": "The Id of this queue", + "Type": { + "$id": "701", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "702", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "703", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "704", + "Type": { + "$ref": "703" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "705", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "DELETE", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/queues/{id}", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + } + ], + "Protocol": { + "$id": "706" + }, + "Creatable": true + }, + { + "$id": "707", + "Name": "JobRouterClient", + "Description": "", + "Operations": [ + { + "$id": "708", + "Name": "upsertJob", + "ResourceName": "RouterJob", + "Summary": "Creates or updates a router job.", + "Description": "Creates or updates a router job.", + "Accessibility": "internal", + "Parameters": [ + { + "$ref": "497" + }, + { + "$ref": "499" + }, + { + "$id": "709", + "Name": "id", + "NameInRequest": "id", + "Description": "The id of the job.", + "Type": { + "$id": "710", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "711", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Description": "This request has a JSON Merge Patch body.", + "Type": { + "$id": "712", + "Name": "Literal", + "LiteralValueType": { + "$id": "713", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Value": "application/merge-patch+json", + "IsNullable": false + }, + "Location": "Header", + "DefaultValue": { + "$id": "714", + "Type": { + "$ref": "712" + }, + "Value": "application/merge-patch+json" + }, + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant" + }, + { + "$id": "715", + "Name": "ifMatch", + "NameInRequest": "If-Match", + "Description": "The request should only proceed if an entity matches this string.", + "Type": { + "$id": "716", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "717", + "Name": "ifUnmodifiedSince", + "NameInRequest": "If-Unmodified-Since", + "Description": "The request should only proceed if the entity was not modified after this time.", + "Type": { + "$id": "718", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "Location": "Header", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "719", + "Name": "resource", + "NameInRequest": "resource", + "Description": "The resource instance.", + "Type": { + "$ref": "292" + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "720", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "721", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "722", + "Type": { + "$ref": "721" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "723", + "StatusCodes": [ + 201 + ], + "BodyType": { + "$ref": "292" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "724", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "725", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "726", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "727", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + }, + { + "$id": "728", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "292" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "729", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "730", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "731", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "732", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + } + ], + "HttpMethod": "PATCH", + "RequestBodyMediaType": "Json", + "Uri": "{endpoint}", + "Path": "/routing/jobs/{id}", + "RequestMediaTypes": [ + "application/merge-patch+json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": false + }, + { + "$id": "733", + "Name": "getJob", + "ResourceName": "RouterJob", + "Summary": "Retrieves an existing job by Id.", + "Description": "Retrieves an existing job by Id.", + "Parameters": [ + { + "$ref": "497" + }, + { + "$ref": "499" + }, + { + "$id": "734", + "Name": "id", + "NameInRequest": "id", + "Description": "The id of the job.", + "Type": { + "$id": "735", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "736", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "737", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "738", + "Type": { + "$ref": "737" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "739", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "292" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "740", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "741", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "742", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "743", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/jobs/{id}", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "744", + "Name": "deleteJob", + "ResourceName": "RouterJob", + "Summary": "Deletes a job and all of its traces.", + "Description": "Deletes a job and all of its traces.", + "Parameters": [ + { + "$ref": "497" + }, + { + "$ref": "499" + }, + { + "$id": "745", + "Name": "id", + "NameInRequest": "id", + "Description": "The id of the job.", + "Type": { + "$id": "746", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "747", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "748", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "749", + "Type": { + "$ref": "748" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "750", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "DELETE", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/jobs/{id}", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "751", + "Name": "reclassifyJob", + "ResourceName": "JobRouterRestClient", + "Summary": "Reclassify a job.", + "Description": "Reclassify a job.", + "Accessibility": "internal", + "Parameters": [ + { + "$ref": "497" + }, + { + "$ref": "499" + }, + { + "$id": "752", + "Name": "id", + "NameInRequest": "id", + "Description": "Id of the job.", + "Type": { + "$id": "753", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "754", + "Name": "reclassifyJobRequest", + "NameInRequest": "reclassifyJobRequest", + "Description": "Request object for reclassifying a job.", + "Type": { + "$id": "755", + "Name": "Dictionary", + "KeyType": { + "$id": "756", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "ValueType": { + "$id": "757", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "IsNullable": false + }, + "Location": "Body", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "758", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "759", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "760", + "Type": { + "$ref": "759" + }, + "Value": "application/json" + } + }, + { + "$id": "761", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "762", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "763", + "Type": { + "$ref": "762" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "764", + "StatusCodes": [ + 200 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "POST", + "RequestBodyMediaType": "Json", + "Uri": "{endpoint}", + "Path": "/routing/jobs/{id}:reclassify", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "765", + "Name": "cancelJob", + "ResourceName": "JobRouterRestClient", + "Summary": "Submits request to cancel an existing job by Id while supplying free-form\ncancellation reason.", + "Description": "Submits request to cancel an existing job by Id while supplying free-form\ncancellation reason.", + "Parameters": [ + { + "$ref": "497" + }, + { + "$ref": "499" + }, + { + "$id": "766", + "Name": "id", + "NameInRequest": "id", + "Description": "Id of the job.", + "Type": { + "$id": "767", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "768", + "Name": "cancelJobRequest", + "NameInRequest": "cancelJobRequest", + "Description": "Request model for cancelling job.", + "Type": { + "$ref": "351" + }, + "Location": "Body", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "769", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "770", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "771", + "Type": { + "$ref": "770" + }, + "Value": "application/json" + } + }, + { + "$id": "772", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "773", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "774", + "Type": { + "$ref": "773" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "775", + "StatusCodes": [ + 200 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "POST", + "RequestBodyMediaType": "Json", + "Uri": "{endpoint}", + "Path": "/routing/jobs/{id}:cancel", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "776", + "Name": "completeJob", + "ResourceName": "JobRouterRestClient", + "Summary": "Completes an assigned job.", + "Description": "Completes an assigned job.", + "Parameters": [ + { + "$ref": "497" + }, + { + "$ref": "499" + }, + { + "$id": "777", + "Name": "id", + "NameInRequest": "id", + "Description": "Id of the job.", + "Type": { + "$id": "778", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "779", + "Name": "completeJobRequest", + "NameInRequest": "completeJobRequest", + "Description": "Request model for completing job.", + "Type": { + "$ref": "356" + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "780", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "781", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "782", + "Type": { + "$ref": "781" + }, + "Value": "application/json" + } + }, + { + "$id": "783", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "784", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "785", + "Type": { + "$ref": "784" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "786", + "StatusCodes": [ + 200 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "POST", + "RequestBodyMediaType": "Json", + "Uri": "{endpoint}", + "Path": "/routing/jobs/{id}:complete", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "787", + "Name": "closeJob", + "ResourceName": "JobRouterRestClient", + "Summary": "Closes a completed job.", + "Description": "Closes a completed job.", + "Parameters": [ + { + "$ref": "497" + }, + { + "$ref": "499" + }, + { + "$id": "788", + "Name": "id", + "NameInRequest": "id", + "Description": "Id of the job.", + "Type": { + "$id": "789", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "790", + "Name": "closeJobRequest", + "NameInRequest": "closeJobRequest", + "Description": "Request model for closing job.", + "Type": { + "$ref": "361" + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "791", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "792", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "793", + "Type": { + "$ref": "792" + }, + "Value": "application/json" + } + }, + { + "$id": "794", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "795", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "796", + "Type": { + "$ref": "795" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "797", + "StatusCodes": [ + 200 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + }, + { + "$id": "798", + "StatusCodes": [ + 202 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "POST", + "RequestBodyMediaType": "Json", + "Uri": "{endpoint}", + "Path": "/routing/jobs/{id}:close", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "799", + "Name": "listJobs", + "ResourceName": "JobRouterRestClient", + "Summary": "Retrieves list of jobs based on filter parameters.", + "Description": "Retrieves list of jobs based on filter parameters.", + "Parameters": [ + { + "$ref": "497" + }, + { + "$ref": "499" + }, + { + "$id": "800", + "Name": "maxpagesize", + "NameInRequest": "maxpagesize", + "Description": "Number of objects to return per page.", + "Type": { + "$id": "801", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "802", + "Name": "status", + "NameInRequest": "status", + "Description": "If specified, filter jobs by status.", + "Type": { + "$ref": "30" + }, + "Location": "Query", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "803", + "Name": "queueId", + "NameInRequest": "queueId", + "Description": "If specified, filter jobs by queue.", + "Type": { + "$id": "804", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "805", + "Name": "channelId", + "NameInRequest": "channelId", + "Description": "If specified, filter jobs by channel.", + "Type": { + "$id": "806", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "807", + "Name": "classificationPolicyId", + "NameInRequest": "classificationPolicyId", + "Description": "If specified, filter jobs by classificationPolicy.", + "Type": { + "$id": "808", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "809", + "Name": "scheduledBefore", + "NameInRequest": "scheduledBefore", + "Description": "If specified, filter on jobs that was scheduled before or at given timestamp.\nRange: (-Inf, scheduledBefore].", + "Type": { + "$id": "810", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "811", + "Name": "scheduledAfter", + "NameInRequest": "scheduledAfter", + "Description": "If specified, filter on jobs that was scheduled at or after given value. Range:\n[scheduledAfter, +Inf).", + "Type": { + "$id": "812", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "813", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "814", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "815", + "Type": { + "$ref": "814" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "816", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "370" + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/jobs", + "BufferResponse": true, + "Paging": { + "$id": "817", + "NextLinkName": "nextLink", + "ItemName": "value" + }, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "818", + "Name": "getQueuePosition", + "ResourceName": "JobRouterRestClient", + "Summary": "Gets a job's position details.", + "Description": "Gets a job's position details.", + "Parameters": [ + { + "$ref": "497" + }, + { + "$ref": "499" + }, + { + "$id": "819", + "Name": "id", + "NameInRequest": "id", + "Description": "Id of the job.", + "Type": { + "$id": "820", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "821", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "822", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "823", + "Type": { + "$ref": "822" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "824", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "379" + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/jobs/{id}/position", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "825", + "Name": "unassignJob", + "ResourceName": "JobRouterRestClient", + "Summary": "Un-assign a job.", + "Description": "Un-assign a job.", + "Parameters": [ + { + "$ref": "497" + }, + { + "$ref": "499" + }, + { + "$id": "826", + "Name": "id", + "NameInRequest": "id", + "Description": "Id of the job to un-assign.", + "Type": { + "$id": "827", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "828", + "Name": "assignmentId", + "NameInRequest": "assignmentId", + "Description": "Id of the assignment to un-assign.", + "Type": { + "$id": "829", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "830", + "Name": "unassignJobRequest", + "NameInRequest": "unassignJobRequest", + "Description": "Request body for unassign route.", + "Type": { + "$ref": "390" + }, + "Location": "Body", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "831", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "832", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "833", + "Type": { + "$ref": "832" + }, + "Value": "application/json" + } + }, + { + "$id": "834", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "835", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "836", + "Type": { + "$ref": "835" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "837", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "393" + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "POST", + "RequestBodyMediaType": "Json", + "Uri": "{endpoint}", + "Path": "/routing/jobs/{id}/assignments/{assignmentId}:unassign", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "838", + "Name": "acceptJobOffer", + "ResourceName": "JobRouterRestClient", + "Summary": "Accepts an offer to work on a job and returns a 409/Conflict if another agent\naccepted the job already.", + "Description": "Accepts an offer to work on a job and returns a 409/Conflict if another agent\naccepted the job already.", + "Parameters": [ + { + "$ref": "497" + }, + { + "$ref": "499" + }, + { + "$id": "839", + "Name": "workerId", + "NameInRequest": "workerId", + "Description": "Id of the worker.", + "Type": { + "$id": "840", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "841", + "Name": "offerId", + "NameInRequest": "offerId", + "Description": "Id of the offer.", + "Type": { + "$id": "842", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "843", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "844", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "845", + "Type": { + "$ref": "844" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "846", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "398" + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "POST", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/workers/{workerId}/offers/{offerId}:accept", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "847", + "Name": "declineJobOffer", + "ResourceName": "JobRouterRestClient", + "Summary": "Declines an offer to work on a job.", + "Description": "Declines an offer to work on a job.", + "Parameters": [ + { + "$ref": "497" + }, + { + "$ref": "499" + }, + { + "$id": "848", + "Name": "workerId", + "NameInRequest": "workerId", + "Description": "Id of the worker.", + "Type": { + "$id": "849", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "850", + "Name": "offerId", + "NameInRequest": "offerId", + "Description": "Id of the offer.", + "Type": { + "$id": "851", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "852", + "Name": "declineJobOfferRequest", + "NameInRequest": "declineJobOfferRequest", + "Description": "Request model for declining offer.", + "Type": { + "$ref": "405" + }, + "Location": "Body", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "853", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Type": { + "$id": "854", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "855", + "Type": { + "$ref": "854" + }, + "Value": "application/json" + } + }, + { + "$id": "856", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "857", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "858", + "Type": { + "$ref": "857" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "859", + "StatusCodes": [ + 200 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "POST", + "RequestBodyMediaType": "Json", + "Uri": "{endpoint}", + "Path": "/routing/workers/{workerId}/offers/{offerId}:decline", + "RequestMediaTypes": [ + "application/json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "860", + "Name": "getQueueStatistics", + "ResourceName": "JobRouterRestClient", + "Summary": "Retrieves a queue's statistics.", + "Description": "Retrieves a queue's statistics.", + "Parameters": [ + { + "$ref": "497" + }, + { + "$ref": "499" + }, + { + "$id": "861", + "Name": "id", + "NameInRequest": "id", + "Description": "Id of the queue to retrieve statistics.", + "Type": { + "$id": "862", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "863", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "864", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "865", + "Type": { + "$ref": "864" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "866", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "408" + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/queues/{id}/statistics", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "867", + "Name": "upsertWorker", + "ResourceName": "RouterWorker", + "Summary": "Creates or updates a worker.", + "Description": "Creates or updates a worker.", + "Accessibility": "internal", + "Parameters": [ + { + "$ref": "497" + }, + { + "$ref": "499" + }, + { + "$id": "868", + "Name": "workerId", + "NameInRequest": "workerId", + "Description": "Id of the worker.", + "Type": { + "$id": "869", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "870", + "Name": "contentType", + "NameInRequest": "Content-Type", + "Description": "This request has a JSON Merge Patch body.", + "Type": { + "$id": "871", + "Name": "Literal", + "LiteralValueType": { + "$id": "872", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Value": "application/merge-patch+json", + "IsNullable": false + }, + "Location": "Header", + "DefaultValue": { + "$id": "873", + "Type": { + "$ref": "871" + }, + "Value": "application/merge-patch+json" + }, + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant" + }, + { + "$id": "874", + "Name": "ifMatch", + "NameInRequest": "If-Match", + "Description": "The request should only proceed if an entity matches this string.", + "Type": { + "$id": "875", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "876", + "Name": "ifUnmodifiedSince", + "NameInRequest": "If-Unmodified-Since", + "Description": "The request should only proceed if the entity was not modified after this time.", + "Type": { + "$id": "877", + "Name": "utcDateTime", + "Kind": "DateTime", + "IsNullable": false + }, + "Location": "Header", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "878", + "Name": "resource", + "NameInRequest": "resource", + "Description": "The resource instance.", + "Type": { + "$ref": "419" + }, + "Location": "Body", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "879", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "880", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "881", + "Type": { + "$ref": "880" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "882", + "StatusCodes": [ + 201 + ], + "BodyType": { + "$ref": "419" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "883", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "884", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "885", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "886", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + }, + { + "$id": "887", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "419" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "888", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "889", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "890", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "891", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + } + ], + "HttpMethod": "PATCH", + "RequestBodyMediaType": "Json", + "Uri": "{endpoint}", + "Path": "/routing/workers/{workerId}", + "RequestMediaTypes": [ + "application/merge-patch+json" + ], + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": false + }, + { + "$id": "892", + "Name": "getWorker", + "ResourceName": "RouterWorker", + "Summary": "Retrieves an existing worker by Id.", + "Description": "Retrieves an existing worker by Id.", + "Parameters": [ + { + "$ref": "497" + }, + { + "$ref": "499" + }, + { + "$id": "893", + "Name": "workerId", + "NameInRequest": "workerId", + "Description": "Id of the worker.", + "Type": { + "$id": "894", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "895", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "896", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "897", + "Type": { + "$ref": "896" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "898", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "419" + }, + "BodyMediaType": "Json", + "Headers": [ + { + "$id": "899", + "Name": "ETag", + "NameInResponse": "etagHeader", + "Description": "The entity tag for the response.", + "Type": { + "$id": "900", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + }, + { + "$id": "901", + "Name": "Last-Modified", + "NameInResponse": "lastModifiedTimestamp", + "Description": "The last modified timestamp.", + "Type": { + "$id": "902", + "Name": "string", + "Kind": "String", + "IsNullable": false + } + } + ], + "IsErrorResponse": false + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/workers/{workerId}", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "903", + "Name": "deleteWorker", + "ResourceName": "RouterWorker", + "Summary": "Deletes a worker and all of its traces.", + "Description": "Deletes a worker and all of its traces.", + "Parameters": [ + { + "$ref": "497" + }, + { + "$ref": "499" + }, + { + "$id": "904", + "Name": "workerId", + "NameInRequest": "workerId", + "Description": "Id of the worker.", + "Type": { + "$id": "905", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Path", + "IsRequired": true, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "906", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "907", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "908", + "Type": { + "$ref": "907" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "909", + "StatusCodes": [ + 204 + ], + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "DELETE", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/workers/{workerId}", + "BufferResponse": true, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + }, + { + "$id": "910", + "Name": "listWorkers", + "ResourceName": "JobRouterRestClient", + "Summary": "Retrieves existing workers.", + "Description": "Retrieves existing workers.", + "Parameters": [ + { + "$ref": "497" + }, + { + "$ref": "499" + }, + { + "$id": "911", + "Name": "maxpagesize", + "NameInRequest": "maxpagesize", + "Description": "Number of objects to return per page.", + "Type": { + "$id": "912", + "Name": "int32", + "Kind": "Int32", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "913", + "Name": "state", + "NameInRequest": "state", + "Description": "If specified, select workers by worker state.", + "Type": { + "$ref": "49" + }, + "Location": "Query", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "914", + "Name": "channelId", + "NameInRequest": "channelId", + "Description": "If specified, select workers who have a channel configuration with this channel.", + "Type": { + "$id": "915", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "916", + "Name": "queueId", + "NameInRequest": "queueId", + "Description": "If specified, select workers who are assigned to this queue.", + "Type": { + "$id": "917", + "Name": "string", + "Kind": "String", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "918", + "Name": "hasCapacity", + "NameInRequest": "hasCapacity", + "Description": "If set to true, select only workers who have capacity for the channel specified\nby `channelId` or for any channel if `channelId` not specified. If set to\nfalse, then will return all workers including workers without any capacity for\njobs. Defaults to false.", + "Type": { + "$id": "919", + "Name": "boolean", + "Kind": "Boolean", + "IsNullable": false + }, + "Location": "Query", + "IsRequired": false, + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Method" + }, + { + "$id": "920", + "Name": "accept", + "NameInRequest": "Accept", + "Type": { + "$id": "921", + "Name": "String", + "Kind": "String", + "IsNullable": false + }, + "Location": "Header", + "IsApiVersion": false, + "IsResourceParameter": false, + "IsContentType": false, + "IsRequired": true, + "IsEndpoint": false, + "SkipUrlEncoding": false, + "Explode": false, + "Kind": "Constant", + "DefaultValue": { + "$id": "922", + "Type": { + "$ref": "921" + }, + "Value": "application/json" + } + } + ], + "Responses": [ + { + "$id": "923", + "StatusCodes": [ + 200 + ], + "BodyType": { + "$ref": "473" + }, + "BodyMediaType": "Json", + "Headers": [], + "IsErrorResponse": false + } + ], + "HttpMethod": "GET", + "RequestBodyMediaType": "None", + "Uri": "{endpoint}", + "Path": "/routing/workers", + "BufferResponse": true, + "Paging": { + "$id": "924", + "NextLinkName": "nextLink", + "ItemName": "value" + }, + "GenerateProtocolMethod": true, + "GenerateConvenienceMethod": true + } + ], + "Protocol": { + "$id": "925" + }, + "Creatable": true + } + ] +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/JobRouterAdministrationClient.cs b/sdk/communication/Azure.Communication.JobRouter/src/JobRouterAdministrationClient.cs deleted file mode 100644 index 3bb46f5b2639..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/JobRouterAdministrationClient.cs +++ /dev/null @@ -1,1582 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using Azure.Communication.JobRouter.Models; -using Azure.Communication.Pipeline; -using Azure.Core; -using Azure.Core.Pipeline; - -namespace Azure.Communication.JobRouter -{ - /// - /// The Azure Communication Services Router Administration client. - /// - public class JobRouterAdministrationClient - { - private readonly ClientDiagnostics _clientDiagnostics; - internal JobRouterAdministrationRestClient RestClient { get; } - - #region public constructors - - /// Initializes a new instance of . - /// Connection string acquired from the Azure Communication Services resource. - public JobRouterAdministrationClient(string connectionString) - : this( - ConnectionString.Parse(Argument.CheckNotNullOrEmpty(connectionString, nameof(connectionString))), - new JobRouterClientOptions()) - { - } - - /// Initializes a new instance of . - /// Connection string acquired from the Azure Communication Services resource. - /// Client option exposing , , , etc. - public JobRouterAdministrationClient(string connectionString, JobRouterClientOptions options) - : this( - ConnectionString.Parse(Argument.CheckNotNullOrEmpty(connectionString, nameof(connectionString))), - options ?? new JobRouterClientOptions()) - { - } - - /// Initializes a new instance of . - /// The URI of the Azure Communication Services resource. - /// The used to authenticate requests. - /// Client option exposing , , , etc. - public JobRouterAdministrationClient(Uri endpoint, AzureKeyCredential credential, JobRouterClientOptions options = default) - : this( - Argument.CheckNotNull(endpoint, nameof(endpoint)).AbsoluteUri, - Argument.CheckNotNull(credential, nameof(credential)), - options ?? new JobRouterClientOptions()) - { - } - - /// Initializes a new instance of . - /// The URI of the Azure Communication Services resource. - /// The TokenCredential used to authenticate requests, such as DefaultAzureCredential. - /// Client option exposing , , , etc. - public JobRouterAdministrationClient(Uri endpoint, TokenCredential credential, JobRouterClientOptions options = default) - : this( - Argument.CheckNotNull(endpoint, nameof(endpoint)).AbsoluteUri, - Argument.CheckNotNull(credential, nameof(credential)), - options ?? new JobRouterClientOptions()) - { - } - - #endregion public constructors - - #region private constructors - - private JobRouterAdministrationClient(ConnectionString connectionString, JobRouterClientOptions options) - : this(connectionString.GetRequired("endpoint"), options.BuildHttpPipeline(connectionString), options) - { - } - - private JobRouterAdministrationClient(string endpoint, TokenCredential tokenCredential, JobRouterClientOptions options) - : this(endpoint, options.BuildHttpPipeline(tokenCredential), options) - { - } - - private JobRouterAdministrationClient(string endpoint, AzureKeyCredential keyCredential, JobRouterClientOptions options) - : this(endpoint, options.BuildHttpPipeline(keyCredential), options) - { - } - - private JobRouterAdministrationClient(string endpoint, HttpPipeline httpPipeline, JobRouterClientOptions options) - { - _clientDiagnostics = new ClientDiagnostics(options); - RestClient = new JobRouterAdministrationRestClient(_clientDiagnostics, httpPipeline, endpoint, options.ApiVersion); - } - - /// Initializes a new instance of for mocking. - protected JobRouterAdministrationClient() - { - _clientDiagnostics = null; - RestClient = null; - } - - #endregion private constructors - - #region ClassificationPolicy - - /// Creates a classification policy. - /// (Optional) Options for creating classification policy. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7386. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual async Task> CreateClassificationPolicyAsync( - CreateClassificationPolicyOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(CreateClassificationPolicy)}"); - scope.Start(); - try - { - var request = new ClassificationPolicy() - { - Name = options.Name, - FallbackQueueId = options.FallbackQueueId, - PrioritizationRule = options.PrioritizationRule, - }; - - request.QueueSelectors.AddRange(options.QueueSelectors); - request.WorkerSelectors.AddRange(options.WorkerSelectors); - - return await RestClient.UpsertClassificationPolicyAsync( - id: options.ClassificationPolicyId, - patch: request, - cancellationToken: cancellationToken) - .ConfigureAwait(false); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Creates or updates a classification policy. - /// (Optional) Options for creating classification policy.. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual Response CreateClassificationPolicy( - CreateClassificationPolicyOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(CreateClassificationPolicy)}"); - scope.Start(); - try - { - var request = new ClassificationPolicy() - { - Name = options.Name, - FallbackQueueId = options.FallbackQueueId, - PrioritizationRule = options.PrioritizationRule, - }; - - request.QueueSelectors.AddRange(options.QueueSelectors); - request.WorkerSelectors.AddRange(options.WorkerSelectors); - - return RestClient.UpsertClassificationPolicy( - id: options.ClassificationPolicyId, - patch: request, - cancellationToken: cancellationToken); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Creates or updates classification policy. - /// (Optional) Options for updating classification policy. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7386. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual async Task> UpdateClassificationPolicyAsync( - UpdateClassificationPolicyOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateClassificationPolicy)}"); - scope.Start(); - try - { - var request = new ClassificationPolicy() - { - Name = options.Name, - FallbackQueueId = options.FallbackQueueId, - PrioritizationRule = options.PrioritizationRule - }; - - request.QueueSelectors.AddRange(options.QueueSelectors); - request.WorkerSelectors.AddRange(options.WorkerSelectors); - - return await RestClient.UpsertClassificationPolicyAsync( - id: options.ClassificationPolicyId, - patch: request, - cancellationToken: cancellationToken) - .ConfigureAwait(false); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Creates or updates a classification policy. - /// (Optional) Options for updating classification policy. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7386. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual Response UpdateClassificationPolicy( - UpdateClassificationPolicyOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateClassificationPolicy)}"); - scope.Start(); - try - { - var request = new ClassificationPolicy() - { - Name = options.Name, - FallbackQueueId = options.FallbackQueueId, - PrioritizationRule = options.PrioritizationRule - }; - - request.QueueSelectors.AddRange(options.QueueSelectors); - request.WorkerSelectors.AddRange(options.WorkerSelectors); - - return RestClient.UpsertClassificationPolicy( - id: options.ClassificationPolicyId, - patch: request, - cancellationToken: cancellationToken); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Protocol method to use to remove properties from classification policy. - /// Id of the classification policy. - /// Request content payload. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// The server returned an error. See for details returned from the server. - public virtual async Task UpdateClassificationPolicyAsync( - string classificationPolicyId, - RequestContent content, - RequestContext context = null) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateClassificationPolicy)}"); - scope.Start(); - try - { - return await RestClient.UpsertClassificationPolicyAsync( - id: classificationPolicyId, - content: content, - context: context) - .ConfigureAwait(false); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Protocol method to use to remove properties from classification policy. - /// Id of the classification policy. - /// Request content payload. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// The server returned an error. See for details returned from the server. - public virtual Response UpdateClassificationPolicy( - string classificationPolicyId, - RequestContent content, - RequestContext context = null) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateClassificationPolicy)}"); - scope.Start(); - try - { - return RestClient.UpsertClassificationPolicy( - id: classificationPolicyId, - content: content, - context: context); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Retrieves existing classification policies. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual AsyncPageable GetClassificationPoliciesAsync(CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? maxPageSize) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(GetClassificationPolicies)}"); - scope.Start(); - try - { - Response response = await RestClient - .ListClassificationPoliciesAsync(maxPageSize, cancellationToken) - .ConfigureAwait(false); - return Page.FromValues(response.Value.Value, - response.Value.NextLink, - response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - async Task> NextPageFunc(string nextLink, int? maxPageSize) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(GetClassificationPolicies)}"); - scope.Start(); - try - { - Response response = await RestClient - .ListClassificationPoliciesNextPageAsync(nextLink, maxPageSize, cancellationToken) - .ConfigureAwait(false); - return Page.FromValues(response.Value.Value, - response.Value.NextLink, - response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Retrieves existing classification policies. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual Pageable GetClassificationPolicies(CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? maxPageSize) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(GetClassificationPolicies)}"); - scope.Start(); - try - { - Response response = RestClient - .ListClassificationPolicies(maxPageSize, cancellationToken); - return Page.FromValues(response.Value.Value, - response.Value.NextLink, - response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - Page NextPageFunc(string nextLink, int? maxPageSize) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(GetClassificationPolicies)}"); - scope.Start(); - try - { - Response response = RestClient - .ListClassificationPoliciesNextPage(nextLink, maxPageSize, cancellationToken); - return Page.FromValues(response.Value.Value, - response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Retrieves an existing classification policy by Id. - /// The Id of the classification policy - /// (Optional) The cancellation token to use. - /// is null. - /// The server returned an error. See for details returned from the server. - public virtual async Task> GetClassificationPolicyAsync(string classificationPolicyId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrWhiteSpace(classificationPolicyId, nameof(classificationPolicyId)); - - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(GetClassificationPolicy)}"); - scope.Start(); - try - { - return await RestClient.GetClassificationPolicyAsync(classificationPolicyId, cancellationToken).ConfigureAwait(false); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Retrieves an existing classification policy by Id. - /// The Id of the classification policy. - /// (Optional) The cancellation token to use. - /// is null. - /// The server returned an error. See for details returned from the server. - public virtual Response GetClassificationPolicy(string classificationPolicyId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrWhiteSpace(classificationPolicyId, nameof(classificationPolicyId)); - - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(GetClassificationPolicy)}"); - scope.Start(); - try - { - return RestClient.GetClassificationPolicy(classificationPolicyId, cancellationToken); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Deletes a Classification Policy by Id. - /// Id of the channel to delete. - /// (Optional) The cancellation token to use. - /// is null. - /// The server returned an error. See for details returned from the server. - public virtual async Task DeleteClassificationPolicyAsync(string classificationPolicyId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrWhiteSpace(classificationPolicyId, nameof(classificationPolicyId)); - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(DeleteClassificationPolicy)}"); - scope.Start(); - try - { - return await RestClient.DeleteClassificationPolicyAsync(classificationPolicyId, cancellationToken).ConfigureAwait(false); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Deletes a Classification Policy by Id. - /// Id of the channel to delete. - /// (Optional) The cancellation token to use. - /// is null. - /// The server returned an error. See for details returned from the server. - public virtual Response DeleteClassificationPolicy(string classificationPolicyId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrWhiteSpace(classificationPolicyId, nameof(classificationPolicyId)); - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(DeleteClassificationPolicy)}"); - scope.Start(); - try - { - return RestClient.DeleteClassificationPolicy(classificationPolicyId, cancellationToken); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - #endregion ClassificationPolicy - - #region DistributionPolicy - - /// Creates a distribution policy. - /// Additional options that can be used while creating distribution policy. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual async Task> CreateDistributionPolicyAsync( - CreateDistributionPolicyOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(CreateDistributionPolicy)}"); - scope.Start(); - try - { - var request = new DistributionPolicy(options.OfferExpiresAfter, options.Mode) - { - Name = options?.Name, - }; - - return await RestClient.UpsertDistributionPolicyAsync( - id: options.DistributionPolicyId, - patch: request, - cancellationToken: cancellationToken) - .ConfigureAwait(false); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Creates a distribution policy. - /// Additional options that can be used while creating distribution policy. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual Response CreateDistributionPolicy( - CreateDistributionPolicyOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(CreateDistributionPolicy)}"); - scope.Start(); - try - { - var request = new DistributionPolicy(options.OfferExpiresAfter, options.Mode) - { - Name = options?.Name, - }; - - return RestClient.UpsertDistributionPolicy( - id: options.DistributionPolicyId, - patch: request, - cancellationToken: cancellationToken); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Updates a distribution policy. - /// (Optional) Options for the distribution policy. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual async Task> UpdateDistributionPolicyAsync( - UpdateDistributionPolicyOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateDistributionPolicy)}"); - scope.Start(); - try - { - var request = new DistributionPolicy() - { - Name = options.Name, - OfferExpiresAfter = options.OfferExpiresAfter, - Mode = options.Mode, - }; - - return await RestClient.UpsertDistributionPolicyAsync( - id: options.DistributionPolicyId, - patch: request, - cancellationToken: cancellationToken) - .ConfigureAwait(false); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Updates a distribution policy. - /// (Optional) Options for the distribution policy. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual Response UpdateDistributionPolicy( - UpdateDistributionPolicyOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateDistributionPolicy)}"); - scope.Start(); - try - { - var request = new DistributionPolicy() - { - Name = options.Name, - OfferExpiresAfter = options.OfferExpiresAfter, - Mode = options.Mode, - }; - - return RestClient.UpsertDistributionPolicy( - id: options.DistributionPolicyId, - patch: request, - cancellationToken: cancellationToken); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Protocol method to use to remove properties from distribution policy. - /// Id of the distribution policy. - /// Request content payload. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// The server returned an error. See for details returned from the server. - public virtual async Task UpdateDistributionPolicyAsync( - string distributionPolicyId, - RequestContent content, - RequestContext context = null) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateDistributionPolicy)}"); - scope.Start(); - try - { - return await RestClient.UpsertDistributionPolicyAsync( - id: distributionPolicyId, - content: content, - context: context) - .ConfigureAwait(false); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Protocol method to use to remove properties from distribution policy. - /// Id of the distribution policy. - /// Request content payload. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// The server returned an error. See for details returned from the server. - public virtual Response UpdateDistributionPolicy( - string distributionPolicyId, - RequestContent content, - RequestContext context = null) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateDistributionPolicy)}"); - scope.Start(); - try - { - return RestClient.UpsertDistributionPolicy( - id: distributionPolicyId, - content: content, - context: context); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Retrieves existing distribution policies. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual AsyncPageable GetDistributionPoliciesAsync(CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? maxPageSize) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(GetDistributionPolicies)}"); - scope.Start(); - try - { - Response response = await RestClient - .ListDistributionPoliciesAsync(maxPageSize, cancellationToken) - .ConfigureAwait(false); - return Page.FromValues(response.Value.Value, - response.Value.NextLink, - response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - async Task> NextPageFunc(string nextLink, int? maxPageSize) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(GetDistributionPolicies)}"); - scope.Start(); - try - { - Response response = await RestClient - .ListDistributionPoliciesNextPageAsync(nextLink, maxPageSize, cancellationToken) - .ConfigureAwait(false); - return Page.FromValues(response.Value.Value, - response.Value.NextLink, - response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Retrieves existing distribution policies. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual Pageable GetDistributionPolicies(CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? maxPageSize) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(GetDistributionPolicies)}"); - scope.Start(); - try - { - Response response = RestClient - .ListDistributionPolicies(maxPageSize, cancellationToken); - return Page.FromValues(response.Value.Value, - response.Value.NextLink, - response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - Page NextPageFunc(string nextLink, int? maxPageSize) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(GetDistributionPolicies)}"); - scope.Start(); - try - { - Response response = RestClient - .ListDistributionPoliciesNextPage(nextLink, maxPageSize, cancellationToken); - return Page.FromValues(response.Value.Value, - response.Value.NextLink, - response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Retrieves an existing distribution policy by Id. - /// The Id of the distribution Policy - /// (Optional) The cancellation token to use. - /// is null. - /// The server returned an error. See for details returned from the server. - public virtual async Task> GetDistributionPolicyAsync(string distributionPolicyId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrWhiteSpace(distributionPolicyId, nameof(distributionPolicyId)); - - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(GetDistributionPolicy)}"); - scope.Start(); - try - { - return await RestClient.GetDistributionPolicyAsync(distributionPolicyId, cancellationToken).ConfigureAwait(false); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Retrieves an existing distribution policy by Id. - /// The Id of the distribution policy - /// (Optional) The cancellation token to use. - /// is null. - /// The server returned an error. See for details returned from the server. - public virtual Response GetDistributionPolicy(string distributionPolicyId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrWhiteSpace(distributionPolicyId, nameof(distributionPolicyId)); - - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(GetDistributionPolicy)}"); - scope.Start(); - try - { - return RestClient.GetDistributionPolicy(distributionPolicyId, cancellationToken); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Delete a distribution policy by Id. - /// The Id of the Distribution Policy - /// (Optional) The cancellation token to use. - /// is null. - /// The server returned an error. See for details returned from the server. - public virtual async Task DeleteDistributionPolicyAsync(string distributionPolicyId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrWhiteSpace(distributionPolicyId, nameof(distributionPolicyId)); - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(DeleteDistributionPolicy)}"); - scope.Start(); - try - { - return await RestClient.DeleteDistributionPolicyAsync(distributionPolicyId, cancellationToken) - .ConfigureAwait(false); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Delete a distribution policy by Id. - /// The id of the Distribution policy - /// (Optional) The cancellation token to use. - /// is null. - /// The server returned an error. See for details returned from the server. - public virtual Response DeleteDistributionPolicy(string distributionPolicyId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrWhiteSpace(distributionPolicyId, nameof(distributionPolicyId)); - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(DeleteDistributionPolicy)}"); - scope.Start(); - try - { - return RestClient.DeleteDistributionPolicy(distributionPolicyId, cancellationToken); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - #endregion DistributionPolicy - - #region ExceptionPolicy - - /// Creates a new exception policy. - /// (Optional) Options for creating an exception policy. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual async Task> CreateExceptionPolicyAsync( - CreateExceptionPolicyOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(CreateExceptionPolicy)}"); - scope.Start(); - try - { - var request = new ExceptionPolicy() - { - Name = options.Name - }; - - foreach (var rule in options.ExceptionRules) - { - request.ExceptionRules[rule.Key] = rule.Value; - } - - return await RestClient.UpsertExceptionPolicyAsync( - id: options.ExceptionPolicyId, - patch: request, - cancellationToken: cancellationToken) - .ConfigureAwait(false); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Creates or updates a exception policy. - /// (Optional) Options for creating an exception policy. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual Response CreateExceptionPolicy( - CreateExceptionPolicyOptions options = default, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(CreateExceptionPolicy)}"); - scope.Start(); - try - { - var request = new ExceptionPolicy() - { - Name = options.Name - }; - - foreach (var rule in options.ExceptionRules) - { - request.ExceptionRules[rule.Key] = rule.Value; - } - - return RestClient.UpsertExceptionPolicy( - id: options.ExceptionPolicyId, - patch: request, - cancellationToken: cancellationToken); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Creates a new exception policy. - /// Options for updating exception policy. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7386. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual async Task> UpdateExceptionPolicyAsync( - UpdateExceptionPolicyOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateExceptionPolicy)}"); - scope.Start(); - try - { - var request = new ExceptionPolicy() - { - Name = options.Name - }; - - foreach (var rule in options.ExceptionRules) - { - request.ExceptionRules[rule.Key] = rule.Value; - } - - return await RestClient.UpsertExceptionPolicyAsync( - id: options.ExceptionPolicyId, - patch: request, - cancellationToken: cancellationToken) - .ConfigureAwait(false); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Creates or updates a exception policy. - /// Options for updating exception policy. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7386. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual Response UpdateExceptionPolicy( - UpdateExceptionPolicyOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateExceptionPolicy)}"); - scope.Start(); - try - { - var request = new ExceptionPolicy() - { - Name = options.Name - }; - - foreach (var rule in options.ExceptionRules) - { - request.ExceptionRules[rule.Key] = rule.Value; - } - - return RestClient.UpsertExceptionPolicy( - id: options.ExceptionPolicyId, - patch: request, - cancellationToken: cancellationToken); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Protocol method to use to remove properties from exception policy. - /// Id of the exception policy. - /// Request content payload. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// The server returned an error. See for details returned from the server. - public virtual async Task UpdateExceptionPolicyAsync( - string exceptionPolicyId, - RequestContent content, - RequestContext context = null) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateExceptionPolicy)}"); - scope.Start(); - try - { - return await RestClient.UpsertExceptionPolicyAsync( - id: exceptionPolicyId, - content: content, - context: context) - .ConfigureAwait(false); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Protocol method to use to remove properties from exception policy. - /// Id of the exception policy. - /// Request content payload. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// The server returned an error. See for details returned from the server. - public virtual Response UpdateExceptionPolicy( - string exceptionPolicyId, - RequestContent content, - RequestContext context = null) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateExceptionPolicy)}"); - scope.Start(); - try - { - return RestClient.UpsertExceptionPolicy( - id: exceptionPolicyId, - content: content, - context: context); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Retrieves existing exception policies. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual AsyncPageable GetExceptionPoliciesAsync(CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? maxPageSize) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(GetExceptionPolicies)}"); - scope.Start(); - - try - { - Response response = await RestClient.ListExceptionPoliciesAsync(maxPageSize, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - async Task> NextPageFunc(string nextLink, int? maxPageSize) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(GetExceptionPolicies)}"); - scope.Start(); - - try - { - Response response = await RestClient.ListExceptionPoliciesNextPageAsync(nextLink, maxPageSize, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Retrieves existing exception policies. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual Pageable GetExceptionPolicies(CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? maxPageSize) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(GetExceptionPolicies)}"); - scope.Start(); - - try - { - Response response = RestClient.ListExceptionPolicies(maxPageSize, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - Page NextPageFunc(string nextLink, int? maxPageSize) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(GetExceptionPolicies)}"); - scope.Start(); - - try - { - Response response = RestClient.ListExceptionPoliciesNextPage(nextLink, maxPageSize, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Retrieves an existing exception policy by Id. - /// Id of the exception policy to retrieve. - /// (Optional) The cancellation token to use. - /// is null. - /// The server returned an error. See for details returned from the server. - public virtual async Task> GetExceptionPolicyAsync(string exceptionPolicyId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrWhiteSpace(exceptionPolicyId, nameof(exceptionPolicyId)); - - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(GetExceptionPolicy)}"); - scope.Start(); - try - { - Response exceptionPolicy = await RestClient.GetExceptionPolicyAsync(exceptionPolicyId, cancellationToken).ConfigureAwait(false); - return Response.FromValue(new ExceptionPolicy(exceptionPolicy.Value.Id, exceptionPolicy.Value.Name, exceptionPolicy.Value.ExceptionRules), exceptionPolicy.GetRawResponse()); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Retrieves an existing exception policy by Id. - /// Id of the exception policy to retrieve. - /// (Optional) The cancellation token to use. - /// is null. - /// The server returned an error. See for details returned from the server. - public virtual Response GetExceptionPolicy(string exceptionPolicyId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrWhiteSpace(exceptionPolicyId, nameof(exceptionPolicyId)); - - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(GetExceptionPolicy)}"); - scope.Start(); - try - { - Response exceptionPolicy = RestClient.GetExceptionPolicy(exceptionPolicyId, cancellationToken); - return Response.FromValue(new ExceptionPolicy(exceptionPolicy.Value.Id, exceptionPolicy.Value.Name, exceptionPolicy.Value.ExceptionRules), exceptionPolicy.GetRawResponse()); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Deletes a exception policy by Id. - /// Id of the exception policy to delete. - /// (Optional) The cancellation token to use. - /// is null. - /// The server returned an error. See for details returned from the server. - public virtual async Task DeleteExceptionPolicyAsync(string exceptionPolicyId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrWhiteSpace(exceptionPolicyId, nameof(exceptionPolicyId)); - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(DeleteExceptionPolicy)}"); - scope.Start(); - try - { - return await RestClient.DeleteExceptionPolicyAsync(exceptionPolicyId, cancellationToken) - .ConfigureAwait(false); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Deletes a exception policy by Id. - /// Id of the exception policy to delete. - /// (Optional) The cancellation token to use. - /// is null. - /// The server returned an error. See for details returned from the server. - public virtual Response DeleteExceptionPolicy(string exceptionPolicyId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrWhiteSpace(exceptionPolicyId, nameof(exceptionPolicyId)); - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(DeleteExceptionPolicy)}"); - scope.Start(); - try - { - return RestClient.DeleteExceptionPolicy(exceptionPolicyId, cancellationToken); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - #endregion ExceptionPolicy - - #region Queue - - /// Creates or updates a queue. - /// Options for creating a job queue. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual async Task> CreateQueueAsync( - CreateQueueOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(CreateQueue)}"); - scope.Start(); - try - { - var request = new Models.RouterQueue() - { - DistributionPolicyId = options.DistributionPolicyId, - Name = options.Name, - ExceptionPolicyId = options.ExceptionPolicyId, - }; - - foreach (var label in options.Labels) - { - request.Labels[label.Key] = label.Value; - } - - return await RestClient.UpsertQueueAsync( - id: options.QueueId, - patch: request, - cancellationToken: cancellationToken) - .ConfigureAwait(false); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Creates or updates a queue. - /// Options for creating a job queue. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual Response CreateQueue( - CreateQueueOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(CreateQueue)}"); - scope.Start(); - try - { - var request = new Models.RouterQueue() - { - DistributionPolicyId = options.DistributionPolicyId, - Name = options.Name, - ExceptionPolicyId = options.ExceptionPolicyId, - }; - - foreach (var label in options.Labels) - { - request.Labels[label.Key] = label.Value; - } - - return RestClient.UpsertQueue( - id: options.QueueId, - patch: request, - cancellationToken: cancellationToken); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Creates or updates a queue. - /// Options for updating a job queue. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7386. - /// (Optional) The cancellation token to use. - /// is null. - /// The server returned an error. See for details returned from the server. - public virtual async Task> UpdateQueueAsync( - UpdateQueueOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateQueue)}"); - scope.Start(); - try - { - var request = new Models.RouterQueue() - { - DistributionPolicyId = options.DistributionPolicyId, - Name = options.Name, - ExceptionPolicyId = options.ExceptionPolicyId, - }; - - foreach (var label in options.Labels) - { - request.Labels[label.Key] = label.Value; - } - - return await RestClient.UpsertQueueAsync( - id: options.QueueId, - patch: request, - cancellationToken: cancellationToken) - .ConfigureAwait(false); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Creates or updates a queue. - /// Options for updating a queue. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7386. - /// (Optional) The cancellation token to use. - /// is null. - /// The server returned an error. See for details returned from the server. - public virtual Response UpdateQueue( - UpdateQueueOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateQueue)}"); - scope.Start(); - try - { - var request = new Models.RouterQueue() - { - DistributionPolicyId = options.DistributionPolicyId, - Name = options.Name, - ExceptionPolicyId = options.ExceptionPolicyId, - }; - - foreach (var label in options.Labels) - { - request.Labels[label.Key] = label.Value; - } - - return RestClient.UpsertQueue( - id: options.QueueId, - patch: request, - cancellationToken: cancellationToken); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Protocol method to use to remove properties from worker. - /// Id of the queue. - /// Request content payload. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// The server returned an error. See for details returned from the server. - public virtual async Task UpdateQueueAsync( - string queueId, - RequestContent content, - RequestContext context = null) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateQueue)}"); - scope.Start(); - try - { - return await RestClient.UpsertQueueAsync( - id: queueId, - content: content, - context: context) - .ConfigureAwait(false); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Creates or updates a queue. - /// Id of the queue. - /// Request content payload. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// is null. - /// The server returned an error. See for details returned from the server. - public virtual Response UpdateQueue( - string queueId, - RequestContent content, - RequestContext context = null) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateQueue)}"); - scope.Start(); - try - { - return RestClient.UpsertQueue( - id: queueId, - content: content, - context: context); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Retrieves existing queues. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual AsyncPageable GetQueuesAsync(CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? maxPageSize) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouter.JobRouterAdministrationClient)}.{nameof(GetQueues)}"); - scope.Start(); - - try - { - Response response = await RestClient.ListQueuesAsync(maxPageSize, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - async Task> NextPageFunc(string nextLink, int? maxPageSize) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouter.JobRouterAdministrationClient)}.{nameof(GetQueues)}"); - scope.Start(); - - try - { - Response response = await RestClient.ListQueuesNextPageAsync(nextLink, maxPageSize, cancellationToken).ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Retrieves existing queues. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual Pageable GetQueues(CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? maxPageSize) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouter.JobRouterAdministrationClient)}.{nameof(GetQueues)}"); - scope.Start(); - - try - { - Response response = RestClient.ListQueues(maxPageSize, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - Page NextPageFunc(string nextLink, int? maxPageSize) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouter.JobRouterAdministrationClient)}.{nameof(GetQueues)}"); - scope.Start(); - - try - { - Response response = - RestClient.ListQueuesNextPage(nextLink, maxPageSize, cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Retrieves an existing queue by Id. - /// Id of the queue to retrieve. - /// (Optional) The cancellation token to use. - /// is null. - /// The server returned an error. See for details returned from the server. - public virtual async Task> GetQueueAsync(string queueId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrWhiteSpace(queueId, nameof(queueId)); - - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(GetQueue)}"); - scope.Start(); - try - { - Response queue = await RestClient.GetQueueAsync(queueId, cancellationToken).ConfigureAwait(false); - return Response.FromValue(queue.Value, queue.GetRawResponse()); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Retrieves an existing queue by Id. - /// Id of the queue to retrieve. - /// (Optional) The cancellation token to use. - /// is null. - public virtual Response GetQueue(string queueId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrWhiteSpace(queueId, nameof(queueId)); - - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(GetQueue)}"); - scope.Start(); - try - { - Response queue = RestClient.GetQueue(queueId, cancellationToken); - return Response.FromValue(queue.Value, queue.GetRawResponse()); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Deletes a queue by Id. - /// Id of the queue to delete. - /// (Optional) The cancellation token to use. - /// is null. - /// The server returned an error. See for details returned from the server. - public virtual async Task DeleteQueueAsync(string queueId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrWhiteSpace(queueId, nameof(queueId)); - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(DeleteQueue)}"); - scope.Start(); - try - { - return await RestClient.DeleteQueueAsync(queueId, cancellationToken) - .ConfigureAwait(false); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Deletes a queue by Id. - /// Id of the queue to delete. - /// (Optional) The cancellation token to use. - /// is null. - /// The server returned an error. See for details returned from the server. - public virtual Response DeleteQueue(string queueId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrWhiteSpace(queueId, nameof(queueId)); - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(DeleteQueue)}"); - scope.Start(); - try - { - return RestClient.DeleteQueue(queueId, cancellationToken); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - #endregion Queue - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/JobRouterClient.cs b/sdk/communication/Azure.Communication.JobRouter/src/JobRouterClient.cs deleted file mode 100644 index 697b5a6c19e2..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/JobRouterClient.cs +++ /dev/null @@ -1,1672 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.Threading; -using System.Threading.Tasks; -using Azure.Communication.JobRouter.Models; -using Azure.Communication.Pipeline; -using Azure.Core; -using Azure.Core.Pipeline; - - namespace Azure.Communication.JobRouter -{ - /// - /// The Azure Communication Services Router client. - /// - public class JobRouterClient - { - private readonly ClientDiagnostics _clientDiagnostics; - internal JobRouterRestClient RestClient { get; } - - #region public constructors - all arguments need null check - - /// Initializes a new instance of . - /// Connection string acquired from the Azure Communication Services resource. - public JobRouterClient(string connectionString) - : this( - ConnectionString.Parse(Argument.CheckNotNullOrEmpty(connectionString, nameof(connectionString))), - new JobRouterClientOptions()) - { - } - - /// Initializes a new instance of . - /// Connection string acquired from the Azure Communication Services resource. - /// Client option exposing , , , etc. - public JobRouterClient(string connectionString, JobRouterClientOptions options) - : this( - ConnectionString.Parse(Argument.CheckNotNullOrEmpty(connectionString, nameof(connectionString))), - options ?? new JobRouterClientOptions()) - { - } - - /// Initializes a new instance of . - /// The URI of the Azure Communication Services resource. - /// The used to authenticate requests. - /// Client option exposing , , , etc. - public JobRouterClient(Uri endpoint, AzureKeyCredential credential, JobRouterClientOptions options = default) - : this( - Argument.CheckNotNull(endpoint, nameof(endpoint)).AbsoluteUri, - Argument.CheckNotNull(credential, nameof(credential)), - options ?? new JobRouterClientOptions()) - { - } - - /// Initializes a new instance of . - /// The URI of the Azure Communication Services resource. - /// The TokenCredential used to authenticate requests, such as DefaultAzureCredential. - /// Client option exposing , , , etc. - public JobRouterClient(Uri endpoint, TokenCredential credential, JobRouterClientOptions options = default) - : this( - Argument.CheckNotNull(endpoint, nameof(endpoint)).AbsoluteUri, - Argument.CheckNotNull(credential, nameof(credential)), - options ?? new JobRouterClientOptions()) - { - } - - #endregion - - #region private constructors - - private JobRouterClient(ConnectionString connectionString, JobRouterClientOptions options) - : this(connectionString.GetRequired("endpoint"), options.BuildHttpPipeline(connectionString), options) - { - } - - private JobRouterClient(string endpoint, TokenCredential tokenCredential, JobRouterClientOptions options) - : this(endpoint, options.BuildHttpPipeline(tokenCredential), options) - { - } - - private JobRouterClient(string endpoint, AzureKeyCredential keyCredential, JobRouterClientOptions options) - : this(endpoint, options.BuildHttpPipeline(keyCredential), options) - { - } - - private JobRouterClient(string endpoint, HttpPipeline httpPipeline, JobRouterClientOptions options) - { - _clientDiagnostics = new ClientDiagnostics(options); - RestClient = new JobRouterRestClient(_clientDiagnostics, httpPipeline, endpoint, options.ApiVersion); - } - - /// Initializes a new instance of for mocking. - protected JobRouterClient() - { - _clientDiagnostics = null; - RestClient = null; - } - - #endregion - - #region Job - - #region Create job with classification policy - - /// Creates a new job to be routed with classification property. - /// Options for creating job with classification properties. - /// The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual async Task> CreateJobWithClassificationPolicyAsync( - CreateJobWithClassificationPolicyOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(CreateJobWithClassificationPolicy)}"); - scope.Start(); - try - { - var request = new RouterJob - { - ChannelId = options.ChannelId, - ClassificationPolicyId = options.ClassificationPolicyId, - ChannelReference = options.ChannelReference, - QueueId = options.QueueId, - Priority = options.Priority, - MatchingMode = options.MatchingMode, - }; - - foreach (var label in options.Labels) - { - request.Labels[label.Key] = label.Value; - } - - foreach (var tag in options.Tags) - { - request.Tags[tag.Key] = tag.Value; - } - - foreach (var workerSelector in options.RequestedWorkerSelectors) - { - request.RequestedWorkerSelectors.Add(workerSelector); - } - - foreach (var note in options.Notes) - { - request.Notes.Add(note); - } - - return await RestClient.UpsertJobAsync( - id:options.JobId, - patch: request, - cancellationToken: cancellationToken) - .ConfigureAwait(false); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Creates a new job to be routed with classification property. - /// Options for creating job with classification properties. - /// The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual Response CreateJobWithClassificationPolicy( - CreateJobWithClassificationPolicyOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(CreateJobWithClassificationPolicy)}"); - scope.Start(); - try - { - var request = new RouterJob - { - ChannelId = options.ChannelId, - ClassificationPolicyId = options.ClassificationPolicyId, - ChannelReference = options.ChannelReference, - QueueId = options.QueueId, - Priority = options.Priority, - MatchingMode = options.MatchingMode, - }; - - foreach (var label in options.Labels) - { - request.Labels[label.Key] = label.Value; - } - - foreach (var tag in options.Tags) - { - request.Tags[tag.Key] = tag.Value; - } - - foreach (var workerSelector in options.RequestedWorkerSelectors) - { - request.RequestedWorkerSelectors.Add(workerSelector); - } - - foreach (var note in options.Notes) - { - request.Notes.Add(note); - } - - return RestClient.UpsertJob( - id:options.JobId, - patch: request, - cancellationToken: cancellationToken); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - #endregion Create job with classification policy - - #region Create job with direct queue assignment - - /// Creates a new job to be routed. - /// Options for creating job with direct queue assignment. - /// The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual async Task> CreateJobAsync( - CreateJobOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(CreateJob)}"); - scope.Start(); - try - { - var request = new RouterJob - { - ChannelId = options.ChannelId, - ChannelReference = options.ChannelReference, - QueueId = options.QueueId, - Priority = options.Priority, - MatchingMode = options.MatchingMode, - }; - - foreach (var label in options.Labels) - { - request.Labels[label.Key] = label.Value; - } - - foreach (var tag in options.Tags) - { - request.Tags[tag.Key] = tag.Value; - } - - foreach (var workerSelector in options.RequestedWorkerSelectors) - { - request.RequestedWorkerSelectors.Add(workerSelector); - } - - foreach (var note in options.Notes) - { - request.Notes.Add(note); - } - - return await RestClient.UpsertJobAsync( - id: options.JobId, - patch: request, - cancellationToken: cancellationToken) - .ConfigureAwait(false); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Creates a new job to be routed. - /// Options for creating job with direct queue assignment. - /// The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual Response CreateJob( - CreateJobOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(CreateJob)}"); - scope.Start(); - try - { - var request = new RouterJob - { - ChannelId = options.ChannelId, - ChannelReference = options.ChannelReference, - QueueId = options.QueueId, - Priority = options.Priority, - MatchingMode = options.MatchingMode, - }; - - foreach (var label in options.Labels) - { - request.Labels[label.Key] = label.Value; - } - - foreach (var tag in options.Tags) - { - request.Tags[tag.Key] = tag.Value; - } - - foreach (var workerSelector in options.RequestedWorkerSelectors) - { - request.RequestedWorkerSelectors.Add(workerSelector); - } - - foreach (var note in options.Notes) - { - request.Notes.Add(note); - } - - return RestClient.UpsertJob( - id: options.JobId, - patch: request, - cancellationToken: cancellationToken); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - #endregion Create job with direct queue assignment - - /// Update an existing job. - /// Options for updating a job. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7386. - /// The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual async Task> UpdateJobAsync( - UpdateJobOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(UpdateJob)}"); - scope.Start(); - try - { - var request = new RouterJob - { - ChannelId = options.ChannelId, - ClassificationPolicyId = options.ClassificationPolicyId, - ChannelReference = options.ChannelReference, - QueueId = options.QueueId, - Priority = options.Priority, - DispositionCode = options.DispositionCode, - MatchingMode = options.MatchingMode, - }; - - foreach (var label in options.Labels) - { - request.Labels[label.Key] = label.Value; - } - - foreach (var tag in options.Tags) - { - request.Tags[tag.Key] = tag.Value; - } - - foreach (var workerSelector in options.RequestedWorkerSelectors) - { - request.RequestedWorkerSelectors.Add(workerSelector); - } - - foreach (var note in options.Notes) - { - request.Notes.Add(note); - } - - return await RestClient.UpsertJobAsync( - id: options.JobId, - patch: request, - cancellationToken: cancellationToken) - .ConfigureAwait(false); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Update an existing job. - /// Options for updating a job. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7386. - /// The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual Response UpdateJob( - UpdateJobOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(UpdateJob)}"); - scope.Start(); - try - { - var request = new RouterJob - { - ChannelId = options.ChannelId, - ClassificationPolicyId = options.ClassificationPolicyId, - ChannelReference = options.ChannelReference, - QueueId = options.QueueId, - Priority = options.Priority, - DispositionCode = options.DispositionCode, - MatchingMode = options.MatchingMode, - }; - - foreach (var label in options.Labels) - { - request.Labels[label.Key] = label.Value; - } - - foreach (var tag in options.Tags) - { - request.Tags[tag.Key] = tag.Value; - } - - foreach (var workerSelector in options.RequestedWorkerSelectors) - { - request.RequestedWorkerSelectors.Add(workerSelector); - } - - foreach (var note in options.Notes) - { - request.Notes.Add(note); - } - - return RestClient.UpsertJob( - id: options.JobId, - patch: request, - cancellationToken: cancellationToken); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Protocol method to use to remove properties from job. - /// Id of the job. - /// Request content payload. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// The server returned an error. See for details returned from the server. - public virtual async Task UpdateJobAsync( - string jobId, - RequestContent content, - RequestContext context = null) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(UpdateJob)}"); - scope.Start(); - try - { - return await RestClient.UpsertJobAsync( - id: jobId, - content: content, - context: context) - .ConfigureAwait(false); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Protocol method to use to remove properties from job. - /// Id of the job. - /// Request content payload. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// The server returned an error. See for details returned from the server. - public virtual Response UpdateJob( - string jobId, - RequestContent content, - RequestContext context = null) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(UpdateJob)}"); - scope.Start(); - try - { - return RestClient.UpsertJob( - id: jobId, - content: content, - context: context); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Retrieves an existing job by Id. - /// The id of the job. - /// (Optional) The cancellation token to use. - /// is null. - /// The server returned an error. See for details returned from the server. - public virtual async Task> GetJobAsync(string jobId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrWhiteSpace(jobId, nameof(jobId)); - - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(GetJob)}"); - scope.Start(); - try - { - Response job = await RestClient.GetJobAsync(jobId, cancellationToken).ConfigureAwait(false); - return Response.FromValue(job.Value, job.GetRawResponse()); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Retrieves an existing job by Id. - /// The Id of the job. - /// (Optional) The cancellation token to use. - /// is null. - /// The server returned an error. See for details returned from the server. - public virtual Response GetJob(string jobId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrWhiteSpace(jobId, nameof(jobId)); - - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(GetJob)}"); - scope.Start(); - try - { - Response job = RestClient.GetJob(jobId, cancellationToken); - return Response.FromValue(job.Value, job.GetRawResponse()); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Reclassify a job. - /// The id of the job. - /// (Optional) The cancellation token to use. - /// - ///The server returned an error. See for details returned from the server. - public virtual async Task ReclassifyJobAsync( - string jobId, - CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrWhiteSpace(jobId, nameof(jobId)); - - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(ReclassifyJob)}"); - scope.Start(); - try - { - var response = await RestClient.ReclassifyJobActionAsync( - id: jobId, - new ReclassifyJobRequest(), - cancellationToken: cancellationToken).ConfigureAwait(false); - return response.GetRawResponse(); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Reclassify a job. - /// The id of the job. - /// (Optional) The cancellation token to use. - /// - ///The server returned an error. See for details returned from the server. - public virtual Response ReclassifyJob( - string jobId, - CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrWhiteSpace(jobId, nameof(jobId)); - - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(ReclassifyJob)}"); - scope.Start(); - try - { - var response = RestClient.ReclassifyJobAction( - id: jobId, - new ReclassifyJobRequest(), - cancellationToken: cancellationToken); - return response.GetRawResponse(); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Submits request to cancel an existing job by Id while supplying free-form cancellation reason. - /// Options for cancelling a job. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual async Task CancelJobAsync( - CancelJobOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(CancelJob)}"); - scope.Start(); - try - { - var response = await RestClient.CancelJobActionAsync( - id: options.JobId, - note: options.Note, - dispositionCode: options.DispositionCode, - cancellationToken: cancellationToken) - .ConfigureAwait(false); - return response.GetRawResponse(); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Submits request to cancel an existing job by Id while supplying free-form cancellation reason. - /// Options for cancelling a job. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual Response CancelJob( - CancelJobOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(CancelJob)}"); - scope.Start(); - try - { - var response = RestClient.CancelJobAction( - id: options.JobId, - note: options.Note, - dispositionCode: options.DispositionCode, - cancellationToken: cancellationToken); - return response.GetRawResponse(); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Completes an assigned job. - /// Options for completing a job. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual async Task CompleteJobAsync( - CompleteJobOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(CompleteJob)}"); - scope.Start(); - try - { - var response = await RestClient.CompleteJobActionAsync( - id: options.JobId, - assignmentId: options.AssignmentId, - note: options.Note, - cancellationToken: cancellationToken) - .ConfigureAwait(false); - - return response.GetRawResponse(); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Completes an assigned job. - /// Options for completing a job. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual Response CompleteJob( - CompleteJobOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(CompleteJob)}"); - scope.Start(); - try - { - var response = RestClient.CompleteJobAction( - id: options.JobId, - assignmentId: options.AssignmentId, - note: options.Note, - cancellationToken: cancellationToken); - - return response.GetRawResponse(); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Closes a completed job. - /// Options for closing a job. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual async Task CloseJobAsync( - CloseJobOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(CloseJob)}"); - scope.Start(); - try - { - var response = await RestClient.CloseJobActionAsync( - id: options.JobId, - assignmentId: options.AssignmentId, - dispositionCode: options.DispositionCode, - closeAt: options.CloseAt, - note: options.Note, - cancellationToken: cancellationToken) - .ConfigureAwait(false); - return response.GetRawResponse(); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Closes a completed job. - /// Options for closing a job. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual Response CloseJob( - CloseJobOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(CloseJob)}"); - scope.Start(); - try - { - var response = RestClient.CloseJobAction( - id: options.JobId, - assignmentId: options.AssignmentId, - dispositionCode: options.DispositionCode, - closeAt: options.CloseAt, - note: options.Note, - cancellationToken: cancellationToken); - return response.GetRawResponse(); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - // Retrieves list of jobs based on filters. - /// Options for filter while retrieving jobs. - /// The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual AsyncPageable GetJobsAsync( - GetJobsOptions options = default, - CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? maxPageSize) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(GetJobs)}"); - scope.Start(); - - try - { - Response response = await RestClient.ListJobsAsync( - status: options?.Status, - queueId: options?.QueueId, - channelId: options?.ChannelId, - classificationPolicyId: options?.ClassificationPolicyId, - scheduledBefore: options?.ScheduledBefore, - scheduledAfter: options?.ScheduledAfter, - maxpagesize: maxPageSize, - cancellationToken: cancellationToken) - .ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - async Task> NextPageFunc(string nextLink, int? maxPageSize) - { - using DiagnosticScope scope = - _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(GetJobs)}"); - scope.Start(); - - try - { - Response response = await RestClient - .ListJobsNextPageAsync( - nextLink: nextLink, - status: options?.Status, - queueId: options?.QueueId, - channelId: options?.ChannelId, - classificationPolicyId: options?.ClassificationPolicyId, - scheduledBefore: options?.ScheduledBefore, - scheduledAfter: options?.ScheduledAfter, - maxpagesize: maxPageSize, - cancellationToken: cancellationToken) - .ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - // Retrieves list of jobs based on filters. - /// Options for filter while retrieving jobs. - /// The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual Pageable GetJobs( - GetJobsOptions options = default, - CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? maxPageSize) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(GetJobs)}"); - scope.Start(); - - try - { - Response response = RestClient.ListJobs( - status: options?.Status, - queueId: options?.QueueId, - channelId: options?.ChannelId, - classificationPolicyId: options?.ClassificationPolicyId, - scheduledBefore: options?.ScheduledBefore, - scheduledAfter: options?.ScheduledAfter, - maxpagesize: maxPageSize, - cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - Page NextPageFunc(string nextLink, int? maxPageSize) - { - using DiagnosticScope scope = - _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(GetJobs)}"); - scope.Start(); - - try - { - Response response = RestClient - .ListJobsNextPage( - nextLink: nextLink, - status: options?.Status, - queueId: options?.QueueId, - channelId: options?.ChannelId, - classificationPolicyId: options?.ClassificationPolicyId, - scheduledBefore: options?.ScheduledBefore, - scheduledAfter: options?.ScheduledAfter, - maxpagesize: maxPageSize, - cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Gets a jobs position details. - /// The String to use. - /// (Optional) The cancellation token to use. - /// is null. - /// The server returned an error. See for details returned from the server. - public virtual async Task> GetQueuePositionAsync(string jobId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrWhiteSpace(jobId, nameof(jobId)); - - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(GetQueuePosition)}"); - scope.Start(); - try - { - Response job = await RestClient.GetInQueuePositionAsync(jobId, cancellationToken).ConfigureAwait(false); - return Response.FromValue(job.Value, job.GetRawResponse()); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Gets a jobs position details. - /// The String to use. - /// (Optional) The cancellation token to use. - /// is null. - /// The server returned an error. See for details returned from the server. - public virtual Response GetQueuePosition(string jobId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrWhiteSpace(jobId, nameof(jobId)); - - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(GetQueuePosition)}"); - scope.Start(); - try - { - Response job = RestClient.GetInQueuePosition(jobId, cancellationToken); - return Response.FromValue(job.Value, job.GetRawResponse()); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Deletes a job and all of its traces. - /// The String to use. - /// (Optional) The cancellation token to use. - /// is null. - /// The server returned an error. See for details returned from the server. - public virtual async Task DeleteJobAsync(string jobId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrWhiteSpace(jobId, nameof(jobId)); - - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(DeleteJob)}"); - scope.Start(); - try - { - return await RestClient.DeleteJobAsync(id: jobId, cancellationToken: cancellationToken).ConfigureAwait(false); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Deletes a job and all of its traces. - /// The String to use. - /// (Optional) The cancellation token to use. - /// is null. - /// The server returned an error. See for details returned from the server. - public virtual Response DeleteJob(string jobId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrWhiteSpace(jobId, nameof(jobId)); - - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(DeleteJob)}"); - scope.Start(); - try - { - return RestClient.DeleteJob(id: jobId, cancellationToken: cancellationToken); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - #endregion Job - - #region Offer - - /// Accepts an offer to work on a job and returns a 409/Conflict if another agent accepted the job already. - /// The Id of the Worker. - /// The Id of the Job offer. - /// (Optional) The cancellation token to use. - /// or is null. - /// The server returned an error. See for details returned from the server. - public virtual async Task> AcceptJobOfferAsync( - string workerId, - string offerId, - CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrWhiteSpace(offerId, nameof(offerId)); - Argument.AssertNotNullOrWhiteSpace(workerId, nameof(workerId)); - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(AcceptJobOffer)}"); - scope.Start(); - try - { - var response = await RestClient.AcceptJobActionAsync( - workerId: workerId, - offerId: offerId, - cancellationToken: cancellationToken) - .ConfigureAwait(false); - - return Response.FromValue(response.Value, response.GetRawResponse()); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Accepts an offer to work on a job and returns a 409/Conflict if another agent accepted the job already. - /// The Id of the Worker. - /// The Id of the Job offer. - /// (Optional) The cancellation token to use. - /// or is null. - /// The server returned an error. See for details returned from the server. - public virtual Response AcceptJobOffer( - string workerId, - string offerId, - CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrWhiteSpace(offerId, nameof(offerId)); - Argument.AssertNotNullOrWhiteSpace(workerId, nameof(workerId)); - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(AcceptJobOffer)}"); - scope.Start(); - try - { - var response = RestClient.AcceptJobAction( - workerId: workerId, - offerId: offerId, - cancellationToken: cancellationToken); - - return Response.FromValue(response.Value, response.GetRawResponse()); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Declines an offer to work on a job. - /// The options for declining a job offer. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual async Task DeclineJobOfferAsync(DeclineJobOfferOptions options, CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(DeclineJobOffer)}"); - scope.Start(); - try - { - var response = await RestClient.DeclineJobActionAsync( - workerId: options.WorkerId, - offerId: options.OfferId, - declineJobOfferRequest: new DeclineJobOfferRequest { RetryOfferAt = options.RetryOfferAt }, - cancellationToken: cancellationToken) - .ConfigureAwait(false); - - return response.GetRawResponse(); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Declines an offer to work on a job. - /// The options for declining a job offer. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual Response DeclineJobOffer(DeclineJobOfferOptions options, CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(DeclineJobOffer)}"); - scope.Start(); - try - { - var response = RestClient.DeclineJobAction( - workerId: options.WorkerId, - offerId: options.OfferId, - declineJobOfferRequest: new DeclineJobOfferRequest { RetryOfferAt = options.RetryOfferAt }, - cancellationToken: cancellationToken); - - return response.GetRawResponse(); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - #endregion Offer - - #region Queue - - /// Retrieves queue statistics by Id. - /// Id of the queue. - /// (Optional) The cancellation token to use. - /// is null. - /// The server returned an error. See for details returned from the server. - public virtual async Task> GetQueueStatisticsAsync(string queueId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrWhiteSpace(queueId, nameof(queueId)); - - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(GetQueueStatistics)}"); - scope.Start(); - try - { - Response queue = await RestClient.GetQueueStatisticsAsync(queueId, cancellationToken).ConfigureAwait(false); - return Response.FromValue(queue.Value, queue.GetRawResponse()); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Retrieves queue statistics by Id. - /// Id of the queue. - /// (Optional) The cancellation token to use. - /// is null. - public virtual Response GetQueueStatistics(string queueId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrWhiteSpace(queueId, nameof(queueId)); - - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(GetQueueStatistics)}"); - scope.Start(); - try - { - Response queue = RestClient.GetQueueStatistics(queueId, cancellationToken); - return Response.FromValue(queue.Value, queue.GetRawResponse()); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - #endregion Queue - - #region Worker - - /// Create or update a worker to process jobs. - /// Options for creating a router worker. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual async Task> CreateWorkerAsync( - CreateWorkerOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(CreateWorker)}"); - scope.Start(); - try - { - var request = new RouterWorker() - { - TotalCapacity = options.TotalCapacity, - AvailableForOffers = options?.AvailableForOffers - }; - - foreach (var queueAssignment in options.QueueAssignments) - { - request.QueueAssignments[queueAssignment.Key] = queueAssignment.Value; - } - - foreach (var label in options.Labels) - { - request.Labels[label.Key] = label.Value; - } - - foreach (var tag in options.Tags) - { - request.Tags[tag.Key] = tag.Value; - } - - foreach (var channel in options.ChannelConfigurations) - { - request.ChannelConfigurations[channel.Key] = channel.Value; - } - - var response = await RestClient.UpsertWorkerAsync( - workerId: options.WorkerId, - patch: request, - cancellationToken: cancellationToken) - .ConfigureAwait(false); - return Response.FromValue(response.Value, response.GetRawResponse()); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Create or update a worker to process jobs. - /// Options for creating a router worker. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual Response CreateWorker( - CreateWorkerOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(CreateWorker)}"); - scope.Start(); - try - { - var request = new RouterWorker() - { - TotalCapacity = options.TotalCapacity, - AvailableForOffers = options?.AvailableForOffers - }; - - foreach (var queueAssignment in options.QueueAssignments) - { - request.QueueAssignments[queueAssignment.Key] = queueAssignment.Value; - } - - foreach (var label in options.Labels) - { - request.Labels[label.Key] = label.Value; - } - - foreach (var tag in options.Tags) - { - request.Tags[tag.Key] = tag.Value; - } - - foreach (var channel in options.ChannelConfigurations) - { - request.ChannelConfigurations[channel.Key] = channel.Value; - } - - var response = RestClient.UpsertWorker( - workerId: options.WorkerId, - patch: request, - cancellationToken: cancellationToken); - return Response.FromValue(response.Value, response.GetRawResponse()); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Create or update a worker to process jobs. - /// Options for updating a router worker. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7386. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual async Task> UpdateWorkerAsync( - UpdateWorkerOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(UpdateWorker)}"); - scope.Start(); - try - { - var request = new RouterWorker() - { - TotalCapacity = options?.TotalCapacity, - AvailableForOffers = options?.AvailableForOffers - }; - - foreach (var queueAssignment in options.QueueAssignments) - { - request.QueueAssignments[queueAssignment.Key] = queueAssignment.Value; - } - - foreach (var label in options.Labels) - { - request.Labels[label.Key] = label.Value; - } - - foreach (var tag in options.Tags) - { - request.Tags[tag.Key] = tag.Value; - } - - foreach (var channel in options.ChannelConfigurations) - { - request.ChannelConfigurations[channel.Key] = channel.Value; - } - - var response = await RestClient.UpsertWorkerAsync( - workerId: options.WorkerId, - patch: request, - cancellationToken: cancellationToken) - .ConfigureAwait(false); - return Response.FromValue(response.Value, response.GetRawResponse()); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Create or update a worker to process jobs. - /// Options for updating a router worker. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7386. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual Response UpdateWorker( - UpdateWorkerOptions options, - CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(UpdateWorker)}"); - scope.Start(); - try - { - var request = new RouterWorker() - { - TotalCapacity = options.TotalCapacity, - AvailableForOffers = options?.AvailableForOffers - }; - - foreach (var queueAssignment in options.QueueAssignments) - { - request.QueueAssignments[queueAssignment.Key] = queueAssignment.Value; - } - - foreach (var label in options.Labels) - { - request.Labels[label.Key] = label.Value; - } - - foreach (var tag in options.Tags) - { - request.Tags[tag.Key] = tag.Value; - } - - foreach (var channel in options.ChannelConfigurations) - { - request.ChannelConfigurations[channel.Key] = channel.Value; - } - - var response = RestClient.UpsertWorker( - workerId: options.WorkerId, - patch: request, - cancellationToken: cancellationToken); - return Response.FromValue(response.Value, response.GetRawResponse()); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Protocol method to use to remove properties from worker. - /// Id of the worker. - /// Request content payload. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// The server returned an error. See for details returned from the server. - public virtual async Task UpdateWorkerAsync( - string workerId, - RequestContent content, - RequestContext context = null) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(UpdateWorker)}"); - scope.Start(); - try - { - return await RestClient.UpsertWorkerAsync( - workerId: workerId, - content: content, - context: context) - .ConfigureAwait(false); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Protocol method to use to remove properties from worker. - /// Id of the worker. - /// Request content payload. - /// The request context, which can override default behaviors of the client pipeline on a per-call basis. - /// The server returned an error. See for details returned from the server. - public virtual Response UpdateWorker( - string workerId, - RequestContent content, - RequestContext context = null) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(UpdateWorker)}"); - scope.Start(); - try - { - return RestClient.UpsertWorker( - workerId: workerId, - content: content, - context: context); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Unassign a job from a worker. - /// Options for unassigning a job from a worker. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual async Task> UnassignJobAsync(UnassignJobOptions options, CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(UnassignJobAsync)}"); - scope.Start(); - try - { - var response = await RestClient.UnassignJobActionAsync( - id: options.JobId, - assignmentId: options.AssignmentId, - cancellationToken: cancellationToken) - .ConfigureAwait(false); - - return Response.FromValue(response.Value, response.GetRawResponse()); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Unassign a job from a worker. - /// Options for unassigning a job from a worker. - /// (Optional) The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual Response UnassignJob(UnassignJobOptions options, CancellationToken cancellationToken = default) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(UnassignJob)}"); - scope.Start(); - try - { - var response = RestClient.UnassignJobAction( - id: options.JobId, - assignmentId: options.AssignmentId, - cancellationToken: cancellationToken); - - return Response.FromValue(response.Value, response.GetRawResponse()); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Retrieves existing workers. Pass status and Channel Id to filter workers further. - /// Options for filtering while retrieving router workers. - /// The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual AsyncPageable GetWorkersAsync( - GetWorkersOptions options = default, - CancellationToken cancellationToken = default) - { - async Task> FirstPageFunc(int? maxPageSize) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(GetWorkers)}"); - scope.Start(); - - try - { - Response response = await RestClient.ListWorkersAsync( - state: options?.State, - channelId: options?.ChannelId, - queueId: options?.QueueId, - hasCapacity: options?.HasCapacity, - maxpagesize: maxPageSize, - cancellationToken: cancellationToken) - .ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - async Task> NextPageFunc(string nextLink, int? maxPageSize) - { - using DiagnosticScope scope = - _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(GetWorkers)}"); - scope.Start(); - - try - { - Response response = await RestClient - .ListWorkersNextPageAsync( - nextLink: nextLink, - state: options?.State, - channelId: options?.ChannelId, - queueId: options?.QueueId, - hasCapacity: options?.HasCapacity, - maxpagesize: maxPageSize, - cancellationToken: cancellationToken) - .ConfigureAwait(false); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - return PageableHelpers.CreateAsyncEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Retrieves existing workers. Pass status and Channel Id to filter workers further. - /// Options for filtering while retrieving router workers. - /// The cancellation token to use. - /// The server returned an error. See for details returned from the server. - public virtual Pageable GetWorkers( - GetWorkersOptions options = default, - CancellationToken cancellationToken = default) - { - Page FirstPageFunc(int? maxPageSize) - { - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(GetWorkers)}"); - scope.Start(); - - try - { - Response response = RestClient.ListWorkers( - state: options?.State, - channelId: options?.ChannelId, - queueId: options?.QueueId, - hasCapacity: options?.HasCapacity, - maxpagesize: maxPageSize, - cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - Page NextPageFunc(string nextLink, int? maxPageSize) - { - using DiagnosticScope scope = - _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(GetWorkers)}"); - scope.Start(); - - try - { - Response response = RestClient - .ListWorkersNextPage( - nextLink: nextLink, - state: options?.State, - channelId: options?.ChannelId, - queueId: options?.QueueId, - hasCapacity: options?.HasCapacity, - maxpagesize: maxPageSize, - cancellationToken: cancellationToken); - return Page.FromValues(response.Value.Value, response.Value.NextLink, response.GetRawResponse()); - } - catch (Exception e) - { - scope.Failed(e); - throw; - } - } - - return PageableHelpers.CreateEnumerable(FirstPageFunc, NextPageFunc); - } - - /// Retrieves an existing worker by Id. - /// The Id of the Worker. - /// (Optional) The cancellation token to use. - /// is null. - /// The server returned an error. See for details returned from the server. - public virtual async Task> GetWorkerAsync(string workerId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrWhiteSpace(workerId, nameof(workerId)); - - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(GetWorker)}"); - scope.Start(); - try - { - Response worker = await RestClient.GetWorkerAsync(workerId, cancellationToken).ConfigureAwait(false); - return Response.FromValue(worker.Value, worker.GetRawResponse()); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Retrieves an existing worker by Id. - /// The Id of the Worker. - /// (Optional) The cancellation token to use. - /// is null. - /// The server returned an error. See for details returned from the server. - public virtual Response GetWorker(string workerId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrWhiteSpace(workerId, nameof(workerId)); - - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(GetWorker)}"); - scope.Start(); - try - { - Response worker = RestClient.GetWorker(workerId, cancellationToken); - return Response.FromValue(worker.Value, worker.GetRawResponse()); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Deletes an existing worker by Id. - /// The Id of the Worker. - /// (Optional) The cancellation token to use. - /// is null. - /// The server returned an error. See for details returned from the server. - public virtual async Task DeleteWorkerAsync(string workerId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrWhiteSpace(workerId, nameof(workerId)); - - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(DeleteWorker)}"); - scope.Start(); - try - { - return await RestClient.DeleteWorkerAsync(workerId, cancellationToken).ConfigureAwait(false); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - /// Deletes an existing worker by Id. - /// The Id of the Worker. - /// (Optional) The cancellation token to use. - /// is null. - /// The server returned an error. See for details returned from the server. - public virtual Response DeleteWorker(string workerId, CancellationToken cancellationToken = default) - { - Argument.AssertNotNullOrWhiteSpace(workerId, nameof(workerId)); - - using DiagnosticScope scope = _clientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(DeleteWorker)}"); - scope.Start(); - try - { - return RestClient.DeleteWorker(workerId, cancellationToken); - } - catch (Exception ex) - { - scope.Failed(ex); - throw; - } - } - - #endregion Worker - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/JobRouterClientOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/JobRouterClientOptions.cs deleted file mode 100644 index ad1924c58fca..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/JobRouterClientOptions.cs +++ /dev/null @@ -1,54 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - /// - /// The options for communication . - /// - public class JobRouterClientOptions : ClientOptions - { - /// - /// The latest version of the Router service. - /// - private const ServiceVersion LatestVersion = ServiceVersion.V2022_07_18_preview; - - internal string ApiVersion { get; } - - /// - /// Initializes a new instance of the . - /// - public JobRouterClientOptions(ServiceVersion version = LatestVersion) - { - ApiVersion = version switch - { - ServiceVersion.V2021_10_20_preview2 => "2021-10-20-preview2", - ServiceVersion.V2022_07_18_preview => "2022-07-18-preview", - _ => throw new ArgumentOutOfRangeException(nameof(version)), - }; - } - - /// - /// The Router service version. - /// - public enum ServiceVersion - { - /// - /// The V1 of the Router service. - /// -#pragma warning disable CA1707 // Identifiers should not contain underscores -#pragma warning disable AZC0016 // All parts of ServiceVersion members' names must begin with a number or uppercase letter and cannot have consecutive underscores - V2021_10_20_preview2 = 1, - - /// - /// The V2 of the Router service. - /// - V2022_07_18_preview = 2 -#pragma warning restore AZC0016 // All parts of ServiceVersion members' names must begin with a number or uppercase letter and cannot have consecutive underscores -#pragma warning restore CA1707 // Identifiers should not contain underscores - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/AcceptJobOfferResult.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/AcceptJobOfferResult.cs index 48f31f1041ae..b11f995ded87 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/AcceptJobOfferResult.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/AcceptJobOfferResult.cs @@ -3,7 +3,7 @@ using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { [CodeGenModel("AcceptJobOfferResult")] public partial class AcceptJobOfferResult diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/BestWorkerMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/BestWorkerMode.cs index c0657039fd3f..40353e0d3efc 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/BestWorkerMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/BestWorkerMode.cs @@ -3,13 +3,14 @@ using System; using System.Collections.Generic; -using Azure.Communication.JobRouter.Models; +using System.Text.Json; using Azure.Core; namespace Azure.Communication.JobRouter { /// Jobs are distributed to the worker with the strongest abilities available. - public partial class BestWorkerMode : DistributionMode + [CodeGenModel("BestWorkerMode")] + public partial class BestWorkerMode : IUtf8JsonSerializable { #region Default scoring rule @@ -31,12 +32,16 @@ public BestWorkerMode() : this(null) /// (Optional) If true, will try to obtain scores for a batch of workers. By default, set to false. /// (Optional) Set batch size when 'allowScoringBatchOfWorkers' is set to true to control batch size of workers. Defaults to 20 if not set. /// (Optional) If false, will sort scores by ascending order. By default, set to true. - public BestWorkerMode(RouterRule scoringRule, + /// 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. +#pragma warning disable CS0051 // parameter type 'IList' is less accessible than method + public BestWorkerMode(RouterRule scoringRule = default, IList scoringParameterSelectors = default, bool allowScoringBatchOfWorkers = false, int? batchSize = default, - bool descendingOrder = true) + bool descendingOrder = true, + bool bypassSelectors = false) : this(null) +#pragma warning restore CS0051 // parameter type 'IList' is less accessible than method { if (batchSize is <= 0) { @@ -44,12 +49,7 @@ public BestWorkerMode(RouterRule scoringRule, } ScoringRule = scoringRule; - ScoringRuleOptions = new ScoringRuleOptions - { - BatchSize = batchSize, - AllowScoringBatchOfWorkers = allowScoringBatchOfWorkers, - DescendingOrder = descendingOrder - }; + ScoringRuleOptions = new ScoringRuleOptions(batchSize,new ChangeTrackingList(), allowScoringBatchOfWorkers, descendingOrder); if (scoringParameterSelectors is not null) { @@ -58,6 +58,8 @@ public BestWorkerMode(RouterRule scoringRule, ScoringRuleOptions.ScoringParameters.Add(scoringParameterSelector); } } + + BypassSelectors = bypassSelectors; } internal BestWorkerMode(string kind) @@ -65,14 +67,37 @@ internal BestWorkerMode(string kind) Kind = kind ?? "best-worker"; } - /// - /// Encapsulates all options that can be passed as parameters for scoring rule with BestWorkerMode. - /// - public ScoringRuleOptions ScoringRuleOptions { get; internal set; } - - /// - /// Defines a scoring rule to use, when calculating a score to determine the best worker. - /// - public RouterRule ScoringRule { get; internal set; } + 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(); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/CancelExceptionAction.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/CancelExceptionAction.cs index b8b5f4546907..86ea0390153f 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/CancelExceptionAction.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/CancelExceptionAction.cs @@ -1,21 +1,48 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using System; -using System.Collections.Generic; -using System.Text; +using System.Text.Json; using Azure.Core; namespace Azure.Communication.JobRouter { [CodeGenModel("CancelExceptionAction")] - public partial class CancelExceptionAction + public partial class CancelExceptionAction: IUtf8JsonSerializable { /// Initializes a new instance of CancelExceptionAction. /// (Optional) Customer supplied note, e.g., cancellation reason. /// (Optional) Customer supplied disposition code for specifying any short label. - public CancelExceptionAction(string note = default, string dispositionCode = default) : this(null, note, dispositionCode) + public CancelExceptionAction(string note = default, string dispositionCode = default) : this("cancel", note, dispositionCode) { } + + /// + /// (Optional) A note that will be appended to the jobs' Notes collection with the + /// current timestamp. + /// + public string Note { get; set; } + /// + /// (Optional) Indicates the outcome of the job, populate this field with your own + /// custom values. + /// + public string DispositionCode { get; set; } + + 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(); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/CancelJobOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/CancelJobOptions.cs index 881328335562..10ee900ea591 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/CancelJobOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/CancelJobOptions.cs @@ -2,8 +2,6 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; -using System.Text; using Azure.Core; namespace Azure.Communication.JobRouter diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ChannelConfiguration.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ChannelConfiguration.cs new file mode 100644 index 000000000000..99d3113525ca --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/ChannelConfiguration.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + [CodeGenModel("ChannelConfiguration")] + public partial class ChannelConfiguration: IUtf8JsonSerializable + { + /// The maximum number of jobs that can be supported concurrently for this channel. + public int? MaxNumberOfJobs { get; set; } + + 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(); + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ClassificationPolicy.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ClassificationPolicy.cs index 9e7142773d44..00b9ee9fb578 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ClassificationPolicy.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/ClassificationPolicy.cs @@ -3,13 +3,14 @@ using System.Collections.Generic; using System.Linq; +using System.Text.Json; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { [CodeGenModel("ClassificationPolicy")] [CodeGenSuppress("ClassificationPolicy")] - public partial class ClassificationPolicy + public partial class ClassificationPolicy: IUtf8JsonSerializable { /// Initializes a new instance of ClassificationPolicy. internal ClassificationPolicy() @@ -71,5 +72,54 @@ internal IList _workerSelectors /// The available derived classes include , , , and . /// public RouterRule PrioritizationRule { get; internal set; } + + 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(); + } + + /// 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/Models/ClassificationPolicyCollection.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ClassificationPolicyCollection.cs deleted file mode 100644 index 676119595ba2..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ClassificationPolicyCollection.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - [CodeGenModel("ClassificationPolicyCollection")] - internal partial class ClassificationPolicyCollection - { - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ClassificationPolicyItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ClassificationPolicyItem.cs index 766533bea25b..1eb5e3a2f0ae 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ClassificationPolicyItem.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/ClassificationPolicyItem.cs @@ -1,12 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using System; -using System.Collections.Generic; -using System.Text; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { [CodeGenModel("ClassificationPolicyItem")] public partial class ClassificationPolicyItem diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/CloseJobOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/CloseJobOptions.cs index 22fb611acc98..d1c8b27e1194 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/CloseJobOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/CloseJobOptions.cs @@ -2,8 +2,6 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; -using System.Text; using Azure.Core; namespace Azure.Communication.JobRouter diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/CommunicationJobRouterModelFactory.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/CommunicationJobRouterModelFactory.cs deleted file mode 100644 index ff49fecc15d4..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/CommunicationJobRouterModelFactory.cs +++ /dev/null @@ -1,27 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System.Collections.Generic; -using System.Linq; -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - [CodeGenModel("CommunicationJobRouterModelFactory")] - public static partial class CommunicationJobRouterModelFactory - { - /// Initializes a new instance of CommunicationError. - /// The error code. - /// The error message. - /// The error target. - /// Further details about specific errors that led to this error. - /// The inner error if any. - /// A new instance for mocking. - internal static CommunicationError CommunicationError(string code = null, string message = null, string target = null, IEnumerable details = null, CommunicationError innerError = null) - { - details ??= new List(); - - return new CommunicationError(code, message, target, details?.ToList(), innerError); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/CompleteJobOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/CompleteJobOptions.cs index a7e66eb3f2ea..c3bf9b994779 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/CompleteJobOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/CompleteJobOptions.cs @@ -2,8 +2,6 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; -using System.Text; using Azure.Core; namespace Azure.Communication.JobRouter diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ConditionalQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ConditionalQueueSelectorAttachment.cs new file mode 100644 index 000000000000..f5030d32ffcb --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/ConditionalQueueSelectorAttachment.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + [CodeGenModel("ConditionalQueueSelectorAttachment")] + public partial class ConditionalQueueSelectorAttachment : IUtf8JsonSerializable + { + 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(); + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ConditionalWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ConditionalWorkerSelectorAttachment.cs new file mode 100644 index 000000000000..6542706b531d --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/ConditionalWorkerSelectorAttachment.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + [CodeGenModel("ConditionalWorkerSelectorAttachment")] + public partial class ConditionalWorkerSelectorAttachment : IUtf8JsonSerializable + { + 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(); + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateClassificationPolicyOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateClassificationPolicyOptions.cs index a9cf7a0c0b0a..181361eb9c49 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateClassificationPolicyOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateClassificationPolicyOptions.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Text; using Azure.Core; namespace Azure.Communication.JobRouter @@ -50,5 +49,10 @@ public CreateClassificationPolicyOptions(string classificationPolicyId) /// The worker label selectors to attach to a given job. public List WorkerSelectors { get; } = new List(); + + /// + /// The content to send as the request conditions of the request. + /// + public RequestConditions RequestConditions { get; set; } = new(); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateDistributionPolicyOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateDistributionPolicyOptions.cs index 77525a7619f2..5278a411f97c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateDistributionPolicyOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateDistributionPolicyOptions.cs @@ -2,8 +2,6 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; -using System.Text; using Azure.Core; namespace Azure.Communication.JobRouter @@ -48,5 +46,10 @@ public CreateDistributionPolicyOptions(string distributionPolicyId, TimeSpan off /// The human readable name of the policy. public string Name { get; set; } + + /// + /// The content to send as the request conditions of the request. + /// + public RequestConditions RequestConditions { get; set; } = new(); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateExceptionPolicyOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateExceptionPolicyOptions.cs index 68ef1b57e83d..39e93b80abb1 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateExceptionPolicyOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateExceptionPolicyOptions.cs @@ -40,5 +40,10 @@ public CreateExceptionPolicyOptions(string exceptionPolicyId, IDictionary (Optional) The name of the exception policy. public string Name { get; set; } + + /// + /// The content to send as the request conditions of the request. + /// + public RequestConditions RequestConditions { get; set; } = new(); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateJobOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateJobOptions.cs index 9d2191028d7a..724a56752f81 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateJobOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateJobOptions.cs @@ -3,8 +3,6 @@ using System; using System.Collections.Generic; -using System.Text; -using Azure.Communication.JobRouter.Models; using Azure.Core; namespace Azure.Communication.JobRouter @@ -73,5 +71,10 @@ public CreateJobOptions(string jobId, string channelId, string queueId) /// If provided, will determine how job matching will be carried out. Default mode: QueueAndMatchMode. /// public JobMatchingMode MatchingMode { get; set; } + + /// + /// The content to send as the request conditions of the request. + /// + public RequestConditions RequestConditions { get; set; } = new(); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateJobWithClassificationPolicyOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateJobWithClassificationPolicyOptions.cs index d56f53c29846..42fa110571f8 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateJobWithClassificationPolicyOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateJobWithClassificationPolicyOptions.cs @@ -3,8 +3,6 @@ using System; using System.Collections.Generic; -using System.Text; -using Azure.Communication.JobRouter.Models; using Azure.Core; namespace Azure.Communication.JobRouter @@ -76,5 +74,10 @@ public CreateJobWithClassificationPolicyOptions(string jobId, string channelId, /// If provided, will determine how job matching will be carried out. Default mode: QueueAndMatchMode. /// public JobMatchingMode MatchingMode { get; set; } + + /// + /// The content to send as the request conditions of the request. + /// + public RequestConditions RequestConditions { get; set; } = new(); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateQueueOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateQueueOptions.cs index 4019670b884e..8567e1eaa41e 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateQueueOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateQueueOptions.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Text; using Azure.Core; namespace Azure.Communication.JobRouter @@ -48,5 +47,10 @@ public CreateQueueOptions(string queueId, string distributionPolicyId) /// A set of key/value pairs that are identifying attributes used by the rules engines to make decisions. /// public IDictionary Labels { get; } = new Dictionary(); + + /// + /// The content to send as the request conditions of the request. + /// + public RequestConditions RequestConditions { get; set; } = new(); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateWorkerOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateWorkerOptions.cs index c3939cc91c37..0ec2cdd45116 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateWorkerOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/CreateWorkerOptions.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Text; using Azure.Core; namespace Azure.Communication.JobRouter @@ -56,5 +55,10 @@ public CreateWorkerOptions(string workerId, int totalCapacity) /// The queue(s) that this worker can receive work from. public IDictionary QueueAssignments { get; } = new Dictionary(); + + /// + /// The content to send as the request conditions of the request. + /// + public RequestConditions RequestConditions { get; set; } = new(); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/DeclineJobOfferOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/DeclineJobOfferOptions.cs index 1d9de4c4bb6e..e443d9ae7269 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/DeclineJobOfferOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/DeclineJobOfferOptions.cs @@ -2,8 +2,6 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; -using System.Text; using Azure.Core; namespace Azure.Communication.JobRouter diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/DirectMapRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/DirectMapRouterRule.cs new file mode 100644 index 000000000000..3cee7a8c4a0e --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/DirectMapRouterRule.cs @@ -0,0 +1,26 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + [CodeGenModel("DirectMapRouterRule")] + [CodeGenSuppress("DirectMapRouterRule")] + public partial class DirectMapRouterRule : IUtf8JsonSerializable + { + /// Initializes a new instance of DirectMapRouterRule. + public DirectMapRouterRule(): this("direct-map-rule") + { + } + + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/DistributionMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/DistributionMode.cs index 591d2258ef9a..4c2bb385a751 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/DistributionMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/DistributionMode.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Text.Json; using System.Text.Json.Serialization; using Azure.Core; @@ -8,7 +9,7 @@ namespace Azure.Communication.JobRouter { [CodeGenModel("DistributionMode")] [JsonConverter(typeof(PolymorphicWriteOnlyJsonConverter))] - public abstract partial class DistributionMode + public abstract partial class DistributionMode : IUtf8JsonSerializable { internal DistributionMode(string kind) { @@ -27,5 +28,40 @@ internal DistributionMode(string kind) /// Governs the maximum number of active concurrent offers a job can have. /// public int MaxConcurrentOffers { get; set; } = 1; + + /// + /// (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. + /// + public bool? BypassSelectors { get; set; } + + 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(); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/DistributionPolicy.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/DistributionPolicy.cs index cae7d75a200d..c4b7dc229a09 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/DistributionPolicy.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/DistributionPolicy.cs @@ -2,13 +2,14 @@ // Licensed under the MIT License. using System; +using System.Text.Json; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { [CodeGenModel("DistributionPolicy")] [CodeGenSuppress("DistributionPolicy")] - public partial class DistributionPolicy + public partial class DistributionPolicy : IUtf8JsonSerializable { /// Initializes a new instance of DistributionPolicy. internal DistributionPolicy() @@ -49,5 +50,34 @@ internal double? _offerExpiresAfterSeconds /// The available derived classes include , and . /// public DistributionMode Mode { get; internal set; } + + 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(); + } + + /// 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/Models/DistributionPolicyCollection.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/DistributionPolicyCollection.cs deleted file mode 100644 index d1e689d32d26..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/DistributionPolicyCollection.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - [CodeGenModel("DistributionPolicyCollection")] - internal partial class DistributionPolicyCollection - { - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/DistributionPolicyItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/DistributionPolicyItem.cs index 7a91985e2471..9bc08660d314 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/DistributionPolicyItem.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/DistributionPolicyItem.cs @@ -1,12 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using System; -using System.Collections.Generic; -using System.Text; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { [CodeGenModel("DistributionPolicyItem")] public partial class DistributionPolicyItem diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionAction.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionAction.cs index 2f0700be6690..736e0ad44170 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionAction.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionAction.cs @@ -1,7 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using System.Data; +using System.Text.Json; using System.Text.Json.Serialization; using Azure.Core; @@ -9,14 +9,14 @@ namespace Azure.Communication.JobRouter { [CodeGenModel("ExceptionAction")] [JsonConverter(typeof(PolymorphicWriteOnlyJsonConverter))] - public abstract partial class ExceptionAction + public abstract partial class ExceptionAction : IUtf8JsonSerializable { - /// Initializes a new instance of ExceptionAction. - internal ExceptionAction() + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { + writer.WriteStartObject(); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + writer.WriteEndObject(); } - - /// The type discriminator describing a sub-type of ExceptionAction. - protected string Kind { get; set; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionPolicy.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionPolicy.cs index 45167fcde3e7..446b3fa7bff5 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionPolicy.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionPolicy.cs @@ -1,17 +1,16 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using System; using System.Collections.Generic; using System.Linq; -using System.Text; +using System.Text.Json; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { [CodeGenModel("ExceptionPolicy")] [CodeGenSuppress("ExceptionPolicy")] - public partial class ExceptionPolicy + public partial class ExceptionPolicy : IUtf8JsonSerializable { /// Initializes a new instance of ExceptionPolicy. internal ExceptionPolicy() @@ -42,5 +41,35 @@ internal IDictionary _exceptionRules /// (Optional) The name of the exception policy. public string Name { get; internal set; } + + 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(); + } + + /// 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/Models/ExceptionPolicyCollection.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionPolicyCollection.cs deleted file mode 100644 index f09e9ae8a696..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionPolicyCollection.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - [CodeGenModel("ExceptionPolicyCollection")] - internal partial class ExceptionPolicyCollection - { - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionPolicyItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionPolicyItem.cs index b763c315bb8e..4135300b8620 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionPolicyItem.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionPolicyItem.cs @@ -3,7 +3,7 @@ using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { [CodeGenModel("ExceptionPolicyItem")] public partial class ExceptionPolicyItem diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionRule.cs index 54ff2ce38611..533d1aba4800 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionRule.cs @@ -4,13 +4,13 @@ #nullable enable using System; using System.Collections.Generic; -using System.Text; +using System.Text.Json; using Azure.Core; namespace Azure.Communication.JobRouter { [CodeGenModel("ExceptionRule")] - public partial class ExceptionRule + public partial class ExceptionRule : IUtf8JsonSerializable { /// Initializes a new instance of ExceptionRule. /// The trigger for this exception rule. @@ -24,5 +24,23 @@ public ExceptionRule(ExceptionTrigger trigger, IDictionary A dictionary collection of actions to perform once the exception is triggered. Key is the Id of each exception action. public IDictionary Actions { get; } + + 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); +#pragma warning disable CS8604 // Null requires to be sent as payload as well + writer.WriteObjectValue(item.Value); +#pragma warning restore CS8604 + } + writer.WriteEndObject(); + writer.WriteEndObject(); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionTrigger.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionTrigger.cs index 59c89997ccd1..29f0f0a2e0e3 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionTrigger.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/ExceptionTrigger.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Text.Json; using System.Text.Json.Serialization; using Azure.Core; @@ -9,9 +10,14 @@ namespace Azure.Communication.JobRouter [CodeGenModel("JobExceptionTrigger")] [CodeGenSuppress("JobExceptionTrigger")] [JsonConverter(typeof(PolymorphicWriteOnlyJsonConverter))] - public abstract partial class ExceptionTrigger + public abstract partial class ExceptionTrigger : IUtf8JsonSerializable { - /// The type discriminator describing a sub-type of ExceptionTrigger. - protected string Kind { get; set; } + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + writer.WriteEndObject(); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ExpressionRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ExpressionRouterRule.cs index 54c626fe31b2..2793ab06c433 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ExpressionRouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/ExpressionRouterRule.cs @@ -2,15 +2,14 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; -using System.Text; +using System.Text.Json; using Azure.Core; namespace Azure.Communication.JobRouter { [CodeGenModel("ExpressionRouterRule")] [CodeGenSuppress("ExpressionRouterRule", typeof(string), typeof(string))] - public partial class ExpressionRouterRule : RouterRule + public partial class ExpressionRouterRule : IUtf8JsonSerializable { /// The available expression languages that can be configured. public string Language { get; } @@ -18,13 +17,24 @@ public partial class ExpressionRouterRule : RouterRule /// Initializes a new instance of ExpressionRule. /// The string containing the expression to evaluate. Should contain return statement with calculated values. /// is null. - public ExpressionRouterRule(string expression) + public ExpressionRouterRule(string expression) : this("expression-rule", ExpressionRouterRuleLanguage.PowerFx.ToString(), expression) { Argument.AssertNotNull(expression, nameof(expression)); + } - Language = ExpressionRouterRuleLanguage.PowerFx.ToString(); - Expression = expression; - Kind = "expression-rule"; + 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(); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/FunctionRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/FunctionRouterRule.cs index c17433744a50..5eac194c1e83 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/FunctionRouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/FunctionRouterRule.cs @@ -2,30 +2,40 @@ // Licensed under the MIT License. using System; +using System.Text.Json; using Azure.Core; namespace Azure.Communication.JobRouter { [CodeGenModel("FunctionRouterRule")] [CodeGenSuppress("FunctionRouterRule")] - [CodeGenSuppress("FunctionRouterRule", typeof(string))] - public partial class FunctionRouterRule : RouterRule + public partial class FunctionRouterRule : IUtf8JsonSerializable { /// Initializes a new instance of AzureFunctionRule. /// URL for custom azure function. /// is null. public FunctionRouterRule(Uri functionAppUri) - : this(null, functionAppUri, null) + : this("azure-function-rule", functionAppUri, null) { - if (functionAppUri == null) + Argument.AssertNotNull(functionAppUri, nameof(functionAppUri)); + } + + /// Credentials used to access Azure function rule. + public FunctionRouterRuleCredential Credential { get; set; } + + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("functionUri"u8); + writer.WriteStringValue(FunctionUri.AbsoluteUri); + if (Optional.IsDefined(Credential)) { - throw new ArgumentNullException(nameof(functionAppUri), "cannot be set to empty or null"); + writer.WritePropertyName("credential"u8); + writer.WriteObjectValue(Credential); } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + writer.WriteEndObject(); } - - /// - /// URL for custom azure function. - /// - public Uri FunctionUri { get; internal set; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/FunctionRouterRuleCredential.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/FunctionRouterRuleCredential.cs index 3bf205cb78d7..0d58d58c7653 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/FunctionRouterRuleCredential.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/FunctionRouterRuleCredential.cs @@ -2,13 +2,14 @@ // Licensed under the MIT License. using System; +using System.Text.Json; using Azure.Core; namespace Azure.Communication.JobRouter { [CodeGenModel("FunctionRouterRuleCredential")] [CodeGenSuppress("FunctionRouterRuleCredential")] - public partial class FunctionRouterRuleCredential + public partial class FunctionRouterRuleCredential : IUtf8JsonSerializable { /// Initializes a new instance of AzureFunctionRuleCredential. /// (Optional) Access key scoped to a particular function. @@ -54,5 +55,26 @@ public FunctionRouterRuleCredential(string appKey, string clientId) /// In context of Azure function, this is usually the name of the key /// public string ClientId { get; internal set; } + + 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(); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/GetJobsOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/GetJobsOptions.cs deleted file mode 100644 index 977391367ade..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/GetJobsOptions.cs +++ /dev/null @@ -1,43 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; - -namespace Azure.Communication.JobRouter -{ - /// - /// Options for filter while retrieving jobs. - /// - public class GetJobsOptions - { - /// - /// If specified, filter jobs by status. - /// - public RouterJobStatusSelector? Status { get; set; } = null; - - /// - /// If specified, filter jobs by queue. - /// - public string QueueId { get; set; } - - /// - /// If specified, filter jobs by channel. - /// - public string ChannelId { get; set; } - - /// - /// If specified, filter jobs by classification policy. - /// - public string ClassificationPolicyId { get; set; } - - /// - /// If specified, filter on jobs that was scheduled before or at given timestamp. Range: (-Inf, scheduledBefore]. - /// - public DateTimeOffset? ScheduledBefore { get; set; } - - /// - /// If specified, filter on jobs that was scheduled at or after given value. Range: [scheduledAfter, +Inf). - /// - public DateTimeOffset? ScheduledAfter { get; set; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/GetWorkersOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/GetWorkersOptions.cs deleted file mode 100644 index f551a66bbdfd..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/GetWorkersOptions.cs +++ /dev/null @@ -1,32 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -namespace Azure.Communication.JobRouter -{ - /// - /// Options for filtering while retrieving router workers. - /// - public class GetWorkersOptions - { - /// - /// If specified, filter workers by worker state. - /// - public RouterWorkerStateSelector? State { get; set; } = null; - - /// - /// Worker available in the particular channel. - /// - public string ChannelId { get; set; } - - /// - /// If specified, select workers who are assigned to this queue. - /// - public string QueueId { get; set; } - - /// - /// If set to true, select only workers who have capacity for the channel specified by or for any channel if not specified. - /// If set to false, then will return all workers including workers without any capacity for jobs. Defaults to false. - /// - public bool HasCapacity { get; set; } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/JobMatchingMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/JobMatchingMode.cs index 5a97e01d5b52..6101c97ab469 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/JobMatchingMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/JobMatchingMode.cs @@ -9,115 +9,13 @@ namespace Azure.Communication.JobRouter { [CodeGenModel("JobMatchingMode")] [CodeGenSuppress("JobMatchingMode")] - [CodeGenSuppress("global::Azure.Core.IUtf8JsonSerializable.Write", typeof(Utf8JsonWriter))] - public partial class JobMatchingMode + public partial class JobMatchingMode : IUtf8JsonSerializable { - /// Gets or sets the mode type. - public JobMatchModeType? ModeType { get; internal set; } - - /// - /// Constructor for QueueAndMatchMode. - /// - /// - public JobMatchingMode(QueueAndMatchMode queueAndMatchMode) - : this(JobMatchModeType.QueueAndMatchMode, new Dictionary(), null, null) - { - QueueAndMatchMode = queueAndMatchMode; - } - - /// - /// Constructor for ScheduleAndSuspendMode. - /// - /// - public JobMatchingMode(ScheduleAndSuspendMode scheduleAndSuspendMode) - : this(JobMatchModeType.ScheduleAndSuspendMode, null, scheduleAndSuspendMode, null) - { - } - - /// - /// Constructor for SuspendMode. - /// - /// - public JobMatchingMode(SuspendMode suspendMode) - : this(JobMatchModeType.SuspendMode, null, null, new Dictionary()) - { - SuspendMode = suspendMode; - } - - /// Any object. - public QueueAndMatchMode QueueAndMatchMode { get; internal set; } - - [CodeGenMember("QueueAndMatchMode")] - internal object _queueAndMatchMode { - get - { - return QueueAndMatchMode != null ? new Dictionary() : null; - } - set - { - QueueAndMatchMode = value != null ? new QueueAndMatchMode() : null; - } - } - - /// Any object. - public SuspendMode SuspendMode { get; internal set; } - - [CodeGenMember("SuspendMode")] - internal object _suspendMode - { - get - { - return SuspendMode != null ? new Dictionary() : null; - } - set - { - SuspendMode = value != null ? new SuspendMode() : null; - } - } - - /// Gets or sets the schedule and suspend mode. - public ScheduleAndSuspendMode ScheduleAndSuspendMode { get; internal set; } - - void global::Azure.Core.IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); - if (Optional.IsDefined(ModeType)) - { - writer.WritePropertyName("modeType"u8); - writer.WriteStringValue(ModeType.Value.ToString()); - } - if (Optional.IsDefined(_queueAndMatchMode)) - { - writer.WritePropertyName("queueAndMatchMode"u8); - writer.WriteObjectValue(_queueAndMatchMode); - } - else - { - writer.WritePropertyName("queueAndMatchMode"u8); - writer.WriteNullValue(); - } - - if (Optional.IsDefined(ScheduleAndSuspendMode)) - { - writer.WritePropertyName("scheduleAndSuspendMode"u8); - writer.WriteObjectValue(ScheduleAndSuspendMode); - } - else - { - writer.WritePropertyName("scheduleAndSuspendMode"u8); - writer.WriteNullValue(); - } - - if (Optional.IsDefined(_suspendMode)) - { - writer.WritePropertyName("suspendMode"u8); - writer.WriteObjectValue(_suspendMode); - } - else - { - writer.WritePropertyName("suspendMode"u8); - writer.WriteNullValue(); - } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); writer.WriteEndObject(); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterAdministrationClient.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterAdministrationClient.cs new file mode 100644 index 000000000000..046ef742d4a8 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterAdministrationClient.cs @@ -0,0 +1,785 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Threading.Tasks; +using System.Threading; +using Azure.Communication.Pipeline; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Communication.JobRouter +{ + [CodeGenSuppress("CreateGetExceptionPoliciesNextPageRequest", typeof(string), typeof(int?), typeof(RequestContext))] + [CodeGenSuppress("CreateGetClassificationPoliciesNextPageRequest", typeof(string), typeof(int?), typeof(RequestContext))] + [CodeGenSuppress("CreateGetQueuesNextPageRequest", typeof(string), typeof(int?), typeof(RequestContext))] + [CodeGenSuppress("CreateGetDistributionPoliciesNextPageRequest", typeof(string), typeof(int?), typeof(RequestContext))] + public partial class JobRouterAdministrationClient + { + #region public constructors + + /// Initializes a new instance of . + /// Connection string acquired from the Azure Communication Services resource. + public JobRouterAdministrationClient(string connectionString) + : this( + ConnectionString.Parse(Argument.CheckNotNullOrEmpty(connectionString, nameof(connectionString))), + new JobRouterClientOptions()) + { + } + + /// Initializes a new instance of . + /// Connection string acquired from the Azure Communication Services resource. + /// Client option exposing , , , etc. + public JobRouterAdministrationClient(string connectionString, JobRouterClientOptions options) + : this( + ConnectionString.Parse(Argument.CheckNotNullOrEmpty(connectionString, nameof(connectionString))), + options ?? new JobRouterClientOptions()) + { + } + + /// Initializes a new instance of . + /// The URI of the Azure Communication Services resource. + /// The used to authenticate requests. + /// Client option exposing , , , etc. + public JobRouterAdministrationClient(Uri endpoint, AzureKeyCredential credential, JobRouterClientOptions options = default) + : this( + Argument.CheckNotNull(endpoint, nameof(endpoint)).AbsoluteUri, + Argument.CheckNotNull(credential, nameof(credential)), + options ?? new JobRouterClientOptions()) + { + } + + /// Initializes a new instance of . + /// The URI of the Azure Communication Services resource. + /// The TokenCredential used to authenticate requests, such as DefaultAzureCredential. + /// Client option exposing , , , etc. + public JobRouterAdministrationClient(Uri endpoint, TokenCredential credential, JobRouterClientOptions options = default) + : this( + Argument.CheckNotNull(endpoint, nameof(endpoint)).AbsoluteUri, + Argument.CheckNotNull(credential, nameof(credential)), + options ?? new JobRouterClientOptions()) + { + } + + #endregion public constructors + + #region private constructors + + private JobRouterAdministrationClient(ConnectionString connectionString, JobRouterClientOptions options) + : this(new Uri(connectionString.GetRequired("endpoint"), UriKind.Absolute), options.BuildHttpPipeline(connectionString), options) + { + } + + private JobRouterAdministrationClient(string endpoint, TokenCredential tokenCredential, JobRouterClientOptions options) + : this(new Uri(endpoint, UriKind.Absolute), options.BuildHttpPipeline(tokenCredential), options) + { + } + + private JobRouterAdministrationClient(string endpoint, AzureKeyCredential keyCredential, JobRouterClientOptions options) + : this(new Uri(endpoint, UriKind.Absolute), options.BuildHttpPipeline(keyCredential), options) + { + } + + /// Initializes a new instance of for mocking. + protected JobRouterAdministrationClient() + { + ClientDiagnostics = null; + } + + #endregion private constructors + + #region ClassificationPolicy + + /// Creates a classification policy. + /// (Optional) Options for creating classification policy. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7396. + /// (Optional) The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual async Task> CreateClassificationPolicyAsync( + CreateClassificationPolicyOptions options, + CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(CreateClassificationPolicy)}"); + scope.Start(); + try + { + var request = new ClassificationPolicy() + { + Name = options.Name, + FallbackQueueId = options.FallbackQueueId, + PrioritizationRule = options.PrioritizationRule, + }; + + request.QueueSelectors.AddRange(options.QueueSelectors); + request.WorkerSelectors.AddRange(options.WorkerSelectors); + + var result = await UpsertClassificationPolicyAsync( + id: options.ClassificationPolicyId, + content: request.ToRequestContent(), + requestConditions: options.RequestConditions, + context: FromCancellationToken(cancellationToken)) + .ConfigureAwait(false); + + return Response.FromValue(ClassificationPolicy.FromResponse(result), result); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// Creates or updates a classification policy. + /// (Optional) Options for creating classification policy. + /// (Optional) The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual Response CreateClassificationPolicy( + CreateClassificationPolicyOptions options, + CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(CreateClassificationPolicy)}"); + scope.Start(); + try + { + var request = new ClassificationPolicy() + { + Name = options.Name, + FallbackQueueId = options.FallbackQueueId, + PrioritizationRule = options.PrioritizationRule, + }; + + request.QueueSelectors.AddRange(options.QueueSelectors); + request.WorkerSelectors.AddRange(options.WorkerSelectors); + + var result = UpsertClassificationPolicy( + id: options.ClassificationPolicyId, + content: request.ToRequestContent(), + requestConditions: options.RequestConditions, + context: FromCancellationToken(cancellationToken)); + + return Response.FromValue(ClassificationPolicy.FromResponse(result), result); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// Creates or updates classification policy. + /// (Optional) Options for updating classification policy. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7396. + /// (Optional) The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual async Task> UpdateClassificationPolicyAsync( + UpdateClassificationPolicyOptions options, + CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateClassificationPolicy)}"); + scope.Start(); + try + { + var request = new ClassificationPolicy() + { + Name = options.Name, + FallbackQueueId = options.FallbackQueueId, + PrioritizationRule = options.PrioritizationRule + }; + + request.QueueSelectors.AddRange(options.QueueSelectors); + request.WorkerSelectors.AddRange(options.WorkerSelectors); + + var response = await UpsertClassificationPolicyAsync( + id: options.ClassificationPolicyId, + content: request.ToRequestContent(), + requestConditions: options.RequestConditions, + context: FromCancellationToken(cancellationToken)) + .ConfigureAwait(false); + + return Response.FromValue(ClassificationPolicy.FromResponse(response), response); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// Creates or updates a classification policy. + /// (Optional) Options for updating classification policy. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7396. + /// (Optional) The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual Response UpdateClassificationPolicy( + UpdateClassificationPolicyOptions options, + CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateClassificationPolicy)}"); + scope.Start(); + try + { + var request = new ClassificationPolicy() + { + Name = options.Name, + FallbackQueueId = options.FallbackQueueId, + PrioritizationRule = options.PrioritizationRule + }; + + request.QueueSelectors.AddRange(options.QueueSelectors); + request.WorkerSelectors.AddRange(options.WorkerSelectors); + + var response = UpsertClassificationPolicy( + id: options.ClassificationPolicyId, + content: request.ToRequestContent(), + requestConditions: options.RequestConditions, + context: FromCancellationToken(cancellationToken)); + + return Response.FromValue(ClassificationPolicy.FromResponse(response), response); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + #endregion ClassificationPolicy + + #region DistributionPolicy + + /// Creates a distribution policy. + /// Additional options that can be used while creating distribution policy. + /// (Optional) The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual async Task> CreateDistributionPolicyAsync( + CreateDistributionPolicyOptions options, + CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(CreateDistributionPolicy)}"); + scope.Start(); + try + { + var request = new DistributionPolicy(options.OfferExpiresAfter, options.Mode) + { + Name = options?.Name, + }; + + var response = await UpsertDistributionPolicyAsync( + id: options.DistributionPolicyId, + content: request.ToRequestContent(), + requestConditions: options.RequestConditions, + context: FromCancellationToken(cancellationToken)) + .ConfigureAwait(false); + + return Response.FromValue(DistributionPolicy.FromResponse(response), response); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// Creates a distribution policy. + /// Additional options that can be used while creating distribution policy. + /// (Optional) The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual Response CreateDistributionPolicy( + CreateDistributionPolicyOptions options, + CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(CreateDistributionPolicy)}"); + scope.Start(); + try + { + var request = new DistributionPolicy(options.OfferExpiresAfter, options.Mode) + { + Name = options?.Name, + }; + + var response = UpsertDistributionPolicy( + id: options.DistributionPolicyId, + content: request.ToRequestContent(), + requestConditions: options.RequestConditions, + context: FromCancellationToken(cancellationToken)); + + return Response.FromValue(DistributionPolicy.FromResponse(response), response); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// Updates a distribution policy. + /// (Optional) Options for the distribution policy. + /// (Optional) The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual async Task> UpdateDistributionPolicyAsync( + UpdateDistributionPolicyOptions options, + CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateDistributionPolicy)}"); + scope.Start(); + try + { + var request = new DistributionPolicy() + { + Name = options.Name, + OfferExpiresAfter = options.OfferExpiresAfter, + Mode = options.Mode, + }; + + var response = await UpsertDistributionPolicyAsync( + id: options.DistributionPolicyId, + content: request.ToRequestContent(), + requestConditions: options.RequestConditions, + context: FromCancellationToken(cancellationToken)) + .ConfigureAwait(false); + + return Response.FromValue(DistributionPolicy.FromResponse(response), response); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// Updates a distribution policy. + /// (Optional) Options for the distribution policy. + /// (Optional) The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual Response UpdateDistributionPolicy( + UpdateDistributionPolicyOptions options, + CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateDistributionPolicy)}"); + scope.Start(); + try + { + var request = new DistributionPolicy() + { + Name = options.Name, + OfferExpiresAfter = options.OfferExpiresAfter, + Mode = options.Mode, + }; + + var response = UpsertDistributionPolicy( + id: options.DistributionPolicyId, + content: request.ToRequestContent(), + requestConditions: options.RequestConditions, + context: FromCancellationToken(cancellationToken)); + + return Response.FromValue(DistributionPolicy.FromResponse(response), response); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + #endregion DistributionPolicy + + #region ExceptionPolicy + + /// Creates a new exception policy. + /// (Optional) Options for creating an exception policy. + /// (Optional) The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual async Task> CreateExceptionPolicyAsync( + CreateExceptionPolicyOptions options, + CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(CreateExceptionPolicy)}"); + scope.Start(); + try + { + var request = new ExceptionPolicy() + { + Name = options.Name + }; + + foreach (var rule in options.ExceptionRules) + { + request.ExceptionRules[rule.Key] = rule.Value; + } + + var response = await UpsertExceptionPolicyAsync( + id: options.ExceptionPolicyId, + content: request.ToRequestContent(), + requestConditions: options.RequestConditions, + context: FromCancellationToken(cancellationToken)) + .ConfigureAwait(false); + + return Response.FromValue(ExceptionPolicy.FromResponse(response), response); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// Creates or updates a exception policy. + /// (Optional) Options for creating an exception policy. + /// (Optional) The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual Response CreateExceptionPolicy( + CreateExceptionPolicyOptions options = default, + CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(CreateExceptionPolicy)}"); + scope.Start(); + try + { + var request = new ExceptionPolicy() + { + Name = options.Name + }; + + foreach (var rule in options.ExceptionRules) + { + request.ExceptionRules[rule.Key] = rule.Value; + } + + var response = UpsertExceptionPolicy( + id: options.ExceptionPolicyId, + content: request.ToRequestContent(), + requestConditions: options.RequestConditions, + context: FromCancellationToken(cancellationToken)); + + return Response.FromValue(ExceptionPolicy.FromResponse(response), response); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// Creates a new exception policy. + /// Options for updating exception policy. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7396. + /// (Optional) The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual async Task> UpdateExceptionPolicyAsync( + UpdateExceptionPolicyOptions options, + CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateExceptionPolicy)}"); + scope.Start(); + try + { + var request = new ExceptionPolicy() + { + Name = options.Name + }; + + foreach (var rule in options.ExceptionRules) + { + request.ExceptionRules[rule.Key] = rule.Value; + } + + var response = await UpsertExceptionPolicyAsync( + id: options.ExceptionPolicyId, + content: request.ToRequestContent(), + requestConditions: options.RequestConditions, + context: FromCancellationToken(cancellationToken)) + .ConfigureAwait(false); + + return Response.FromValue(ExceptionPolicy.FromResponse(response), response); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// Creates or updates a exception policy. + /// Options for updating exception policy. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7396. + /// (Optional) The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual Response UpdateExceptionPolicy( + UpdateExceptionPolicyOptions options, + CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateExceptionPolicy)}"); + scope.Start(); + try + { + var request = new ExceptionPolicy() + { + Name = options.Name + }; + + foreach (var rule in options.ExceptionRules) + { + request.ExceptionRules[rule.Key] = rule.Value; + } + + var response = UpsertExceptionPolicy( + id: options.ExceptionPolicyId, + content: request.ToRequestContent(), + requestConditions: options.RequestConditions, + context: FromCancellationToken(cancellationToken)); + + return Response.FromValue(ExceptionPolicy.FromResponse(response), response); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + #endregion ExceptionPolicy + + #region Queue + + /// Creates or updates a queue. + /// Options for creating a job queue. + /// (Optional) The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual async Task> CreateQueueAsync( + CreateQueueOptions options, + CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(CreateQueue)}"); + scope.Start(); + try + { + var request = new RouterQueue() + { + DistributionPolicyId = options.DistributionPolicyId, + Name = options.Name, + ExceptionPolicyId = options.ExceptionPolicyId, + }; + + foreach (var label in options.Labels) + { + request.Labels[label.Key] = label.Value; + } + + var response = await UpsertQueueAsync( + id: options.QueueId, + content: request.ToRequestContent(), + requestConditions: options.RequestConditions, + context: FromCancellationToken(cancellationToken)) + .ConfigureAwait(false); + + return Response.FromValue(RouterQueue.FromResponse(response), response); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// Creates or updates a queue. + /// Options for creating a job queue. + /// (Optional) The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual Response CreateQueue( + CreateQueueOptions options, + CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(CreateQueue)}"); + scope.Start(); + try + { + var request = new RouterQueue() + { + DistributionPolicyId = options.DistributionPolicyId, + Name = options.Name, + ExceptionPolicyId = options.ExceptionPolicyId, + }; + + foreach (var label in options.Labels) + { + request.Labels[label.Key] = label.Value; + } + + var response = UpsertQueue( + id: options.QueueId, + content: request.ToRequestContent(), + requestConditions: options.RequestConditions, + context: FromCancellationToken(cancellationToken)); + + return Response.FromValue(RouterQueue.FromResponse(response), response); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// Creates or updates a queue. + /// Options for updating a job queue. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7396. + /// (Optional) The cancellation token to use. + /// is null. + /// The server returned an error. See for details returned from the server. + public virtual async Task> UpdateQueueAsync( + UpdateQueueOptions options, + CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateQueue)}"); + scope.Start(); + try + { + var request = new RouterQueue() + { + DistributionPolicyId = options.DistributionPolicyId, + Name = options.Name, + ExceptionPolicyId = options.ExceptionPolicyId, + }; + + foreach (var label in options.Labels) + { + request.Labels[label.Key] = label.Value; + } + + var response = await UpsertQueueAsync( + id: options.QueueId, + content: request.ToRequestContent(), + requestConditions: options.RequestConditions, + context: FromCancellationToken(cancellationToken)) + .ConfigureAwait(false); + + return Response.FromValue(RouterQueue.FromResponse(response), response); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// Creates or updates a queue. + /// Options for updating a queue. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7396. + /// (Optional) The cancellation token to use. + /// is null. + /// The server returned an error. See for details returned from the server. + public virtual Response UpdateQueue( + UpdateQueueOptions options, + CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterAdministrationClient)}.{nameof(UpdateQueue)}"); + scope.Start(); + try + { + var request = new RouterQueue() + { + DistributionPolicyId = options.DistributionPolicyId, + Name = options.Name, + ExceptionPolicyId = options.ExceptionPolicyId, + }; + + foreach (var label in options.Labels) + { + request.Labels[label.Key] = label.Value; + } + + var response = UpsertQueue( + id: options.QueueId, + content: request.ToRequestContent(), + requestConditions: options.RequestConditions, + context: FromCancellationToken(cancellationToken)); + + return Response.FromValue(RouterQueue.FromResponse(response), response); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + #endregion Queue + + /// Initializes a new instance of JobRouterAdministrationRestClient. + /// The Uri to use. + /// The options for configuring the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// is null. + internal JobRouterAdministrationClient(Uri endpoint, HttpPipeline pipeline, JobRouterClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + options ??= new JobRouterClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _pipeline = pipeline; + _endpoint = endpoint; + _apiVersion = options.Version; + } + +#pragma warning disable CA1801 // Review unused parameters + // Temporary work around before fix: https://github.com/Azure/autorest.csharp/issues/2323 + internal HttpMessage CreateGetExceptionPoliciesNextPageRequest(string nextLink, int? maxpagesize, RequestContext context) +#pragma warning restore CA1801 // Review unused parameters + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + +#pragma warning disable CA1801 // Review unused parameters + // Temporary work around before fix: https://github.com/Azure/autorest.csharp/issues/2323 + internal HttpMessage CreateGetClassificationPoliciesNextPageRequest(string nextLink, int? maxpagesize, RequestContext context) +#pragma warning restore CA1801 // Review unused parameters + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + +#pragma warning disable CA1801 // Review unused parameters + // Temporary work around before fix: https://github.com/Azure/autorest.csharp/issues/2323 + internal HttpMessage CreateGetQueuesNextPageRequest(string nextLink, int? maxpagesize, RequestContext context) +#pragma warning restore CA1801 // Review unused parameters + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + +#pragma warning disable CA1801 // Review unused parameters + // Temporary work around before fix: https://github.com/Azure/autorest.csharp/issues/2323 + internal HttpMessage CreateGetDistributionPoliciesNextPageRequest(string nextLink, int? maxpagesize, RequestContext context) +#pragma warning restore CA1801 // Review unused parameters + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterAdministrationRestClient.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterAdministrationRestClient.cs deleted file mode 100644 index adca80004f34..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterAdministrationRestClient.cs +++ /dev/null @@ -1,87 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.Communication.JobRouter.Models; -using System.Text.Json; -using System.Threading.Tasks; -using System.Threading; -using System; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - [CodeGenSuppress("CreateListExceptionPoliciesNextPageRequest", typeof(string), typeof(int?))] - [CodeGenSuppress("CreateListClassificationPoliciesNextPageRequest", typeof(string), typeof(int?))] - [CodeGenSuppress("CreateListQueuesNextPageRequest", typeof(string), typeof(int?))] - [CodeGenSuppress("CreateListDistributionPoliciesNextPageRequest", typeof(string), typeof(int?))] - internal partial class JobRouterAdministrationRestClient - { -#pragma warning disable CA1801 // Review unused parameters - // Temporary work around before fix: https://github.com/Azure/autorest.csharp/issues/2323 - internal HttpMessage CreateListExceptionPoliciesNextPageRequest(string nextLink, int? maxpagesize) -#pragma warning restore CA1801 // Review unused parameters - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendRawNextLink(nextLink, false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - -#pragma warning disable CA1801 // Review unused parameters - // Temporary work around before fix: https://github.com/Azure/autorest.csharp/issues/2323 - internal HttpMessage CreateListClassificationPoliciesNextPageRequest(string nextLink, int? maxpagesize) -#pragma warning restore CA1801 // Review unused parameters - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendRawNextLink(nextLink, false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - -#pragma warning disable CA1801 // Review unused parameters - // Temporary work around before fix: https://github.com/Azure/autorest.csharp/issues/2323 - internal HttpMessage CreateListQueuesNextPageRequest(string nextLink, int? maxpagesize) -#pragma warning restore CA1801 // Review unused parameters - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendRawNextLink(nextLink, false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - -#pragma warning disable CA1801 // Review unused parameters - // Temporary work around before fix: https://github.com/Azure/autorest.csharp/issues/2323 - internal HttpMessage CreateListDistributionPoliciesNextPageRequest(string nextLink, int? maxpagesize) -#pragma warning restore CA1801 // Review unused parameters - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendRawNextLink(nextLink, false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterClient.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterClient.cs new file mode 100644 index 000000000000..4fcd48c34d17 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterClient.cs @@ -0,0 +1,1054 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Threading.Tasks; +using System.Threading; +using Azure.Communication.Pipeline; +using Azure.Core; +using Azure.Core.Pipeline; +using System.Collections.Generic; + +namespace Azure.Communication.JobRouter +{ + [CodeGenSuppress("CreateGetJobsNextPageRequest", typeof(string), typeof(int?), typeof(string), typeof(string), typeof(string), typeof(string), typeof(DateTimeOffset), typeof(DateTimeOffset), typeof(RequestContext))] + [CodeGenSuppress("CreateGetWorkersNextPageRequest", typeof(string), typeof(int?), typeof(string), typeof(string), typeof(string), typeof(bool), typeof(RequestContext))] + public partial class JobRouterClient + { + #region public constructors - all arguments need null check + + /// Initializes a new instance of . + /// Connection string acquired from the Azure Communication Services resource. + public JobRouterClient(string connectionString) + : this( + ConnectionString.Parse(Argument.CheckNotNullOrEmpty(connectionString, nameof(connectionString))), + new JobRouterClientOptions()) + { + } + + /// Initializes a new instance of . + /// Connection string acquired from the Azure Communication Services resource. + /// Client option exposing , , , etc. + public JobRouterClient(string connectionString, JobRouterClientOptions options) + : this( + ConnectionString.Parse(Argument.CheckNotNullOrEmpty(connectionString, nameof(connectionString))), + options ?? new JobRouterClientOptions()) + { + } + + /// Initializes a new instance of . + /// The URI of the Azure Communication Services resource. + /// The used to authenticate requests. + /// Client option exposing , , , etc. + public JobRouterClient(Uri endpoint, AzureKeyCredential credential, JobRouterClientOptions options = default) + : this( + Argument.CheckNotNull(endpoint, nameof(endpoint)).AbsoluteUri, + Argument.CheckNotNull(credential, nameof(credential)), + options ?? new JobRouterClientOptions()) + { + } + + /// Initializes a new instance of . + /// The URI of the Azure Communication Services resource. + /// The TokenCredential used to authenticate requests, such as DefaultAzureCredential. + /// Client option exposing , , , etc. + public JobRouterClient(Uri endpoint, TokenCredential credential, JobRouterClientOptions options = default) + : this( + Argument.CheckNotNull(endpoint, nameof(endpoint)).AbsoluteUri, + Argument.CheckNotNull(credential, nameof(credential)), + options ?? new JobRouterClientOptions()) + { + } + + #endregion + + #region private constructors + + private JobRouterClient(ConnectionString connectionString, JobRouterClientOptions options) + : this(new Uri(connectionString.GetRequired("endpoint"), UriKind.Absolute), options.BuildHttpPipeline(connectionString), options) + { + } + + private JobRouterClient(string endpoint, TokenCredential tokenCredential, JobRouterClientOptions options) + : this(new Uri(endpoint, UriKind.Absolute), options.BuildHttpPipeline(tokenCredential), options) + { + } + + private JobRouterClient(string endpoint, AzureKeyCredential keyCredential, JobRouterClientOptions options) + : this(new Uri(endpoint, UriKind.Absolute), options.BuildHttpPipeline(keyCredential), options) + { + } + + /// Initializes a new instance of for mocking. + protected JobRouterClient() + { + ClientDiagnostics = null; + } + + /// Initializes a new instance of JobRouterAdministrationRestClient. + /// The Uri to use. + /// The options for configuring the client. + /// The HTTP pipeline for sending and receiving REST requests and responses. + /// is null. + private JobRouterClient(Uri endpoint, HttpPipeline pipeline, JobRouterClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + options ??= new JobRouterClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _pipeline = pipeline; + _endpoint = endpoint; + _apiVersion = options.Version; + } + + #endregion + + #region Job + + #region Create job with classification policy + + /// Creates a new job to be routed with classification property. + /// Options for creating job with classification properties. + /// The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual async Task> CreateJobWithClassificationPolicyAsync( + CreateJobWithClassificationPolicyOptions options, + CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(CreateJobWithClassificationPolicy)}"); + scope.Start(); + try + { + var request = new RouterJob + { + ChannelId = options.ChannelId, + ClassificationPolicyId = options.ClassificationPolicyId, + ChannelReference = options.ChannelReference, + QueueId = options.QueueId, + Priority = options.Priority, + MatchingMode = options.MatchingMode, + }; + + foreach (var label in options.Labels) + { + request.Labels[label.Key] = label.Value; + } + + foreach (var tag in options.Tags) + { + request.Tags[tag.Key] = tag.Value; + } + + foreach (var workerSelector in options.RequestedWorkerSelectors) + { + request.RequestedWorkerSelectors.Add(workerSelector); + } + + foreach (var note in options.Notes) + { + request.Notes.Add(note); + } + + var response = await UpsertJobAsync( + id: options.JobId, + content: request.ToRequestContent(), + requestConditions: options.RequestConditions, + context: FromCancellationToken(cancellationToken)) + .ConfigureAwait(false); + + return Response.FromValue(RouterJob.FromResponse(response), response); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// Creates a new job to be routed with classification property. + /// Options for creating job with classification properties. + /// The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual Response CreateJobWithClassificationPolicy( + CreateJobWithClassificationPolicyOptions options, + CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(CreateJobWithClassificationPolicy)}"); + scope.Start(); + try + { + var request = new RouterJob + { + ChannelId = options.ChannelId, + ClassificationPolicyId = options.ClassificationPolicyId, + ChannelReference = options.ChannelReference, + QueueId = options.QueueId, + Priority = options.Priority, + MatchingMode = options.MatchingMode, + }; + + foreach (var label in options.Labels) + { + request.Labels[label.Key] = label.Value; + } + + foreach (var tag in options.Tags) + { + request.Tags[tag.Key] = tag.Value; + } + + foreach (var workerSelector in options.RequestedWorkerSelectors) + { + request.RequestedWorkerSelectors.Add(workerSelector); + } + + foreach (var note in options.Notes) + { + request.Notes.Add(note); + } + + var response = UpsertJob( + id: options.JobId, + content: request.ToRequestContent(), + requestConditions: options.RequestConditions, + context: FromCancellationToken(cancellationToken)); + + return Response.FromValue(RouterJob.FromResponse(response), response); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + #endregion Create job with classification policy + + #region Create job with direct queue assignment + + /// Creates a new job to be routed. + /// Options for creating job with direct queue assignment. + /// The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual async Task> CreateJobAsync( + CreateJobOptions options, + CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(CreateJob)}"); + scope.Start(); + try + { + var request = new RouterJob + { + ChannelId = options.ChannelId, + ChannelReference = options.ChannelReference, + QueueId = options.QueueId, + Priority = options.Priority, + MatchingMode = options.MatchingMode, + }; + + foreach (var label in options.Labels) + { + request.Labels[label.Key] = label.Value; + } + + foreach (var tag in options.Tags) + { + request.Tags[tag.Key] = tag.Value; + } + + foreach (var workerSelector in options.RequestedWorkerSelectors) + { + request.RequestedWorkerSelectors.Add(workerSelector); + } + + foreach (var note in options.Notes) + { + request.Notes.Add(note); + } + + var response = await UpsertJobAsync( + id: options.JobId, + content: request.ToRequestContent(), + requestConditions: options.RequestConditions, + context: FromCancellationToken(cancellationToken)) + .ConfigureAwait(false); + + return Response.FromValue(RouterJob.FromResponse(response), response); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// Creates a new job to be routed. + /// Options for creating job with direct queue assignment. + /// The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual Response CreateJob( + CreateJobOptions options, + CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(CreateJob)}"); + scope.Start(); + try + { + var request = new RouterJob + { + ChannelId = options.ChannelId, + ChannelReference = options.ChannelReference, + QueueId = options.QueueId, + Priority = options.Priority, + MatchingMode = options.MatchingMode, + }; + + foreach (var label in options.Labels) + { + request.Labels[label.Key] = label.Value; + } + + foreach (var tag in options.Tags) + { + request.Tags[tag.Key] = tag.Value; + } + + foreach (var workerSelector in options.RequestedWorkerSelectors) + { + request.RequestedWorkerSelectors.Add(workerSelector); + } + + foreach (var note in options.Notes) + { + request.Notes.Add(note); + } + + var response = UpsertJob( + id: options.JobId, + content: request.ToRequestContent(), + requestConditions: options.RequestConditions, + context: FromCancellationToken(cancellationToken)); + + return Response.FromValue(RouterJob.FromResponse(response), response); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + #endregion Create job with direct queue assignment + + /// Update an existing job. + /// Options for updating a job. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7396. + /// The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual async Task> UpdateJobAsync( + UpdateJobOptions options, + CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(UpdateJob)}"); + scope.Start(); + try + { + var request = new RouterJob + { + ChannelId = options.ChannelId, + ClassificationPolicyId = options.ClassificationPolicyId, + ChannelReference = options.ChannelReference, + QueueId = options.QueueId, + Priority = options.Priority, + DispositionCode = options.DispositionCode, + MatchingMode = options.MatchingMode, + }; + + foreach (var label in options.Labels) + { + request.Labels[label.Key] = label.Value; + } + + foreach (var tag in options.Tags) + { + request.Tags[tag.Key] = tag.Value; + } + + foreach (var workerSelector in options.RequestedWorkerSelectors) + { + request.RequestedWorkerSelectors.Add(workerSelector); + } + + foreach (var note in options.Notes) + { + request.Notes.Add(note); + } + + var response = await UpsertJobAsync( + id: options.JobId, + content: request.ToRequestContent(), + requestConditions: options.RequestConditions, + context: FromCancellationToken(cancellationToken)) + .ConfigureAwait(false); + + return Response.FromValue(RouterJob.FromResponse(response), response); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// Update an existing job. + /// Options for updating a job. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7396. + /// The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual Response UpdateJob( + UpdateJobOptions options, + CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(UpdateJob)}"); + scope.Start(); + try + { + var request = new RouterJob + { + ChannelId = options.ChannelId, + ClassificationPolicyId = options.ClassificationPolicyId, + ChannelReference = options.ChannelReference, + QueueId = options.QueueId, + Priority = options.Priority, + DispositionCode = options.DispositionCode, + MatchingMode = options.MatchingMode, + }; + + foreach (var label in options.Labels) + { + request.Labels[label.Key] = label.Value; + } + + foreach (var tag in options.Tags) + { + request.Tags[tag.Key] = tag.Value; + } + + foreach (var workerSelector in options.RequestedWorkerSelectors) + { + request.RequestedWorkerSelectors.Add(workerSelector); + } + + foreach (var note in options.Notes) + { + request.Notes.Add(note); + } + + var response = UpsertJob( + id: options.JobId, + content: request.ToRequestContent(), + requestConditions: options.RequestConditions, + context: FromCancellationToken(cancellationToken)); + + return Response.FromValue(RouterJob.FromResponse(response), response); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// Reclassify a job. + /// The id of the job. + /// (Optional) The cancellation token to use. + /// + ///The server returned an error. See for details returned from the server. + public virtual async Task ReclassifyJobAsync( + string jobId, + CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrWhiteSpace(jobId, nameof(jobId)); + + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(ReclassifyJob)}"); + scope.Start(); + try + { + return await ReclassifyJobAsync( + id: jobId, + reclassifyJobRequest: new Dictionary(), + cancellationToken: cancellationToken).ConfigureAwait(false); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// Reclassify a job. + /// The id of the job. + /// (Optional) The cancellation token to use. + /// + ///The server returned an error. See for details returned from the server. + public virtual Response ReclassifyJob( + string jobId, + CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrWhiteSpace(jobId, nameof(jobId)); + + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(ReclassifyJob)}"); + scope.Start(); + try + { + return ReclassifyJob( + id: jobId, + reclassifyJobRequest: new Dictionary(), + cancellationToken: cancellationToken); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// Submits request to cancel an existing job by Id while supplying free-form cancellation reason. + /// Options for cancelling a job. + /// (Optional) The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual async Task CancelJobAsync( + CancelJobOptions options, + CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(CancelJob)}"); + scope.Start(); + try + { + return await CancelJobAsync( + id: options.JobId, + cancelJobRequest: new CancelJobRequest(options.Note, options.DispositionCode), + cancellationToken: cancellationToken) + .ConfigureAwait(false); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// Submits request to cancel an existing job by Id while supplying free-form cancellation reason. + /// Options for cancelling a job. + /// (Optional) The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual Response CancelJob( + CancelJobOptions options, + CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(CancelJob)}"); + scope.Start(); + try + { + return CancelJob( + id: options.JobId, + cancelJobRequest: new CancelJobRequest(options.Note, options.DispositionCode), + cancellationToken: cancellationToken); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// Completes an assigned job. + /// Options for completing a job. + /// (Optional) The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual async Task CompleteJobAsync( + CompleteJobOptions options, + CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(CompleteJob)}"); + scope.Start(); + try + { + return await CompleteJobAsync( + id: options.JobId, + completeJobRequest: new CompleteJobRequest(options.AssignmentId, options.Note), + cancellationToken: cancellationToken) + .ConfigureAwait(false); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// Completes an assigned job. + /// Options for completing a job. + /// (Optional) The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual Response CompleteJob( + CompleteJobOptions options, + CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(CompleteJob)}"); + scope.Start(); + try + { + return CompleteJob( + id: options.JobId, + completeJobRequest: new CompleteJobRequest(options.AssignmentId, options.Note), + cancellationToken: cancellationToken); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// Closes a completed job. + /// Options for closing a job. + /// (Optional) The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual async Task CloseJobAsync( + CloseJobOptions options, + CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(CloseJob)}"); + scope.Start(); + try + { + return await CloseJobAsync( + id: options.JobId, + closeJobRequest: new CloseJobRequest(options.AssignmentId, options.DispositionCode, options.CloseAt, options.Note), + cancellationToken: cancellationToken) + .ConfigureAwait(false); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// Closes a completed job. + /// Options for closing a job. + /// (Optional) The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual Response CloseJob( + CloseJobOptions options, + CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(CloseJob)}"); + scope.Start(); + try + { + return CloseJob( + id: options.JobId, + closeJobRequest: new CloseJobRequest(options.AssignmentId, options.DispositionCode, options.CloseAt, options.Note), + cancellationToken: cancellationToken); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + #endregion Job + + #region Offer + + /// Declines an offer to work on a job. + /// The options for declining a job offer. + /// (Optional) The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual async Task DeclineJobOfferAsync(DeclineJobOfferOptions options, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(DeclineJobOffer)}"); + scope.Start(); + try + { + return await DeclineJobOfferAsync( + workerId: options.WorkerId, + offerId: options.OfferId, + declineJobOfferRequest: new DeclineJobOfferRequest { RetryOfferAt = options.RetryOfferAt }, + cancellationToken: cancellationToken) + .ConfigureAwait(false); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// Declines an offer to work on a job. + /// The options for declining a job offer. + /// (Optional) The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual Response DeclineJobOffer(DeclineJobOfferOptions options, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(DeclineJobOffer)}"); + scope.Start(); + try + { + return DeclineJobOffer( + workerId: options.WorkerId, + offerId: options.OfferId, + declineJobOfferRequest: new DeclineJobOfferRequest { RetryOfferAt = options.RetryOfferAt }, + cancellationToken: cancellationToken); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + #endregion Offer + + #region Worker + + /// Create or update a worker to process jobs. + /// Options for creating a router worker. + /// (Optional) The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual async Task> CreateWorkerAsync( + CreateWorkerOptions options, + CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(CreateWorker)}"); + scope.Start(); + try + { + var request = new RouterWorker() + { + TotalCapacity = options.TotalCapacity, + AvailableForOffers = options?.AvailableForOffers + }; + + foreach (var queueAssignment in options.QueueAssignments) + { + request.QueueAssignments[queueAssignment.Key] = queueAssignment.Value; + } + + foreach (var label in options.Labels) + { + request.Labels[label.Key] = label.Value; + } + + foreach (var tag in options.Tags) + { + request.Tags[tag.Key] = tag.Value; + } + + foreach (var channel in options.ChannelConfigurations) + { + request.ChannelConfigurations[channel.Key] = channel.Value; + } + + var response = await UpsertWorkerAsync( + workerId: options.WorkerId, + content: request.ToRequestContent(), + requestConditions: options.RequestConditions, + context: FromCancellationToken(cancellationToken)) + .ConfigureAwait(false); + + return Response.FromValue(RouterWorker.FromResponse(response), response); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// Create or update a worker to process jobs. + /// Options for creating a router worker. + /// (Optional) The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual Response CreateWorker( + CreateWorkerOptions options, + CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(CreateWorker)}"); + scope.Start(); + try + { + var request = new RouterWorker() + { + TotalCapacity = options.TotalCapacity, + AvailableForOffers = options?.AvailableForOffers + }; + + foreach (var queueAssignment in options.QueueAssignments) + { + request.QueueAssignments[queueAssignment.Key] = queueAssignment.Value; + } + + foreach (var label in options.Labels) + { + request.Labels[label.Key] = label.Value; + } + + foreach (var tag in options.Tags) + { + request.Tags[tag.Key] = tag.Value; + } + + foreach (var channel in options.ChannelConfigurations) + { + request.ChannelConfigurations[channel.Key] = channel.Value; + } + + var response = UpsertWorker( + workerId: options.WorkerId, + content: request.ToRequestContent(), + requestConditions: options.RequestConditions, + context: FromCancellationToken(cancellationToken)); + + return Response.FromValue(RouterWorker.FromResponse(response), response); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// Create or update a worker to process jobs. + /// Options for updating a router worker. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7396. + /// (Optional) The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual async Task> UpdateWorkerAsync( + UpdateWorkerOptions options, + CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(UpdateWorker)}"); + scope.Start(); + try + { + var request = new RouterWorker() + { + TotalCapacity = options?.TotalCapacity, + AvailableForOffers = options?.AvailableForOffers + }; + + foreach (var queueAssignment in options.QueueAssignments) + { + request.QueueAssignments[queueAssignment.Key] = queueAssignment.Value; + } + + foreach (var label in options.Labels) + { + request.Labels[label.Key] = label.Value; + } + + foreach (var tag in options.Tags) + { + request.Tags[tag.Key] = tag.Value; + } + + foreach (var channel in options.ChannelConfigurations) + { + request.ChannelConfigurations[channel.Key] = channel.Value; + } + + var response = await UpsertWorkerAsync( + workerId: options.WorkerId, + content: request.ToRequestContent(), + requestConditions: options.RequestConditions, + context: FromCancellationToken(cancellationToken)) + .ConfigureAwait(false); + + return Response.FromValue(RouterWorker.FromResponse(response), response); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// Create or update a worker to process jobs. + /// Options for updating a router worker. Uses merge-patch semantics: https://datatracker.ietf.org/doc/html/rfc7396. + /// (Optional) The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual Response UpdateWorker( + UpdateWorkerOptions options, + CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(UpdateWorker)}"); + scope.Start(); + try + { + var request = new RouterWorker() + { + TotalCapacity = options.TotalCapacity, + AvailableForOffers = options?.AvailableForOffers + }; + + foreach (var queueAssignment in options.QueueAssignments) + { + request.QueueAssignments[queueAssignment.Key] = queueAssignment.Value; + } + + foreach (var label in options.Labels) + { + request.Labels[label.Key] = label.Value; + } + + foreach (var tag in options.Tags) + { + request.Tags[tag.Key] = tag.Value; + } + + foreach (var channel in options.ChannelConfigurations) + { + request.ChannelConfigurations[channel.Key] = channel.Value; + } + + var response = UpsertWorker( + workerId: options.WorkerId, + content: request.ToRequestContent(), + requestConditions: options.RequestConditions, + context: FromCancellationToken(cancellationToken)); + + return Response.FromValue(RouterWorker.FromResponse(response), response); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// Unassign a job from a worker. + /// Options for unassigning a job from a worker. + /// (Optional) The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual async Task> UnassignJobAsync(UnassignJobOptions options, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(UnassignJobAsync)}"); + scope.Start(); + try + { + var response = await UnassignJobAsync( + id: options.JobId, + assignmentId: options.AssignmentId, + unassignJobRequest: new UnassignJobRequest(options.SuspendMatching), + cancellationToken: cancellationToken) + .ConfigureAwait(false); + + return Response.FromValue(response.Value, response.GetRawResponse()); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + /// Unassign a job from a worker. + /// Options for unassigning a job from a worker. + /// (Optional) The cancellation token to use. + /// The server returned an error. See for details returned from the server. + public virtual Response UnassignJob(UnassignJobOptions options, CancellationToken cancellationToken = default) + { + using DiagnosticScope scope = ClientDiagnostics.CreateScope($"{nameof(JobRouterClient)}.{nameof(UnassignJob)}"); + scope.Start(); + try + { + var response = UnassignJob( + id: options.JobId, + assignmentId: options.AssignmentId, + unassignJobRequest: new UnassignJobRequest(options.SuspendMatching), + cancellationToken: cancellationToken); + + return Response.FromValue(response.Value, response.GetRawResponse()); + } + catch (Exception ex) + { + scope.Failed(ex); + throw; + } + } + + #endregion Worker + +#pragma warning disable CA1801 // Review unused parameters + // Temporary work around before fix: https://github.com/Azure/autorest.csharp/issues/2323 + internal HttpMessage CreateGetJobsNextPageRequest(string nextLink, int? maxpagesize, string status, string queueId, string channelId, string classificationPolicyId, DateTimeOffset? scheduledBefore, DateTimeOffset? scheduledAfter, RequestContext context) +#pragma warning restore CA1801 // Review unused parameters + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + +#pragma warning disable CA1801 // Review unused parameters + // Temporary work around before fix: https://github.com/Azure/autorest.csharp/issues/2323 + internal HttpMessage CreateGetWorkersNextPageRequest(string nextLink, int? maxpagesize, string state, string channelId, string queueId, bool? hasCapacity, RequestContext context) +#pragma warning restore CA1801 // Review unused parameters + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + /// Un-assign a job. + /// Id of the job to un-assign. + /// Id of the assignment to un-assign. + /// Request body for unassign route. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + internal virtual async Task> UnassignJobAsync(string id, string assignmentId, UnassignJobRequest unassignJobRequest = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(assignmentId, nameof(assignmentId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await UnassignJobAsync(id, assignmentId, unassignJobRequest?.ToRequestContent(), context).ConfigureAwait(false); + return Response.FromValue(UnassignJobResult.FromResponse(response), response); + } + + /// Un-assign a job. + /// Id of the job to un-assign. + /// Id of the assignment to un-assign. + /// Request body for unassign route. + /// The cancellation token to use. + /// or is null. + /// or is an empty string, and was expected to be non-empty. + /// + internal virtual Response UnassignJob(string id, string assignmentId, UnassignJobRequest unassignJobRequest = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(id, nameof(id)); + Argument.AssertNotNullOrEmpty(assignmentId, nameof(assignmentId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = UnassignJob(id, assignmentId, unassignJobRequest?.ToRequestContent(), context); + return Response.FromValue(UnassignJobResult.FromResponse(response), response); + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterClientOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterClientOptions.cs new file mode 100644 index 000000000000..63cdce31edfa --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterClientOptions.cs @@ -0,0 +1,31 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Text; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + [CodeGenModel("AzureCommunicationJobRouterClientOptions")] + public partial class JobRouterClientOptions + { + /// + /// The latest version of the Router service. + /// + private const ServiceVersion LatestVersion = ServiceVersion.V2023_11_01; + + /// + /// Initializes a new instance of the . + /// + public JobRouterClientOptions(ServiceVersion version = LatestVersion) + { + Version = version switch + { + ServiceVersion.V2023_11_01 => "2023-11-01", + _ => throw new ArgumentOutOfRangeException(nameof(version)), + }; + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterRestClient.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterRestClient.cs deleted file mode 100644 index b12557bba7d6..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/JobRouterRestClient.cs +++ /dev/null @@ -1,51 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Text.Json; -using System.Threading.Tasks; -using System.Threading; -using Azure.Communication.JobRouter.Models; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - [CodeGenSuppress("CreateListJobsNextPageRequest", typeof(string), typeof(RouterJobStatusSelector?), typeof(string), typeof(string), typeof(string), typeof(DateTimeOffset?), typeof(DateTimeOffset?), typeof(int?))] - [CodeGenSuppress("CreateListWorkersNextPageRequest", typeof(string), typeof(RouterWorkerStateSelector?), typeof(string), typeof(string), typeof(bool?), typeof(int?))] - internal partial class JobRouterRestClient - { -#pragma warning disable CA1801 // Review unused parameters - // Temporary work around before fix: https://github.com/Azure/autorest.csharp/issues/2323 - internal HttpMessage CreateListJobsNextPageRequest(string nextLink, RouterJobStatusSelector? status, string queueId, string channelId, string classificationPolicyId, DateTimeOffset? scheduledBefore, DateTimeOffset? scheduledAfter, int? maxPageSize) -#pragma warning restore CA1801 // Review unused parameters - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendRawNextLink(nextLink, false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - -#pragma warning disable CA1801 // Review unused parameters - // Temporary work around before fix: https://github.com/Azure/autorest.csharp/issues/2323 - internal HttpMessage CreateListWorkersNextPageRequest(string nextLink, RouterWorkerStateSelector? state, string channelId, string queueId, bool? hasCapacity, int? maxpagesize) -#pragma warning restore CA1801 // Review unused parameters - { - var message = _pipeline.CreateMessage(); - var request = message.Request; - request.Method = RequestMethod.Get; - var uri = new RawRequestUriBuilder(); - uri.AppendRaw(_endpoint, false); - uri.AppendRawNextLink(nextLink, false); - uri.AppendQuery("api-version", _apiVersion, true); - request.Uri = uri; - request.Headers.Add("Accept", "application/json"); - return message; - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/JobMatchModeType.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/LabelOperator.cs similarity index 57% rename from sdk/communication/Azure.Communication.JobRouter/src/Models/JobMatchModeType.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Models/LabelOperator.cs index 314ce4c9c132..463b9ec6e28f 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/JobMatchModeType.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/LabelOperator.cs @@ -1,9 +1,13 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; +using System.Collections.Generic; +using System.Text; + namespace Azure.Communication.JobRouter { - public readonly partial struct JobMatchModeType + public readonly partial struct LabelOperator { } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/LabelValue.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/LabelValue.cs index 25fda7775272..f68dc448a69c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/LabelValue.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/LabelValue.cs @@ -2,10 +2,7 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; using System.ComponentModel; -using System.Diagnostics; -using System.Text; namespace Azure.Communication.JobRouter { diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/LongestIdleMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/LongestIdleMode.cs index e5c12c3693d5..30a423f49f43 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/LongestIdleMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/LongestIdleMode.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Text.Json; using Azure.Core; #nullable disable @@ -9,7 +10,7 @@ namespace Azure.Communication.JobRouter { /// Jobs are directed to the worker who has been idle longest. [CodeGenSuppress("LongestIdleMode", typeof(int), typeof(int))] - public partial class LongestIdleMode : DistributionMode + public partial class LongestIdleMode : IUtf8JsonSerializable { /// Initializes a new instance of LongestIdleModePolicy. public LongestIdleMode() : this(null) @@ -20,5 +21,28 @@ internal LongestIdleMode(string kind) { Kind = kind ?? "longest-idle"; } + + 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(); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ManualReclassifyExceptionAction.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ManualReclassifyExceptionAction.cs index 131610e59f42..7954f1beca25 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ManualReclassifyExceptionAction.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/ManualReclassifyExceptionAction.cs @@ -4,6 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Text.Json; using Azure.Core; namespace Azure.Communication.JobRouter @@ -11,11 +12,64 @@ namespace Azure.Communication.JobRouter [CodeGenModel("ManualReclassifyExceptionAction")] [CodeGenSuppress("ManualReclassifyExceptionAction")] [CodeGenSuppress("ManualReclassifyExceptionAction", typeof(string))] - public partial class ManualReclassifyExceptionAction + public partial class ManualReclassifyExceptionAction : IUtf8JsonSerializable { /// Initializes a new instance of ManualReclassifyExceptionAction. - public ManualReclassifyExceptionAction() : this(null, null, null, Array.Empty().ToList()) + public ManualReclassifyExceptionAction() : this("manual-reclassify", null, null, Array.Empty().ToList()) { } + + /// Updated QueueId. + public string QueueId { get; set; } + /// Updated Priority. + public int? Priority { get; set; } + + /// Updated WorkerSelectors. + public IList WorkerSelectors { get; } = new List(); + + [CodeGenMember("WorkerSelectors")] + internal IReadOnlyList _workerSelectors + { + get + { + return WorkerSelectors.Count != 0 + ? WorkerSelectors.ToList() : new ChangeTrackingList(); + } + set + { + foreach (var routerWorkerSelector in value) + { + WorkerSelectors.Add(routerWorkerSelector); + } + } + } + + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(QueueId)) + { + writer.WritePropertyName("queueId"u8); + writer.WriteStringValue(QueueId); + } + if (Optional.IsDefined(Priority)) + { + writer.WritePropertyName("priority"u8); + writer.WriteNumberValue(Priority.Value); + } + if (Optional.IsCollectionDefined(_workerSelectors)) + { + 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(); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/Oauth2ClientCredential.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/Oauth2ClientCredential.cs new file mode 100644 index 000000000000..53efd1c7d79b --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/Oauth2ClientCredential.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + public partial class Oauth2ClientCredential : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ClientId)) + { + writer.WritePropertyName("clientId"u8); + writer.WriteStringValue(ClientId); + } + if (Optional.IsDefined(ClientSecret)) + { + writer.WritePropertyName("clientSecret"u8); + writer.WriteStringValue(ClientSecret); + } + writer.WriteEndObject(); + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/PassThroughQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/PassThroughQueueSelectorAttachment.cs new file mode 100644 index 000000000000..0e716b627b99 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/PassThroughQueueSelectorAttachment.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + [CodeGenModel("PassThroughQueueSelectorAttachment")] + public partial class PassThroughQueueSelectorAttachment : IUtf8JsonSerializable + { + /// Describes how the value of the label is compared to the value pass through. + public LabelOperator LabelOperator { get; internal set; } + + /// 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. + /// is null. + public PassThroughQueueSelectorAttachment(string key, LabelOperator labelOperator): this("pass-through", key, labelOperator) + { + Argument.AssertNotNull(key, nameof(key)); + } + + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + writer.WritePropertyName("labelOperator"u8); + writer.WriteStringValue(LabelOperator.ToString()); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/PassThroughWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/PassThroughWorkerSelectorAttachment.cs index dbed1878b86c..d0b78f78e657 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/PassThroughWorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/PassThroughWorkerSelectorAttachment.cs @@ -2,32 +2,23 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; -using System.Text; -using Azure.Communication.JobRouter.Models; +using System.Text.Json; using Azure.Core; namespace Azure.Communication.JobRouter { [CodeGenModel("PassThroughWorkerSelectorAttachment")] - public partial class PassThroughWorkerSelectorAttachment + public partial class PassThroughWorkerSelectorAttachment : IUtf8JsonSerializable { - /// Initializes a new instance of PassThroughWorkerSelectorAttachment. - /// The label key to query against. - /// Describes how the value of the label is compared to the value pass through. - /// Describes how long the attached label selector is valid. - /// is null. - public PassThroughWorkerSelectorAttachment(string key, LabelOperator labelOperator, TimeSpan? expiresAfter = default) - : this(null, key, labelOperator, expiresAfter?.TotalSeconds) - { - Argument.AssertNotNullOrWhiteSpace(key, nameof(key)); - } + /// Describes how the value of the label is compared to the value pass through. + public LabelOperator LabelOperator { get; internal set; } /// Describes how long the attached label selector is valid in seconds. public TimeSpan? ExpiresAfter { get; internal set; } [CodeGenMember("ExpiresAfterSeconds")] - internal double? _expiresAfterSeconds { + internal double? _expiresAfterSeconds + { get { return ExpiresAfter?.TotalSeconds is null or 0 ? null : ExpiresAfter?.TotalSeconds; @@ -37,5 +28,33 @@ internal double? _expiresAfterSeconds { ExpiresAfter = value != null ? TimeSpan.FromSeconds(value.Value) : null; } } + + /// Initializes a new instance of PassThroughWorkerSelectorAttachment. + /// The label key to query against. + /// Describes how the value of the label is compared to the value pass through. + /// Describes how long the attached label selector is valid. + /// is null. + public PassThroughWorkerSelectorAttachment(string key, LabelOperator labelOperator, TimeSpan? expiresAfter = default) + : this("pass-through", key, labelOperator, expiresAfter?.TotalSeconds) + { + Argument.AssertNotNullOrWhiteSpace(key, nameof(key)); + } + + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + writer.WritePropertyName("labelOperator"u8); + writer.WriteStringValue(LabelOperator.ToString()); + if (Optional.IsDefined(_expiresAfterSeconds)) + { + writer.WritePropertyName("expiresAfterSeconds"u8); + writer.WriteNumberValue(_expiresAfterSeconds.Value); + } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + writer.WriteEndObject(); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueAndMatchMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueAndMatchMode.cs index 41d4157b00bb..cf06763f562a 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueAndMatchMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueAndMatchMode.cs @@ -9,13 +9,22 @@ namespace Azure.Communication.JobRouter /// /// Used to specify default behavior of greedy matching of jobs and worker. /// - public class QueueAndMatchMode + [CodeGenModel("QueueAndMatchMode")] + public partial class QueueAndMatchMode : IUtf8JsonSerializable { /// /// Constructor. /// - public QueueAndMatchMode() + public QueueAndMatchMode() : this("queue-and-match") { } + + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + writer.WriteEndObject(); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueLengthExceptionTrigger.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueLengthExceptionTrigger.cs index 73cee77d266c..404f6237690e 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueLengthExceptionTrigger.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueLengthExceptionTrigger.cs @@ -1,16 +1,30 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Text.Json; +using Azure.Core; + namespace Azure.Communication.JobRouter { /// Trigger for an exception action on exceeding queue length. - public partial class QueueLengthExceptionTrigger : ExceptionTrigger + [CodeGenModel("QueueLengthExceptionTrigger")] + public partial class QueueLengthExceptionTrigger : IUtf8JsonSerializable { /// Initializes a new instance of QueueLengthExceptionTrigger. /// Threshold of number of jobs queued to for this trigger. Must be greater than 0 public QueueLengthExceptionTrigger(int threshold) - : this(null, threshold) + : this("queue-length", threshold) + { + } + + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { + writer.WriteStartObject(); + writer.WritePropertyName("threshold"u8); + writer.WriteNumberValue(Threshold); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + writer.WriteEndObject(); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueSelectorAttachment.cs index ae2c15772ff6..13ea271c4a7c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueSelectorAttachment.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Text.Json; using System.Text.Json.Serialization; using Azure.Core; @@ -8,14 +9,14 @@ namespace Azure.Communication.JobRouter { [CodeGenModel("QueueSelectorAttachment")] [JsonConverter(typeof(PolymorphicWriteOnlyJsonConverter))] - public abstract partial class QueueSelectorAttachment + public abstract partial class QueueSelectorAttachment : IUtf8JsonSerializable { - /// Initializes a new instance of QueueSelectorAttachment. - internal QueueSelectorAttachment() + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { + writer.WriteStartObject(); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + writer.WriteEndObject(); } - - /// The type discriminator describing the type of label selector attachment. - protected string Kind { get; set; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueWeightedAllocation.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueWeightedAllocation.cs new file mode 100644 index 000000000000..d30e43220e8f --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/QueueWeightedAllocation.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + [CodeGenModel("QueueWeightedAllocation")] + public partial class QueueWeightedAllocation : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("weight"u8); + writer.WriteNumberValue(Weight); + writer.WritePropertyName("queueSelectors"u8); + writer.WriteStartArray(); + foreach (var item in QueueSelectors) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ReclassifyExceptionAction.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ReclassifyExceptionAction.cs index 12151e5a77fe..c0d61e11c0cf 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ReclassifyExceptionAction.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/ReclassifyExceptionAction.cs @@ -1,17 +1,16 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using System; using System.Collections.Generic; using System.Linq; -using System.Text; +using System.Text.Json; using Azure.Core; namespace Azure.Communication.JobRouter { [CodeGenModel("ReclassifyExceptionAction")] [CodeGenSuppress("ReclassifyExceptionAction")] - public partial class ReclassifyExceptionAction + public partial class ReclassifyExceptionAction : IUtf8JsonSerializable { [CodeGenMember("LabelsToUpsert")] internal IDictionary _labelsToUpsert @@ -41,11 +40,40 @@ internal IDictionary _labelsToUpsert /// (optional) The new classification policy that will determine queue, priority and worker selectors. /// (optional) Dictionary containing the labels to update (or add if not existing) in key-value pairs. public ReclassifyExceptionAction(string classificationPolicyId, IDictionary labelsToUpsert = default) - : this(null, classificationPolicyId, null) + : this("reclassify", classificationPolicyId, null) { Argument.AssertNotNullOrWhiteSpace(classificationPolicyId, nameof(classificationPolicyId)); LabelsToUpsert = labelsToUpsert; } + + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ClassificationPolicyId)) + { + writer.WritePropertyName("classificationPolicyId"u8); + writer.WriteStringValue(ClassificationPolicyId); + } + if (Optional.IsCollectionDefined(_labelsToUpsert)) + { + writer.WritePropertyName("labelsToUpsert"u8); + writer.WriteStartObject(); + foreach (var item in _labelsToUpsert) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + writer.WriteEndObject(); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ReclassifyJobRequest.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ReclassifyJobRequest.cs deleted file mode 100644 index 0ba66ea08ad7..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ReclassifyJobRequest.cs +++ /dev/null @@ -1,28 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using System; -using System.Collections.Generic; -using System.Text; -using System.Text.Json; -using System.Text.Json.Serialization; -using Azure.Core; - -namespace Azure.Communication.JobRouter -{ - /// - /// An assignment of a worker to a queue. - /// - internal class ReclassifyJobRequest : IUtf8JsonSerializable - { - /// - /// Write empty object. - /// - /// - void global::Azure.Core.IUtf8JsonSerializable.Write(Utf8JsonWriter writer) - { - writer.WriteStartObject(); - writer.WriteEndObject(); - } - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RoundRobinMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RoundRobinMode.cs index 217b6a218a60..12c6491932a5 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RoundRobinMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RoundRobinMode.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Text.Json; using Azure.Core; #nullable disable @@ -10,7 +11,7 @@ namespace Azure.Communication.JobRouter /// Jobs are distributed in order to workers, starting with the worker that is after the last worker to receive a job. [CodeGenModel("RoundRobinMode")] [CodeGenSuppress("RoundRobinMode", typeof(int), typeof(int))] - public partial class RoundRobinMode : DistributionMode + public partial class RoundRobinMode : IUtf8JsonSerializable { /// Initializes a new instance of RoundRobinModePolicy. public RoundRobinMode() : this(null) @@ -21,5 +22,28 @@ internal RoundRobinMode(string kind) { Kind = kind ?? "round-robin"; } + + 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(); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJob.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJob.cs index c8887150f83e..f37971b6ff35 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJob.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJob.cs @@ -8,22 +8,21 @@ using System.Text.Json; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { [CodeGenModel("RouterJob")] - [CodeGenSuppress("RouterJob")] - public partial class RouterJob + public partial class RouterJob : IUtf8JsonSerializable { - /// Initializes a new instance of RouterJob. + /*/// Initializes a new instance of RouterJob. internal RouterJob() { AttachedWorkerSelectors = new ChangeTrackingList(); Assignments = new ChangeTrackingDictionary(); _requestedWorkerSelectors = new ChangeTrackingList(); - _labels = new ChangeTrackingDictionary(); - _tags = new ChangeTrackingDictionary(); + _labels = new ChangeTrackingDictionary(); + _tags = new ChangeTrackingDictionary(); _notes = new ChangeTrackingDictionary(); - } + }*/ /// /// A set of key/value pairs that are identifying attributes used by the rules engines to make decisions. @@ -61,13 +60,13 @@ internal RouterJob() public JobMatchingMode MatchingMode { get; internal set; } [CodeGenMember("Labels")] - internal IDictionary _labels + internal IDictionary _labels { get { return Labels != null && Labels.Count != 0 - ? Labels?.ToDictionary(x => x.Key, x => x.Value?.Value) - : new ChangeTrackingDictionary(); + ? Labels?.ToDictionary(x => x.Key, x => BinaryData.FromObjectAsJson(x.Value?.Value)) + : new ChangeTrackingDictionary(); } set { @@ -75,20 +74,20 @@ internal IDictionary _labels { foreach (var label in value) { - Labels[label.Key] = new LabelValue(label.Value); + Labels[label.Key] = new LabelValue(label.Value.ToObjectFromJson()); } } } } [CodeGenMember("Tags")] - internal IDictionary _tags + internal IDictionary _tags { get { return Tags != null && Tags.Count != 0 - ? Tags?.ToDictionary(x => x.Key, x => x.Value?.Value) - : new ChangeTrackingDictionary(); + ? Tags?.ToDictionary(x => x.Key, x => BinaryData.FromObjectAsJson(x.Value?.Value)) + : new ChangeTrackingDictionary(); } set { @@ -96,7 +95,7 @@ internal IDictionary _tags { foreach (var tag in value) { - Tags[tag.Key] = new LabelValue(tag.Value); + Tags[tag.Key] = new LabelValue(tag.Value.ToObjectFromJson()); } } } @@ -139,5 +138,106 @@ internal IList _requestedWorkerSelectors RequestedWorkerSelectors.AddRange(value); } } + + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ChannelReference)) + { + writer.WritePropertyName("channelReference"u8); + writer.WriteStringValue(ChannelReference); + } + if (Optional.IsDefined(ChannelId)) + { + writer.WritePropertyName("channelId"u8); + writer.WriteStringValue(ChannelId); + } + if (Optional.IsDefined(ClassificationPolicyId)) + { + writer.WritePropertyName("classificationPolicyId"u8); + writer.WriteStringValue(ClassificationPolicyId); + } + if (Optional.IsDefined(QueueId)) + { + writer.WritePropertyName("queueId"u8); + writer.WriteStringValue(QueueId); + } + if (Optional.IsDefined(Priority)) + { + writer.WritePropertyName("priority"u8); + writer.WriteNumberValue(Priority.Value); + } + if (Optional.IsDefined(DispositionCode)) + { + writer.WritePropertyName("dispositionCode"u8); + writer.WriteStringValue(DispositionCode); + } + if (Optional.IsCollectionDefined(_requestedWorkerSelectors)) + { + writer.WritePropertyName("requestedWorkerSelectors"u8); + writer.WriteStartArray(); + foreach (var item in _requestedWorkerSelectors) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsCollectionDefined(_labels)) + { + writer.WritePropertyName("labels"u8); + writer.WriteStartObject(); + foreach (var item in _labels) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteObjectValue(item.Value.ToObjectFromJson()); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(_tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in _tags) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteObjectValue(item.Value.ToObjectFromJson()); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(_notes)) + { + writer.WritePropertyName("notes"u8); + writer.WriteStartObject(); + foreach (var item in _notes) + { + writer.WritePropertyName(item.Key); + writer.WriteStringValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(MatchingMode)) + { + writer.WritePropertyName("matchingMode"u8); + writer.WriteObjectValue(MatchingMode); + } + writer.WriteEndObject(); + } + + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobAssignment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobAssignment.cs index 82ce8083a058..c0358a38e9c8 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobAssignment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobAssignment.cs @@ -3,7 +3,7 @@ using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { [CodeGenModel("RouterJobAssignment")] public partial class RouterJobAssignment diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobCollection.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobCollection.cs deleted file mode 100644 index 084175ff5686..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobCollection.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - [CodeGenModel("RouterJobCollection")] - internal partial class RouterJobCollection - { - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobItem.cs index f6e18b060144..4011765f17ab 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobItem.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobItem.cs @@ -3,7 +3,7 @@ using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { [CodeGenModel("RouterJobItem")] public partial class RouterJobItem diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobOffer.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobOffer.cs index 6e8262cdb5c8..3a37b8c060c3 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobOffer.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobOffer.cs @@ -1,10 +1,9 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using System; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { [CodeGenModel("RouterJobOffer")] public partial class RouterJobOffer diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobPositionDetails.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobPositionDetails.cs index e2f2444d6c69..b6be14403966 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobPositionDetails.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobPositionDetails.cs @@ -4,7 +4,7 @@ using System; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { [CodeGenModel("RouterJobPositionDetails")] public partial class RouterJobPositionDetails diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobStatus.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobStatus.cs index bf3825e69758..ba636b048462 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobStatus.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterJobStatus.cs @@ -3,7 +3,7 @@ using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { [CodeGenModel("RouterJobStatus")] public readonly partial struct RouterJobStatus diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueue.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueue.cs index 02308191eaf7..012af7659bd6 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueue.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueue.cs @@ -2,12 +2,13 @@ // Licensed under the MIT License. using System.Collections.Generic; using System.Linq; +using System.Text.Json; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { [CodeGenModel("RouterQueue")] - public partial class RouterQueue + public partial class RouterQueue : IUtf8JsonSerializable { [CodeGenMember("Labels")] internal IDictionary _labels @@ -49,5 +50,50 @@ internal RouterQueue() { _labels = new ChangeTrackingDictionary(); } + + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(Name)) + { + writer.WritePropertyName("name"u8); + writer.WriteStringValue(Name); + } + if (Optional.IsDefined(DistributionPolicyId)) + { + writer.WritePropertyName("distributionPolicyId"u8); + writer.WriteStringValue(DistributionPolicyId); + } + if (Optional.IsCollectionDefined(_labels)) + { + writer.WritePropertyName("labels"u8); + writer.WriteStartObject(); + foreach (var item in _labels) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(ExceptionPolicyId)) + { + writer.WritePropertyName("exceptionPolicyId"u8); + writer.WriteStringValue(ExceptionPolicyId); + } + 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/Models/RouterQueueAssignment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueAssignment.cs index 1425b4ec9fcb..adb0bc4669c4 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueAssignment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueAssignment.cs @@ -1,11 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using System; -using System.Collections.Generic; -using System.Text; using System.Text.Json; -using System.Text.Json.Serialization; using Azure.Core; namespace Azure.Communication.JobRouter @@ -13,7 +9,7 @@ namespace Azure.Communication.JobRouter /// /// An assignment of a worker to a queue. /// - public class RouterQueueAssignment : IUtf8JsonSerializable + public partial class RouterQueueAssignment : IUtf8JsonSerializable { /// /// Public constructor. @@ -26,7 +22,7 @@ public RouterQueueAssignment() /// Write empty object. /// /// - void global::Azure.Core.IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { writer.WriteStartObject(); writer.WriteEndObject(); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueCollection.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueCollection.cs deleted file mode 100644 index c26f0b26933c..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueCollection.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - [CodeGenModel("RouterQueueCollection")] - internal partial class RouterQueueCollection - { - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueItem.cs index 74e300c47ab1..2ac7edf27061 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueItem.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueItem.cs @@ -3,7 +3,7 @@ using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { [CodeGenModel("RouterQueueItem")] public partial class RouterQueueItem diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueSelector.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueSelector.cs index 65e749efc2a5..418b03713df1 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueSelector.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueSelector.cs @@ -1,28 +1,32 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using System.Text.Json.Serialization; +using System; +using System.Text.Json; using Azure.Core; +using Azure.Core.Serialization; namespace Azure.Communication.JobRouter { [CodeGenModel("RouterQueueSelector")] [CodeGenSuppress("RouterQueueSelector", typeof(string), typeof(LabelOperator))] - public partial class RouterQueueSelector + public partial class RouterQueueSelector : IUtf8JsonSerializable { [CodeGenMember("Value")] - private object _value { + private BinaryData _value + { get { - return Value.Value; + return BinaryData.FromObjectAsJson(Value.Value); } set { - Value = new LabelValue(value); - } } + Value = new LabelValue(value.ToObjectFromJson()); + } + } /// The value to compare against the actual label value with the given operator. - public LabelValue Value { get; set; } + public LabelValue Value { get; internal set; } /// Initializes a new instance of QueueSelector. /// The label key to query against. @@ -34,5 +38,20 @@ public RouterQueueSelector(string key, LabelOperator labelOperator, LabelValue v LabelOperator = labelOperator; Value = value; } + + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + writer.WritePropertyName("labelOperator"u8); + writer.WriteStringValue(LabelOperator.ToString()); + if (Optional.IsDefined(_value)) + { + writer.WritePropertyName("value"u8); + writer.WriteObjectValue(_value.ToObjectFromJson()); + } + writer.WriteEndObject(); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueStatistics.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueStatistics.cs index 5bcf367fd493..695de66b1152 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueStatistics.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterQueueStatistics.cs @@ -3,7 +3,7 @@ using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { [CodeGenModel("RouterQueueStatistics")] public partial class RouterQueueStatistics diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterRule.cs index 6684ce9e5226..231e771e1e12 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterRule.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Text.Json; using System.Text.Json.Serialization; using Azure.Core; @@ -9,14 +10,14 @@ namespace Azure.Communication.JobRouter [CodeGenModel("RouterRule")] [CodeGenSuppress("RouterRule")] [JsonConverter(typeof(PolymorphicWriteOnlyJsonConverter))] - public abstract partial class RouterRule + public abstract partial class RouterRule : IUtf8JsonSerializable { - /// Initializes a new instance of RouterRule. - internal RouterRule() + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { + writer.WriteStartObject(); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + writer.WriteEndObject(); } - - /// The type discriminator describing a sub-type of Rule. - public string Kind { get; set; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorker.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorker.cs index ee5f7148c08c..915177b0e610 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorker.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorker.cs @@ -1,27 +1,17 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System; using System.Collections.Generic; using System.Linq; -using System.Text.Json.Serialization; +using System.Text.Json; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { [CodeGenModel("RouterWorker")] - public partial class RouterWorker + public partial class RouterWorker : IUtf8JsonSerializable { - /// Initializes a new instance of RouterWorker. - internal RouterWorker() - { - _queueAssignments = new ChangeTrackingDictionary(); - _labels = new ChangeTrackingDictionary(); - _tags = new ChangeTrackingDictionary(); - _channelConfigurations = new ChangeTrackingDictionary(); - Offers = new ChangeTrackingList(); - AssignedJobs = new ChangeTrackingList(); - } - /// /// A set of key/value pairs that are identifying attributes used by the rules engines to make decisions. /// @@ -45,13 +35,13 @@ internal RouterWorker() public bool? AvailableForOffers { get; internal set; } [CodeGenMember("Labels")] - internal IDictionary _labels + internal IDictionary _labels { get { return Labels != null && Labels.Count != 0 - ? Labels?.ToDictionary(x => x.Key, x => x.Value?.Value) - : new ChangeTrackingDictionary(); + ? Labels?.ToDictionary(x => x.Key, x => BinaryData.FromObjectAsJson(x.Value?.Value)) + : new ChangeTrackingDictionary(); } set { @@ -59,20 +49,20 @@ internal IDictionary _labels { foreach (var label in value) { - Labels[label.Key] = new LabelValue(label.Value); + Labels[label.Key] = new LabelValue(label.Value.ToObjectFromJson()); } } } } [CodeGenMember("Tags")] - internal IDictionary _tags + internal IDictionary _tags { get { return Tags != null && Tags.Count != 0 - ? Tags?.ToDictionary(x => x.Key, x => x.Value?.Value) - : new ChangeTrackingDictionary(); + ? Tags?.ToDictionary(x => x.Key, x => BinaryData.FromObjectAsJson(x.Value?.Value)) + : new ChangeTrackingDictionary(); } set { @@ -80,7 +70,7 @@ internal IDictionary _tags { foreach (var tag in value) { - Tags[tag.Key] = new LabelValue(tag.Value); + Tags[tag.Key] = new LabelValue(tag.Value.ToObjectFromJson()); } } } @@ -96,23 +86,19 @@ internal IDictionary _channelConfigurations { { foreach (var channelConfiguration in value) { - ChannelConfigurations[channelConfiguration.Key] = new ChannelConfiguration(channelConfiguration.Value.CapacityCostPerJob) - { - MaxNumberOfJobs = channelConfiguration.Value.MaxNumberOfJobs - }; + ChannelConfigurations[channelConfiguration.Key] = new ChannelConfiguration(channelConfiguration.Value.CapacityCostPerJob, channelConfiguration.Value.MaxNumberOfJobs); } } } [CodeGenMember("QueueAssignments")] - internal IDictionary _queueAssignments + internal IReadOnlyDictionary _queueAssignments { get { return QueueAssignments != null - ? QueueAssignments.ToDictionary(x => x.Key, - x => (object)x.Value) - : new ChangeTrackingDictionary(); + ? QueueAssignments.ToDictionary(x => x.Key, x => x.Value) + : new ChangeTrackingDictionary(); } set { @@ -122,5 +108,87 @@ internal IDictionary _queueAssignments } } } + + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsCollectionDefined(_queueAssignments)) + { + writer.WritePropertyName("queueAssignments"u8); + writer.WriteStartObject(); + foreach (var item in _queueAssignments) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(TotalCapacity)) + { + writer.WritePropertyName("totalCapacity"u8); + writer.WriteNumberValue(TotalCapacity.Value); + } + if (Optional.IsCollectionDefined(_labels)) + { + writer.WritePropertyName("labels"u8); + writer.WriteStartObject(); + foreach (var item in _labels) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteObjectValue(item.Value.ToObjectFromJson()); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(_tags)) + { + writer.WritePropertyName("tags"u8); + writer.WriteStartObject(); + foreach (var item in _tags) + { + writer.WritePropertyName(item.Key); + if (item.Value == null) + { + writer.WriteNullValue(); + continue; + } + writer.WriteObjectValue(item.Value.ToObjectFromJson()); + } + writer.WriteEndObject(); + } + if (Optional.IsCollectionDefined(_channelConfigurations)) + { + writer.WritePropertyName("channelConfigurations"u8); + writer.WriteStartObject(); + foreach (var item in _channelConfigurations) + { + writer.WritePropertyName(item.Key); + writer.WriteObjectValue(item.Value); + } + writer.WriteEndObject(); + } + if (Optional.IsDefined(AvailableForOffers)) + { + writer.WritePropertyName("availableForOffers"u8); + writer.WriteBooleanValue(AvailableForOffers.Value); + } + writer.WriteEndObject(); + } + + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this); + return content; + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerAssignment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerAssignment.cs index 8f36472b3bb1..cbc171524279 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerAssignment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerAssignment.cs @@ -3,7 +3,7 @@ using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { [CodeGenModel("RouterWorkerAssignment")] public partial class RouterWorkerAssignment diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerCollection.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerCollection.cs deleted file mode 100644 index 8e9b3d7aaf5a..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerCollection.cs +++ /dev/null @@ -1,12 +0,0 @@ -// Copyright (c) Microsoft Corporation. All rights reserved. -// Licensed under the MIT License. - -using Azure.Core; - -namespace Azure.Communication.JobRouter.Models -{ - [CodeGenModel("RouterWorkerCollection")] - internal partial class RouterWorkerCollection - { - } -} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerItem.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerItem.cs index e0c72db9818e..bc7ddebe06e2 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerItem.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerItem.cs @@ -3,7 +3,7 @@ using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { [CodeGenModel("RouterWorkerItem")] public partial class RouterWorkerItem diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerSelector.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerSelector.cs index b9438f232233..4b46b2bbe9e5 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerSelector.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerSelector.cs @@ -2,15 +2,14 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; -using System.Text; +using System.Text.Json; using Azure.Core; namespace Azure.Communication.JobRouter { [CodeGenModel("RouterWorkerSelector")] [CodeGenSuppress("RouterWorkerSelector", typeof(string), typeof(LabelOperator))] - public partial class RouterWorkerSelector + public partial class RouterWorkerSelector : IUtf8JsonSerializable { /// Describes how long this label selector is valid for. public TimeSpan? ExpiresAfter { get; set; } @@ -28,21 +27,24 @@ internal double? _expiresAfterSeconds { } [CodeGenMember("Value")] - private object _value + private BinaryData _value { get { - return Value.Value; + return BinaryData.FromObjectAsJson(Value.Value); } set { - Value = new LabelValue(value); + Value = new LabelValue(value.ToObjectFromJson()); } } /// The value to compare against the actual label value with the given operator. public LabelValue Value { get; set; } + /// The time at which this worker selector expires in UTC. + public DateTimeOffset? ExpiresAt { get; set; } + /// Initializes a new instance of WorkerSelector. /// The label key to query against. /// Describes how the value of the label is compared to the value defined on the label selector. @@ -53,5 +55,30 @@ public RouterWorkerSelector(string key, LabelOperator labelOperator, LabelValue LabelOperator = labelOperator; Value = value; } + + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("key"u8); + writer.WriteStringValue(Key); + writer.WritePropertyName("labelOperator"u8); + writer.WriteStringValue(LabelOperator.ToString()); + if (Optional.IsDefined(_value)) + { + writer.WritePropertyName("value"u8); + writer.WriteObjectValue(_value.ToObjectFromJson()); + } + if (Optional.IsDefined(_expiresAfterSeconds)) + { + writer.WritePropertyName("expiresAfterSeconds"u8); + writer.WriteNumberValue(_expiresAfterSeconds.Value); + } + if (Optional.IsDefined(Expedite)) + { + writer.WritePropertyName("expedite"u8); + writer.WriteBooleanValue(Expedite.Value); + } + writer.WriteEndObject(); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerSelectorStatus.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerSelectorStatus.cs index 4afa6d42fd55..f9f6a3d2c58f 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerSelectorStatus.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerSelectorStatus.cs @@ -1,11 +1,12 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using Azure.Core; +using System; +using System.Collections.Generic; +using System.Text; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { - [CodeGenModel("RouterWorkerSelectorStatus")] public readonly partial struct RouterWorkerSelectorStatus { } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerState.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerState.cs new file mode 100644 index 000000000000..42c29aa2eae1 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RouterWorkerState.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Azure.Communication.JobRouter +{ + public readonly partial struct RouterWorkerState + { + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RuleEngineQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RuleEngineQueueSelectorAttachment.cs new file mode 100644 index 000000000000..3a319a584c8c --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RuleEngineQueueSelectorAttachment.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + public partial class RuleEngineQueueSelectorAttachment : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("rule"u8); + writer.WriteObjectValue(Rule); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/RuleEngineWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/RuleEngineWorkerSelectorAttachment.cs new file mode 100644 index 000000000000..4c8c49dc7087 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/RuleEngineWorkerSelectorAttachment.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + public partial class RuleEngineWorkerSelectorAttachment : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("rule"u8); + writer.WriteObjectValue(Rule); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ScheduleAndSuspendMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ScheduleAndSuspendMode.cs index 2b4756efab8f..88fa3784bb9d 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ScheduleAndSuspendMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/ScheduleAndSuspendMode.cs @@ -2,7 +2,6 @@ // Licensed under the MIT License. using System; -using System.Security.Cryptography; using System.Text.Json; using Azure.Core; @@ -10,18 +9,29 @@ namespace Azure.Communication.JobRouter { [CodeGenSuppress("ScheduleAndSuspendMode")] [CodeGenSuppress("ScheduleAndSuspendMode", typeof(DateTimeOffset?))] - public partial class ScheduleAndSuspendMode + public partial class ScheduleAndSuspendMode : IUtf8JsonSerializable { /// Initializes a new instance of ScheduleAndSuspendMode. /// The time at which the job will be scheduled. /// is null. - public ScheduleAndSuspendMode(DateTimeOffset scheduleAt) + public ScheduleAndSuspendMode(DateTimeOffset scheduleAt) : this("schedule-and-suspend", scheduleAt) { Argument.AssertNotNull(scheduleAt, nameof(scheduleAt)); - ScheduleAt = scheduleAt; } - /// Gets or sets the schedule at. - public DateTimeOffset ScheduleAt { get; } + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(ScheduleAt)) + { + writer.WritePropertyName("scheduleAt"u8); + writer.WriteStringValue(ScheduleAt, "O"); + } + + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + + writer.WriteEndObject(); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ScoringRuleOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ScoringRuleOptions.cs index 07dd71225915..dcd2b103cefe 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/ScoringRuleOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/ScoringRuleOptions.cs @@ -1,27 +1,52 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using System; using System.Collections.Generic; -using System.Text; +using System.Text.Json; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { [CodeGenModel("ScoringRuleOptions")] - public partial class ScoringRuleOptions + public partial class ScoringRuleOptions : IUtf8JsonSerializable { - internal ScoringRuleOptions() - { - ScoringParameters = new ChangeTrackingList(); - } - /// /// (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. /// - public IList ScoringParameters { get; } + public IList ScoringParameters { get; } = new List(); + + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(BatchSize)) + { + writer.WritePropertyName("batchSize"u8); + writer.WriteNumberValue(BatchSize.Value); + } + if (Optional.IsCollectionDefined(ScoringParameters)) + { + writer.WritePropertyName("scoringParameters"u8); + writer.WriteStartArray(); + foreach (var item in ScoringParameters) + { + writer.WriteStringValue(item.ToString()); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(AllowScoringBatchOfWorkers)) + { + writer.WritePropertyName("allowScoringBatchOfWorkers"u8); + writer.WriteBooleanValue(AllowScoringBatchOfWorkers.Value); + } + if (Optional.IsDefined(DescendingOrder)) + { + writer.WritePropertyName("descendingOrder"u8); + writer.WriteBooleanValue(DescendingOrder.Value); + } + writer.WriteEndObject(); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/ScoringRuleParameterSelector.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/ScoringRuleParameterSelector.cs new file mode 100644 index 000000000000..8947c25c71ee --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/ScoringRuleParameterSelector.cs @@ -0,0 +1,13 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Text; + +namespace Azure.Communication.JobRouter +{ + public readonly partial struct ScoringRuleParameterSelector + { + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/StaticQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/StaticQueueSelectorAttachment.cs new file mode 100644 index 000000000000..e45aa3c12cbc --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/StaticQueueSelectorAttachment.cs @@ -0,0 +1,21 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + public partial class StaticQueueSelectorAttachment : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("queueSelector"u8); + writer.WriteObjectValue(QueueSelector); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/StaticRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/StaticRouterRule.cs index 70fc26cb5347..51a3d8aad6d4 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/StaticRouterRule.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/StaticRouterRule.cs @@ -2,35 +2,47 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; -using System.Text; +using System.Text.Json; using Azure.Core; namespace Azure.Communication.JobRouter { [CodeGenModel("StaticRouterRule")] [CodeGenSuppress("StaticRouterRule")] - public partial class StaticRouterRule : RouterRule + public partial class StaticRouterRule : IUtf8JsonSerializable { /// The static value this rule always returns. public LabelValue Value { get; set; } [CodeGenMember("Value")] - internal object _value { + internal BinaryData _value { get { - return Value.Value; + return BinaryData.FromObjectAsJson(Value.Value); } set { - Value = new LabelValue(value); + Value = new LabelValue(value.ToObjectFromJson()); } } /// Initializes a new instance of StaticRule. /// The static value this rule always returns. - public StaticRouterRule(LabelValue value) : this(null, value.Value) + public StaticRouterRule(LabelValue value) : this("static-rule", BinaryData.FromObjectAsJson(value.Value)) { } + + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(_value)) + { + writer.WritePropertyName("value"u8); + writer.WriteObjectValue(_value.ToObjectFromJson()); + } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + writer.WriteEndObject(); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/StaticWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/StaticWorkerSelectorAttachment.cs new file mode 100644 index 000000000000..ce2315b7ccb1 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/StaticWorkerSelectorAttachment.cs @@ -0,0 +1,22 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + [CodeGenModel("StaticWorkerSelectorAttachment")] + public partial class StaticWorkerSelectorAttachment : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("workerSelector"u8); + writer.WriteObjectValue(WorkerSelector); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/SuspendMode.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/SuspendMode.cs index f6c8ed27ffb4..2a70e4b45700 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/SuspendMode.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/SuspendMode.cs @@ -1,18 +1,29 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Text.Json; +using Azure.Core; + namespace Azure.Communication.JobRouter { /// /// Used to specify a match mode when no action is taken on a job. /// - public class SuspendMode + public partial class SuspendMode : IUtf8JsonSerializable { /// /// Constructor. /// - public SuspendMode() + public SuspendMode() : this("suspend") + { + } + + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { + writer.WriteStartObject(); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + writer.WriteEndObject(); } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/UnassignJobOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/UnassignJobOptions.cs index 1c90036b725f..c6c5ee9c0bd3 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/UnassignJobOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/UnassignJobOptions.cs @@ -3,9 +3,6 @@ #nullable enable using System; -using System.Collections.Generic; -using System.Security.Cryptography; -using System.Text; using Azure.Core; namespace Azure.Communication.JobRouter @@ -40,5 +37,11 @@ public UnassignJobOptions(string jobId, string assignmentId) /// Unique key that identifies this job assignment. /// public string AssignmentId { get; } + + /// + /// If SuspendMatching is true, then the job is not queued for re-matching with a + /// worker. + /// + public bool? SuspendMatching { get; set; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/UnassignJobResult.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/UnassignJobResult.cs index 00b0450e9bd8..e5ed4860a4e4 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/UnassignJobResult.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/UnassignJobResult.cs @@ -3,7 +3,7 @@ using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { [CodeGenModel("UnassignJobResult")] public partial class UnassignJobResult diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/CommunicationError.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/UnknownJobMatchingMode.cs similarity index 51% rename from sdk/communication/Azure.Communication.JobRouter/src/Models/CommunicationError.cs rename to sdk/communication/Azure.Communication.JobRouter/src/Models/UnknownJobMatchingMode.cs index d9cbe3c33042..c90b82d3d396 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/CommunicationError.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/UnknownJobMatchingMode.cs @@ -6,13 +6,10 @@ using System.Text; using Azure.Core; -namespace Azure.Communication.JobRouter.Models +namespace Azure.Communication.JobRouter { - /// - /// Error model. - /// - [CodeGenModel("CommunicationError")] - internal partial class CommunicationError + [CodeGenSuppress("UnknownJobMatchingMode")] + internal partial class UnknownJobMatchingMode { } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/UnknownRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/UnknownRouterRule.cs new file mode 100644 index 000000000000..fb0de604375b --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/UnknownRouterRule.cs @@ -0,0 +1,15 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Collections.Generic; +using System.Text; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + [CodeGenSuppress("UnknownRouterRule")] + internal partial class UnknownRouterRule + { + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateClassificationPolicyOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateClassificationPolicyOptions.cs index 4381f330426e..fbfa9eb6daf8 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateClassificationPolicyOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateClassificationPolicyOptions.cs @@ -3,7 +3,6 @@ using System; using System.Collections.Generic; -using System.Text; using Azure.Core; namespace Azure.Communication.JobRouter @@ -51,5 +50,10 @@ public UpdateClassificationPolicyOptions(string classificationPolicyId) /// The worker label selectors to attach to a given job. public List WorkerSelectors { get; } = new List(); + + /// + /// The content to send as the request conditions of the request. + /// + public RequestConditions RequestConditions { get; set; } = new(); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateDistributionPolicyOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateDistributionPolicyOptions.cs index 9b0aa994dbef..f24185e3e6ba 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateDistributionPolicyOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateDistributionPolicyOptions.cs @@ -2,8 +2,6 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; -using System.Text; using Azure.Core; namespace Azure.Communication.JobRouter @@ -40,5 +38,10 @@ public UpdateDistributionPolicyOptions(string distributionPolicyId) /// Abstract base class for defining a distribution mode. public DistributionMode Mode { get; set; } + + /// + /// The content to send as the request conditions of the request. + /// + public RequestConditions RequestConditions { get; set; } = new(); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateExceptionPolicyOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateExceptionPolicyOptions.cs index 7ad62d18f8a0..5d46bbf653a9 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateExceptionPolicyOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateExceptionPolicyOptions.cs @@ -4,7 +4,6 @@ #nullable enable using System; using System.Collections.Generic; -using System.Text; using Azure.Core; namespace Azure.Communication.JobRouter @@ -36,5 +35,10 @@ public UpdateExceptionPolicyOptions(string exceptionPolicyId) /// (Optional) A dictionary collection of exception rules on the exception policy. Key is the Id of each exception rule. public IDictionary ExceptionRules { get; } = new Dictionary(); + + /// + /// The content to send as the request conditions of the request. + /// + public RequestConditions RequestConditions { get; set; } = new(); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateJobOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateJobOptions.cs index 74e2d1c5e0af..fbf7dab32574 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateJobOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateJobOptions.cs @@ -4,8 +4,6 @@ #nullable enable using System; using System.Collections.Generic; -using System.Text; -using Azure.Communication.JobRouter.Models; using Azure.Core; namespace Azure.Communication.JobRouter @@ -68,5 +66,10 @@ public UpdateJobOptions(string jobId) /// If provided, will determine how job matching will be carried out. /// public JobMatchingMode? MatchingMode { get; set; } + + /// + /// The content to send as the request conditions of the request. + /// + public RequestConditions RequestConditions { get; set; } = new(); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateQueueOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateQueueOptions.cs index f565694f22b2..94c98c8a0ed9 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateQueueOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateQueueOptions.cs @@ -43,5 +43,10 @@ public UpdateQueueOptions(string queueId) /// A set of key/value pairs that are identifying attributes used by the rules engines to make decisions. /// public IDictionary Labels { get; } = new Dictionary(); + + /// + /// The content to send as the request conditions of the request. + /// + public RequestConditions RequestConditions { get; set; } = new(); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateWorkerOptions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateWorkerOptions.cs index a3c3055cd473..8df7f86a16e7 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateWorkerOptions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/UpdateWorkerOptions.cs @@ -4,7 +4,6 @@ #nullable enable using System; using System.Collections.Generic; -using System.Text; using Azure.Core; namespace Azure.Communication.JobRouter @@ -52,5 +51,10 @@ public UpdateWorkerOptions(string workerId) /// The queue(s) that this worker can receive work from. public IDictionary QueueAssignments { get; } = new Dictionary(); + + /// + /// The content to send as the request conditions of the request. + /// + public RequestConditions RequestConditions { get; set; } = new(); } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/WaitTimeExceptionTrigger.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/WaitTimeExceptionTrigger.cs index ab0f66bd2377..37fd07996cf7 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/WaitTimeExceptionTrigger.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/WaitTimeExceptionTrigger.cs @@ -4,7 +4,7 @@ // using System; -using System.Globalization; +using System.Text.Json; using Azure.Core; #nullable disable @@ -14,11 +14,11 @@ namespace Azure.Communication.JobRouter /// Trigger for an exception action on exceeding wait time. [CodeGenModel("WaitTimeExceptionTrigger")] [CodeGenSuppress("WaitTimeExceptionTrigger", typeof(double))] - public partial class WaitTimeExceptionTrigger : ExceptionTrigger + public partial class WaitTimeExceptionTrigger : IUtf8JsonSerializable { /// Initializes a new instance of WaitTimeExceptionTrigger. /// Threshold for wait time for this trigger. - public WaitTimeExceptionTrigger(TimeSpan threshold) : this(null, threshold.TotalSeconds) + public WaitTimeExceptionTrigger(TimeSpan threshold) : this("wait-time", threshold.TotalSeconds) { } @@ -37,5 +37,15 @@ internal double _thresholdSeconds { Threshold = TimeSpan.FromSeconds(value); } } + + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("thresholdSeconds"u8); + writer.WriteNumberValue(_thresholdSeconds); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + writer.WriteEndObject(); + } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/WebhookRouterRule.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/WebhookRouterRule.cs new file mode 100644 index 000000000000..2154be87b0a2 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/WebhookRouterRule.cs @@ -0,0 +1,43 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + [CodeGenModel("WebhookRouterRule")] + [CodeGenSuppress("WebhookRouterRule")] + public partial class WebhookRouterRule : IUtf8JsonSerializable + { + /// Initializes a new instance of WebhookRouterRule. + public WebhookRouterRule(Uri authorizationServerUri, Oauth2ClientCredential clientCredential, Uri webhookUri) + : this("webhook-rule", authorizationServerUri, clientCredential, webhookUri) + { + } + + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + if (Optional.IsDefined(AuthorizationServerUri)) + { + writer.WritePropertyName("authorizationServerUri"u8); + writer.WriteStringValue(AuthorizationServerUri.AbsoluteUri); + } + if (Optional.IsDefined(ClientCredential)) + { + writer.WritePropertyName("clientCredential"u8); + writer.WriteObjectValue(ClientCredential); + } + if (Optional.IsDefined(WebhookUri)) + { + writer.WritePropertyName("webhookUri"u8); + writer.WriteStringValue(WebhookUri.AbsoluteUri); + } + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/WeightedAllocationQueueSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/WeightedAllocationQueueSelectorAttachment.cs new file mode 100644 index 000000000000..6d01d067396b --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/WeightedAllocationQueueSelectorAttachment.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core; +using System.Text.Json; + +namespace Azure.Communication.JobRouter +{ + [CodeGenModel("WeightedAllocationQueueSelectorAttachment")] + public partial class WeightedAllocationQueueSelectorAttachment : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("allocations"u8); + writer.WriteStartArray(); + foreach (var item in Allocations) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/WeightedAllocationWorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/WeightedAllocationWorkerSelectorAttachment.cs new file mode 100644 index 000000000000..d10e97c2ccb1 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/WeightedAllocationWorkerSelectorAttachment.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using Azure.Core; +using System.Text.Json; + +namespace Azure.Communication.JobRouter +{ + [CodeGenModel("WeightedAllocationWorkerSelectorAttachment")] + public partial class WeightedAllocationWorkerSelectorAttachment : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("allocations"u8); + writer.WriteStartArray(); + foreach (var item in Allocations) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/WorkerSelectorAttachment.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/WorkerSelectorAttachment.cs index cef497bb5ea6..ff650eccaf9a 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Models/WorkerSelectorAttachment.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/WorkerSelectorAttachment.cs @@ -1,6 +1,7 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. +using System.Text.Json; using System.Text.Json.Serialization; using Azure.Core; @@ -8,14 +9,14 @@ namespace Azure.Communication.JobRouter { [CodeGenModel("WorkerSelectorAttachment")] [JsonConverter(typeof(PolymorphicWriteOnlyJsonConverter))] - public abstract partial class WorkerSelectorAttachment + public abstract partial class WorkerSelectorAttachment : IUtf8JsonSerializable { - /// Initializes a new instance of QueueSelectorAttachment. - internal WorkerSelectorAttachment() + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) { + writer.WriteStartObject(); + writer.WritePropertyName("kind"u8); + writer.WriteStringValue(Kind); + writer.WriteEndObject(); } - - /// The type discriminator describing the type of label selector attachment. - protected string Kind { get; set; } } } diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Models/WorkerWeightedAllocation.cs b/sdk/communication/Azure.Communication.JobRouter/src/Models/WorkerWeightedAllocation.cs new file mode 100644 index 000000000000..4d0c866e3ae7 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Models/WorkerWeightedAllocation.cs @@ -0,0 +1,27 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.JobRouter +{ + [CodeGenModel("WorkerWeightedAllocation")] + public partial class WorkerWeightedAllocation : IUtf8JsonSerializable + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) + { + writer.WriteStartObject(); + writer.WritePropertyName("weight"u8); + writer.WriteNumberValue(Weight); + writer.WritePropertyName("workerSelectors"u8); + writer.WriteStartArray(); + foreach (var item in WorkerSelectors) + { + writer.WriteObjectValue(item); + } + writer.WriteEndArray(); + writer.WriteEndObject(); + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/src/autorest.md b/sdk/communication/Azure.Communication.JobRouter/src/autorest.md deleted file mode 100644 index 9fb1dbc8b78f..000000000000 --- a/sdk/communication/Azure.Communication.JobRouter/src/autorest.md +++ /dev/null @@ -1,27 +0,0 @@ -# Azure.Communication.JobRouter - -When a new version of the swagger needs to be updated: -1. Go to sdk\communication\Azure.Communication.JobRouter\src, and run `dotnet msbuild /t:GenerateCode` to generate code. -2. In root folder, run `eng\scripts\Export-API.ps1 -ServiceDirectory communication/Azure.Communication.JobRouter` -3. In root folder, run `eng\scripts\Update-Snippets.ps1 -ServiceDirectory communication/Azure.Communication.JobRouter` - -> see [https://aka.ms/autorest](https://aka.ms/autorest) - -## Configuration - -```yaml -tag: package-jobrouter-2022-07-18-preview -model-namespace: false -require: - - https://raw.githubusercontent.com/Azure/azure-rest-api-specs/29159d148372f5f61cb04b76fc87252b13c62515/specification/communication/data-plane/JobRouter/readme.md - -generation1-convenience-client: true -reflect-api-versions: true -protocol-method-list: - - JobRouterAdministration_UpsertClassificationPolicy - - JobRouterAdministration_UpsertDistributionPolicy - - JobRouterAdministration_UpsertExceptionPolicy - - JobRouterAdministration_UpsertQueue - - JobRouter_UpsertJob - - JobRouter_UpsertWorker -``` diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Generated/Samples/Samples_JobRouterAdministrationClient.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Generated/Samples/Samples_JobRouterAdministrationClient.cs new file mode 100644 index 000000000000..d84debe11391 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Generated/Samples/Samples_JobRouterAdministrationClient.cs @@ -0,0 +1,1084 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading.Tasks; +using Azure; +using Azure.Communication.JobRouter; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Communication.JobRouter.Samples +{ + public partial class Samples_JobRouterAdministrationClient + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDistributionPolicy_ShortVersion() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = client.GetDistributionPolicy("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetDistributionPolicy_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = await client.GetDistributionPolicyAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDistributionPolicy_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = client.GetDistributionPolicy(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetDistributionPolicy_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = await client.GetDistributionPolicyAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDistributionPolicy_AllParameters() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = client.GetDistributionPolicy("", 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()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetDistributionPolicy_AllParameters_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = await client.GetDistributionPolicyAsync("", 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()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDistributionPolicy_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = client.GetDistributionPolicy(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetDistributionPolicy_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = await client.GetDistributionPolicyAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeleteDistributionPolicy_ShortVersion() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = client.DeleteDistributionPolicy(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeleteDistributionPolicy_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = await client.DeleteDistributionPolicyAsync(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeleteDistributionPolicy_AllParameters() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = client.DeleteDistributionPolicy(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeleteDistributionPolicy_AllParameters_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = await client.DeleteDistributionPolicyAsync(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetClassificationPolicy_ShortVersion() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = client.GetClassificationPolicy("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetClassificationPolicy_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = await client.GetClassificationPolicyAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetClassificationPolicy_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = client.GetClassificationPolicy(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetClassificationPolicy_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = await client.GetClassificationPolicyAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetClassificationPolicy_AllParameters() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = client.GetClassificationPolicy("", 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()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetClassificationPolicy_AllParameters_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = await client.GetClassificationPolicyAsync("", 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()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetClassificationPolicy_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = client.GetClassificationPolicy(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetClassificationPolicy_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = await client.GetClassificationPolicyAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeleteClassificationPolicy_ShortVersion() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = client.DeleteClassificationPolicy(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeleteClassificationPolicy_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = await client.DeleteClassificationPolicyAsync(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeleteClassificationPolicy_AllParameters() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = client.DeleteClassificationPolicy(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeleteClassificationPolicy_AllParameters_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = await client.DeleteClassificationPolicyAsync(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetExceptionPolicy_ShortVersion() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = client.GetExceptionPolicy("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetExceptionPolicy_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = await client.GetExceptionPolicyAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetExceptionPolicy_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = client.GetExceptionPolicy(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetExceptionPolicy_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = await client.GetExceptionPolicyAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetExceptionPolicy_AllParameters() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = client.GetExceptionPolicy("", 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()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetExceptionPolicy_AllParameters_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = await client.GetExceptionPolicyAsync("", 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()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetExceptionPolicy_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = client.GetExceptionPolicy(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetExceptionPolicy_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = await client.GetExceptionPolicyAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeleteExceptionPolicy_ShortVersion() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = client.DeleteExceptionPolicy(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeleteExceptionPolicy_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = await client.DeleteExceptionPolicyAsync(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeleteExceptionPolicy_AllParameters() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = client.DeleteExceptionPolicy(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeleteExceptionPolicy_AllParameters_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = await client.DeleteExceptionPolicyAsync(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetQueue_ShortVersion() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = client.GetQueue("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetQueue_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = await client.GetQueueAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetQueue_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = client.GetQueue(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetQueue_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = await client.GetQueueAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetQueue_AllParameters() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = client.GetQueue("", 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()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetQueue_AllParameters_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = await client.GetQueueAsync("", 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()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetQueue_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = client.GetQueue(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetQueue_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = await client.GetQueueAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeleteQueue_ShortVersion() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = client.DeleteQueue(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeleteQueue_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = await client.DeleteQueueAsync(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeleteQueue_AllParameters() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = client.DeleteQueue(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeleteQueue_AllParameters_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + Response response = await client.DeleteQueueAsync(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDistributionPolicies_ShortVersion() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + foreach (BinaryData item in client.GetDistributionPolicies(null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetDistributionPolicies_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + await foreach (BinaryData item in client.GetDistributionPoliciesAsync(null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("distributionPolicy").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDistributionPolicies_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + foreach (DistributionPolicyItem item in client.GetDistributionPolicies()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetDistributionPolicies_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + await foreach (DistributionPolicyItem item in client.GetDistributionPoliciesAsync()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDistributionPolicies_AllParameters() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + foreach (BinaryData item in client.GetDistributionPolicies(1234, null)) + { + 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()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetDistributionPolicies_AllParameters_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + await foreach (BinaryData item in client.GetDistributionPoliciesAsync(1234, null)) + { + 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()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetDistributionPolicies_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + foreach (DistributionPolicyItem item in client.GetDistributionPolicies(maxpagesize: 1234)) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetDistributionPolicies_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + await foreach (DistributionPolicyItem item in client.GetDistributionPoliciesAsync(maxpagesize: 1234)) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetClassificationPolicies_ShortVersion() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + foreach (BinaryData item in client.GetClassificationPolicies(null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetClassificationPolicies_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + await foreach (BinaryData item in client.GetClassificationPoliciesAsync(null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("classificationPolicy").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetClassificationPolicies_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + foreach (ClassificationPolicyItem item in client.GetClassificationPolicies()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetClassificationPolicies_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + await foreach (ClassificationPolicyItem item in client.GetClassificationPoliciesAsync()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetClassificationPolicies_AllParameters() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + foreach (BinaryData item in client.GetClassificationPolicies(1234, null)) + { + 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()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetClassificationPolicies_AllParameters_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + await foreach (BinaryData item in client.GetClassificationPoliciesAsync(1234, null)) + { + 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()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetClassificationPolicies_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + foreach (ClassificationPolicyItem item in client.GetClassificationPolicies(maxpagesize: 1234)) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetClassificationPolicies_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + await foreach (ClassificationPolicyItem item in client.GetClassificationPoliciesAsync(maxpagesize: 1234)) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetExceptionPolicies_ShortVersion() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + foreach (BinaryData item in client.GetExceptionPolicies(null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetExceptionPolicies_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + await foreach (BinaryData item in client.GetExceptionPoliciesAsync(null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("exceptionPolicy").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetExceptionPolicies_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + foreach (ExceptionPolicyItem item in client.GetExceptionPolicies()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetExceptionPolicies_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + await foreach (ExceptionPolicyItem item in client.GetExceptionPoliciesAsync()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetExceptionPolicies_AllParameters() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + foreach (BinaryData item in client.GetExceptionPolicies(1234, null)) + { + 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()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetExceptionPolicies_AllParameters_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + await foreach (BinaryData item in client.GetExceptionPoliciesAsync(1234, null)) + { + 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()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetExceptionPolicies_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + foreach (ExceptionPolicyItem item in client.GetExceptionPolicies(maxpagesize: 1234)) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetExceptionPolicies_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + await foreach (ExceptionPolicyItem item in client.GetExceptionPoliciesAsync(maxpagesize: 1234)) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetQueues_ShortVersion() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + foreach (BinaryData item in client.GetQueues(null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("queue").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetQueues_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + await foreach (BinaryData item in client.GetQueuesAsync(null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("queue").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetQueues_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + foreach (RouterQueueItem item in client.GetQueues()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetQueues_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + await foreach (RouterQueueItem item in client.GetQueuesAsync()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetQueues_AllParameters() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + foreach (BinaryData item in client.GetQueues(1234, null)) + { + 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()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetQueues_AllParameters_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + await foreach (BinaryData item in client.GetQueuesAsync(1234, null)) + { + 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()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetQueues_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + foreach (RouterQueueItem item in client.GetQueues(maxpagesize: 1234)) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetQueues_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint); + + await foreach (RouterQueueItem item in client.GetQueuesAsync(maxpagesize: 1234)) + { + } + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Generated/Samples/Samples_JobRouterClient.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Generated/Samples/Samples_JobRouterClient.cs new file mode 100644 index 000000000000..1949ba0c256a --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Generated/Samples/Samples_JobRouterClient.cs @@ -0,0 +1,1595 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading.Tasks; +using Azure; +using Azure.Communication.JobRouter; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Communication.JobRouter.Samples +{ + public partial class Samples_JobRouterClient + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetJob_ShortVersion() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = client.GetJob("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetJob_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = await client.GetJobAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetJob_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = client.GetJob(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetJob_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = await client.GetJobAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetJob_AllParameters() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = client.GetJob("", 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("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetJob_AllParameters_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = await client.GetJobAsync("", 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("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetJob_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = client.GetJob(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetJob_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = await client.GetJobAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeleteJob_ShortVersion() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = client.DeleteJob(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeleteJob_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = await client.DeleteJobAsync(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeleteJob_AllParameters() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = client.DeleteJob(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeleteJob_AllParameters_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = await client.DeleteJobAsync(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CancelJob_ShortVersion() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + using RequestContent content = null; + Response response = client.CancelJob("", content); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CancelJob_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + using RequestContent content = null; + Response response = await client.CancelJobAsync("", content); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CancelJob_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = client.CancelJob(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CancelJob_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = await client.CancelJobAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CancelJob_AllParameters() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + using RequestContent content = RequestContent.Create(new + { + note = "", + dispositionCode = "", + }); + Response response = client.CancelJob("", content); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CancelJob_AllParameters_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + using RequestContent content = RequestContent.Create(new + { + note = "", + dispositionCode = "", + }); + Response response = await client.CancelJobAsync("", content); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CancelJob_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + CancelJobRequest cancelJobRequest = new CancelJobRequest + { + Note = "", + DispositionCode = "", + }; + Response response = client.CancelJob("", cancelJobRequest: cancelJobRequest); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CancelJob_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + CancelJobRequest cancelJobRequest = new CancelJobRequest + { + Note = "", + DispositionCode = "", + }; + Response response = await client.CancelJobAsync("", cancelJobRequest: cancelJobRequest); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CompleteJob_ShortVersion() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + using RequestContent content = RequestContent.Create(new + { + assignmentId = "", + }); + Response response = client.CompleteJob("", content); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CompleteJob_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + using RequestContent content = RequestContent.Create(new + { + assignmentId = "", + }); + Response response = await client.CompleteJobAsync("", content); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CompleteJob_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + CompleteJobRequest completeJobRequest = new CompleteJobRequest(""); + Response response = client.CompleteJob("", completeJobRequest); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CompleteJob_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + CompleteJobRequest completeJobRequest = new CompleteJobRequest(""); + Response response = await client.CompleteJobAsync("", completeJobRequest); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CompleteJob_AllParameters() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + using RequestContent content = RequestContent.Create(new + { + assignmentId = "", + note = "", + }); + Response response = client.CompleteJob("", content); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CompleteJob_AllParameters_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + using RequestContent content = RequestContent.Create(new + { + assignmentId = "", + note = "", + }); + Response response = await client.CompleteJobAsync("", content); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CompleteJob_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + CompleteJobRequest completeJobRequest = new CompleteJobRequest("") + { + Note = "", + }; + Response response = client.CompleteJob("", completeJobRequest); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CompleteJob_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + CompleteJobRequest completeJobRequest = new CompleteJobRequest("") + { + Note = "", + }; + Response response = await client.CompleteJobAsync("", completeJobRequest); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CloseJob_ShortVersion() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + using RequestContent content = RequestContent.Create(new + { + assignmentId = "", + }); + Response response = client.CloseJob("", content); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CloseJob_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + using RequestContent content = RequestContent.Create(new + { + assignmentId = "", + }); + Response response = await client.CloseJobAsync("", content); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CloseJob_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + CloseJobRequest closeJobRequest = new CloseJobRequest(""); + Response response = client.CloseJob("", closeJobRequest); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CloseJob_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + CloseJobRequest closeJobRequest = new CloseJobRequest(""); + Response response = await client.CloseJobAsync("", closeJobRequest); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CloseJob_AllParameters() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + using RequestContent content = RequestContent.Create(new + { + assignmentId = "", + dispositionCode = "", + closeAt = "2022-05-10T14:57:31.2311892-04:00", + note = "", + }); + Response response = client.CloseJob("", content); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CloseJob_AllParameters_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + using RequestContent content = RequestContent.Create(new + { + assignmentId = "", + dispositionCode = "", + closeAt = "2022-05-10T14:57:31.2311892-04:00", + note = "", + }); + Response response = await client.CloseJobAsync("", content); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_CloseJob_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + CloseJobRequest closeJobRequest = new CloseJobRequest("") + { + DispositionCode = "", + CloseAt = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + Note = "", + }; + Response response = client.CloseJob("", closeJobRequest); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_CloseJob_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + CloseJobRequest closeJobRequest = new CloseJobRequest("") + { + DispositionCode = "", + CloseAt = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + Note = "", + }; + Response response = await client.CloseJobAsync("", closeJobRequest); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetQueuePosition_ShortVersion() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = client.GetQueuePosition("", null); + + 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()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetQueuePosition_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = await client.GetQueuePositionAsync("", null); + + 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()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetQueuePosition_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = client.GetQueuePosition(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetQueuePosition_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = await client.GetQueuePositionAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetQueuePosition_AllParameters() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = client.GetQueuePosition("", null); + + 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()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetQueuePosition_AllParameters_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = await client.GetQueuePositionAsync("", null); + + 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()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetQueuePosition_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = client.GetQueuePosition(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetQueuePosition_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = await client.GetQueuePositionAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_UnassignJob_ShortVersion() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + using RequestContent content = null; + Response response = client.UnassignJob("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("unassignmentCount").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_UnassignJob_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + using RequestContent content = null; + Response response = await client.UnassignJobAsync("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("unassignmentCount").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_UnassignJob_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = client.UnassignJob("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_UnassignJob_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = await client.UnassignJobAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_UnassignJob_AllParameters() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + using RequestContent content = RequestContent.Create(new + { + suspendMatching = true, + }); + Response response = client.UnassignJob("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("unassignmentCount").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_UnassignJob_AllParameters_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + using RequestContent content = RequestContent.Create(new + { + suspendMatching = true, + }); + Response response = await client.UnassignJobAsync("", "", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("jobId").ToString()); + Console.WriteLine(result.GetProperty("unassignmentCount").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_UnassignJob_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + UnassignJobRequest unassignJobRequest = new UnassignJobRequest + { + SuspendMatching = true, + }; + Response response = client.UnassignJob("", "", unassignJobRequest: unassignJobRequest); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_UnassignJob_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + UnassignJobRequest unassignJobRequest = new UnassignJobRequest + { + SuspendMatching = true, + }; + Response response = await client.UnassignJobAsync("", "", unassignJobRequest: unassignJobRequest); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AcceptJobOffer_ShortVersion() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = client.AcceptJobOffer("", "", null); + + 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()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AcceptJobOffer_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = await client.AcceptJobOfferAsync("", "", null); + + 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()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AcceptJobOffer_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = client.AcceptJobOffer("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AcceptJobOffer_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = await client.AcceptJobOfferAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AcceptJobOffer_AllParameters() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = client.AcceptJobOffer("", "", null); + + 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()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AcceptJobOffer_AllParameters_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = await client.AcceptJobOfferAsync("", "", null); + + 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()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_AcceptJobOffer_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = client.AcceptJobOffer("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_AcceptJobOffer_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = await client.AcceptJobOfferAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeclineJobOffer_ShortVersion() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + using RequestContent content = null; + Response response = client.DeclineJobOffer("", "", content); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeclineJobOffer_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + using RequestContent content = null; + Response response = await client.DeclineJobOfferAsync("", "", content); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeclineJobOffer_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = client.DeclineJobOffer("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeclineJobOffer_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = await client.DeclineJobOfferAsync("", ""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeclineJobOffer_AllParameters() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + using RequestContent content = RequestContent.Create(new + { + retryOfferAt = "2022-05-10T14:57:31.2311892-04:00", + }); + Response response = client.DeclineJobOffer("", "", content); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeclineJobOffer_AllParameters_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + using RequestContent content = RequestContent.Create(new + { + retryOfferAt = "2022-05-10T14:57:31.2311892-04:00", + }); + Response response = await client.DeclineJobOfferAsync("", "", content); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeclineJobOffer_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + DeclineJobOfferRequest declineJobOfferRequest = new DeclineJobOfferRequest + { + RetryOfferAt = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + }; + Response response = client.DeclineJobOffer("", "", declineJobOfferRequest: declineJobOfferRequest); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeclineJobOffer_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + DeclineJobOfferRequest declineJobOfferRequest = new DeclineJobOfferRequest + { + RetryOfferAt = DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), + }; + Response response = await client.DeclineJobOfferAsync("", "", declineJobOfferRequest: declineJobOfferRequest); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetQueueStatistics_ShortVersion() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = client.GetQueueStatistics("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("queueId").ToString()); + Console.WriteLine(result.GetProperty("length").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetQueueStatistics_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = await client.GetQueueStatisticsAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("queueId").ToString()); + Console.WriteLine(result.GetProperty("length").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetQueueStatistics_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = client.GetQueueStatistics(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetQueueStatistics_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = await client.GetQueueStatisticsAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetQueueStatistics_AllParameters() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = client.GetQueueStatistics("", null); + + 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()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetQueueStatistics_AllParameters_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = await client.GetQueueStatisticsAsync("", null); + + 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()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetQueueStatistics_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = client.GetQueueStatistics(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetQueueStatistics_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = await client.GetQueueStatisticsAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetWorker_ShortVersion() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = client.GetWorker("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetWorker_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = await client.GetWorkerAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetWorker_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = client.GetWorker(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetWorker_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = await client.GetWorkerAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetWorker_AllParameters() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = client.GetWorker("", 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()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetWorker_AllParameters_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = await client.GetWorkerAsync("", 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()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetWorker_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = client.GetWorker(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetWorker_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = await client.GetWorkerAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeleteWorker_ShortVersion() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = client.DeleteWorker(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeleteWorker_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = await client.DeleteWorkerAsync(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DeleteWorker_AllParameters() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = client.DeleteWorker(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DeleteWorker_AllParameters_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + Response response = await client.DeleteWorkerAsync(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetJobs_ShortVersion() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + foreach (BinaryData item in client.GetJobs(null, null, null, null, null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("job").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetJobs_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + await foreach (BinaryData item in client.GetJobsAsync(null, null, null, null, null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("job").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetJobs_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + foreach (RouterJobItem item in client.GetJobs()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetJobs_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + await foreach (RouterJobItem item in client.GetJobsAsync()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetJobs_AllParameters() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + foreach (BinaryData item in client.GetJobs(1234, "all", "", "", "", DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), null)) + { + 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("kind").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetJobs_AllParameters_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + await foreach (BinaryData item in client.GetJobsAsync(1234, "all", "", "", "", DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), null)) + { + 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("kind").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetJobs_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + foreach (RouterJobItem item in client.GetJobs(maxpagesize: 1234, status: RouterJobStatusSelector.All, queueId: "", channelId: "", classificationPolicyId: "", scheduledBefore: DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), scheduledAfter: DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"))) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetJobs_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + await foreach (RouterJobItem item in client.GetJobsAsync(maxpagesize: 1234, status: RouterJobStatusSelector.All, queueId: "", channelId: "", classificationPolicyId: "", scheduledBefore: DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"), scheduledAfter: DateTimeOffset.Parse("2022-05-10T14:57:31.2311892-04:00"))) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetWorkers_ShortVersion() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + foreach (BinaryData item in client.GetWorkers(null, null, null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("worker").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetWorkers_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + await foreach (BinaryData item in client.GetWorkersAsync(null, null, null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("worker").GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("etag").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetWorkers_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + foreach (RouterWorkerItem item in client.GetWorkers()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetWorkers_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + await foreach (RouterWorkerItem item in client.GetWorkersAsync()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetWorkers_AllParameters() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + foreach (BinaryData item in client.GetWorkers(1234, "active", "", "", true, null)) + { + 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()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetWorkers_AllParameters_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + await foreach (BinaryData item in client.GetWorkersAsync(1234, "active", "", "", true, null)) + { + 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()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_GetWorkers_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + foreach (RouterWorkerItem item in client.GetWorkers(maxpagesize: 1234, state: RouterWorkerStateSelector.Active, channelId: "", queueId: "", hasCapacity: true)) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_GetWorkers_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + JobRouterClient client = new JobRouterClient(endpoint); + + await foreach (RouterWorkerItem item in client.GetWorkersAsync(maxpagesize: 1234, state: RouterWorkerStateSelector.Active, channelId: "", queueId: "", hasCapacity: true)) + { + } + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Infrastructure/RouterLiveTestBase.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Infrastructure/RouterLiveTestBase.cs index 52a111411a20..1c30cdf30224 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Infrastructure/RouterLiveTestBase.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Infrastructure/RouterLiveTestBase.cs @@ -9,7 +9,6 @@ using System.Security.Cryptography; using System.Text; using System.Threading.Tasks; -using Azure.Communication.JobRouter.Models; using Azure.Core.TestFramework; using Azure.Core.TestFramework.Models; using NUnit.Framework; @@ -161,7 +160,7 @@ protected async Task> CreateDistributionPolicy(stri #region Support assertions - protected void AssertQueueResponseIsEqual(Response upsertQueueResponse, string queueId, string distributionPolicyId, string? queueName = default, IDictionary? queueLabels = default, string? exceptionPolicyId = default) + protected void AssertQueueResponseIsEqual(Response upsertQueueResponse, string queueId, string distributionPolicyId, string? queueName = default, IDictionary? queueLabels = default, string? exceptionPolicyId = default) { var response = upsertQueueResponse.Value; diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/ClassificationPolicyLiveTests.cs b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/ClassificationPolicyLiveTests.cs index 2e3ac7494198..e4dea0a93529 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/ClassificationPolicyLiveTests.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/ClassificationPolicyLiveTests.cs @@ -1,12 +1,10 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Azure.Communication.JobRouter.Tests.Infrastructure; using Azure.Core; -using Azure.Core.TestFramework; using NUnit.Framework; namespace Azure.Communication.JobRouter.Tests.RouterClients @@ -224,32 +222,6 @@ public async Task CreateWorkerRequirementsClassificationPolicyTest() Assert.AreEqual(1, getClassificationPolicyResponse.Value.WorkerSelectors.Count); } - [Test] - public async Task CreateClassificationPolicyAndRemoveAProperty() - { - JobRouterAdministrationClient routerClient = CreateRouterAdministrationClientWithConnectionString(); - - var classificationPolicyId = GenerateUniqueId($"{nameof(CreateClassificationPolicyAndRemoveAProperty)}-ClassicationPolicy_w_WSelector"); - var classificationPolicyName = $"Priority-ClassificationPolicy"; - var createClassificationPolicyResponse = await routerClient.CreateClassificationPolicyAsync( - new CreateClassificationPolicyOptions(classificationPolicyId) - { - Name = classificationPolicyName, - WorkerSelectors = { new StaticWorkerSelectorAttachment(new RouterWorkerSelector("department", LabelOperator.Equal, new LabelValue("sales"))) } - }); - - AddForCleanup(new Task(async () => await routerClient.DeleteClassificationPolicyAsync(classificationPolicyId))); - - Assert.False(string.IsNullOrWhiteSpace(createClassificationPolicyResponse.Value.Name)); - - var updatedPolicyResponse = await routerClient.UpdateClassificationPolicyAsync(classificationPolicyId, - RequestContent.Create(new { Name = (string?)null })); - - var retrievedPolicy = await routerClient.GetClassificationPolicyAsync(classificationPolicyId); - - Assert.True(string.IsNullOrWhiteSpace(retrievedPolicy.Value.Name)); - } - #endregion Classification Policy Tests } } diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/DateTimeOffsetParserTests.cs b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/DateTimeOffsetParserTests.cs index 8559c22a09de..7c426b3bcb69 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/DateTimeOffsetParserTests.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/DateTimeOffsetParserTests.cs @@ -2,11 +2,6 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; -using System.Globalization; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using NUnit.Framework; namespace Azure.Communication.JobRouter.Tests.RouterClients diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/DistributionPolicyLiveTests.cs b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/DistributionPolicyLiveTests.cs index fe89cf06ae96..f763f2d8f444 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/DistributionPolicyLiveTests.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/DistributionPolicyLiveTests.cs @@ -4,9 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; using System.Threading.Tasks; -using Azure.Communication.JobRouter.Models; using Azure.Communication.JobRouter.Tests.Infrastructure; using Azure.Core; using Azure.Core.TestFramework; @@ -50,14 +48,7 @@ public async Task CreateDistributionPolicyTest_BestWorker_DefaultScoringRule() new UpdateDistributionPolicyOptions(bestWorkerModeDistributionPolicyId) { OfferExpiresAfter = TimeSpan.FromSeconds(60), - Mode = new BestWorkerMode - { - BypassSelectors = true, - ScoringRuleOptions = new ScoringRuleOptions - { - DescendingOrder = false - } - }, + Mode = new BestWorkerMode(descendingOrder: false, bypassSelectors: true), Name = bestWorkerModeDistributionPolicyName }); @@ -268,38 +259,6 @@ public async Task CreateDistributionPolicyTest_RoundRobin() #endregion round robin mode constructors - #region sanity checks - - [Test] - public async Task CreateDistributionPolicyAndRemoveAProperty() - { - JobRouterAdministrationClient routerClient = CreateRouterAdministrationClientWithConnectionString(); - // test best worker mode constructors - - // --- default scoring rule - var bestWorkerModeDistributionPolicyId = GenerateUniqueId($"{nameof(CreateDistributionPolicyAndRemoveAProperty)}-Default-DistributionPolicy"); - var bestWorkerModeDistributionPolicyName = $"{bestWorkerModeDistributionPolicyId}-Name"; - var bestWorkerModeDistributionPolicyResponse = await routerClient.CreateDistributionPolicyAsync( - new CreateDistributionPolicyOptions(bestWorkerModeDistributionPolicyId, TimeSpan.FromSeconds(60), new BestWorkerMode()) - { - Name = bestWorkerModeDistributionPolicyName - }); - - AddForCleanup(new Task(async () => await routerClient.DeleteDistributionPolicyAsync(bestWorkerModeDistributionPolicyId))); - - Assert.False(string.IsNullOrWhiteSpace(bestWorkerModeDistributionPolicyResponse.Value.Name)); - - var updatedDistributionPolicyResponse = - await routerClient.UpdateDistributionPolicyAsync(bestWorkerModeDistributionPolicyId, - RequestContent.Create(new { Name = (string?)null })); - - var retrievedPolicy = await routerClient.GetDistributionPolicyAsync(bestWorkerModeDistributionPolicyId); - - Assert.True(string.IsNullOrWhiteSpace(retrievedPolicy.Value.Name)); - } - - #endregion sanity checks - #endregion Distribution Policy Tests } } diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/ExceptionPolicyLiveTests.cs b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/ExceptionPolicyLiveTests.cs index 406b56c7bd96..a96bba086340 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/ExceptionPolicyLiveTests.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/ExceptionPolicyLiveTests.cs @@ -1,14 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using System; using System.Collections.Generic; using System.Linq; -using System.Text; using System.Threading.Tasks; using Azure.Communication.JobRouter.Tests.Infrastructure; using Azure.Core; -using Azure.Core.TestFramework; using NUnit.Framework; namespace Azure.Communication.JobRouter.Tests.RouterClients @@ -179,65 +176,6 @@ public async Task CreateExceptionPolicyTest_WaitTime() Assert.AreEqual(exceptionPolicyName, exceptionPolicy.Name); } - [Test] - public async Task CreateExceptionPolicyAndRemoveProperty() - { - JobRouterAdministrationClient routerClient = CreateRouterAdministrationClientWithConnectionString(); - - var createDistributionPolicyResponse = await CreateDistributionPolicy(nameof(CreateExceptionPolicyAndRemoveProperty)); - var queueId = GenerateUniqueId(IdPrefix, nameof(CreateExceptionPolicyAndRemoveProperty)); - var createQueueResponse = await routerClient.CreateQueueAsync(new CreateQueueOptions(queueId, - createDistributionPolicyResponse.Value.Id)); - - var classificationPolicyId = GenerateUniqueId($"{IdPrefix}{nameof(CreateExceptionPolicyAndRemoveProperty)}"); - var createClassificationPolicyResponse = await routerClient.CreateClassificationPolicyAsync( - new CreateClassificationPolicyOptions(classificationPolicyId) - { - PrioritizationRule = new StaticRouterRule(new LabelValue(1)) - }); - var exceptionPolicyId = GenerateUniqueId($"{IdPrefix}{nameof(CreateExceptionPolicyAndRemoveProperty)}"); - - var labelsToUpsert = new Dictionary() { ["Label_1"] = new LabelValue("Value_1") }; - // exception rules - var exceptionRuleId = GenerateUniqueId($"{IdPrefix}-ExceptionRule"); - var reclassifyActionId = GenerateUniqueId($"{IdPrefix}-ReclassifyExceptionAction"); - var manualReclassifyActionId = GenerateUniqueId($"{IdPrefix}-ManualReclassifyAction"); - var rules = new Dictionary() - { - [exceptionRuleId] = new ExceptionRule(new QueueLengthExceptionTrigger(1), - new Dictionary() - { - [reclassifyActionId] = new ReclassifyExceptionAction(classificationPolicyId) - { - LabelsToUpsert = labelsToUpsert - }, - [manualReclassifyActionId] = new ManualReclassifyExceptionAction - { - QueueId = createQueueResponse.Value.Id, - Priority = 1, - WorkerSelectors = { new RouterWorkerSelector("abc", LabelOperator.Equal, new LabelValue(1)) } - } - } - ) - }; - - var createExceptionPolicyResponse = await routerClient.CreateExceptionPolicyAsync(new CreateExceptionPolicyOptions(exceptionPolicyId, rules) - { - Name = "FakeExceptionPolicyFriendlyName" - }); - - AddForCleanup(new Task(async () => await routerClient.DeleteExceptionPolicyAsync(exceptionPolicyId))); - - Assert.False(string.IsNullOrWhiteSpace(createExceptionPolicyResponse.Value.Name)); - - var updatedExpcetionPolicyResponse = await routerClient.UpdateExceptionPolicyAsync(exceptionPolicyId, - RequestContent.Create(new { Name = (string?)null })); - - var retrievedPolicy = await routerClient.GetExceptionPolicyAsync(exceptionPolicyId); - - Assert.True(string.IsNullOrWhiteSpace(retrievedPolicy.Value.Name)); - } - #endregion Exception Policy Tests } } diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/JobQueueLiveTests.cs b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/JobQueueLiveTests.cs index 863b83a5b059..0126e2dd0c1c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/JobQueueLiveTests.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/JobQueueLiveTests.cs @@ -1,14 +1,11 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using System; using System.Collections.Generic; using System.Linq; -using System.Text; using System.Threading.Tasks; using Azure.Communication.JobRouter.Tests.Infrastructure; using Azure.Core; -using Azure.Core.TestFramework; using NUnit.Framework; namespace Azure.Communication.JobRouter.Tests.RouterClients @@ -88,31 +85,6 @@ public async Task UpdateQueueTest() }); } - [Test] - public async Task CreateQueueAndRemoveProperty() - { - JobRouterAdministrationClient routerClient = CreateRouterAdministrationClientWithConnectionString(); - var createDistributionPolicyResponse = await CreateDistributionPolicy(nameof(CreateQueueAndRemoveProperty)); - var queueId = GenerateUniqueId(IdPrefix, nameof(CreateQueueAndRemoveProperty)); - var queueName = "DefaultQueueWithLabels" + queueId; - var createQueueResponse = await routerClient.CreateQueueAsync( - new CreateQueueOptions(queueId, - createDistributionPolicyResponse.Value.Id) - { - Name = queueName, - Labels = { ["Label_1"] = new LabelValue("Value_1") } - }); - AddForCleanup(new Task(async () => await routerClient.DeleteQueueAsync(createQueueResponse.Value.Id))); - - Assert.False(string.IsNullOrWhiteSpace(createQueueResponse.Value.Name)); - - var updatedQueueResponse = - await routerClient.UpdateQueueAsync(queueId, RequestContent.Create(new { Name = (string?)null })); - - var queriedQueue = await routerClient.GetQueueAsync(queueId); - Assert.True(string.IsNullOrWhiteSpace(queriedQueue.Value.Name)); - } - #endregion Queue Tests } } diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/RouterClientCrudTests.cs b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/RouterClientCrudTests.cs index 517e9fbf1e8f..f6fa571fcba0 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/RouterClientCrudTests.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/RouterClientCrudTests.cs @@ -50,7 +50,6 @@ public async Task NullOrEmptyIdThrowsError_SetClassificationPolicyAsync(string? [Test] [TestCase(null, typeof(ArgumentNullException))] [TestCase("", typeof(ArgumentException))] - [TestCase(" ", typeof(ArgumentException))] public void NullOrEmptyIdThrowsError_GetClassificationPolicy(string? input, Type exceptionType) { var client = CreateMockRouterAdministrationClient(200); @@ -67,7 +66,6 @@ public void NullOrEmptyIdThrowsError_GetClassificationPolicy(string? input, Type [Test] [TestCase(null, typeof(ArgumentNullException))] [TestCase("", typeof(ArgumentException))] - [TestCase(" ", typeof(ArgumentException))] public async Task NullOrEmptyIdThrowsError_GetClassificationPolicyAsync(string? input, Type exceptionType) { var client = CreateMockRouterAdministrationClient(200); @@ -84,7 +82,6 @@ public async Task NullOrEmptyIdThrowsError_GetClassificationPolicyAsync(string? [Test] [TestCase(null, typeof(ArgumentNullException))] [TestCase("", typeof(ArgumentException))] - [TestCase(" ", typeof(ArgumentException))] public void NullOrEmptyIdThrowsError_DeleteClassificationPolicy(string? input, Type exceptionType) { var client = CreateMockRouterAdministrationClient(200); @@ -101,7 +98,6 @@ public void NullOrEmptyIdThrowsError_DeleteClassificationPolicy(string? input, T [Test] [TestCase(null, typeof(ArgumentNullException))] [TestCase("", typeof(ArgumentException))] - [TestCase(" ", typeof(ArgumentException))] public async Task NullOrEmptyIdThrowsError_DeleteClassificationPolicyAsync(string? input, Type exceptionType) { var client = CreateMockRouterAdministrationClient(200); @@ -156,7 +152,6 @@ public async Task NullOrEmptyIdThrowsError_SetDistributionPolicyAsync(string? in [Test] [TestCase(null, typeof(ArgumentNullException))] [TestCase("", typeof(ArgumentException))] - [TestCase(" ", typeof(ArgumentException))] public void NullOrEmptyIdThrowsError_GetDistributionPolicy(string? input, Type exceptionType) { var client = CreateMockRouterAdministrationClient(200); @@ -173,7 +168,6 @@ public void NullOrEmptyIdThrowsError_GetDistributionPolicy(string? input, Type e [Test] [TestCase(null, typeof(ArgumentNullException))] [TestCase("", typeof(ArgumentException))] - [TestCase(" ", typeof(ArgumentException))] public async Task NullOrEmptyIdThrowsError_GetDistributionPolicyAsync(string? input, Type exceptionType) { var client = CreateMockRouterAdministrationClient(200); @@ -190,7 +184,6 @@ public async Task NullOrEmptyIdThrowsError_GetDistributionPolicyAsync(string? in [Test] [TestCase(null, typeof(ArgumentNullException))] [TestCase("", typeof(ArgumentException))] - [TestCase(" ", typeof(ArgumentException))] public void NullOrEmptyIdThrowsError_DeleteDistributionPolicy(string? input, Type exceptionType) { var client = CreateMockRouterAdministrationClient(200); @@ -207,7 +200,6 @@ public void NullOrEmptyIdThrowsError_DeleteDistributionPolicy(string? input, Typ [Test] [TestCase(null, typeof(ArgumentNullException))] [TestCase("", typeof(ArgumentException))] - [TestCase(" ", typeof(ArgumentException))] public async Task NullOrEmptyIdThrowsError_DeleteDistributionPolicyAsync(string? input, Type exceptionType) { var client = CreateMockRouterAdministrationClient(200); @@ -262,7 +254,6 @@ public async Task NullOrEmptyIdThrowsError_SetExceptionAsync(string input, Type [Test] [TestCase(null, typeof(ArgumentNullException))] [TestCase("", typeof(ArgumentException))] - [TestCase(" ", typeof(ArgumentException))] public void NullOrEmptyIdThrowsError_GetExceptionPolicy(string? input, Type exceptionType) { var client = CreateMockRouterAdministrationClient(200); @@ -279,7 +270,6 @@ public void NullOrEmptyIdThrowsError_GetExceptionPolicy(string? input, Type exce [Test] [TestCase(null, typeof(ArgumentNullException))] [TestCase("", typeof(ArgumentException))] - [TestCase(" ", typeof(ArgumentException))] public async Task NullOrEmptyIdThrowsError_GetExceptionPolicyAsync(string? input, Type exceptionType) { var client = CreateMockRouterAdministrationClient(200); @@ -296,7 +286,6 @@ public async Task NullOrEmptyIdThrowsError_GetExceptionPolicyAsync(string? input [Test] [TestCase(null, typeof(ArgumentNullException))] [TestCase("", typeof(ArgumentException))] - [TestCase(" ", typeof(ArgumentException))] public void NullOrEmptyIdThrowsError_DeleteExceptionPolicy(string? input, Type exceptionType) { var client = CreateMockRouterAdministrationClient(200); @@ -313,7 +302,6 @@ public void NullOrEmptyIdThrowsError_DeleteExceptionPolicy(string? input, Type e [Test] [TestCase(null, typeof(ArgumentNullException))] [TestCase("", typeof(ArgumentException))] - [TestCase(" ", typeof(ArgumentException))] public async Task NullOrEmptyIdThrowsError_DeleteExceptionPolicyAsync(string? input, Type exceptionType) { var client = CreateMockRouterAdministrationClient(200); @@ -380,7 +368,6 @@ public async Task NullOrEmptyIdThrowsError_SetQueueAsync(string?[] input, Type e [Test] [TestCase(null, typeof(ArgumentNullException))] [TestCase("", typeof(ArgumentException))] - [TestCase(" ", typeof(ArgumentException))] public void NullOrEmptyIdThrowsError_GetQueue(string? input, Type exceptionType) { var client = CreateMockRouterAdministrationClient(200); @@ -397,7 +384,6 @@ public void NullOrEmptyIdThrowsError_GetQueue(string? input, Type exceptionType) [Test] [TestCase(null, typeof(ArgumentNullException))] [TestCase("", typeof(ArgumentException))] - [TestCase(" ", typeof(ArgumentException))] public async Task NullOrEmptyIdThrowsError_GetQueueAsync(string? input, Type exceptionType) { var client = CreateMockRouterAdministrationClient(200); @@ -414,7 +400,6 @@ public async Task NullOrEmptyIdThrowsError_GetQueueAsync(string? input, Type exc [Test] [TestCase(null, typeof(ArgumentNullException))] [TestCase("", typeof(ArgumentException))] - [TestCase(" ", typeof(ArgumentException))] public void NullOrEmptyIdThrowsError_DeleteQueue(string? input, Type exceptionType) { var client = CreateMockRouterAdministrationClient(200); @@ -431,7 +416,6 @@ public void NullOrEmptyIdThrowsError_DeleteQueue(string? input, Type exceptionTy [Test] [TestCase(null, typeof(ArgumentNullException))] [TestCase("", typeof(ArgumentException))] - [TestCase(" ", typeof(ArgumentException))] public async Task NullOrEmptyIdThrowsError_DeleteQueueAsync(string? input, Type exceptionType) { var client = CreateMockRouterAdministrationClient(200); @@ -486,7 +470,6 @@ public async Task NullOrEmptyIdThrowsError_RegisterWorkerAsync(string? input, Ty [Test] [TestCase(null, typeof(ArgumentNullException))] [TestCase("", typeof(ArgumentException))] - [TestCase(" ", typeof(ArgumentException))] public void NullOrEmptyIdThrowsError_GetWorker(string? input, Type exceptionType) { var client = CreateMockRouterClient(200); @@ -503,7 +486,6 @@ public void NullOrEmptyIdThrowsError_GetWorker(string? input, Type exceptionType [Test] [TestCase(null, typeof(ArgumentNullException))] [TestCase("", typeof(ArgumentException))] - [TestCase(" ", typeof(ArgumentException))] public async Task NullOrEmptyIdThrowsError_GetWorkerAsync(string? input, Type exceptionType) { var client = CreateMockRouterClient(200); diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/RouterJobLiveTests.cs b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/RouterJobLiveTests.cs index 6ad4f4176a0f..ae80b59bc58b 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/RouterJobLiveTests.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/RouterJobLiveTests.cs @@ -2,11 +2,9 @@ // Licensed under the MIT License. using System; -using System.Collections.Concurrent; using System.Collections.Generic; -using System.Linq; +using System.Threading; using System.Threading.Tasks; -using Azure.Communication.JobRouter.Models; using Azure.Communication.JobRouter.Tests.Infrastructure; using Azure.Core; using Azure.Core.TestFramework; @@ -122,11 +120,7 @@ public async Task GetJobsTest() Assert.AreEqual(RouterJobStatus.Queued, job2Result.Value.Status); // test get jobs - var getJobsResponse = routerClient.GetJobsAsync(new GetJobsOptions() - { - ChannelId = channelId, - QueueId = createQueue.Id, - }); + var getJobsResponse = routerClient.GetJobsAsync(channelId: channelId, queueId: createQueue.Id); var allJobs = new List(); await foreach (var jobPage in getJobsResponse.AsPages(pageSizeHint: 1)) @@ -159,19 +153,14 @@ public async Task GetJobsWithSchedulingFiltersTest() new CreateJobOptions(jobId1, channelId, createQueue.Id) { Priority = 1, - MatchingMode = new JobMatchingMode(new ScheduleAndSuspendMode(timeToEnqueueJob)), + MatchingMode = new ScheduleAndSuspendMode(timeToEnqueueJob), }); AddForCleanup(new Task(async () => await routerClient.CancelJobAsync(new CancelJobOptions(jobId1)))); AddForCleanup(new Task(async () => await routerClient.DeleteJobAsync(jobId1))); var createJob1 = createJob1Response.Value; // test get jobs - var getJobsResponse = routerClient.GetJobsAsync(new GetJobsOptions() - { - ChannelId = channelId, - QueueId = createQueue.Id, - ScheduledAfter = timeToEnqueueJob, - }); + var getJobsResponse = routerClient.GetJobsAsync(channelId: channelId, queueId: createQueue.Id, scheduledAfter: timeToEnqueueJob); var allJobs = new List(); await foreach (var jobPage in getJobsResponse.AsPages(pageSizeHint: 1)) @@ -380,34 +369,6 @@ public async Task CreateJobWithQueue_And_ClassificationPolicy_w_FallbackQueue() Assert.AreEqual(createQueue1.Id, queuedJob.Value.QueueId); // from queue selector in classification policy } - [Test] - public async Task CreateJobAndRemoveProperty() - { - JobRouterClient routerClient = CreateRouterClientWithConnectionString(); - var channelId = GenerateUniqueId($"{nameof(CreateJobAndRemoveProperty)}-Channel"); - - // Setup queue - var createQueueResponse = await CreateQueueAsync(nameof(CreateJobAndRemoveProperty)); - var createQueue = createQueueResponse.Value; - - // Create 1 job - var jobId1 = GenerateUniqueId($"{IdPrefix}{nameof(CreateJobAndRemoveProperty)}1"); - var createJob1Response = await routerClient.CreateJobAsync( - new CreateJobOptions(jobId1, channelId, createQueue.Id) - { - Priority = 1, - ChannelReference = "IncorrectValue", - }); - var createJob1 = createJob1Response.Value; - AddForCleanup(new Task(async () => await routerClient.DeleteJobAsync(createJob1.Id))); - - var updatedJob1Response = await routerClient.UpdateJobAsync(createJob1.Id, RequestContent.Create(new { ChannelReference = (string?)null })); - - var retrievedJob = await routerClient.GetJobAsync(jobId1); - - Assert.True(string.IsNullOrWhiteSpace(retrievedJob.Value.ChannelReference)); - } - [Test] public async Task CreateJobWithQueueAndMatchMode() { @@ -425,15 +386,12 @@ public async Task CreateJobWithQueueAndMatchMode() { Priority = 1, ChannelReference = "IncorrectValue", - MatchingMode = new JobMatchingMode(new QueueAndMatchMode()), + MatchingMode = new QueueAndMatchMode(), }); var createJob1 = createJob1Response.Value; AddForCleanup(new Task(async () => await routerClient.DeleteJobAsync(createJob1.Id))); - Assert.IsTrue(createJob1.MatchingMode.ModeType == JobMatchModeType.QueueAndMatchMode); - Assert.IsNull(createJob1.MatchingMode.ScheduleAndSuspendMode); - Assert.IsNull(createJob1.MatchingMode.SuspendMode); - Assert.IsNotNull(createJob1.MatchingMode.QueueAndMatchMode); + Assert.IsTrue(createJob1.MatchingMode.GetType() == typeof(QueueAndMatchMode)); } [Test] @@ -453,15 +411,12 @@ public async Task CreateJobWithSuspendMode() { Priority = 1, ChannelReference = "IncorrectValue", - MatchingMode = new JobMatchingMode(new SuspendMode()), + MatchingMode = new SuspendMode(), }); var createJob1 = createJob1Response.Value; AddForCleanup(new Task(async () => await routerClient.DeleteJobAsync(createJob1.Id))); - Assert.IsTrue(createJob1.MatchingMode.ModeType == JobMatchModeType.SuspendMode); - Assert.IsNull(createJob1.MatchingMode.ScheduleAndSuspendMode); - Assert.IsNotNull(createJob1.MatchingMode.SuspendMode); - Assert.IsNull(createJob1.MatchingMode.QueueAndMatchMode); + Assert.IsTrue(createJob1.MatchingMode.GetType() == typeof(SuspendMode)); } [Test] @@ -482,15 +437,12 @@ public async Task CreateJobWithScheduleAndSuspendMode() { Priority = 1, ChannelReference = "IncorrectValue", - MatchingMode = new JobMatchingMode(new ScheduleAndSuspendMode(timeToEnqueueJob)), + MatchingMode = new ScheduleAndSuspendMode(timeToEnqueueJob), }); var createJob1 = createJob1Response.Value; AddForCleanup(new Task(async () => await routerClient.DeleteJobAsync(createJob1.Id))); - Assert.IsTrue(createJob1.MatchingMode.ModeType == JobMatchModeType.ScheduleAndSuspendMode); - Assert.IsNotNull(createJob1.MatchingMode.ScheduleAndSuspendMode); - Assert.IsNull(createJob1.MatchingMode.SuspendMode); - Assert.IsNull(createJob1.MatchingMode.QueueAndMatchMode); + Assert.IsTrue(createJob1.MatchingMode.GetType() == typeof(ScheduleAndSuspendMode)); } [Test] @@ -586,7 +538,12 @@ public async Task ReclassifyJob() var createJob1 = createJob1Response.Value; AddForCleanup(new Task(async () => await routerClient.DeleteJobAsync(createJob1.Id))); - await routerClient.ReclassifyJobAsync(jobId1); + if (Mode != RecordedTestMode.Playback) + { + await Task.Delay(TimeSpan.FromSeconds(5)); + } + + await routerClient.ReclassifyJobAsync(jobId1, CancellationToken.None); Assert.AreEqual(createJob1.QueueId, createQueue.Id); } diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/RouterWorkerLiveTests.cs b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/RouterWorkerLiveTests.cs index f09f29bf7f22..efed9dfde0c7 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/RouterWorkerLiveTests.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/RouterWorkerLiveTests.cs @@ -4,11 +4,8 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; using System.Threading.Tasks; -using Azure.Communication.JobRouter.Models; using Azure.Communication.JobRouter.Tests.Infrastructure; -using Azure.Core.TestFramework; using NUnit.Framework; namespace Azure.Communication.JobRouter.Tests.RouterClients @@ -79,7 +76,7 @@ public async Task RegisterWorkerShouldNotThrowArgumentNullExceptionTest() Assert.NotNull(routerWorkerResponse.Value); } - [Test] + /*[Test] public async Task GetWorkersTest() { JobRouterClient routerClient = CreateRouterClientWithConnectionString(); @@ -246,7 +243,7 @@ public async Task GetWorkersTest() await routerClient.DeleteWorkerAsync(expectedWorkerIds[1]); await routerClient.DeleteWorkerAsync(expectedWorkerIds[2]); await routerClient.DeleteWorkerAsync(expectedWorkerIds[3]); - } + }*/ [Test] public async Task UpdateWorkerTest() diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/StaticRuleTests.cs b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/StaticRuleTests.cs index f5bbf62c7f32..717034487b88 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/StaticRuleTests.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/RouterClients/StaticRuleTests.cs @@ -1,11 +1,6 @@ // Copyright (c) Microsoft Corporation. All rights reserved. // Licensed under the MIT License. -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; using NUnit.Framework; namespace Azure.Communication.JobRouter.Tests.RouterClients diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/ClassificationPolicyCrudOps.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/ClassificationPolicyCrudOps.cs index 718ce82dd31f..9ab84d2bc7a8 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/ClassificationPolicyCrudOps.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/ClassificationPolicyCrudOps.cs @@ -3,10 +3,6 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Azure.Communication.JobRouter.Models; using Azure.Communication.JobRouter.Tests.Infrastructure; using Azure.Core; using Azure.Core.TestFramework; @@ -72,17 +68,6 @@ public void ClassificationPolicyCrud() #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetClassificationPolicy - #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateClassificationPolicyRemoveProp - - Response updatedClassificationPolicyWithoutName = routerAdministrationClient.UpdateClassificationPolicy(classificationPolicyId, - RequestContent.Create(new { Name = (string?)null })); - - Response queriedClassificationPolicyWithoutName = routerAdministrationClient.GetClassificationPolicy(classificationPolicyId); - - Console.WriteLine($"Classification policy successfully updated: 'Name' has been removed. Status: {string.IsNullOrWhiteSpace(queriedClassificationPolicyWithoutName.Value.Name)}"); - - #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateClassificationPolicyRemoveProp - #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateClassificationPolicy Response updatedClassificationPolicy = routerAdministrationClient.UpdateClassificationPolicy( diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/ClassificationPolicyCrudOpsAsync.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/ClassificationPolicyCrudOpsAsync.cs index 3409d4472647..e46a1d61dc7e 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/ClassificationPolicyCrudOpsAsync.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/ClassificationPolicyCrudOpsAsync.cs @@ -3,10 +3,7 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Threading.Tasks; -using Azure.Communication.JobRouter.Models; using Azure.Communication.JobRouter.Tests.Infrastructure; using Azure.Core; using Azure.Core.TestFramework; @@ -72,17 +69,6 @@ public async Task ClassificationPolicyCrud() #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetClassificationPolicy_Async - #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateClassificationPolicyRemoveProp_Async - - Response updatedClassificationPolicyWithoutName = await routerAdministrationClient.UpdateClassificationPolicyAsync(classificationPolicyId, - RequestContent.Create(new { Name = (string?)null })); - - Response queriedClassificationPolicyWithoutName = await routerAdministrationClient.GetClassificationPolicyAsync(classificationPolicyId); - - Console.WriteLine($"Classification policy successfully updated: 'Name' has been removed. Status: {string.IsNullOrWhiteSpace(queriedClassificationPolicyWithoutName.Value.Name)}"); - - #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateClassificationPolicyRemoveProp_Async - #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateClassificationPolicy_Async Response updatedClassificationPolicy = await routerAdministrationClient.UpdateClassificationPolicyAsync( diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/DistributionPolicyCrudOps.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/DistributionPolicyCrudOps.cs index 7b068ce3eb90..ff07251e9c91 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/DistributionPolicyCrudOps.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/DistributionPolicyCrudOps.cs @@ -2,11 +2,6 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Azure.Communication.JobRouter.Models; using Azure.Communication.JobRouter.Tests.Infrastructure; using Azure.Core; using Azure.Core.TestFramework; @@ -48,17 +43,6 @@ public void DistributionPolicyCrud() #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetDistributionPolicy - #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateDistributionPolicyRemoveProp - - Response updatedDistributionPolicyWithoutName = routerAdministrationClient.UpdateDistributionPolicy(distributionPolicyId, - RequestContent.Create(new { Name = (string?)null })); - - Response queriedDistributionPolicyWithoutName = routerAdministrationClient.GetDistributionPolicy(distributionPolicyId); - - Console.WriteLine($"Distribution policy successfully updated: 'Name' has been removed. Status: Status: {string.IsNullOrWhiteSpace(queriedDistributionPolicyWithoutName.Value.Name)}"); - - #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateDistributionPolicyRemoveProp - #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateDistributionPolicy Response updatedDistributionPolicy = routerAdministrationClient.UpdateDistributionPolicy( diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/DistributionPolicyCrudOpsAsync.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/DistributionPolicyCrudOpsAsync.cs index fbe8b8364933..f2f2c6ee3a99 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/DistributionPolicyCrudOpsAsync.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/DistributionPolicyCrudOpsAsync.cs @@ -2,11 +2,7 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Threading.Tasks; -using Azure.Communication.JobRouter.Models; using Azure.Communication.JobRouter.Tests.Infrastructure; using Azure.Core; using Azure.Core.TestFramework; @@ -48,17 +44,6 @@ public async Task DistributionPolicyCrud() #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetDistributionPolicy_Async - #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateDistributionPolicyRemoveProp_Async - - Response updatedDistributionPolicyWithoutName = await routerAdministrationClient.UpdateDistributionPolicyAsync(distributionPolicyId, - RequestContent.Create(new { Name = (string?)null })); - - Response queriedDistributionPolicyWithoutName = await routerAdministrationClient.GetDistributionPolicyAsync(distributionPolicyId); - - Console.WriteLine($"Distribution policy successfully updated: 'Name' has been removed. Status: Status: {string.IsNullOrWhiteSpace(queriedDistributionPolicyWithoutName.Value.Name)}"); - - #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateDistributionPolicyRemoveProp_Async - #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateDistributionPolicy_Async Response updatedDistributionPolicy = await routerAdministrationClient.UpdateDistributionPolicyAsync( diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/ExceptionPolicyCrudOps.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/ExceptionPolicyCrudOps.cs index ae5f3ab916c8..1b835291daf3 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/ExceptionPolicyCrudOps.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/ExceptionPolicyCrudOps.cs @@ -3,10 +3,6 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Azure.Communication.JobRouter.Models; using Azure.Communication.JobRouter.Tests.Infrastructure; using Azure.Core; using Azure.Core.TestFramework; @@ -95,18 +91,6 @@ public void DistributionPolicyCrud() #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetExceptionPolicy - #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateExceptionPolicyRemoveProp - - // we are going to remove Name - Response updateExceptionPolicyWithoutName = routerClient.UpdateExceptionPolicy(exceptionPolicyId, - RequestContent.Create(new { Name = (string?)null })); - - Response queriedExceptionPolicyWithoutName = routerClient.GetExceptionPolicy(exceptionPolicyId); - - Console.WriteLine($"Exception policy successfully updated: 'Name' has been removed. Status: {string.IsNullOrWhiteSpace(queriedExceptionPolicyWithoutName.Value.Name)}"); - - #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateExceptionPolicyRemoveProp - #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateExceptionPolicy // we are going to diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/ExceptionPolicyCrudOpsAsync.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/ExceptionPolicyCrudOpsAsync.cs index 635c5421039c..ed1004a41006 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/ExceptionPolicyCrudOpsAsync.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/ExceptionPolicyCrudOpsAsync.cs @@ -3,10 +3,7 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Threading.Tasks; -using Azure.Communication.JobRouter.Models; using Azure.Communication.JobRouter.Tests.Infrastructure; using Azure.Core; using Azure.Core.TestFramework; @@ -95,18 +92,6 @@ public async Task DistributionPolicyCrud() #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetExceptionPolicy_Async - #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateExceptionPolicyRemoveProp_Async - - // we are going to remove Name - Response updateExceptionPolicyWithoutName = await routerClient.UpdateExceptionPolicyAsync(exceptionPolicyId, - RequestContent.Create(new { Name = (string?)null })); - - Response queriedExceptionPolicyWithoutName = await routerClient.GetExceptionPolicyAsync(exceptionPolicyId); - - Console.WriteLine($"Exception policy successfully updated: 'Name' has been removed. Status: {string.IsNullOrWhiteSpace(queriedExceptionPolicyWithoutName.Value.Name)}"); - - #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateExceptionPolicyRemoveProp_Async - #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateExceptionPolicy_Async // we are going to diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/JobQueueCrudOps.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/JobQueueCrudOps.cs index b572e4efcf87..b543514af2d7 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/JobQueueCrudOps.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/JobQueueCrudOps.cs @@ -2,12 +2,7 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Text.Json; -using System.Threading.Tasks; -using Azure.Communication.JobRouter.Models; using Azure.Communication.JobRouter.Tests.Infrastructure; using Azure.Core; using Azure.Core.TestFramework; @@ -33,7 +28,7 @@ public void JobQueueCrud() // set `distributionPolicyId` to an existing distribution policy string jobQueueId = "job-queue-id"; - Response jobQueue = routerAdministrationClient.CreateQueue( + Response jobQueue = routerAdministrationClient.CreateQueue( options: new CreateQueueOptions(jobQueueId, distributionPolicyId) // this is optional { Name = "My job queue" @@ -45,7 +40,7 @@ public void JobQueueCrud() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetJobQueue - Response queriedJobQueue = routerAdministrationClient.GetQueue(jobQueueId); + Response queriedJobQueue = routerAdministrationClient.GetQueue(jobQueueId); Console.WriteLine($"Successfully fetched queue with id: {queriedJobQueue.Value.Id}"); @@ -53,25 +48,15 @@ public void JobQueueCrud() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetJobQueueStat - Response queueStatistics = routerClient.GetQueueStatistics(queueId: jobQueueId); + Response queueStatistics = routerClient.GetQueueStatistics(jobQueueId); Console.WriteLine($"Queue statistics successfully retrieved for queue: {JsonSerializer.Serialize(queueStatistics.Value)}"); #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetJobQueueStat - #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateQueueRemoveProp - - Response updatedJobQueueWithoutName = routerAdministrationClient.UpdateQueue(jobQueueId, - RequestContent.Create(new { Name = (string?)null })); - - Response queriedJobQueueWithoutName = routerAdministrationClient.GetQueue(jobQueueId); - - Console.WriteLine($"Queue successfully updated: 'Name' has been removed. Status: {string.IsNullOrWhiteSpace(queriedJobQueueWithoutName.Value.Name)}"); - #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateQueueRemoveProp - #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateGetJobQueue - Response updatedJobQueue = routerAdministrationClient.UpdateQueue( + Response updatedJobQueue = routerAdministrationClient.UpdateQueue( options: new UpdateQueueOptions(jobQueueId) { Labels = { ["Additional-Queue-Label"] = new LabelValue("ChatQueue") } @@ -81,10 +66,10 @@ public void JobQueueCrud() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetJobQueues - Pageable jobQueues = routerAdministrationClient.GetQueues(); - foreach (Page asPage in jobQueues.AsPages(pageSizeHint: 10)) + Pageable jobQueues = routerAdministrationClient.GetQueues(); + foreach (Page asPage in jobQueues.AsPages(pageSizeHint: 10)) { - foreach (Models.RouterQueueItem? policy in asPage.Values) + foreach (RouterQueueItem? policy in asPage.Values) { Console.WriteLine($"Listing job queue with id: {policy.Queue.Id}"); } diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/JobQueueCrudOpsAsync.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/JobQueueCrudOpsAsync.cs index f5e301cb2630..64c14d3af05c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/JobQueueCrudOpsAsync.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/JobQueueCrudOpsAsync.cs @@ -2,12 +2,8 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Text.Json; using System.Threading.Tasks; -using Azure.Communication.JobRouter.Models; using Azure.Communication.JobRouter.Tests.Infrastructure; using Azure.Core; using Azure.Core.TestFramework; @@ -33,7 +29,7 @@ public async Task JobQueueCrud() // set `distributionPolicyId` to an existing distribution policy string jobQueueId = "job-queue-id"; - Response jobQueue = await routerAdministrationClient.CreateQueueAsync( + Response jobQueue = await routerAdministrationClient.CreateQueueAsync( options: new CreateQueueOptions(jobQueueId, distributionPolicyId) { Name = "My job queue" @@ -45,7 +41,7 @@ public async Task JobQueueCrud() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetJobQueue_Async - Response queriedJobQueue = await routerAdministrationClient.GetQueueAsync(jobQueueId); + Response queriedJobQueue = await routerAdministrationClient.GetQueueAsync(jobQueueId); Console.WriteLine($"Successfully fetched queue with id: {queriedJobQueue.Value.Id}"); @@ -53,26 +49,15 @@ public async Task JobQueueCrud() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetJobQueueStat_Async - Response queueStatistics = await routerClient.GetQueueStatisticsAsync(queueId: jobQueueId); + Response queueStatistics = await routerClient.GetQueueStatisticsAsync(jobQueueId); Console.WriteLine($"Queue statistics successfully retrieved for queue: {JsonSerializer.Serialize(queueStatistics.Value)}"); #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetJobQueueStat_Async - #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateQueueRemoveProp_Async - - Response updatedJobQueueWithoutName = await routerAdministrationClient.UpdateQueueAsync(jobQueueId, - RequestContent.Create(new { Name = (string?)null })); - - Response queriedJobQueueWithoutName = await routerAdministrationClient.GetQueueAsync(jobQueueId); - - Console.WriteLine($"Queue successfully updated: 'Name' has been removed. Status: {string.IsNullOrWhiteSpace(queriedJobQueueWithoutName.Value.Name)}"); - - #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateQueueRemoveProp_Async - #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateGetJobQueue_Async - Response updatedJobQueue = await routerAdministrationClient.UpdateQueueAsync( + Response updatedJobQueue = await routerAdministrationClient.UpdateQueueAsync( options: new UpdateQueueOptions(jobQueueId) { Labels = { ["Additional-Queue-Label"] = new LabelValue("ChatQueue") } @@ -82,10 +67,10 @@ public async Task JobQueueCrud() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetJobQueues_Async - AsyncPageable jobQueues = routerAdministrationClient.GetQueuesAsync(); - await foreach (Page asPage in jobQueues.AsPages(pageSizeHint: 10)) + AsyncPageable jobQueues = routerAdministrationClient.GetQueuesAsync(); + await foreach (Page asPage in jobQueues.AsPages(pageSizeHint: 10)) { - foreach (Models.RouterQueueItem? policy in asPage.Values) + foreach (RouterQueueItem? policy in asPage.Values) { Console.WriteLine($"Listing job queue with id: {policy.Queue.Id}"); } diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterJobCrudOps.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterJobCrudOps.cs index ec9abe73fc1a..1bffb07e1007 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterJobCrudOps.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterJobCrudOps.cs @@ -2,11 +2,9 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; using System.Linq; -using System.Text; +using System.Threading; using System.Threading.Tasks; -using Azure.Communication.JobRouter.Models; using Azure.Communication.JobRouter.Tests.Infrastructure; using Azure.Core; using Azure.Core.TestFramework; @@ -29,7 +27,7 @@ public void RouterCrudOps() Response distributionPolicy = routerAdministrationClient.CreateDistributionPolicy(new CreateDistributionPolicyOptions("distribution-policy-id", TimeSpan.FromMinutes(5), new LongestIdleMode())); - Response jobQueue = routerAdministrationClient.CreateQueue(new CreateQueueOptions("job-queue-id", distributionPolicy.Value.Id)); + Response jobQueue = routerAdministrationClient.CreateQueue(new CreateQueueOptions("job-queue-id", distributionPolicy.Value.Id)); string jobId = "router-job-id"; @@ -83,23 +81,12 @@ public void RouterCrudOps() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetRouterJobPosition - Response jobPositionDetails = routerClient.GetQueuePosition(jobId); + Response jobPositionDetails = routerClient.GetQueuePosition(jobId); Console.WriteLine($"Job position for id `{jobPositionDetails.Value.JobId}` successfully retrieved. JobPosition: {jobPositionDetails.Value.Position}"); #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetRouterJobPosition - #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateJobRemoveProp - - Response updatedJobWithoutChannelReference = routerClient.UpdateJob(jobId, - RequestContent.Create(new { ChannelReference = (string?)null })); - - Response queriedJobWithoutChannelReference = routerClient.GetJob(jobId); - - Console.WriteLine($"Job has been successfully updated. 'ChannelReference' has been removed: {string.IsNullOrWhiteSpace(queriedJobWithoutChannelReference.Value.ChannelReference)}"); - - #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateJobRemoveProp - #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateRouterJob Response updatedJob = routerClient.UpdateJob( @@ -115,7 +102,7 @@ public void RouterCrudOps() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_ReclassifyRouterJob - Response reclassifyJob = routerClient.ReclassifyJob(jobWithCpId); + Response reclassifyJob = routerClient.ReclassifyJob(jobWithCpId, CancellationToken.None); #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_ReclassifyRouterJob @@ -140,7 +127,7 @@ public void RouterCrudOps() Response queriedWorker = routerClient.GetWorker(worker.Value.Id); - Models.RouterJobOffer? issuedOffer = queriedWorker.Value.Offers.First(offer => offer.JobId == jobId); + RouterJobOffer? issuedOffer = queriedWorker.Value.Offers.First(offer => offer.JobId == jobId); Console.WriteLine($"Worker has been successfully issued to worker with offerId: {issuedOffer.OfferId} and offer expiry time: {issuedOffer.ExpiresAt}"); diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterJobCrudOpsAsync.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterJobCrudOpsAsync.cs index e3a75ee40482..c2c77c60c8d5 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterJobCrudOpsAsync.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterJobCrudOpsAsync.cs @@ -2,11 +2,9 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; using System.Linq; -using System.Text; +using System.Threading; using System.Threading.Tasks; -using Azure.Communication.JobRouter.Models; using Azure.Communication.JobRouter.Tests.Infrastructure; using Azure.Core; using Azure.Core.TestFramework; @@ -30,7 +28,7 @@ public async Task RouterCrudOps() await routerAdministrationClient.CreateDistributionPolicyAsync(new CreateDistributionPolicyOptions( "distribution-policy-id", TimeSpan.FromMinutes(5), new LongestIdleMode())); - Response jobQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions("job-queue-id", distributionPolicy.Value.Id)); + Response jobQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions("job-queue-id", distributionPolicy.Value.Id)); string jobId = "router-job-id"; @@ -84,23 +82,12 @@ await routerAdministrationClient.CreateDistributionPolicyAsync(new CreateDistrib #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetRouterJobPosition_Async - Response jobPositionDetails = await routerClient.GetQueuePositionAsync(jobId); + Response jobPositionDetails = await routerClient.GetQueuePositionAsync(jobId); Console.WriteLine($"Job position for id `{jobPositionDetails.Value.JobId}` successfully retrieved. JobPosition: {jobPositionDetails.Value.Position}"); #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_GetRouterJobPosition_Async - #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateJobRemoveProp_Async - - Response updatedJobWithoutChannelReference = await routerClient.UpdateJobAsync(jobId, - RequestContent.Create(new { ChannelReference = (string?)null })); - - Response queriedJobWithoutChannelReference = await routerClient.GetJobAsync(jobId); - - Console.WriteLine($"Job has been successfully updated. 'ChannelReference' has been removed: {string.IsNullOrWhiteSpace(queriedJobWithoutChannelReference.Value.ChannelReference)}"); - - #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateJobRemoveProp_Async - #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_UpdateRouterJob_Async Response updatedJob = await routerClient.UpdateJobAsync( @@ -116,7 +103,7 @@ await routerAdministrationClient.CreateDistributionPolicyAsync(new CreateDistrib #region Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_ReclassifyRouterJob_Async - Response reclassifyJob = await routerClient.ReclassifyJobAsync(jobWithCpId); + Response reclassifyJob = await routerClient.ReclassifyJobAsync(jobWithCpId, CancellationToken.None); #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_Crud_ReclassifyRouterJob_Async @@ -141,7 +128,7 @@ await routerAdministrationClient.CreateDistributionPolicyAsync(new CreateDistrib Response queriedWorker = await routerClient.GetWorkerAsync(worker.Value.Id); - Models.RouterJobOffer? issuedOffer = queriedWorker.Value.Offers.First(offer => offer.JobId == jobId); + RouterJobOffer? issuedOffer = queriedWorker.Value.Offers.First(offer => offer.JobId == jobId); Console.WriteLine($"Worker has been successfully issued to worker with offerId: {issuedOffer.OfferId} and offer expiry time: {issuedOffer.ExpiresAt}"); diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterWorkerCrudOps.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterWorkerCrudOps.cs index ed96471fda7e..f91b112ce29f 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterWorkerCrudOps.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterWorkerCrudOps.cs @@ -2,12 +2,7 @@ // Licensed under the MIT License. using System; -using System.Collections.Concurrent; -using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Threading.Tasks; -using Azure.Communication.JobRouter.Models; using Azure.Communication.JobRouter.Tests.Infrastructure; using Azure.Core.TestFramework; using NUnit.Framework; @@ -125,10 +120,7 @@ public void RouterWorkerCrud() } // Additionally workers can be queried with several filters like queueId, capacity, state etc. - workers = routerClient.GetWorkers(new GetWorkersOptions() - { - ChannelId = "Voip", State = RouterWorkerStateSelector.All - }); + workers = routerClient.GetWorkers(channelId: "Voip", state: RouterWorkerStateSelector.All); foreach (Page asPage in workers.AsPages(pageSizeHint: 10)) { diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterWorkerCrudOpsAsync.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterWorkerCrudOpsAsync.cs index c3ee8e19767d..cd72aa50715b 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterWorkerCrudOpsAsync.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/RouterWorkerCrudOpsAsync.cs @@ -2,12 +2,8 @@ // Licensed under the MIT License. using System; -using System.Collections.Concurrent; -using System.Collections.Generic; using System.Linq; -using System.Text; using System.Threading.Tasks; -using Azure.Communication.JobRouter.Models; using Azure.Communication.JobRouter.Tests.Infrastructure; using Azure.Core.TestFramework; using NUnit.Framework; @@ -127,10 +123,7 @@ public async Task RouterWorkerCrud() } // Additionally workers can be queried with several filters like queueId, capacity, state etc. - workers = routerClient.GetWorkersAsync(new GetWorkersOptions() - { - ChannelId = "Voip", State = RouterWorkerStateSelector.All - }); + workers = routerClient.GetWorkersAsync(channelId: "Voip", state: RouterWorkerStateSelector.All); await foreach (Page asPage in workers.AsPages(pageSizeHint: 10)) { diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample1_KeyConcepts.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample1_KeyConcepts.cs index 5ee4a2ca37b8..defda1a96f30 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample1_KeyConcepts.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample1_KeyConcepts.cs @@ -2,15 +2,11 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; using System.Linq; -using System.Text; using System.Threading; -using System.Threading.Tasks; #region Snippet:Azure_Communication_JobRouter_Tests_Samples_UsingStatements using Azure.Communication.JobRouter; -using Azure.Communication.JobRouter.Models; #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_UsingStatements using Azure.Communication.JobRouter.Tests.Infrastructure; using Azure.Core.TestFramework; @@ -40,7 +36,7 @@ public void BasicScenario() #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_CreateDistributionPolicyLongestIdleTTL1D #region Snippet:Azure_Communication_JobRouter_Tests_Samples_CreateQueue - Response queue = routerAdministrationClient.CreateQueue( + Response queue = routerAdministrationClient.CreateQueue( new CreateQueueOptions( queueId: "queue-1", distributionPolicyId: distributionPolicy.Value.Id) @@ -78,7 +74,7 @@ public void BasicScenario() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_QueryWorker Response result = routerClient.GetWorker(worker.Value.Id); - foreach (Models.RouterJobOffer? offer in result.Value.Offers) + foreach (RouterJobOffer? offer in result.Value.Offers) { Console.WriteLine($"Worker {worker.Value.Id} has an active offer for job {offer.JobId}"); } @@ -87,7 +83,7 @@ public void BasicScenario() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_AcceptOffer // fetching the offer id - Models.RouterJobOffer jobOffer = result.Value.Offers.First(x => x.JobId == job.Value.Id); + RouterJobOffer jobOffer = result.Value.Offers.First(x => x.JobId == job.Value.Id); string offerId = jobOffer.OfferId; // `OfferId` can be retrieved directly from consuming event from Event grid diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample1_KeyConceptsAsync.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample1_KeyConceptsAsync.cs index b3febe8982b0..a4d667b982d7 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample1_KeyConceptsAsync.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample1_KeyConceptsAsync.cs @@ -2,14 +2,11 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; using System.Linq; -using System.Text; using System.Threading.Tasks; #region Snippet:Azure_Communication_JobRouter_Tests_Samples_UsingStatements_Async using Azure.Communication.JobRouter; -using Azure.Communication.JobRouter.Models; #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_UsingStatements_Async using Azure.Communication.JobRouter.Tests.Infrastructure; using Azure.Core.TestFramework; @@ -39,7 +36,7 @@ public async Task BasicScenario() #endregion Snippet:Azure_Communication_JobRouter_Tests_Samples_CreateDistributionPolicyLongestIdleTTL1D_Async #region Snippet:Azure_Communication_JobRouter_Tests_Samples_CreateQueue_Async - Response queue = await routerAdministrationClient.CreateQueueAsync( + Response queue = await routerAdministrationClient.CreateQueueAsync( new CreateQueueOptions( queueId: "queue-1", distributionPolicyId: distributionPolicy.Value.Id) @@ -77,7 +74,7 @@ public async Task BasicScenario() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_QueryWorker_Async Response result = await routerClient.GetWorkerAsync(worker.Value.Id); - foreach (Models.RouterJobOffer? offer in result.Value.Offers) + foreach (RouterJobOffer? offer in result.Value.Offers) { Console.WriteLine($"Worker {worker.Value.Id} has an active offer for job {offer.JobId}"); } @@ -86,7 +83,7 @@ public async Task BasicScenario() #region Snippet:Azure_Communication_JobRouter_Tests_Samples_AcceptOffer_Async // fetching the offer id - Models.RouterJobOffer jobOffer = result.Value.Offers.First(x => x.JobId == job.Value.Id); + RouterJobOffer jobOffer = result.Value.Offers.First(x => x.JobId == job.Value.Id); string offerId = jobOffer.OfferId; // `OfferId` can be retrieved directly from consuming event from Event grid diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample2_ClassificationWithPriorityRuleAsync.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample2_ClassificationWithPriorityRuleAsync.cs index 0d46fee7e332..6238008cae49 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample2_ClassificationWithPriorityRuleAsync.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample2_ClassificationWithPriorityRuleAsync.cs @@ -2,11 +2,7 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Threading.Tasks; -using Azure.Communication.JobRouter.Models; using Azure.Communication.JobRouter.Tests.Infrastructure; using Azure.Core.TestFramework; using NUnit.Framework; @@ -51,7 +47,7 @@ public async Task Scenario1() // Create queue string jobQueueId = "my-default-queue"; - Response jobQueue = + Response jobQueue = await routerAdministration.CreateQueueAsync(new CreateQueueOptions(queueId: jobQueueId, distributionPolicyId: distributionPolicyId)); Console.WriteLine($"Queue has been successfully created with id: {jobQueue.Value.Id}"); @@ -129,7 +125,7 @@ public async Task Scenario2() // Create queue string jobQueueId = "my-default-queue"; - Response jobQueue = + Response jobQueue = await routerAdministration.CreateQueueAsync(new CreateQueueOptions(queueId: jobQueueId, distributionPolicyId: distributionPolicyId)); Console.WriteLine($"Queue has been successfully created with id: {jobQueue.Value.Id}"); @@ -233,7 +229,7 @@ public async Task Scenario3() // Create queue string jobQueueId = "my-default-queue"; - Response jobQueue = + Response jobQueue = await routerAdministration.CreateQueueAsync(new CreateQueueOptions(queueId: jobQueueId, distributionPolicyId: distributionPolicyId)); Console.WriteLine($"Queue has been successfully created with id: {jobQueue.Value.Id}"); diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample2_ClassificationWithQueueSelectorAsync.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample2_ClassificationWithQueueSelectorAsync.cs index 37d180744192..c7529a60eb5e 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample2_ClassificationWithQueueSelectorAsync.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample2_ClassificationWithQueueSelectorAsync.cs @@ -3,10 +3,7 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Text; using System.Threading.Tasks; -using Azure.Communication.JobRouter.Models; using Azure.Communication.JobRouter.Tests.Infrastructure; using Azure.Core.TestFramework; using NUnit.Framework; @@ -42,13 +39,13 @@ public async Task QueueSelection_ById() } ); - Response queue1 = await routerAdministrationClient.CreateQueueAsync( + Response queue1 = await routerAdministrationClient.CreateQueueAsync( new CreateQueueOptions(queueId: "Queue-1", distributionPolicyId: distributionPolicy.Value.Id) { Name = "Queue_365", }); - Response queue2 = await routerAdministrationClient.CreateQueueAsync( + Response queue2 = await routerAdministrationClient.CreateQueueAsync( new CreateQueueOptions(queueId: "Queue-2", distributionPolicyId: distributionPolicy.Value.Id) { Name = "Queue_XBox", @@ -152,7 +149,7 @@ public async Task QueueSelection_ByCondition() } ); - Response queue1 = await routerAdministrationClient.CreateQueueAsync( + Response queue1 = await routerAdministrationClient.CreateQueueAsync( new CreateQueueOptions( queueId: "Queue-1", distributionPolicyId: distributionPolicy.Value.Id) @@ -164,7 +161,7 @@ public async Task QueueSelection_ByCondition() } }); - Response queue2 = await routerAdministrationClient.CreateQueueAsync( + Response queue2 = await routerAdministrationClient.CreateQueueAsync( new CreateQueueOptions( queueId: "Queue-2", distributionPolicyId: distributionPolicy.Value.Id) @@ -288,7 +285,7 @@ public async Task QueueSelection_ByPassThroughValues() } ); - Response queue1 = await routerAdministrationClient.CreateQueueAsync( + Response queue1 = await routerAdministrationClient.CreateQueueAsync( new CreateQueueOptions( queueId: "Queue-1", distributionPolicyId: distributionPolicy.Value.Id) @@ -302,7 +299,7 @@ public async Task QueueSelection_ByPassThroughValues() }, }); - Response queue2 = await routerAdministrationClient.CreateQueueAsync( + Response queue2 = await routerAdministrationClient.CreateQueueAsync( new CreateQueueOptions( queueId: "Queue-2", distributionPolicyId: distributionPolicy.Value.Id) @@ -316,7 +313,7 @@ public async Task QueueSelection_ByPassThroughValues() }, }); - Response queue3 = await routerAdministrationClient.CreateQueueAsync( + Response queue3 = await routerAdministrationClient.CreateQueueAsync( new CreateQueueOptions( queueId: "Queue-3", distributionPolicyId: distributionPolicy.Value.Id) diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample2_ClassificationWithWorkerSelectorAsync.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample2_ClassificationWithWorkerSelectorAsync.cs index f02af78767a2..51ba594a0524 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample2_ClassificationWithWorkerSelectorAsync.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample2_ClassificationWithWorkerSelectorAsync.cs @@ -4,9 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; using System.Threading.Tasks; -using Azure.Communication.JobRouter.Models; using Azure.Communication.JobRouter.Tests.Infrastructure; using Azure.Core.TestFramework; using NUnit.Framework; @@ -54,7 +52,7 @@ public async Task WorkerSelection_StaticSelectors() ); string queueId = "Queue-1"; - Response queue1 = await routerAdministrationClient.CreateQueueAsync( + Response queue1 = await routerAdministrationClient.CreateQueueAsync( new CreateQueueOptions(queueId: queueId, distributionPolicyId: distributionPolicy.Value.Id) { Name = "Queue_365", @@ -197,7 +195,7 @@ public async Task WorkerSelection_ByCondition() ); string queueId = "Queue-1"; - Response queue1 = await routerAdministrationClient.CreateQueueAsync( + Response queue1 = await routerAdministrationClient.CreateQueueAsync( new CreateQueueOptions(queueId: queueId, distributionPolicyId: distributionPolicy.Value.Id) { Name = "Queue_365", @@ -352,7 +350,7 @@ public async Task WorkerSelection_ByPassThroughValues() ); string queueId = "Queue-1"; - Response queue1 = await routerAdministrationClient.CreateQueueAsync( + Response queue1 = await routerAdministrationClient.CreateQueueAsync( new CreateQueueOptions( queueId: queueId, distributionPolicyId: distributionPolicy.Value.Id) diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample3_AdvancedDistributionAsync.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample3_AdvancedDistributionAsync.cs index 52d710099810..bdf24e98ffd5 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample3_AdvancedDistributionAsync.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample3_AdvancedDistributionAsync.cs @@ -4,9 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; using System.Threading.Tasks; -using Azure.Communication.JobRouter.Models; using Azure.Communication.JobRouter.Tests.Infrastructure; using Azure.Core.TestFramework; using NUnit.Framework; @@ -35,7 +33,7 @@ public async Task BestWorkerDistribution_Advanced_ExpressionRouterRule() // Create job queue string jobQueueId = "job-queue-id-2"; - Response jobQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions( + Response jobQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions( queueId: jobQueueId, distributionPolicyId: distributionPolicyId)); @@ -116,7 +114,7 @@ public async Task BestWorkerDistribution_Advanced_AzureFunctionRouterRule() // Create job queue string queueId = "job-queue-id-1"; - Response jobQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions( + Response jobQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions( queueId: queueId, distributionPolicyId: distributionPolicyId)); diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample3_SimpleDistributionAsync.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample3_SimpleDistributionAsync.cs index 142a499d3a5a..bca5834e8354 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample3_SimpleDistributionAsync.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample3_SimpleDistributionAsync.cs @@ -2,11 +2,8 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; using System.Linq; -using System.Text; using System.Threading.Tasks; -using Azure.Communication.JobRouter.Models; using Azure.Communication.JobRouter.Tests.Infrastructure; using Azure.Core.TestFramework; using NUnit.Framework; @@ -41,7 +38,7 @@ public async Task SimpleDistribution_LongestIdle() // Create queue string queueId = "queue-id-1"; - Response jobQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions( + Response jobQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions( queueId: queueId, distributionPolicyId: distributionPolicyId)); @@ -128,7 +125,7 @@ public async Task SimpleDistribution_RoundRobin() // Create queue string queueId = "queue-id-1"; - Response jobQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions(queueId: queueId, distributionPolicyId: distributionPolicyId)); + Response jobQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions(queueId: queueId, distributionPolicyId: distributionPolicyId)); // Setting up 2 identical workers string worker1Id = "worker-id-1"; @@ -220,7 +217,7 @@ public async Task SimpleDistribution_DefaultBestWorker() // Create queue string queueId = "queue-id-1"; - Response jobQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions( + Response jobQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions( queueId: queueId, distributionPolicyId: distributionPolicyId)); @@ -352,7 +349,7 @@ await routerAdministrationClient.CreateDistributionPolicyAsync( // Create queue string queueId = "queue-id-1"; - Response jobQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions( + Response jobQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions( queueId: queueId, distributionPolicyId: distributionPolicyId)); diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample4_QueueLengthExceptionTriggerAsync.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample4_QueueLengthExceptionTriggerAsync.cs index ba8dc8a66b65..3116545f2dbc 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample4_QueueLengthExceptionTriggerAsync.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample4_QueueLengthExceptionTriggerAsync.cs @@ -4,9 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; using System.Threading.Tasks; -using Azure.Communication.JobRouter.Models; using Azure.Communication.JobRouter.Tests.Infrastructure; using Azure.Core.TestFramework; using NUnit.Framework; @@ -46,7 +44,7 @@ public async Task QueueLengthTriggerException_SampleScenario() // create backup queue string backupJobQueueId = "job-queue-2"; - Response backupJobQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions( + Response backupJobQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions( queueId: backupJobQueueId, distributionPolicyId: distributionPolicyId)); @@ -83,7 +81,7 @@ public async Task QueueLengthTriggerException_SampleScenario() string activeJobQueueId = "active-job-queue"; - Response activeJobQueue = await routerAdministrationClient.CreateQueueAsync( + Response activeJobQueue = await routerAdministrationClient.CreateQueueAsync( options: new CreateQueueOptions(queueId: activeJobQueueId, distributionPolicyId: distributionPolicyId) { ExceptionPolicyId = exceptionPolicyId }); // create 10 jobs to fill in primary queue diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample4_WaitTimeExceptionAsync.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample4_WaitTimeExceptionAsync.cs index b99adf2773c8..639885bb185f 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample4_WaitTimeExceptionAsync.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Samples/Sample4_WaitTimeExceptionAsync.cs @@ -4,9 +4,7 @@ using System; using System.Collections.Generic; using System.Linq; -using System.Text; using System.Threading.Tasks; -using Azure.Communication.JobRouter.Models; using Azure.Communication.JobRouter.Tests.Infrastructure; using Azure.Core.TestFramework; using NUnit.Framework; @@ -42,7 +40,7 @@ public async Task WaitTimeTriggerException_SampleScenario() // Create fallback queue string fallbackQueueId = "fallback-q-id"; - Response fallbackQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions( + Response fallbackQueue = await routerAdministrationClient.CreateQueueAsync(new CreateQueueOptions( queueId: fallbackQueueId, distributionPolicyId: distributionPolicyId)); @@ -73,7 +71,7 @@ public async Task WaitTimeTriggerException_SampleScenario() // Create initial queue string jobQueueId = "job-queue-id"; - Response jobQueue = await routerAdministrationClient.CreateQueueAsync( + Response jobQueue = await routerAdministrationClient.CreateQueueAsync( options: new CreateQueueOptions( queueId: jobQueueId, distributionPolicyId: distributionPolicyId) diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/AssignmentScenario.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/AssignmentScenario.cs index 6ee6e4ee7f41..f3fb41e65ec0 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/AssignmentScenario.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/AssignmentScenario.cs @@ -2,11 +2,9 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; using System.Linq; using System.Threading.Tasks; using Azure.Communication.JobRouter.Tests.Infrastructure; -using Azure.Core.TestFramework; using NUnit.Framework; namespace Azure.Communication.JobRouter.Tests.Scenarios diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/CancellationScenario.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/CancellationScenario.cs index 5c56fecafa5f..a565cbc19d96 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/CancellationScenario.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/CancellationScenario.cs @@ -2,11 +2,8 @@ // Licensed under the MIT License. using System; -using System.Linq; using System.Threading.Tasks; -using Azure.Communication.JobRouter.Models; using Azure.Communication.JobRouter.Tests.Infrastructure; -using Azure.Core.TestFramework; using NUnit.Framework; namespace Azure.Communication.JobRouter.Tests.Scenarios diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/QueueScenario.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/QueueScenario.cs index 2663913edf9d..cc14feb9aa75 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/QueueScenario.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/QueueScenario.cs @@ -4,9 +4,7 @@ using System; using System.Collections.Generic; using System.Threading.Tasks; -using Azure.Communication.JobRouter.Models; using Azure.Communication.JobRouter.Tests.Infrastructure; -using Azure.Core.TestFramework; using NUnit.Framework; namespace Azure.Communication.JobRouter.Tests.Scenarios diff --git a/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/SchedulingScenario.cs b/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/SchedulingScenario.cs index e242d0b6b7bf..d2cd12458283 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/SchedulingScenario.cs +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Scenarios/SchedulingScenario.cs @@ -2,15 +2,9 @@ // Licensed under the MIT License. using System; -using System.Collections.Generic; using System.Linq; -using System.Text; -using System.Text.Json; -using System.Threading; using System.Threading.Tasks; -using Azure.Communication.JobRouter.Models; using Azure.Communication.JobRouter.Tests.Infrastructure; -using Azure.Core.TestFramework; using NUnit.Framework; namespace Azure.Communication.JobRouter.Tests.Scenarios @@ -60,7 +54,7 @@ public async Task SimpleSchedulingScenario() new CreateJobOptions(jobId, channelResponse, queueResponse.Value.Id) { Priority = 1, - MatchingMode = new JobMatchingMode(new ScheduleAndSuspendMode(timeToEnqueueJob)) + MatchingMode = new ScheduleAndSuspendMode(timeToEnqueueJob) }); AddForCleanup(new Task(async () => await client.DeleteJobAsync(jobId))); @@ -74,12 +68,12 @@ public async Task SimpleSchedulingScenario() var updateJobToStartMatching = await client.UpdateJobAsync(new UpdateJobOptions(jobId) { - MatchingMode = new JobMatchingMode(new QueueAndMatchMode()) + MatchingMode = new QueueAndMatchMode() }); Assert.AreEqual(RouterJobStatus.Queued, updateJobToStartMatching.Value.Status); Assert.NotNull(updateJobToStartMatching.Value.ScheduledAt); - Assert.AreEqual(JobMatchModeType.QueueAndMatchMode, updateJobToStartMatching.Value.MatchingMode.ModeType); + Assert.AreEqual(typeof(QueueAndMatchMode), updateJobToStartMatching.Value.MatchingMode.GetType()); var worker = await Poll(async () => await client.GetWorkerAsync(registerWorker.Value.Id), w => w.Value.Offers.Any(x => x.JobId == updateJobToStartMatching.Value.Id), diff --git a/sdk/communication/Azure.Communication.JobRouter/tsp-location.yaml b/sdk/communication/Azure.Communication.JobRouter/tsp-location.yaml new file mode 100644 index 000000000000..c5a4e75bd59d --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/tsp-location.yaml @@ -0,0 +1,5 @@ +commit: 0ed5668035ed54064596d28bc1c7c8f045d5a463 +directory: specification/communication/Communication.JobRouter +additionalDirectories: [] +repo: sarkar-rajarshi/azure-rest-api-specs +