diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterClientBuilderExtensions.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterClientBuilderExtensions.cs index 87d5e0cfe1b4..e0d40560226c 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterClientBuilderExtensions.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/CommunicationJobRouterClientBuilderExtensions.cs @@ -17,18 +17,18 @@ internal static partial class CommunicationJobRouterClientBuilderExtensions /// The builder to register with. /// Uri of your Communication resource. public static IAzureClientBuilder AddJobRouterAdministrationClient(this TBuilder builder, Uri endpoint) - where TBuilder : IAzureClientFactoryBuilder + where TBuilder : IAzureClientFactoryBuilderWithCredential { - return builder.RegisterClientFactory((options) => new JobRouterAdministrationClient(endpoint, options)); + return builder.RegisterClientFactory((options, cred) => new JobRouterAdministrationClient(endpoint, cred, options)); } /// Registers a instance. /// The builder to register with. /// Uri of your Communication resource. public static IAzureClientBuilder AddJobRouterClient(this TBuilder builder, Uri endpoint) - where TBuilder : IAzureClientFactoryBuilder + where TBuilder : IAzureClientFactoryBuilderWithCredential { - return builder.RegisterClientFactory((options) => new JobRouterClient(endpoint, options)); + return builder.RegisterClientFactory((options, cred) => new JobRouterClient(endpoint, cred, options)); } /// Registers a instance. 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..4412ef4cf06a --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Docs/JobRouterAdministrationClient.xml @@ -0,0 +1,317 @@ + + + + + +This sample shows how to call GetDistributionPolicyAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + +Response response = await client.GetDistributionPolicyAsync("MainDistributionPolicy"); +]]> + + + +This sample shows how to call GetDistributionPolicy. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + +Response response = client.GetDistributionPolicy("MainDistributionPolicy"); +]]> + + + +This sample shows how to call GetDistributionPolicyAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + +Response response = await client.GetDistributionPolicyAsync("MainDistributionPolicy", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +]]> + + + +This sample shows how to call GetDistributionPolicy and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + +Response response = client.GetDistributionPolicy("MainDistributionPolicy", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +]]> + + + +This sample shows how to call DeleteDistributionPolicyAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + +Response response = await client.DeleteDistributionPolicyAsync("MainDistributionPolicy"); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call DeleteDistributionPolicy. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + +Response response = client.DeleteDistributionPolicy("MainDistributionPolicy"); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call GetClassificationPolicyAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + +Response response = await client.GetClassificationPolicyAsync("MainClassificationPolicy"); +]]> + + + +This sample shows how to call GetClassificationPolicy. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + +Response response = client.GetClassificationPolicy("MainClassificationPolicy"); +]]> + + + +This sample shows how to call GetClassificationPolicyAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + +Response response = await client.GetClassificationPolicyAsync("MainClassificationPolicy", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +]]> + + + +This sample shows how to call GetClassificationPolicy and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + +Response response = client.GetClassificationPolicy("MainClassificationPolicy", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +]]> + + + +This sample shows how to call DeleteClassificationPolicyAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + +Response response = await client.DeleteClassificationPolicyAsync("MainClassificationPolicy"); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call DeleteClassificationPolicy. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + +Response response = client.DeleteClassificationPolicy("MainClassificationPolicy"); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call GetExceptionPolicyAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + +Response response = await client.GetExceptionPolicyAsync("MainExceptionPolicy"); +]]> + + + +This sample shows how to call GetExceptionPolicy. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + +Response response = client.GetExceptionPolicy("MainExceptionPolicy"); +]]> + + + +This sample shows how to call GetExceptionPolicyAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + +Response response = await client.GetExceptionPolicyAsync("MainExceptionPolicy", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +]]> + + + +This sample shows how to call GetExceptionPolicy and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + +Response response = client.GetExceptionPolicy("MainExceptionPolicy", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +]]> + + + +This sample shows how to call DeleteExceptionPolicyAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + +Response response = await client.DeleteExceptionPolicyAsync("MainExceptionPolicy"); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call DeleteExceptionPolicy. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + +Response response = client.DeleteExceptionPolicy("MainExceptionPolicy"); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call GetQueueAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + +Response response = await client.GetQueueAsync("MainQueue"); +]]> + + + +This sample shows how to call GetQueue. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + +Response response = client.GetQueue("MainQueue"); +]]> + + + +This sample shows how to call GetQueueAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + +Response response = await client.GetQueueAsync("MainQueue", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +]]> + + + +This sample shows how to call GetQueue and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + +Response response = client.GetQueue("MainQueue", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +]]> + + + +This sample shows how to call DeleteQueueAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + +Response response = await client.DeleteQueueAsync("MainQueue"); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call DeleteQueue. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + +Response response = client.DeleteQueue("MainQueue"); + +Console.WriteLine(response.Status); +]]> + + + \ 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..8b3266aee793 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/Docs/JobRouterClient.xml @@ -0,0 +1,325 @@ + + + + + +This sample shows how to call GetJobAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterClient client = new JobRouterClient(endpoint, credential); + +Response response = await client.GetJobAsync("8780b28c-7079-4de1-9143-4d369289e958"); +]]> + + + +This sample shows how to call GetJob. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterClient client = new JobRouterClient(endpoint, credential); + +Response response = client.GetJob("8780b28c-7079-4de1-9143-4d369289e958"); +]]> + + + +This sample shows how to call GetJobAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterClient client = new JobRouterClient(endpoint, credential); + +Response response = await client.GetJobAsync("8780b28c-7079-4de1-9143-4d369289e958", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +]]> + + + +This sample shows how to call GetJob and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterClient client = new JobRouterClient(endpoint, credential); + +Response response = client.GetJob("8780b28c-7079-4de1-9143-4d369289e958", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +]]> + + + +This sample shows how to call DeleteJobAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterClient client = new JobRouterClient(endpoint, credential); + +Response response = await client.DeleteJobAsync("8780b28c-7079-4de1-9143-4d369289e958"); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call DeleteJob. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterClient client = new JobRouterClient(endpoint, credential); + +Response response = client.DeleteJob("8780b28c-7079-4de1-9143-4d369289e958"); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call GetQueuePositionAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterClient client = new JobRouterClient(endpoint, credential); + +Response response = await client.GetQueuePositionAsync("8780b28c-7079-4de1-9143-4d369289e958"); +]]> + + + +This sample shows how to call GetQueuePosition. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterClient client = new JobRouterClient(endpoint, credential); + +Response response = client.GetQueuePosition("8780b28c-7079-4de1-9143-4d369289e958"); +]]> + + + +This sample shows how to call GetQueuePositionAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterClient client = new JobRouterClient(endpoint, credential); + +Response response = await client.GetQueuePositionAsync("8780b28c-7079-4de1-9143-4d369289e958", 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. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterClient client = new JobRouterClient(endpoint, credential); + +Response response = client.GetQueuePosition("8780b28c-7079-4de1-9143-4d369289e958", 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 AcceptJobOfferAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterClient client = new JobRouterClient(endpoint, credential); + +Response response = await client.AcceptJobOfferAsync("DefaultWorker", "1d5896f3-8b54-40be-82d3-910323f5e2af"); +]]> + + + +This sample shows how to call AcceptJobOffer. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterClient client = new JobRouterClient(endpoint, credential); + +Response response = client.AcceptJobOffer("DefaultWorker", "1d5896f3-8b54-40be-82d3-910323f5e2af"); +]]> + + + +This sample shows how to call AcceptJobOfferAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterClient client = new JobRouterClient(endpoint, credential); + +Response response = await client.AcceptJobOfferAsync("DefaultWorker", "1d5896f3-8b54-40be-82d3-910323f5e2af", 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. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterClient client = new JobRouterClient(endpoint, credential); + +Response response = client.AcceptJobOffer("DefaultWorker", "1d5896f3-8b54-40be-82d3-910323f5e2af", 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 GetQueueStatisticsAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterClient client = new JobRouterClient(endpoint, credential); + +Response response = await client.GetQueueStatisticsAsync("MainQueue"); +]]> + + + +This sample shows how to call GetQueueStatistics. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterClient client = new JobRouterClient(endpoint, credential); + +Response response = client.GetQueueStatistics("MainQueue"); +]]> + + + +This sample shows how to call GetQueueStatisticsAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterClient client = new JobRouterClient(endpoint, credential); + +Response response = await client.GetQueueStatisticsAsync("MainQueue", 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 and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterClient client = new JobRouterClient(endpoint, credential); + +Response response = client.GetQueueStatistics("MainQueue", 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 GetWorkerAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterClient client = new JobRouterClient(endpoint, credential); + +Response response = await client.GetWorkerAsync("DefaultWorker"); +]]> + + + +This sample shows how to call GetWorker. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterClient client = new JobRouterClient(endpoint, credential); + +Response response = client.GetWorker("DefaultWorker"); +]]> + + + +This sample shows how to call GetWorkerAsync and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterClient client = new JobRouterClient(endpoint, credential); + +Response response = await client.GetWorkerAsync("DefaultWorker", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +]]> + + + +This sample shows how to call GetWorker and parse the result. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterClient client = new JobRouterClient(endpoint, credential); + +Response response = client.GetWorker("DefaultWorker", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("etag").ToString()); +Console.WriteLine(result.GetProperty("id").ToString()); +]]> + + + +This sample shows how to call DeleteWorkerAsync. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterClient client = new JobRouterClient(endpoint, credential); + +Response response = await client.DeleteWorkerAsync("DefaultWorker"); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call DeleteWorker. +"); +TokenCredential credential = new DefaultAzureCredential(); +JobRouterClient client = new JobRouterClient(endpoint, credential); + +Response response = client.DeleteWorker("DefaultWorker"); + +Console.WriteLine(response.Status); +]]> + + + \ No newline at end of file diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterAdministrationClient.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterAdministrationClient.cs index 40ca039656c1..88c12de1c667 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterAdministrationClient.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterAdministrationClient.cs @@ -18,6 +18,8 @@ namespace Azure.Communication.JobRouter /// The JobRouterAdministration service client. public partial class JobRouterAdministrationClient { + private static readonly string[] AuthorizationScopes = new string[] { "https://communication.azure.com/.default" }; + private readonly TokenCredential _tokenCredential; private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; @@ -28,6 +30,14 @@ public partial class JobRouterAdministrationClient /// The HTTP pipeline for sending and receiving REST requests and responses. public virtual HttpPipeline Pipeline => _pipeline; + /// Initializes a new instance of JobRouterAdministrationClient. + /// Uri of your Communication resource. + /// A credential used to authenticate to an Azure Service. + /// or is null. + public JobRouterAdministrationClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new JobRouterClientOptions()) + { + } + /// /// [Protocol Method] Creates or updates a distribution policy. /// @@ -125,6 +135,7 @@ internal virtual Response UpsertDistributionPolicy(string distributionPolicyId, /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. + /// public virtual async Task> GetDistributionPolicyAsync(string distributionPolicyId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(distributionPolicyId, nameof(distributionPolicyId)); @@ -139,6 +150,7 @@ public virtual async Task> GetDistributionPolicyAsy /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. + /// public virtual Response GetDistributionPolicy(string distributionPolicyId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(distributionPolicyId, nameof(distributionPolicyId)); @@ -169,6 +181,7 @@ public virtual Response GetDistributionPolicy(string distrib /// 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 distributionPolicyId, RequestContext context) { Argument.AssertNotNullOrEmpty(distributionPolicyId, nameof(distributionPolicyId)); @@ -208,6 +221,7 @@ public virtual async Task GetDistributionPolicyAsync(string distributi /// 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 distributionPolicyId, RequestContext context) { Argument.AssertNotNullOrEmpty(distributionPolicyId, nameof(distributionPolicyId)); @@ -243,6 +257,7 @@ public virtual Response GetDistributionPolicy(string distributionPolicyId, Reque /// 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 distributionPolicyId, RequestContext context = null) { Argument.AssertNotNullOrEmpty(distributionPolicyId, nameof(distributionPolicyId)); @@ -278,6 +293,7 @@ public virtual async Task DeleteDistributionPolicyAsync(string distrib /// 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 distributionPolicyId, RequestContext context = null) { Argument.AssertNotNullOrEmpty(distributionPolicyId, nameof(distributionPolicyId)); @@ -393,6 +409,7 @@ internal virtual Response UpsertClassificationPolicy(string classificationPolicy /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. + /// public virtual async Task> GetClassificationPolicyAsync(string classificationPolicyId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(classificationPolicyId, nameof(classificationPolicyId)); @@ -407,6 +424,7 @@ public virtual async Task> GetClassificationPolic /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. + /// public virtual Response GetClassificationPolicy(string classificationPolicyId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(classificationPolicyId, nameof(classificationPolicyId)); @@ -437,6 +455,7 @@ public virtual Response GetClassificationPolicy(string cla /// 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 classificationPolicyId, RequestContext context) { Argument.AssertNotNullOrEmpty(classificationPolicyId, nameof(classificationPolicyId)); @@ -476,6 +495,7 @@ public virtual async Task GetClassificationPolicyAsync(string classifi /// 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 classificationPolicyId, RequestContext context) { Argument.AssertNotNullOrEmpty(classificationPolicyId, nameof(classificationPolicyId)); @@ -511,6 +531,7 @@ public virtual Response GetClassificationPolicy(string classificationPolicyId, R /// 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 classificationPolicyId, RequestContext context = null) { Argument.AssertNotNullOrEmpty(classificationPolicyId, nameof(classificationPolicyId)); @@ -546,6 +567,7 @@ public virtual async Task DeleteClassificationPolicyAsync(string class /// 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 classificationPolicyId, RequestContext context = null) { Argument.AssertNotNullOrEmpty(classificationPolicyId, nameof(classificationPolicyId)); @@ -661,6 +683,7 @@ internal virtual Response UpsertExceptionPolicy(string exceptionPolicyId, Reques /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. + /// public virtual async Task> GetExceptionPolicyAsync(string exceptionPolicyId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(exceptionPolicyId, nameof(exceptionPolicyId)); @@ -675,6 +698,7 @@ public virtual async Task> GetExceptionPolicyAsync(str /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. + /// public virtual Response GetExceptionPolicy(string exceptionPolicyId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(exceptionPolicyId, nameof(exceptionPolicyId)); @@ -705,6 +729,7 @@ public virtual Response GetExceptionPolicy(string exceptionPoli /// 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 exceptionPolicyId, RequestContext context) { Argument.AssertNotNullOrEmpty(exceptionPolicyId, nameof(exceptionPolicyId)); @@ -744,6 +769,7 @@ public virtual async Task GetExceptionPolicyAsync(string exceptionPoli /// 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 exceptionPolicyId, RequestContext context) { Argument.AssertNotNullOrEmpty(exceptionPolicyId, nameof(exceptionPolicyId)); @@ -779,6 +805,7 @@ public virtual Response GetExceptionPolicy(string exceptionPolicyId, RequestCont /// 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 exceptionPolicyId, RequestContext context = null) { Argument.AssertNotNullOrEmpty(exceptionPolicyId, nameof(exceptionPolicyId)); @@ -814,6 +841,7 @@ public virtual async Task DeleteExceptionPolicyAsync(string exceptionP /// 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 exceptionPolicyId, RequestContext context = null) { Argument.AssertNotNullOrEmpty(exceptionPolicyId, nameof(exceptionPolicyId)); @@ -929,6 +957,7 @@ internal virtual Response UpsertQueue(string queueId, RequestContent content, Re /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. + /// public virtual async Task> GetQueueAsync(string queueId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(queueId, nameof(queueId)); @@ -943,6 +972,7 @@ public virtual async Task> GetQueueAsync(string queueId, C /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. + /// public virtual Response GetQueue(string queueId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(queueId, nameof(queueId)); @@ -973,6 +1003,7 @@ public virtual Response GetQueue(string queueId, CancellationToken /// 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 queueId, RequestContext context) { Argument.AssertNotNullOrEmpty(queueId, nameof(queueId)); @@ -1012,6 +1043,7 @@ public virtual async Task GetQueueAsync(string queueId, RequestContext /// 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 queueId, RequestContext context) { Argument.AssertNotNullOrEmpty(queueId, nameof(queueId)); @@ -1047,6 +1079,7 @@ public virtual Response GetQueue(string queueId, RequestContext context) /// 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 queueId, RequestContext context = null) { Argument.AssertNotNullOrEmpty(queueId, nameof(queueId)); @@ -1082,6 +1115,7 @@ public virtual async Task DeleteQueueAsync(string queueId, RequestCont /// 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 queueId, RequestContext context = null) { Argument.AssertNotNullOrEmpty(queueId, nameof(queueId)); diff --git a/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterClient.cs b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterClient.cs index af9362d7bf7f..f59a43728e17 100644 --- a/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterClient.cs +++ b/sdk/communication/Azure.Communication.JobRouter/src/Generated/JobRouterClient.cs @@ -18,6 +18,8 @@ namespace Azure.Communication.JobRouter /// The JobRouter service client. public partial class JobRouterClient { + private static readonly string[] AuthorizationScopes = new string[] { "https://communication.azure.com/.default" }; + private readonly TokenCredential _tokenCredential; private readonly HttpPipeline _pipeline; private readonly Uri _endpoint; private readonly string _apiVersion; @@ -28,6 +30,14 @@ public partial class JobRouterClient /// The HTTP pipeline for sending and receiving REST requests and responses. public virtual HttpPipeline Pipeline => _pipeline; + /// Initializes a new instance of JobRouterClient. + /// Uri of your Communication resource. + /// A credential used to authenticate to an Azure Service. + /// or is null. + public JobRouterClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new JobRouterClientOptions()) + { + } + /// /// [Protocol Method] Creates or updates a router job. /// @@ -125,6 +135,7 @@ internal virtual Response UpsertJob(string jobId, RequestContent content, Reques /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. + /// public virtual async Task> GetJobAsync(string jobId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); @@ -139,6 +150,7 @@ public virtual async Task> GetJobAsync(string jobId, Cancell /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. + /// public virtual Response GetJob(string jobId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); @@ -169,6 +181,7 @@ public virtual Response GetJob(string jobId, CancellationToken cancel /// 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 jobId, RequestContext context) { Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); @@ -208,6 +221,7 @@ public virtual async Task GetJobAsync(string jobId, RequestContext con /// 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 jobId, RequestContext context) { Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); @@ -243,6 +257,7 @@ public virtual Response GetJob(string jobId, RequestContext context) /// 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 jobId, RequestContext context = null) { Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); @@ -278,6 +293,7 @@ public virtual async Task DeleteJobAsync(string jobId, RequestContext /// 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 jobId, RequestContext context = null) { Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); @@ -437,6 +453,7 @@ internal virtual Response CloseJob(string jobId, string assignme /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. + /// public virtual async Task> GetQueuePositionAsync(string jobId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); @@ -451,6 +468,7 @@ public virtual async Task> GetQueuePositionAs /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. + /// public virtual Response GetQueuePosition(string jobId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); @@ -481,6 +499,7 @@ public virtual Response GetQueuePosition(string jobId, /// 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 jobId, RequestContext context) { Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); @@ -520,6 +539,7 @@ public virtual async Task GetQueuePositionAsync(string jobId, RequestC /// 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 jobId, RequestContext context) { Argument.AssertNotNullOrEmpty(jobId, nameof(jobId)); @@ -580,6 +600,7 @@ internal virtual Response UnassignJob(string jobId, string as /// 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)); @@ -596,6 +617,7 @@ public virtual async Task> AcceptJobOfferAsync(st /// 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)); @@ -628,6 +650,7 @@ public virtual Response AcceptJobOffer(string workerId, st /// 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)); @@ -669,6 +692,7 @@ public virtual async Task AcceptJobOfferAsync(string workerId, string /// 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)); @@ -729,6 +753,7 @@ internal virtual Response DeclineJobOffer(string workerId /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. + /// public virtual async Task> GetQueueStatisticsAsync(string queueId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(queueId, nameof(queueId)); @@ -743,6 +768,7 @@ public virtual async Task> GetQueueStatisticsAsy /// The cancellation token to use. /// is null. /// is an empty string, and was expected to be non-empty. + /// public virtual Response GetQueueStatistics(string queueId, CancellationToken cancellationToken = default) { Argument.AssertNotNullOrEmpty(queueId, nameof(queueId)); @@ -773,6 +799,7 @@ public virtual Response GetQueueStatistics(string queueId /// 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 queueId, RequestContext context) { Argument.AssertNotNullOrEmpty(queueId, nameof(queueId)); @@ -812,6 +839,7 @@ public virtual async Task GetQueueStatisticsAsync(string queueId, Requ /// 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 queueId, RequestContext context) { Argument.AssertNotNullOrEmpty(queueId, nameof(queueId)); @@ -927,6 +955,7 @@ internal virtual Response UpsertWorker(string workerId, RequestContent content, /// 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)); @@ -941,6 +970,7 @@ public virtual async Task> GetWorkerAsync(string workerId /// 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)); @@ -971,6 +1001,7 @@ public virtual Response GetWorker(string workerId, CancellationTok /// 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)); @@ -1010,6 +1041,7 @@ public virtual async Task GetWorkerAsync(string workerId, RequestConte /// 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)); @@ -1045,6 +1077,7 @@ public virtual Response GetWorker(string workerId, RequestContext context) /// 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)); @@ -1080,6 +1113,7 @@ public virtual async Task DeleteWorkerAsync(string workerId, RequestCo /// 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)); 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..e2d8e1cfe3c2 --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Generated/Samples/Samples_JobRouterAdministrationClient.cs @@ -0,0 +1,331 @@ +// 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.Core; +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_DistributionPolicy_GetDistributionPolicy_RetrievesAnExistingDistributionPolicyById() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + + Response response = client.GetDistributionPolicy("MainDistributionPolicy", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DistributionPolicy_GetDistributionPolicy_RetrievesAnExistingDistributionPolicyById_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + + Response response = await client.GetDistributionPolicyAsync("MainDistributionPolicy", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DistributionPolicy_GetDistributionPolicy_RetrievesAnExistingDistributionPolicyById_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + + Response response = client.GetDistributionPolicy("MainDistributionPolicy"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DistributionPolicy_GetDistributionPolicy_RetrievesAnExistingDistributionPolicyById_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + + Response response = await client.GetDistributionPolicyAsync("MainDistributionPolicy"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_DistributionPolicy_DeleteDistributionPolicy_DeleteADistributionPolicy() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + + Response response = client.DeleteDistributionPolicy("MainDistributionPolicy"); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_DistributionPolicy_DeleteDistributionPolicy_DeleteADistributionPolicy_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + + Response response = await client.DeleteDistributionPolicyAsync("MainDistributionPolicy"); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ClassificationPolicy_GetClassificationPolicy_RetrievesAnExistingClassificationPolicyById() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + + Response response = client.GetClassificationPolicy("MainClassificationPolicy", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ClassificationPolicy_GetClassificationPolicy_RetrievesAnExistingClassificationPolicyById_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + + Response response = await client.GetClassificationPolicyAsync("MainClassificationPolicy", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ClassificationPolicy_GetClassificationPolicy_RetrievesAnExistingClassificationPolicyById_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + + Response response = client.GetClassificationPolicy("MainClassificationPolicy"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ClassificationPolicy_GetClassificationPolicy_RetrievesAnExistingClassificationPolicyById_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + + Response response = await client.GetClassificationPolicyAsync("MainClassificationPolicy"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ClassificationPolicy_DeleteClassificationPolicy_DeleteAClassificationPolicy() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + + Response response = client.DeleteClassificationPolicy("MainClassificationPolicy"); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ClassificationPolicy_DeleteClassificationPolicy_DeleteAClassificationPolicy_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + + Response response = await client.DeleteClassificationPolicyAsync("MainClassificationPolicy"); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ExceptionPolicy_GetExceptionPolicy_RetrievesAnExistingExceptionPolicyById() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + + Response response = client.GetExceptionPolicy("MainExceptionPolicy", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ExceptionPolicy_GetExceptionPolicy_RetrievesAnExistingExceptionPolicyById_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + + Response response = await client.GetExceptionPolicyAsync("MainExceptionPolicy", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ExceptionPolicy_GetExceptionPolicy_RetrievesAnExistingExceptionPolicyById_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + + Response response = client.GetExceptionPolicy("MainExceptionPolicy"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ExceptionPolicy_GetExceptionPolicy_RetrievesAnExistingExceptionPolicyById_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + + Response response = await client.GetExceptionPolicyAsync("MainExceptionPolicy"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ExceptionPolicy_DeleteExceptionPolicy_DeletesAExceptionPolicy() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + + Response response = client.DeleteExceptionPolicy("MainExceptionPolicy"); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ExceptionPolicy_DeleteExceptionPolicy_DeletesAExceptionPolicy_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + + Response response = await client.DeleteExceptionPolicyAsync("MainExceptionPolicy"); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_RouterQueue_GetQueue_RetrievesAnExistingQueueById() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + + Response response = client.GetQueue("MainQueue", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_RouterQueue_GetQueue_RetrievesAnExistingQueueById_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + + Response response = await client.GetQueueAsync("MainQueue", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_RouterQueue_GetQueue_RetrievesAnExistingQueueById_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + + Response response = client.GetQueue("MainQueue"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_RouterQueue_GetQueue_RetrievesAnExistingQueueById_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + + Response response = await client.GetQueueAsync("MainQueue"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_RouterQueue_DeleteQueue_DeletesAQueue() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + + Response response = client.DeleteQueue("MainQueue"); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_RouterQueue_DeleteQueue_DeletesAQueue_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterAdministrationClient client = new JobRouterAdministrationClient(endpoint, credential); + + Response response = await client.DeleteQueueAsync("MainQueue"); + + Console.WriteLine(response.Status); + } + } +} 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..ffff2e307b4c --- /dev/null +++ b/sdk/communication/Azure.Communication.JobRouter/tests/Generated/Samples/Samples_JobRouterClient.cs @@ -0,0 +1,339 @@ +// 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.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_RouterJob_GetJob_RetrievesAnExistingJobById() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterClient client = new JobRouterClient(endpoint, credential); + + Response response = client.GetJob("8780b28c-7079-4de1-9143-4d369289e958", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_RouterJob_GetJob_RetrievesAnExistingJobById_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterClient client = new JobRouterClient(endpoint, credential); + + Response response = await client.GetJobAsync("8780b28c-7079-4de1-9143-4d369289e958", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_RouterJob_GetJob_RetrievesAnExistingJobById_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterClient client = new JobRouterClient(endpoint, credential); + + Response response = client.GetJob("8780b28c-7079-4de1-9143-4d369289e958"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_RouterJob_GetJob_RetrievesAnExistingJobById_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterClient client = new JobRouterClient(endpoint, credential); + + Response response = await client.GetJobAsync("8780b28c-7079-4de1-9143-4d369289e958"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_RouterJob_DeleteJob_DeletesAJobAndAllOfItsTraces() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterClient client = new JobRouterClient(endpoint, credential); + + Response response = client.DeleteJob("8780b28c-7079-4de1-9143-4d369289e958"); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_RouterJob_DeleteJob_DeletesAJobAndAllOfItsTraces_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterClient client = new JobRouterClient(endpoint, credential); + + Response response = await client.DeleteJobAsync("8780b28c-7079-4de1-9143-4d369289e958"); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_JobRouterRestClient_GetQueuePosition_GetsAJobSPositionDetails() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterClient client = new JobRouterClient(endpoint, credential); + + Response response = client.GetQueuePosition("8780b28c-7079-4de1-9143-4d369289e958", 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_JobRouterRestClient_GetQueuePosition_GetsAJobSPositionDetails_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterClient client = new JobRouterClient(endpoint, credential); + + Response response = await client.GetQueuePositionAsync("8780b28c-7079-4de1-9143-4d369289e958", 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_JobRouterRestClient_GetQueuePosition_GetsAJobSPositionDetails_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterClient client = new JobRouterClient(endpoint, credential); + + Response response = client.GetQueuePosition("8780b28c-7079-4de1-9143-4d369289e958"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_JobRouterRestClient_GetQueuePosition_GetsAJobSPositionDetails_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterClient client = new JobRouterClient(endpoint, credential); + + Response response = await client.GetQueuePositionAsync("8780b28c-7079-4de1-9143-4d369289e958"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_JobRouterRestClient_AcceptJobOffer_AcceptsAnOfferToWorkOnAJob() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterClient client = new JobRouterClient(endpoint, credential); + + Response response = client.AcceptJobOffer("DefaultWorker", "1d5896f3-8b54-40be-82d3-910323f5e2af", 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_JobRouterRestClient_AcceptJobOffer_AcceptsAnOfferToWorkOnAJob_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterClient client = new JobRouterClient(endpoint, credential); + + Response response = await client.AcceptJobOfferAsync("DefaultWorker", "1d5896f3-8b54-40be-82d3-910323f5e2af", 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_JobRouterRestClient_AcceptJobOffer_AcceptsAnOfferToWorkOnAJob_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterClient client = new JobRouterClient(endpoint, credential); + + Response response = client.AcceptJobOffer("DefaultWorker", "1d5896f3-8b54-40be-82d3-910323f5e2af"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_JobRouterRestClient_AcceptJobOffer_AcceptsAnOfferToWorkOnAJob_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterClient client = new JobRouterClient(endpoint, credential); + + Response response = await client.AcceptJobOfferAsync("DefaultWorker", "1d5896f3-8b54-40be-82d3-910323f5e2af"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_JobRouterRestClient_GetQueueStatistics_RetrievesAQueueSStatistics() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterClient client = new JobRouterClient(endpoint, credential); + + Response response = client.GetQueueStatistics("MainQueue", 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_JobRouterRestClient_GetQueueStatistics_RetrievesAQueueSStatistics_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterClient client = new JobRouterClient(endpoint, credential); + + Response response = await client.GetQueueStatisticsAsync("MainQueue", 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_JobRouterRestClient_GetQueueStatistics_RetrievesAQueueSStatistics_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterClient client = new JobRouterClient(endpoint, credential); + + Response response = client.GetQueueStatistics("MainQueue"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_JobRouterRestClient_GetQueueStatistics_RetrievesAQueueSStatistics_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterClient client = new JobRouterClient(endpoint, credential); + + Response response = await client.GetQueueStatisticsAsync("MainQueue"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_RouterWorker_GetWorker_RetrievesAnExistingWorkerById() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterClient client = new JobRouterClient(endpoint, credential); + + Response response = client.GetWorker("DefaultWorker", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_RouterWorker_GetWorker_RetrievesAnExistingWorkerById_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterClient client = new JobRouterClient(endpoint, credential); + + Response response = await client.GetWorkerAsync("DefaultWorker", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("etag").ToString()); + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_RouterWorker_GetWorker_RetrievesAnExistingWorkerById_Convenience() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterClient client = new JobRouterClient(endpoint, credential); + + Response response = client.GetWorker("DefaultWorker"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_RouterWorker_GetWorker_RetrievesAnExistingWorkerById_Convenience_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterClient client = new JobRouterClient(endpoint, credential); + + Response response = await client.GetWorkerAsync("DefaultWorker"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_RouterWorker_DeleteWorker_DeletesAWorkerAndAllOfItsTraces() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterClient client = new JobRouterClient(endpoint, credential); + + Response response = client.DeleteWorker("DefaultWorker"); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_RouterWorker_DeleteWorker_DeletesAWorkerAndAllOfItsTraces_Async() + { + Uri endpoint = new Uri(""); + TokenCredential credential = new DefaultAzureCredential(); + JobRouterClient client = new JobRouterClient(endpoint, credential); + + Response response = await client.DeleteWorkerAsync("DefaultWorker"); + + Console.WriteLine(response.Status); + } + } +} diff --git a/sdk/communication/Azure.Communication.JobRouter/tsp-location.yaml b/sdk/communication/Azure.Communication.JobRouter/tsp-location.yaml index 3d71082e5561..8f1e550f2543 100644 --- a/sdk/communication/Azure.Communication.JobRouter/tsp-location.yaml +++ b/sdk/communication/Azure.Communication.JobRouter/tsp-location.yaml @@ -1,5 +1,4 @@ -commit: 327984bd2b2fca0d32b1018d7d4a36d1f4eb65ce directory: specification/communication/Communication.JobRouter -additionalDirectories: [] +commit: 726419b7eba57b9b5888ca11e055c8f82dcaae58 repo: Azure/azure-rest-api-specs - +additionalDirectories: diff --git a/sdk/communication/Azure.Communication.Messages/tsp-location.yaml b/sdk/communication/Azure.Communication.Messages/tsp-location.yaml index 1746c1b45ffd..62ec1bec6d75 100644 --- a/sdk/communication/Azure.Communication.Messages/tsp-location.yaml +++ b/sdk/communication/Azure.Communication.Messages/tsp-location.yaml @@ -1,4 +1,4 @@ -commit: ad8f361fbc5a2d826ddcd5abe78d1d91b2e4422c directory: specification/communication/Communication.Messages -additionalDirectories: [] +commit: 726419b7eba57b9b5888ca11e055c8f82dcaae58 repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/communication/Azure.ResourceManager.Communication/src/autorest.md b/sdk/communication/Azure.ResourceManager.Communication/src/autorest.md index 44f2ddaf4b78..a62f52180ad7 100644 --- a/sdk/communication/Azure.ResourceManager.Communication/src/autorest.md +++ b/sdk/communication/Azure.ResourceManager.Communication/src/autorest.md @@ -8,7 +8,7 @@ azure-arm: true title: communication namespace: Azure.ResourceManager.Communication # default tag is a preview version -require: https://github.com/Azure/azure-rest-api-specs/blob/5a281cf0d538de6dad0c70eda7ee901c60a11e6b/specification/communication/resource-manager/readme.md#tag-package-2023-04 +require: /mnt/vss/_work/1/s/azure-rest-api-specs/specification/communication/resource-manager/readme.md#tag-package-2023-04 output-folder: $(this-folder)/Generated clear-output-folder: true sample-gen: