diff --git a/eng/Packages.Data.props b/eng/Packages.Data.props index a86a62d967288..d5daa3d84e88f 100644 --- a/eng/Packages.Data.props +++ b/eng/Packages.Data.props @@ -176,7 +176,7 @@ All should have PrivateAssets="All" set so they don't become package dependencies --> - + diff --git a/eng/emitter-package-lock.json b/eng/emitter-package-lock.json index fc3ffe6223c6e..a92bd23d39c8e 100644 --- a/eng/emitter-package-lock.json +++ b/eng/emitter-package-lock.json @@ -5,7 +5,7 @@ "packages": { "": { "dependencies": { - "@azure-tools/typespec-csharp": "0.2.0-beta.20231012.5" + "@azure-tools/typespec-csharp": "0.2.0-beta.20231013.1" } }, "node_modules/@aashutoshrathi/word-wrap": { @@ -17,9 +17,9 @@ } }, "node_modules/@autorest/csharp": { - "version": "3.0.0-beta.20231012.5", - "resolved": "https://registry.npmjs.org/@autorest/csharp/-/csharp-3.0.0-beta.20231012.5.tgz", - "integrity": "sha512-LpR/Pbdrp+lUudKpX4lI9Z9diE7oQ0RHfMSrB0IB0Vv4BeuPUZYT1cXnKnakL5n2SX1UTxhtmLrQB8PF4kdOvQ==" + "version": "3.0.0-beta.20231013.1", + "resolved": "https://registry.npmjs.org/@autorest/csharp/-/csharp-3.0.0-beta.20231013.1.tgz", + "integrity": "sha512-gTmO7yO5ad6pvCoWcmKd9Xc416gdZEUJeeNOkGUf/WIe6mNjQLgUgi/m8OVN5ppAnAAT538r9ayN9KS/BWaq+Q==" }, "node_modules/@azure-tools/typespec-azure-core": { "version": "0.35.0", @@ -49,11 +49,11 @@ } }, "node_modules/@azure-tools/typespec-csharp": { - "version": "0.2.0-beta.20231012.5", - "resolved": "https://registry.npmjs.org/@azure-tools/typespec-csharp/-/typespec-csharp-0.2.0-beta.20231012.5.tgz", - "integrity": "sha512-HYKUnh6A+eS0qScuy2BZHoV82D/Ylx53MznBg5cDjcqR3AfPvMdl++7AWIq3nZvzBzNno4df4VRcuK/qcCCXzw==", + "version": "0.2.0-beta.20231013.1", + "resolved": "https://registry.npmjs.org/@azure-tools/typespec-csharp/-/typespec-csharp-0.2.0-beta.20231013.1.tgz", + "integrity": "sha512-O9xlpcJ9OlvkNdkexbmEpA12PGqdYWa4LNF0OxkMC2cx0iQAZN+9i1PXuL3QFKJ5d8l1PJzAVvL3UTaiLAxuEw==", "dependencies": { - "@autorest/csharp": "3.0.0-beta.20231012.5", + "@autorest/csharp": "3.0.0-beta.20231013.1", "@azure-tools/typespec-azure-core": "0.35.0", "@azure-tools/typespec-client-generator-core": "0.35.0", "@typespec/compiler": "0.49.0", diff --git a/eng/emitter-package.json b/eng/emitter-package.json index c22ccc0b5de41..06e20c4b5a216 100644 --- a/eng/emitter-package.json +++ b/eng/emitter-package.json @@ -1,6 +1,6 @@ { "main": "dist/src/index.js", "dependencies": { - "@azure-tools/typespec-csharp": "0.2.0-beta.20231012.5" + "@azure-tools/typespec-csharp": "0.2.0-beta.20231013.1" } } diff --git a/sdk/devcenter/Azure.Developer.DevCenter/api/Azure.Developer.DevCenter.netstandard2.0.cs b/sdk/devcenter/Azure.Developer.DevCenter/api/Azure.Developer.DevCenter.netstandard2.0.cs index bde93d69e6813..44ecad4379e78 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/api/Azure.Developer.DevCenter.netstandard2.0.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/api/Azure.Developer.DevCenter.netstandard2.0.cs @@ -8,8 +8,8 @@ public DeploymentEnvironmentsClient(System.Uri endpoint, Azure.Core.TokenCredent public virtual Azure.Core.Pipeline.HttpPipeline Pipeline { get { throw null; } } public virtual Azure.Operation CreateOrUpdateEnvironment(Azure.WaitUntil waitUntil, string projectName, string userId, string environmentName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } public virtual System.Threading.Tasks.Task> CreateOrUpdateEnvironmentAsync(Azure.WaitUntil waitUntil, string projectName, string userId, string environmentName, Azure.Core.RequestContent content, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Operation DeleteEnvironment(Azure.WaitUntil waitUntil, string projectName, string userId, string environmentName, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task> DeleteEnvironmentAsync(Azure.WaitUntil waitUntil, string projectName, string userId, string environmentName, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Operation DeleteEnvironment(Azure.WaitUntil waitUntil, string projectName, string userId, string environmentName, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task DeleteEnvironmentAsync(Azure.WaitUntil waitUntil, string projectName, string userId, string environmentName, Azure.RequestContext context = null) { throw null; } public virtual Azure.Pageable GetAllEnvironments(string projectName, int? maxCount = default(int?), Azure.RequestContext context = null) { throw null; } public virtual Azure.AsyncPageable GetAllEnvironmentsAsync(string projectName, int? maxCount = default(int?), Azure.RequestContext context = null) { throw null; } public virtual Azure.Response GetCatalog(string projectName, string catalogName, Azure.RequestContext context = null) { throw null; } @@ -41,8 +41,8 @@ public DevBoxesClient(System.Uri endpoint, Azure.Core.TokenCredential credential public virtual System.Threading.Tasks.Task DelayActionAsync(string projectName, string userId, string devBoxName, string actionName, System.DateTimeOffset until, Azure.RequestContext context = null) { throw null; } public virtual Azure.Pageable DelayAllActions(string projectName, string userId, string devBoxName, System.DateTimeOffset until, Azure.RequestContext context = null) { throw null; } public virtual Azure.AsyncPageable DelayAllActionsAsync(string projectName, string userId, string devBoxName, System.DateTimeOffset until, Azure.RequestContext context = null) { throw null; } - public virtual Azure.Operation DeleteDevBox(Azure.WaitUntil waitUntil, string projectName, string userId, string devBoxName, Azure.RequestContext context = null) { throw null; } - public virtual System.Threading.Tasks.Task> DeleteDevBoxAsync(Azure.WaitUntil waitUntil, string projectName, string userId, string devBoxName, Azure.RequestContext context = null) { throw null; } + public virtual Azure.Operation DeleteDevBox(Azure.WaitUntil waitUntil, string projectName, string userId, string devBoxName, Azure.RequestContext context = null) { throw null; } + public virtual System.Threading.Tasks.Task DeleteDevBoxAsync(Azure.WaitUntil waitUntil, string projectName, string userId, string devBoxName, Azure.RequestContext context = null) { throw null; } public virtual Azure.Response GetAction(string projectName, string userId, string devBoxName, string actionName, Azure.RequestContext context = null) { throw null; } public virtual System.Threading.Tasks.Task GetActionAsync(string projectName, string userId, string devBoxName, string actionName, Azure.RequestContext context = null) { throw null; } public virtual Azure.Pageable GetActions(string projectName, string userId, string devBoxName, Azure.RequestContext context = null) { throw null; } diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DeploymentEnvironmentsClient.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DeploymentEnvironmentsClient.cs index 45e29f704ed7c..ee8ef9064e0b3 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DeploymentEnvironmentsClient.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DeploymentEnvironmentsClient.cs @@ -727,7 +727,7 @@ public virtual Operation CreateOrUpdateEnvironment(WaitUntil waitUnt /// Service returned a non-success status code. /// The representing an asynchronous operation on the service. /// - public virtual async Task> DeleteEnvironmentAsync(WaitUntil waitUntil, string projectName, string userId, string environmentName, RequestContext context = null) + public virtual async Task DeleteEnvironmentAsync(WaitUntil waitUntil, string projectName, string userId, string environmentName, RequestContext context = null) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); @@ -738,7 +738,7 @@ public virtual async Task> DeleteEnvironmentAsync(WaitUnti try { using HttpMessage message = CreateDeleteEnvironmentRequest(projectName, userId, environmentName, context); - return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "DeploymentEnvironmentsClient.DeleteEnvironment", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); + return await ProtocolOperationHelpers.ProcessMessageWithoutResponseValueAsync(_pipeline, message, ClientDiagnostics, "DeploymentEnvironmentsClient.DeleteEnvironment", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); } catch (Exception e) { @@ -767,7 +767,7 @@ public virtual async Task> DeleteEnvironmentAsync(WaitUnti /// Service returned a non-success status code. /// The representing an asynchronous operation on the service. /// - public virtual Operation DeleteEnvironment(WaitUntil waitUntil, string projectName, string userId, string environmentName, RequestContext context = null) + public virtual Operation DeleteEnvironment(WaitUntil waitUntil, string projectName, string userId, string environmentName, RequestContext context = null) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); @@ -778,7 +778,7 @@ public virtual Operation DeleteEnvironment(WaitUntil waitUntil, stri try { using HttpMessage message = CreateDeleteEnvironmentRequest(projectName, userId, environmentName, context); - return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "DeploymentEnvironmentsClient.DeleteEnvironment", OperationFinalStateVia.Location, context, waitUntil); + return ProtocolOperationHelpers.ProcessMessageWithoutResponseValue(_pipeline, message, ClientDiagnostics, "DeploymentEnvironmentsClient.DeleteEnvironment", OperationFinalStateVia.Location, context, waitUntil); } catch (Exception e) { diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevBoxesClient.cs b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevBoxesClient.cs index cd32b90fe447b..234a72573dbf7 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevBoxesClient.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/DevBoxesClient.cs @@ -1121,7 +1121,7 @@ public virtual Operation CreateDevBox(WaitUntil waitUntil, string pr /// Service returned a non-success status code. /// The representing an asynchronous operation on the service. /// - public virtual async Task> DeleteDevBoxAsync(WaitUntil waitUntil, string projectName, string userId, string devBoxName, RequestContext context = null) + public virtual async Task DeleteDevBoxAsync(WaitUntil waitUntil, string projectName, string userId, string devBoxName, RequestContext context = null) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); @@ -1132,7 +1132,7 @@ public virtual async Task> DeleteDevBoxAsync(WaitUntil wai try { using HttpMessage message = CreateDeleteDevBoxRequest(projectName, userId, devBoxName, context); - return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "DevBoxesClient.DeleteDevBox", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); + return await ProtocolOperationHelpers.ProcessMessageWithoutResponseValueAsync(_pipeline, message, ClientDiagnostics, "DevBoxesClient.DeleteDevBox", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); } catch (Exception e) { @@ -1161,7 +1161,7 @@ public virtual async Task> DeleteDevBoxAsync(WaitUntil wai /// Service returned a non-success status code. /// The representing an asynchronous operation on the service. /// - public virtual Operation DeleteDevBox(WaitUntil waitUntil, string projectName, string userId, string devBoxName, RequestContext context = null) + public virtual Operation DeleteDevBox(WaitUntil waitUntil, string projectName, string userId, string devBoxName, RequestContext context = null) { Argument.AssertNotNullOrEmpty(projectName, nameof(projectName)); Argument.AssertNotNullOrEmpty(userId, nameof(userId)); @@ -1172,7 +1172,7 @@ public virtual Operation DeleteDevBox(WaitUntil waitUntil, string pr try { using HttpMessage message = CreateDeleteDevBoxRequest(projectName, userId, devBoxName, context); - return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "DevBoxesClient.DeleteDevBox", OperationFinalStateVia.Location, context, waitUntil); + return ProtocolOperationHelpers.ProcessMessageWithoutResponseValue(_pipeline, message, ClientDiagnostics, "DevBoxesClient.DeleteDevBox", OperationFinalStateVia.Location, context, waitUntil); } catch (Exception e) { diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Docs/DeploymentEnvironmentsClient.xml b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Docs/DeploymentEnvironmentsClient.xml index b69a9d918ef81..1633e89acb28c 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Docs/DeploymentEnvironmentsClient.xml +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Docs/DeploymentEnvironmentsClient.xml @@ -751,74 +751,40 @@ Console.WriteLine(result.GetProperty("parameters").ToString()); -This sample shows how to call DeleteEnvironmentAsync and parse the result. +This sample shows how to call DeleteEnvironmentAsync. "); TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); -Operation operation = await client.DeleteEnvironmentAsync(WaitUntil.Completed, "", "me", ""); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("status").ToString()); +Operation operation = await client.DeleteEnvironmentAsync(WaitUntil.Completed, "", "me", ""); ]]> -This sample shows how to call DeleteEnvironmentAsync with all parameters and parse the result. +This sample shows how to call DeleteEnvironmentAsync with all parameters. "); TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); -Operation operation = await client.DeleteEnvironmentAsync(WaitUntil.Completed, "", "me", ""); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("name").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("resourceId").ToString()); -Console.WriteLine(result.GetProperty("startTime").ToString()); -Console.WriteLine(result.GetProperty("endTime").ToString()); -Console.WriteLine(result.GetProperty("percentComplete").ToString()); -Console.WriteLine(result.GetProperty("properties").ToString()); -Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); +Operation operation = await client.DeleteEnvironmentAsync(WaitUntil.Completed, "", "me", ""); ]]> -This sample shows how to call DeleteEnvironment and parse the result. +This sample shows how to call DeleteEnvironment. "); TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); -Operation operation = client.DeleteEnvironment(WaitUntil.Completed, "", "me", ""); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("status").ToString()); +Operation operation = client.DeleteEnvironment(WaitUntil.Completed, "", "me", ""); ]]> -This sample shows how to call DeleteEnvironment with all parameters and parse the result. +This sample shows how to call DeleteEnvironment with all parameters. "); TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); -Operation operation = client.DeleteEnvironment(WaitUntil.Completed, "", "me", ""); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("name").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("resourceId").ToString()); -Console.WriteLine(result.GetProperty("startTime").ToString()); -Console.WriteLine(result.GetProperty("endTime").ToString()); -Console.WriteLine(result.GetProperty("percentComplete").ToString()); -Console.WriteLine(result.GetProperty("properties").ToString()); -Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); +Operation operation = client.DeleteEnvironment(WaitUntil.Completed, "", "me", ""); ]]> diff --git a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Docs/DevBoxesClient.xml b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Docs/DevBoxesClient.xml index 1bfc0e684d083..c8409a1a6875b 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Docs/DevBoxesClient.xml +++ b/sdk/devcenter/Azure.Developer.DevCenter/src/Generated/Docs/DevBoxesClient.xml @@ -1201,74 +1201,40 @@ Console.WriteLine(result.GetProperty("localAdministrator").ToString()); -This sample shows how to call DeleteDevBoxAsync and parse the result. +This sample shows how to call DeleteDevBoxAsync. "); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Operation operation = await client.DeleteDevBoxAsync(WaitUntil.Completed, "", "me", ""); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("status").ToString()); +Operation operation = await client.DeleteDevBoxAsync(WaitUntil.Completed, "", "me", ""); ]]> -This sample shows how to call DeleteDevBoxAsync with all parameters and parse the result. +This sample shows how to call DeleteDevBoxAsync with all parameters. "); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Operation operation = await client.DeleteDevBoxAsync(WaitUntil.Completed, "", "me", ""); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("name").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("resourceId").ToString()); -Console.WriteLine(result.GetProperty("startTime").ToString()); -Console.WriteLine(result.GetProperty("endTime").ToString()); -Console.WriteLine(result.GetProperty("percentComplete").ToString()); -Console.WriteLine(result.GetProperty("properties").ToString()); -Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); +Operation operation = await client.DeleteDevBoxAsync(WaitUntil.Completed, "", "me", ""); ]]> -This sample shows how to call DeleteDevBox and parse the result. +This sample shows how to call DeleteDevBox. "); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Operation operation = client.DeleteDevBox(WaitUntil.Completed, "", "me", ""); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("status").ToString()); +Operation operation = client.DeleteDevBox(WaitUntil.Completed, "", "me", ""); ]]> -This sample shows how to call DeleteDevBox with all parameters and parse the result. +This sample shows how to call DeleteDevBox with all parameters. "); TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); -Operation operation = client.DeleteDevBox(WaitUntil.Completed, "", "me", ""); -BinaryData responseData = operation.Value; - -JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; -Console.WriteLine(result.GetProperty("id").ToString()); -Console.WriteLine(result.GetProperty("name").ToString()); -Console.WriteLine(result.GetProperty("status").ToString()); -Console.WriteLine(result.GetProperty("resourceId").ToString()); -Console.WriteLine(result.GetProperty("startTime").ToString()); -Console.WriteLine(result.GetProperty("endTime").ToString()); -Console.WriteLine(result.GetProperty("percentComplete").ToString()); -Console.WriteLine(result.GetProperty("properties").ToString()); -Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); -Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); +Operation operation = client.DeleteDevBox(WaitUntil.Completed, "", "me", ""); ]]> diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/Generated/Samples/Samples_DeploymentEnvironmentsClient.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/Generated/Samples/Samples_DeploymentEnvironmentsClient.cs index 46a011a3fa19b..3b886e3b82b33 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/tests/Generated/Samples/Samples_DeploymentEnvironmentsClient.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/tests/Generated/Samples/Samples_DeploymentEnvironmentsClient.cs @@ -834,11 +834,7 @@ public void Example_DeleteEnvironment_ShortVersion() TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); - Operation operation = client.DeleteEnvironment(WaitUntil.Completed, "", "me", ""); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("status").ToString()); + Operation operation = client.DeleteEnvironment(WaitUntil.Completed, "", "me", ""); } [Test] @@ -849,11 +845,7 @@ public async Task Example_DeleteEnvironment_ShortVersion_Async() TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); - Operation operation = await client.DeleteEnvironmentAsync(WaitUntil.Completed, "", "me", ""); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("status").ToString()); + Operation operation = await client.DeleteEnvironmentAsync(WaitUntil.Completed, "", "me", ""); } [Test] @@ -864,20 +856,7 @@ public void Example_DeleteEnvironment_AllParameters() TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); - Operation operation = client.DeleteEnvironment(WaitUntil.Completed, "", "me", ""); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("resourceId").ToString()); - Console.WriteLine(result.GetProperty("startTime").ToString()); - Console.WriteLine(result.GetProperty("endTime").ToString()); - Console.WriteLine(result.GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("properties").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); + Operation operation = client.DeleteEnvironment(WaitUntil.Completed, "", "me", ""); } [Test] @@ -888,20 +867,7 @@ public async Task Example_DeleteEnvironment_AllParameters_Async() TokenCredential credential = new DefaultAzureCredential(); DeploymentEnvironmentsClient client = new DeploymentEnvironmentsClient(endpoint, credential); - Operation operation = await client.DeleteEnvironmentAsync(WaitUntil.Completed, "", "me", ""); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("resourceId").ToString()); - Console.WriteLine(result.GetProperty("startTime").ToString()); - Console.WriteLine(result.GetProperty("endTime").ToString()); - Console.WriteLine(result.GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("properties").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); + Operation operation = await client.DeleteEnvironmentAsync(WaitUntil.Completed, "", "me", ""); } } } diff --git a/sdk/devcenter/Azure.Developer.DevCenter/tests/Generated/Samples/Samples_DevBoxesClient.cs b/sdk/devcenter/Azure.Developer.DevCenter/tests/Generated/Samples/Samples_DevBoxesClient.cs index f90303ff7bd96..791e085dc799f 100644 --- a/sdk/devcenter/Azure.Developer.DevCenter/tests/Generated/Samples/Samples_DevBoxesClient.cs +++ b/sdk/devcenter/Azure.Developer.DevCenter/tests/Generated/Samples/Samples_DevBoxesClient.cs @@ -1314,11 +1314,7 @@ public void Example_DeleteDevBox_ShortVersion() TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Operation operation = client.DeleteDevBox(WaitUntil.Completed, "", "me", ""); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("status").ToString()); + Operation operation = client.DeleteDevBox(WaitUntil.Completed, "", "me", ""); } [Test] @@ -1329,11 +1325,7 @@ public async Task Example_DeleteDevBox_ShortVersion_Async() TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Operation operation = await client.DeleteDevBoxAsync(WaitUntil.Completed, "", "me", ""); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("status").ToString()); + Operation operation = await client.DeleteDevBoxAsync(WaitUntil.Completed, "", "me", ""); } [Test] @@ -1344,20 +1336,7 @@ public void Example_DeleteDevBox_AllParameters() TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Operation operation = client.DeleteDevBox(WaitUntil.Completed, "", "me", ""); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("resourceId").ToString()); - Console.WriteLine(result.GetProperty("startTime").ToString()); - Console.WriteLine(result.GetProperty("endTime").ToString()); - Console.WriteLine(result.GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("properties").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); + Operation operation = client.DeleteDevBox(WaitUntil.Completed, "", "me", ""); } [Test] @@ -1368,20 +1347,7 @@ public async Task Example_DeleteDevBox_AllParameters_Async() TokenCredential credential = new DefaultAzureCredential(); DevBoxesClient client = new DevBoxesClient(endpoint, credential); - Operation operation = await client.DeleteDevBoxAsync(WaitUntil.Completed, "", "me", ""); - BinaryData responseData = operation.Value; - - JsonElement result = JsonDocument.Parse(responseData.ToStream()).RootElement; - Console.WriteLine(result.GetProperty("id").ToString()); - Console.WriteLine(result.GetProperty("name").ToString()); - Console.WriteLine(result.GetProperty("status").ToString()); - Console.WriteLine(result.GetProperty("resourceId").ToString()); - Console.WriteLine(result.GetProperty("startTime").ToString()); - Console.WriteLine(result.GetProperty("endTime").ToString()); - Console.WriteLine(result.GetProperty("percentComplete").ToString()); - Console.WriteLine(result.GetProperty("properties").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("code").ToString()); - Console.WriteLine(result.GetProperty("error").GetProperty("message").ToString()); + Operation operation = await client.DeleteDevBoxAsync(WaitUntil.Completed, "", "me", ""); } [Test] diff --git a/sdk/healthinsights/Azure.Health.Insights.CancerProfiling/src/Generated/CancerProfilingClient.cs b/sdk/healthinsights/Azure.Health.Insights.CancerProfiling/src/Generated/CancerProfilingClient.cs index 368a01f697a4d..ec81d02271294 100644 --- a/sdk/healthinsights/Azure.Health.Insights.CancerProfiling/src/Generated/CancerProfilingClient.cs +++ b/sdk/healthinsights/Azure.Health.Insights.CancerProfiling/src/Generated/CancerProfilingClient.cs @@ -126,7 +126,7 @@ public virtual async Task> InferCancerProfileAsync(WaitUnt try { using HttpMessage message = CreateInferCancerProfileRequest(content, context); - return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "CancerProfilingClient.InferCancerProfile", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); + return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "CancerProfilingClient.InferCancerProfile", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); } catch (Exception e) { @@ -166,7 +166,7 @@ public virtual Operation InferCancerProfile(WaitUntil waitUntil, Req try { using HttpMessage message = CreateInferCancerProfileRequest(content, context); - return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "CancerProfilingClient.InferCancerProfile", OperationFinalStateVia.Location, context, waitUntil); + return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "CancerProfilingClient.InferCancerProfile", OperationFinalStateVia.OperationLocation, context, waitUntil); } catch (Exception e) { diff --git a/sdk/healthinsights/Azure.Health.Insights.ClinicalMatching/src/Generated/ClinicalMatchingClient.cs b/sdk/healthinsights/Azure.Health.Insights.ClinicalMatching/src/Generated/ClinicalMatchingClient.cs index 531050542978d..3358d415f7e38 100644 --- a/sdk/healthinsights/Azure.Health.Insights.ClinicalMatching/src/Generated/ClinicalMatchingClient.cs +++ b/sdk/healthinsights/Azure.Health.Insights.ClinicalMatching/src/Generated/ClinicalMatchingClient.cs @@ -126,7 +126,7 @@ public virtual async Task> MatchTrialsAsync(WaitUntil wait try { using HttpMessage message = CreateMatchTrialsRequest(content, context); - return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "ClinicalMatchingClient.MatchTrials", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); + return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "ClinicalMatchingClient.MatchTrials", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); } catch (Exception e) { @@ -166,7 +166,7 @@ public virtual Operation MatchTrials(WaitUntil waitUntil, RequestCon try { using HttpMessage message = CreateMatchTrialsRequest(content, context); - return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "ClinicalMatchingClient.MatchTrials", OperationFinalStateVia.Location, context, waitUntil); + return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "ClinicalMatchingClient.MatchTrials", OperationFinalStateVia.OperationLocation, context, waitUntil); } catch (Exception e) { diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/ImageGenerations.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/ImageGenerations.cs index 214865a4044c0..e1835fdc5741f 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Custom/ImageGenerations.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Custom/ImageGenerations.cs @@ -5,8 +5,10 @@ using System; using System.Collections.Generic; +using System.Linq; using System.Runtime.CompilerServices; using System.Text.Json; +using System.Xml.Linq; using Azure.Core; namespace Azure.AI.OpenAI @@ -32,5 +34,24 @@ internal static void DeserializeDataProperty(JsonProperty property, ref IReadOnl } data = array; } + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ImageGenerations FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content); + JsonElement element = document.RootElement; + foreach (var property in document.RootElement.EnumerateObject()) + { + if (property.NameEquals("result"u8)) + { + //we have the envelop and need to deserialize the inner object + //https://github.com/Azure/autorest.csharp/issues/3837 + element = property.Value; + break; + } + } + return DeserializeImageGenerations(element); + } } } diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/ImageSize.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/ImageSize.cs new file mode 100644 index 0000000000000..6adba31850efa --- /dev/null +++ b/sdk/openai/Azure.AI.OpenAI/src/Custom/ImageSize.cs @@ -0,0 +1,14 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +using System; + +namespace Azure.AI.OpenAI +{ + /// The desired size of the generated images. Must be one of 256x256, 512x512, or 1024x1024. + public readonly partial struct ImageSize : IEquatable + { + //Temp change need until we resolve usage issue. + //https://github.com/Azure/autorest.csharp/issues/3836 + } +} diff --git a/sdk/openai/Azure.AI.OpenAI/src/Custom/OpenAIClient.cs b/sdk/openai/Azure.AI.OpenAI/src/Custom/OpenAIClient.cs index a0badd30e9869..e46691d42ae88 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Custom/OpenAIClient.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Custom/OpenAIClient.cs @@ -603,16 +603,15 @@ public virtual Response GetImageGenerations( if (_isConfiguredForAzureOpenAI) { - Operation imagesOperation + Operation imagesOperation = BeginAzureBatchImageGeneration( WaitUntil.Completed, imageGenerationOptions, cancellationToken); rawResponse = imagesOperation.GetRawResponse(); - BatchImageGenerationOperationResponse operationResponse = imagesOperation.Value; - responseValue = operationResponse.Result; + responseValue = imagesOperation.Value; } else { @@ -663,7 +662,7 @@ public virtual async Task> GetImageGenerationsAsync( if (_isConfiguredForAzureOpenAI) { - Operation imagesOperation + Operation imagesOperation = await BeginAzureBatchImageGenerationAsync( WaitUntil.Completed, imageGenerationOptions, @@ -671,9 +670,8 @@ Operation imagesOperation .ConfigureAwait(false); rawResponse = imagesOperation.GetRawResponse(); - BatchImageGenerationOperationResponse operationResponse = imagesOperation.Value; - responseValue = operationResponse.Result; + responseValue = imagesOperation.Value; } else { diff --git a/sdk/openai/Azure.AI.OpenAI/src/Generated/ImageGenerations.Serialization.cs b/sdk/openai/Azure.AI.OpenAI/src/Generated/ImageGenerations.Serialization.cs index 551e28de47f32..34fdd3d1241c3 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Generated/ImageGenerations.Serialization.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Generated/ImageGenerations.Serialization.cs @@ -37,13 +37,5 @@ internal static ImageGenerations DeserializeImageGenerations(JsonElement element } return new ImageGenerations(created, data); } - - /// Deserializes the model from a raw response. - /// The response to deserialize the model from. - internal static ImageGenerations FromResponse(Response response) - { - using var document = JsonDocument.Parse(response.Content); - return DeserializeImageGenerations(document.RootElement); - } } } diff --git a/sdk/openai/Azure.AI.OpenAI/src/Generated/OpenAIClient.cs b/sdk/openai/Azure.AI.OpenAI/src/Generated/OpenAIClient.cs index e104ca9fd6819..9a5fee3ef669d 100644 --- a/sdk/openai/Azure.AI.OpenAI/src/Generated/OpenAIClient.cs +++ b/sdk/openai/Azure.AI.OpenAI/src/Generated/OpenAIClient.cs @@ -42,14 +42,14 @@ protected OpenAIClient() /// Represents the request data used to generate images. /// The cancellation token to use. /// is null. - internal virtual async Task> BeginAzureBatchImageGenerationAsync(WaitUntil waitUntil, ImageGenerationOptions imageGenerationOptions, CancellationToken cancellationToken = default) + internal virtual async Task> BeginAzureBatchImageGenerationAsync(WaitUntil waitUntil, ImageGenerationOptions imageGenerationOptions, CancellationToken cancellationToken = default) { Argument.AssertNotNull(imageGenerationOptions, nameof(imageGenerationOptions)); RequestContext context = FromCancellationToken(cancellationToken); using RequestContent content = imageGenerationOptions.ToRequestContent(); Operation response = await BeginAzureBatchImageGenerationAsync(waitUntil, content, context).ConfigureAwait(false); - return ProtocolOperationHelpers.Convert(response, BatchImageGenerationOperationResponse.FromResponse, ClientDiagnostics, "OpenAIClient.BeginAzureBatchImageGeneration"); + return ProtocolOperationHelpers.Convert(response, ImageGenerations.FromResponse, ClientDiagnostics, "OpenAIClient.BeginAzureBatchImageGeneration"); } /// Starts the generation of a batch of images from a text caption. @@ -57,14 +57,14 @@ internal virtual async Task> Be /// Represents the request data used to generate images. /// The cancellation token to use. /// is null. - internal virtual Operation BeginAzureBatchImageGeneration(WaitUntil waitUntil, ImageGenerationOptions imageGenerationOptions, CancellationToken cancellationToken = default) + internal virtual Operation BeginAzureBatchImageGeneration(WaitUntil waitUntil, ImageGenerationOptions imageGenerationOptions, CancellationToken cancellationToken = default) { Argument.AssertNotNull(imageGenerationOptions, nameof(imageGenerationOptions)); RequestContext context = FromCancellationToken(cancellationToken); using RequestContent content = imageGenerationOptions.ToRequestContent(); Operation response = BeginAzureBatchImageGeneration(waitUntil, content, context); - return ProtocolOperationHelpers.Convert(response, BatchImageGenerationOperationResponse.FromResponse, ClientDiagnostics, "OpenAIClient.BeginAzureBatchImageGeneration"); + return ProtocolOperationHelpers.Convert(response, ImageGenerations.FromResponse, ClientDiagnostics, "OpenAIClient.BeginAzureBatchImageGeneration"); } // The convenience method of this operation is made internal because this operation directly or indirectly uses a low confident type, for instance, unions, literal types with number values, etc. @@ -98,7 +98,7 @@ internal virtual async Task> BeginAzureBatchImageGeneratio try { using HttpMessage message = CreateBeginAzureBatchImageGenerationRequest(content, context); - return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "OpenAIClient.BeginAzureBatchImageGeneration", OperationFinalStateVia.Location, context, waitUntil).ConfigureAwait(false); + return await ProtocolOperationHelpers.ProcessMessageAsync(_pipeline, message, ClientDiagnostics, "OpenAIClient.BeginAzureBatchImageGeneration", OperationFinalStateVia.OperationLocation, context, waitUntil).ConfigureAwait(false); } catch (Exception e) { @@ -138,7 +138,7 @@ internal virtual Operation BeginAzureBatchImageGeneration(WaitUntil try { using HttpMessage message = CreateBeginAzureBatchImageGenerationRequest(content, context); - return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "OpenAIClient.BeginAzureBatchImageGeneration", OperationFinalStateVia.Location, context, waitUntil); + return ProtocolOperationHelpers.ProcessMessage(_pipeline, message, ClientDiagnostics, "OpenAIClient.BeginAzureBatchImageGeneration", OperationFinalStateVia.OperationLocation, context, waitUntil); } catch (Exception e) {