diff --git a/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs b/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs index fbc0fcac38ca..9fc36d2e4c4a 100644 --- a/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs +++ b/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/samples/Generated/Samples/Sample_SubscriptionResourceExtensions.cs @@ -6,6 +6,7 @@ #nullable disable using System; +using System.Text; using System.Threading.Tasks; using Azure.Core; using Azure.Identity; @@ -19,9 +20,9 @@ public partial class Sample_SubscriptionResourceExtensions { [Test] [Ignore("Only validating compilation of examples")] - public async Task SubmitVirtualMachineDeallocate_ScheduledActionsVirtualMachinesSubmitDeallocate() + public async Task SubmitVirtualMachineDeallocate_ScheduledActionsVirtualMachinesSubmitDeallocateMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { - // Generated from example definition: 2024-10-01/ScheduledActions_VirtualMachinesSubmitDeallocate.json + // Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesSubmitDeallocate_MaximumSet_Gen.json // this example is just showing the usage of "ScheduledActions_SubmitVirtualMachineDeallocate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -31,24 +32,27 @@ public async Task SubmitVirtualMachineDeallocate_ScheduledActionsVirtualMachines // this example assumes you already have this SubscriptionResource created on azure // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "D8E30CC0-2763-4FCC-84A8-3C5659281032"; + string subscriptionId = "0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F"; ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation - string locationparameter = "eastus2euap"; - SubmitDeallocateContent content = new SubmitDeallocateContent(new UserRequestSchedule(ScheduledActionDeadlineType.InitiateAt) + string locationparameter = "mqlftjjfnzubxpricsgstgjojaoah"; + SubmitDeallocateContent content = new SubmitDeallocateContent(new UserRequestSchedule(ScheduledActionDeadlineType.Unknown) { - Deadline = DateTimeOffset.Parse("2024-11-01T17:52:54.215Z"), - Timezone = "UTC", + Deadline = DateTimeOffset.Parse("2025-04-15T19:47:04.403Z"), + UserRequestDeadline = DateTimeOffset.Parse("2025-04-15T19:47:04.403Z"), + Timezone = "qacufsmctpgjozovlsihrzoctatcsj", + UserRequestTimezone = "upnmayfebiadztdktxzq", }, new ScheduledActionExecutionParameterDetail { + OptimizationPreference = ScheduledActionOptimizationPreference.Cost, RetryPolicy = new UserRequestRetryPolicy { - RetryCount = 4, - RetryWindowInMinutes = 27, + RetryCount = 25, + RetryWindowInMinutes = 4, }, - }, new UserRequestResources(new ResourceIdentifier[] { new ResourceIdentifier("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3") }), "23480d2f-1dca-4610-afb4-dd25eec1f34r"); + }, new UserRequestResources(new ResourceIdentifier[] { new ResourceIdentifier("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3") }), "evmwonebfzxenjdpucgcwdjdya"); DeallocateResourceOperationResult result = await subscriptionResource.SubmitVirtualMachineDeallocateAsync(locationparameter, content); Console.WriteLine($"Succeeded: {result}"); @@ -56,9 +60,35 @@ public async Task SubmitVirtualMachineDeallocate_ScheduledActionsVirtualMachines [Test] [Ignore("Only validating compilation of examples")] - public async Task SubmitVirtualMachineHibernate_ScheduledActionsVirtualMachinesSubmitHibernate() + public async Task SubmitVirtualMachineDeallocate_ScheduledActionsVirtualMachinesSubmitDeallocateMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() { - // Generated from example definition: 2024-10-01/ScheduledActions_VirtualMachinesSubmitHibernate.json + // Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesSubmitDeallocate_MinimumSet_Gen.json + // this example is just showing the usage of "ScheduledActions_SubmitVirtualMachineDeallocate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation + string locationparameter = "xrcabowpojl"; + SubmitDeallocateContent content = new SubmitDeallocateContent(new UserRequestSchedule(ScheduledActionDeadlineType.Unknown), new ScheduledActionExecutionParameterDetail(), new UserRequestResources(new ResourceIdentifier[] { new ResourceIdentifier("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3") }), "evmwonebfzxenjdpucgcwdjdya"); + DeallocateResourceOperationResult result = await subscriptionResource.SubmitVirtualMachineDeallocateAsync(locationparameter, content); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task SubmitVirtualMachineHibernate_ScheduledActionsVirtualMachinesSubmitHibernateMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() + { + // Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesSubmitHibernate_MaximumSet_Gen.json // this example is just showing the usage of "ScheduledActions_SubmitVirtualMachineHibernate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -68,24 +98,53 @@ public async Task SubmitVirtualMachineHibernate_ScheduledActionsVirtualMachinesS // this example assumes you already have this SubscriptionResource created on azure // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "D8E30CC0-2763-4FCC-84A8-3C5659281032"; + string subscriptionId = "0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F"; ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation - string locationparameter = "eastus2euap"; - SubmitHibernateContent content = new SubmitHibernateContent(new UserRequestSchedule(ScheduledActionDeadlineType.InitiateAt) + string locationparameter = "hiceqzwkjmijxdfw"; + SubmitHibernateContent content = new SubmitHibernateContent(new UserRequestSchedule(ScheduledActionDeadlineType.Unknown) { - Deadline = DateTimeOffset.Parse("2024-11-01T17:52:54.215Z"), - Timezone = "UTC", + Deadline = DateTimeOffset.Parse("2025-04-15T19:47:04.403Z"), + UserRequestDeadline = DateTimeOffset.Parse("2025-04-15T19:47:04.403Z"), + Timezone = "qacufsmctpgjozovlsihrzoctatcsj", + UserRequestTimezone = "upnmayfebiadztdktxzq", }, new ScheduledActionExecutionParameterDetail { + OptimizationPreference = ScheduledActionOptimizationPreference.Cost, RetryPolicy = new UserRequestRetryPolicy { - RetryCount = 2, - RetryWindowInMinutes = 27, + RetryCount = 25, + RetryWindowInMinutes = 4, }, - }, new UserRequestResources(new ResourceIdentifier[] { new ResourceIdentifier("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3") }), "23480d2f-1dca-4610-afb4-dd25eec1f34r"); + }, new UserRequestResources(new ResourceIdentifier[] { new ResourceIdentifier("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3") }), "htqivutynuoslvbp"); + HibernateResourceOperationResult result = await subscriptionResource.SubmitVirtualMachineHibernateAsync(locationparameter, content); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task SubmitVirtualMachineHibernate_ScheduledActionsVirtualMachinesSubmitHibernateMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() + { + // Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesSubmitHibernate_MinimumSet_Gen.json + // this example is just showing the usage of "ScheduledActions_SubmitVirtualMachineHibernate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation + string locationparameter = "jsbmestfaqxxejcgrs"; + SubmitHibernateContent content = new SubmitHibernateContent(new UserRequestSchedule(ScheduledActionDeadlineType.Unknown), new ScheduledActionExecutionParameterDetail(), new UserRequestResources(new ResourceIdentifier[] { new ResourceIdentifier("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3") }), "htqivutynuoslvbp"); HibernateResourceOperationResult result = await subscriptionResource.SubmitVirtualMachineHibernateAsync(locationparameter, content); Console.WriteLine($"Succeeded: {result}"); @@ -93,9 +152,9 @@ public async Task SubmitVirtualMachineHibernate_ScheduledActionsVirtualMachinesS [Test] [Ignore("Only validating compilation of examples")] - public async Task SubmitVirtualMachineStart_ScheduledActionsVirtualMachinesSubmitStart() + public async Task SubmitVirtualMachineStart_ScheduledActionsVirtualMachinesSubmitStartMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { - // Generated from example definition: 2024-10-01/ScheduledActions_VirtualMachinesSubmitStart.json + // Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesSubmitStart_MaximumSet_Gen.json // this example is just showing the usage of "ScheduledActions_SubmitVirtualMachineStart" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -105,24 +164,27 @@ public async Task SubmitVirtualMachineStart_ScheduledActionsVirtualMachinesSubmi // this example assumes you already have this SubscriptionResource created on azure // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "D8E30CC0-2763-4FCC-84A8-3C5659281032"; + string subscriptionId = "0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F"; ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation - string locationparameter = "eastus2euap"; - SubmitStartContent content = new SubmitStartContent(new UserRequestSchedule(ScheduledActionDeadlineType.InitiateAt) + string locationparameter = "klvdoznxekrxhuvgeels"; + SubmitStartContent content = new SubmitStartContent(new UserRequestSchedule(ScheduledActionDeadlineType.Unknown) { - Deadline = DateTimeOffset.Parse("2024-11-01T17:52:54.215Z"), - Timezone = "UTC", + Deadline = DateTimeOffset.Parse("2025-04-15T19:47:04.403Z"), + UserRequestDeadline = DateTimeOffset.Parse("2025-04-15T19:47:04.403Z"), + Timezone = "qacufsmctpgjozovlsihrzoctatcsj", + UserRequestTimezone = "upnmayfebiadztdktxzq", }, new ScheduledActionExecutionParameterDetail { + OptimizationPreference = ScheduledActionOptimizationPreference.Cost, RetryPolicy = new UserRequestRetryPolicy { - RetryCount = 5, - RetryWindowInMinutes = 27, + RetryCount = 25, + RetryWindowInMinutes = 4, }, - }, new UserRequestResources(new ResourceIdentifier[] { new ResourceIdentifier("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3") }), "23480d2f-1dca-4610-afb4-dd25eec1f34r"); + }, new UserRequestResources(new ResourceIdentifier[] { new ResourceIdentifier("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3") }), "bvmpxvbd"); StartResourceOperationResult result = await subscriptionResource.SubmitVirtualMachineStartAsync(locationparameter, content); Console.WriteLine($"Succeeded: {result}"); @@ -130,9 +192,35 @@ public async Task SubmitVirtualMachineStart_ScheduledActionsVirtualMachinesSubmi [Test] [Ignore("Only validating compilation of examples")] - public async Task ExecuteVirtualMachineDeallocate_ScheduledActionsVirtualMachinesExecuteDeallocate() + public async Task SubmitVirtualMachineStart_ScheduledActionsVirtualMachinesSubmitStartMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() { - // Generated from example definition: 2024-10-01/ScheduledActions_VirtualMachinesExecuteDeallocate.json + // Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesSubmitStart_MinimumSet_Gen.json + // this example is just showing the usage of "ScheduledActions_SubmitVirtualMachineStart" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation + string locationparameter = "rbsdwsfprygqqwqhwapovusm"; + SubmitStartContent content = new SubmitStartContent(new UserRequestSchedule(ScheduledActionDeadlineType.Unknown), new ScheduledActionExecutionParameterDetail(), new UserRequestResources(new ResourceIdentifier[] { new ResourceIdentifier("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3") }), "bvmpxvbd"); + StartResourceOperationResult result = await subscriptionResource.SubmitVirtualMachineStartAsync(locationparameter, content); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task ExecuteVirtualMachineDeallocate_ScheduledActionsVirtualMachinesExecuteDeallocateMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() + { + // Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesExecuteDeallocate_MaximumSet_Gen.json // this example is just showing the usage of "ScheduledActions_ExecuteVirtualMachineDeallocate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -142,20 +230,21 @@ public async Task ExecuteVirtualMachineDeallocate_ScheduledActionsVirtualMachine // this example assumes you already have this SubscriptionResource created on azure // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "D8E30CC0-2763-4FCC-84A8-3C5659281032"; + string subscriptionId = "0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F"; ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation - string locationparameter = "eastus2euap"; + string locationparameter = "ykpowbmjexmsv"; ExecuteDeallocateContent content = new ExecuteDeallocateContent(new ScheduledActionExecutionParameterDetail { + OptimizationPreference = ScheduledActionOptimizationPreference.Cost, RetryPolicy = new UserRequestRetryPolicy { - RetryCount = 4, - RetryWindowInMinutes = 27, + RetryCount = 25, + RetryWindowInMinutes = 4, }, - }, new UserRequestResources(new ResourceIdentifier[] { new ResourceIdentifier("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3") }), "23480d2f-1dca-4610-afb4-dd25eec1f34r"); + }, new UserRequestResources(new ResourceIdentifier[] { new ResourceIdentifier("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3") }), "dsszhmrdsczkv"); DeallocateResourceOperationResult result = await subscriptionResource.ExecuteVirtualMachineDeallocateAsync(locationparameter, content); Console.WriteLine($"Succeeded: {result}"); @@ -163,9 +252,35 @@ public async Task ExecuteVirtualMachineDeallocate_ScheduledActionsVirtualMachine [Test] [Ignore("Only validating compilation of examples")] - public async Task ExecuteVirtualMachineHibernate_ScheduledActionsVirtualMachinesExecuteHibernate() + public async Task ExecuteVirtualMachineDeallocate_ScheduledActionsVirtualMachinesExecuteDeallocateMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() { - // Generated from example definition: 2024-10-01/ScheduledActions_VirtualMachinesExecuteHibernate.json + // Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesExecuteDeallocate_MinimumSet_Gen.json + // this example is just showing the usage of "ScheduledActions_ExecuteVirtualMachineDeallocate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation + string locationparameter = "bfldnxffvllwvqa"; + ExecuteDeallocateContent content = new ExecuteDeallocateContent(new ScheduledActionExecutionParameterDetail(), new UserRequestResources(new ResourceIdentifier[] { new ResourceIdentifier("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3") }), "dsszhmrdsczkv"); + DeallocateResourceOperationResult result = await subscriptionResource.ExecuteVirtualMachineDeallocateAsync(locationparameter, content); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task ExecuteVirtualMachineHibernate_ScheduledActionsVirtualMachinesExecuteHibernateMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() + { + // Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesExecuteHibernate_MaximumSet_Gen.json // this example is just showing the usage of "ScheduledActions_ExecuteVirtualMachineHibernate" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -175,20 +290,47 @@ public async Task ExecuteVirtualMachineHibernate_ScheduledActionsVirtualMachines // this example assumes you already have this SubscriptionResource created on azure // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "D8E30CC0-2763-4FCC-84A8-3C5659281032"; + string subscriptionId = "0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F"; ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation - string locationparameter = "eastus2euap"; + string locationparameter = "aojgnzdqrphhygchir"; ExecuteHibernateContent content = new ExecuteHibernateContent(new ScheduledActionExecutionParameterDetail { + OptimizationPreference = ScheduledActionOptimizationPreference.Cost, RetryPolicy = new UserRequestRetryPolicy { - RetryCount = 5, - RetryWindowInMinutes = 27, + RetryCount = 25, + RetryWindowInMinutes = 4, }, - }, new UserRequestResources(new ResourceIdentifier[] { new ResourceIdentifier("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3") }), "23480d2f-1dca-4610-afb4-dd25eec1f34r"); + }, new UserRequestResources(new ResourceIdentifier[] { new ResourceIdentifier("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3") }), "jmdiz"); + HibernateResourceOperationResult result = await subscriptionResource.ExecuteVirtualMachineHibernateAsync(locationparameter, content); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task ExecuteVirtualMachineHibernate_ScheduledActionsVirtualMachinesExecuteHibernateMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() + { + // Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesExecuteHibernate_MinimumSet_Gen.json + // this example is just showing the usage of "ScheduledActions_ExecuteVirtualMachineHibernate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation + string locationparameter = "gmflbqliyjrhmrjvqrxrgocbxzjr"; + ExecuteHibernateContent content = new ExecuteHibernateContent(new ScheduledActionExecutionParameterDetail(), new UserRequestResources(new ResourceIdentifier[] { new ResourceIdentifier("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3") }), "jmdiz"); HibernateResourceOperationResult result = await subscriptionResource.ExecuteVirtualMachineHibernateAsync(locationparameter, content); Console.WriteLine($"Succeeded: {result}"); @@ -196,9 +338,9 @@ public async Task ExecuteVirtualMachineHibernate_ScheduledActionsVirtualMachines [Test] [Ignore("Only validating compilation of examples")] - public async Task ExecuteVirtualMachineStart_ScheduledActionsVirtualMachinesExecuteStart() + public async Task ExecuteVirtualMachineStart_ScheduledActionsVirtualMachinesExecuteStartMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() { - // Generated from example definition: 2024-10-01/ScheduledActions_VirtualMachinesExecuteStart.json + // Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesExecuteStart_MaximumSet_Gen.json // this example is just showing the usage of "ScheduledActions_ExecuteVirtualMachineStart" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -208,20 +350,21 @@ public async Task ExecuteVirtualMachineStart_ScheduledActionsVirtualMachinesExec // this example assumes you already have this SubscriptionResource created on azure // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "D8E30CC0-2763-4FCC-84A8-3C5659281032"; + string subscriptionId = "0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F"; ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation - string locationparameter = "eastus2euap"; + string locationparameter = "jwybvpf"; ExecuteStartContent content = new ExecuteStartContent(new ScheduledActionExecutionParameterDetail { + OptimizationPreference = ScheduledActionOptimizationPreference.Cost, RetryPolicy = new UserRequestRetryPolicy { - RetryCount = 2, - RetryWindowInMinutes = 27, + RetryCount = 25, + RetryWindowInMinutes = 4, }, - }, new UserRequestResources(new ResourceIdentifier[] { new ResourceIdentifier("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3") }), "23480d2f-1dca-4610-afb4-dd25eec1f34r"); + }, new UserRequestResources(new ResourceIdentifier[] { new ResourceIdentifier("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3") }), "vwpcrwowcfgjuwnxzvvdma"); StartResourceOperationResult result = await subscriptionResource.ExecuteVirtualMachineStartAsync(locationparameter, content); Console.WriteLine($"Succeeded: {result}"); @@ -229,9 +372,167 @@ public async Task ExecuteVirtualMachineStart_ScheduledActionsVirtualMachinesExec [Test] [Ignore("Only validating compilation of examples")] - public async Task GetVirtualMachineOperationStatus_ScheduledActionsVirtualMachinesGetOperationStatus() + public async Task ExecuteVirtualMachineStart_ScheduledActionsVirtualMachinesExecuteStartMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() { - // Generated from example definition: 2024-10-01/ScheduledActions_VirtualMachinesGetOperationStatus.json + // Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesExecuteStart_MinimumSet_Gen.json + // this example is just showing the usage of "ScheduledActions_ExecuteVirtualMachineStart" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation + string locationparameter = "ksfzuak"; + ExecuteStartContent content = new ExecuteStartContent(new ScheduledActionExecutionParameterDetail(), new UserRequestResources(new ResourceIdentifier[] { new ResourceIdentifier("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3") }), "vwpcrwowcfgjuwnxzvvdma"); + StartResourceOperationResult result = await subscriptionResource.ExecuteVirtualMachineStartAsync(locationparameter, content); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task VirtualMachinesExecuteCreateScheduledAction_ScheduledActionsVirtualMachinesExecuteCreateMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() + { + // Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesExecuteCreate_MaximumSet_Gen.json + // this example is just showing the usage of "ScheduledActions_VirtualMachinesExecuteCreate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation + string locationparameter = "nxbiupqfkijjq"; + ExecuteCreateContent content = new ExecuteCreateContent(new ResourceProvisionPayload(28) + { + BaseProfile = Encoding.UTF8.GetBytes("TG9yZW0gaXBzdW0gZG9sb3Igc2l0IGFtZXQ="), + ResourceOverrides = { Encoding.UTF8.GetBytes("Y29uc2VjdGV0dXIgYWRpcGlzY2luZyBlbGl0"), Encoding.UTF8.GetBytes("c2VkIGRvIGVpdXNtb2QgdGVtcG9yIGluY2lkaWR1bnQ=") }, + ResourcePrefix = "rqlxavviucrxfjj", + }, new ScheduledActionExecutionParameterDetail + { + OptimizationPreference = ScheduledActionOptimizationPreference.Cost, + RetryPolicy = new UserRequestRetryPolicy + { + RetryCount = 25, + RetryWindowInMinutes = 4, + }, + }) + { + Correlationid = "erpswvxajdpqgxfpgmzy", + }; + CreateResourceOperationResponse result = await subscriptionResource.VirtualMachinesExecuteCreateScheduledActionAsync(locationparameter, content); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task VirtualMachinesExecuteCreateScheduledAction_ScheduledActionsVirtualMachinesExecuteCreateMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() + { + // Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesExecuteCreate_MinimumSet_Gen.json + // this example is just showing the usage of "ScheduledActions_VirtualMachinesExecuteCreate" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation + string locationparameter = "aiqyytlqsikciuxzocihxb"; + ExecuteCreateContent content = new ExecuteCreateContent(new ResourceProvisionPayload(28), new ScheduledActionExecutionParameterDetail()); + CreateResourceOperationResponse result = await subscriptionResource.VirtualMachinesExecuteCreateScheduledActionAsync(locationparameter, content); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task VirtualMachinesExecuteDeleteScheduledAction_ScheduledActionsVirtualMachinesExecuteDeleteMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() + { + // Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesExecuteDelete_MaximumSet_Gen.json + // this example is just showing the usage of "ScheduledActions_VirtualMachinesExecuteDelete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation + string locationparameter = "yrngwxkxxxbifqyc"; + ExecuteDeleteContent content = new ExecuteDeleteContent(new ScheduledActionExecutionParameterDetail + { + OptimizationPreference = ScheduledActionOptimizationPreference.Cost, + RetryPolicy = new UserRequestRetryPolicy + { + RetryCount = 25, + RetryWindowInMinutes = 4, + }, + }, new UserRequestResources(new ResourceIdentifier[] { new ResourceIdentifier("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3") })) + { + Correlationid = "lgxsiioaybtjexssjzw", + ForceDeletion = true, + }; + DeleteResourceOperationResponse result = await subscriptionResource.VirtualMachinesExecuteDeleteScheduledActionAsync(locationparameter, content); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task VirtualMachinesExecuteDeleteScheduledAction_ScheduledActionsVirtualMachinesExecuteDeleteMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() + { + // Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesExecuteDelete_MinimumSet_Gen.json + // this example is just showing the usage of "ScheduledActions_VirtualMachinesExecuteDelete" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation + string locationparameter = "urzqnogieubgnjsyadipeyqegdomtm"; + ExecuteDeleteContent content = new ExecuteDeleteContent(new ScheduledActionExecutionParameterDetail(), new UserRequestResources(new ResourceIdentifier[] { new ResourceIdentifier("/subscriptions/YourSubscriptionId/resourceGroups/YourResourceGroupName/providers/Microsoft.Compute/virtualMachines/testResource3") })); + DeleteResourceOperationResponse result = await subscriptionResource.VirtualMachinesExecuteDeleteScheduledActionAsync(locationparameter, content); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetVirtualMachineOperationStatus_ScheduledActionsVirtualMachinesGetOperationStatusMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() + { + // Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesGetOperationStatus_MaximumSet_Gen.json // this example is just showing the usage of "ScheduledActions_GetVirtualMachineOperationStatus" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -241,13 +542,13 @@ public async Task GetVirtualMachineOperationStatus_ScheduledActionsVirtualMachin // this example assumes you already have this SubscriptionResource created on azure // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "D8E30CC0-2763-4FCC-84A8-3C5659281032"; + string subscriptionId = "0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F"; ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation - string locationparameter = "eastus2euap"; - GetOperationStatusContent content = new GetOperationStatusContent(new string[] { "23480d2f-1dca-4610-afb4-dd25eec1f34r" }, "35780d2f-1dca-4610-afb4-dd25eec1f34r"); + string locationparameter = "xzbxygykutmvmxpfowdai"; + GetOperationStatusContent content = new GetOperationStatusContent(new string[] { "hswzfrierpxdgcuu" }, "jtlszorevrftvfhnqoxlwpiwcbmj"); GetOperationStatusResult result = await subscriptionResource.GetVirtualMachineOperationStatusAsync(locationparameter, content); Console.WriteLine($"Succeeded: {result}"); @@ -255,9 +556,35 @@ public async Task GetVirtualMachineOperationStatus_ScheduledActionsVirtualMachin [Test] [Ignore("Only validating compilation of examples")] - public async Task CancelVirtualMachineOperations_ScheduledActionsVirtualMachinesCancelOperations() + public async Task GetVirtualMachineOperationStatus_ScheduledActionsVirtualMachinesGetOperationStatusMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() { - // Generated from example definition: 2024-10-01/ScheduledActions_VirtualMachinesCancelOperations.json + // Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesGetOperationStatus_MinimumSet_Gen.json + // this example is just showing the usage of "ScheduledActions_GetVirtualMachineOperationStatus" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation + string locationparameter = "egz"; + GetOperationStatusContent content = new GetOperationStatusContent(new string[] { "hswzfrierpxdgcuu" }, "jtlszorevrftvfhnqoxlwpiwcbmj"); + GetOperationStatusResult result = await subscriptionResource.GetVirtualMachineOperationStatusAsync(locationparameter, content); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task CancelVirtualMachineOperations_ScheduledActionsVirtualMachinesCancelOperationsMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() + { + // Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesCancelOperations_MaximumSet_Gen.json // this example is just showing the usage of "ScheduledActions_CancelVirtualMachineOperations" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -267,13 +594,13 @@ public async Task CancelVirtualMachineOperations_ScheduledActionsVirtualMachines // this example assumes you already have this SubscriptionResource created on azure // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "D8E30CC0-2763-4FCC-84A8-3C5659281032"; + string subscriptionId = "0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F"; ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation - string locationparameter = "eastus2euap"; - CancelOperationsContent content = new CancelOperationsContent(new string[] { "23480d2f-1dca-4610-afb4-dd25eec1f34r" }, "23480d2f-1dca-4610-afb4-gg25eec1f34r"); + string locationparameter = "hwrogamrxmqmbhyksvvbpge"; + CancelOperationsContent content = new CancelOperationsContent(new string[] { "rcudibq" }, "lacjacfbxixdmg"); CancelOperationsResult result = await subscriptionResource.CancelVirtualMachineOperationsAsync(locationparameter, content); Console.WriteLine($"Succeeded: {result}"); @@ -281,9 +608,61 @@ public async Task CancelVirtualMachineOperations_ScheduledActionsVirtualMachines [Test] [Ignore("Only validating compilation of examples")] - public async Task GetVirtualMachineOperationErrors_ScheduledActionsVirtualMachinesGetOperationErrors() + public async Task CancelVirtualMachineOperations_ScheduledActionsVirtualMachinesCancelOperationsMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() + { + // Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesCancelOperations_MinimumSet_Gen.json + // this example is just showing the usage of "ScheduledActions_CancelVirtualMachineOperations" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation + string locationparameter = "pitwczrefdkzfrpphvbqrvbavgnfxl"; + CancelOperationsContent content = new CancelOperationsContent(new string[] { "rcudibq" }, "lacjacfbxixdmg"); + CancelOperationsResult result = await subscriptionResource.CancelVirtualMachineOperationsAsync(locationparameter, content); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetVirtualMachineOperationErrors_ScheduledActionsVirtualMachinesGetOperationErrorsMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMaximumSetRule() + { + // Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesGetOperationErrors_MaximumSet_Gen.json + // this example is just showing the usage of "ScheduledActions_GetVirtualMachineOperationErrors" operation, for the dependent resources, they will have to be created separately. + + // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line + TokenCredential cred = new DefaultAzureCredential(); + // authenticate your client + ArmClient client = new ArmClient(cred); + + // this example assumes you already have this SubscriptionResource created on azure + // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource + string subscriptionId = "0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F"; + ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); + SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); + + // invoke the operation + string locationparameter = "paluwjjcxtjeozpoxrnstls"; + GetOperationErrorsContent content = new GetOperationErrorsContent(new string[] { "ksufjznokhsbowdupyt" }); + GetOperationErrorsResult result = await subscriptionResource.GetVirtualMachineOperationErrorsAsync(locationparameter, content); + + Console.WriteLine($"Succeeded: {result}"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task GetVirtualMachineOperationErrors_ScheduledActionsVirtualMachinesGetOperationErrorsMaximumSetGenGeneratedByMaximumSetRuleGeneratedByMaximumSetRuleGeneratedByMinimumSetRule() { - // Generated from example definition: 2024-10-01/ScheduledActions_VirtualMachinesGetOperationErrors.json + // Generated from example definition: 2025-05-01/ScheduledActions_VirtualMachinesGetOperationErrors_MinimumSet_Gen.json // this example is just showing the usage of "ScheduledActions_GetVirtualMachineOperationErrors" operation, for the dependent resources, they will have to be created separately. // get your azure access token, for more details of how Azure SDK get your access token, please refer to https://learn.microsoft.com/en-us/dotnet/azure/sdk/authentication?tabs=command-line @@ -293,13 +672,13 @@ public async Task GetVirtualMachineOperationErrors_ScheduledActionsVirtualMachin // this example assumes you already have this SubscriptionResource created on azure // for more information of creating SubscriptionResource, please refer to the document of SubscriptionResource - string subscriptionId = "D8E30CC0-2763-4FCC-84A8-3C5659281032"; + string subscriptionId = "0505D8E4-D41A-48FB-9CA5-4AF8D93BE75F"; ResourceIdentifier subscriptionResourceId = SubscriptionResource.CreateResourceIdentifier(subscriptionId); SubscriptionResource subscriptionResource = client.GetSubscriptionResource(subscriptionResourceId); // invoke the operation - string locationparameter = "eastus2euap"; - GetOperationErrorsContent content = new GetOperationErrorsContent(new string[] { "23480d2f-1dca-4610-afb4-dd25eec1f34r" }); + string locationparameter = "nqwtkslhoamsmxucgbljcz"; + GetOperationErrorsContent content = new GetOperationErrorsContent(new string[] { "ksufjznokhsbowdupyt" }); GetOperationErrorsResult result = await subscriptionResource.GetVirtualMachineOperationErrorsAsync(locationparameter, content); Console.WriteLine($"Succeeded: {result}"); diff --git a/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/ArmComputeScheduleModelFactory.cs b/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/ArmComputeScheduleModelFactory.cs index f90d6dc03e9c..d5d21f6ac81b 100644 --- a/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/ArmComputeScheduleModelFactory.cs +++ b/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/ArmComputeScheduleModelFactory.cs @@ -124,6 +124,68 @@ public static StartResourceOperationResult StartResourceOperationResult(string d return new StartResourceOperationResult(description, resourceType, location, results?.ToList(), serializedAdditionalRawData: null); } + /// Initializes a new instance of . + /// resource creation payload. + /// The execution parameters for the request. + /// CorrelationId item. + /// A new instance for mocking. + public static ExecuteCreateContent ExecuteCreateContent(ResourceProvisionPayload resourceConfigParameters = null, ScheduledActionExecutionParameterDetail executionParameters = null, string correlationid = null) + { + return new ExecuteCreateContent(resourceConfigParameters, executionParameters, correlationid, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// baseProfile, Resource properties that common across all resources. + /// resourceOverrides, properties per resource that needs to be overwritted from baseProfile. + /// Number of resources to be created. + /// if resourceOverrides doesn't contain "name", service will create name based of prefix and ResourceCount e.g. resourceprefix-0,resourceprefix-1.. + /// A new instance for mocking. + public static ResourceProvisionPayload ResourceProvisionPayload(byte[] baseProfile = null, IEnumerable resourceOverrides = null, int resourceCount = default, string resourcePrefix = null) + { + resourceOverrides ??= new List(); + + return new ResourceProvisionPayload(baseProfile, resourceOverrides?.ToList(), resourceCount, resourcePrefix, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The description of the operation response. + /// The type of resources used in the create request eg virtual machines. + /// The location of the start request eg westus. + /// The results from the start request if no errors exist. + /// A new instance for mocking. + public static CreateResourceOperationResponse CreateResourceOperationResponse(string description = null, string type = null, AzureLocation location = default, IEnumerable results = null) + { + results ??= new List(); + + return new CreateResourceOperationResponse(description, type, location, results?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The execution parameters for the request. + /// The resources for the request. + /// CorrelationId item. + /// Forced delete resource item. + /// A new instance for mocking. + public static ExecuteDeleteContent ExecuteDeleteContent(ScheduledActionExecutionParameterDetail executionParameters = null, IEnumerable resourcesIds = null, string correlationid = null, bool? forceDeletion = null) + { + resourcesIds ??= new List(); + + return new ExecuteDeleteContent(executionParameters, resourcesIds != null ? new UserRequestResources(resourcesIds?.ToList(), serializedAdditionalRawData: null) : null, correlationid, forceDeletion, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The description of the operation response. + /// The type of resources used in the delete request eg virtual machines. + /// The location of the start request eg westus. + /// The results from the start request if no errors exist. + /// A new instance for mocking. + public static DeleteResourceOperationResponse DeleteResourceOperationResponse(string description = null, string type = null, AzureLocation location = default, IEnumerable results = null) + { + results ??= new List(); + + return new DeleteResourceOperationResponse(description, type, location, results?.ToList(), serializedAdditionalRawData: null); + } + /// Initializes a new instance of . /// An array of resource operations based on their operation ids. /// A new instance for mocking. diff --git a/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Extensions/ComputeScheduleExtensions.cs b/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Extensions/ComputeScheduleExtensions.cs index 599f4b22f17e..3787938a4b04 100644 --- a/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Extensions/ComputeScheduleExtensions.cs +++ b/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Extensions/ComputeScheduleExtensions.cs @@ -35,7 +35,7 @@ private static MockableComputeScheduleSubscriptionResource GetMockableComputeSch /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -69,7 +69,7 @@ public static async Task> SubmitVirt /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -103,7 +103,7 @@ public static Response SubmitVirtualMachineDe /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -137,7 +137,7 @@ public static async Task> SubmitVirtu /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -171,7 +171,7 @@ public static Response SubmitVirtualMachineHib /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -205,7 +205,7 @@ public static async Task> SubmitVirtualMa /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -239,7 +239,7 @@ public static Response SubmitVirtualMachineStart(t /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -273,7 +273,7 @@ public static async Task> ExecuteVir /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -307,7 +307,7 @@ public static Response ExecuteVirtualMachineD /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -341,7 +341,7 @@ public static async Task> ExecuteVirt /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -375,7 +375,7 @@ public static Response ExecuteVirtualMachineHi /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -409,7 +409,7 @@ public static async Task> ExecuteVirtualM /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -430,6 +430,142 @@ public static Response ExecuteVirtualMachineStart( return GetMockableComputeScheduleSubscriptionResource(subscriptionResource).ExecuteVirtualMachineStart(locationparameter, content, cancellationToken); } + /// + /// VirtualMachinesExecuteCreate: Execute create operation for a batch of virtual machines, this operation is triggered as soon as Computeschedule receives it. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteCreate + /// + /// + /// Operation Id + /// ScheduledActions_VirtualMachinesExecuteCreate + /// + /// + /// Default Api Version + /// 2025-05-01 + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The location name. + /// The request body. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// , or is null. + public static async Task> VirtualMachinesExecuteCreateScheduledActionAsync(this SubscriptionResource subscriptionResource, string locationparameter, ExecuteCreateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return await GetMockableComputeScheduleSubscriptionResource(subscriptionResource).VirtualMachinesExecuteCreateScheduledActionAsync(locationparameter, content, cancellationToken).ConfigureAwait(false); + } + + /// + /// VirtualMachinesExecuteCreate: Execute create operation for a batch of virtual machines, this operation is triggered as soon as Computeschedule receives it. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteCreate + /// + /// + /// Operation Id + /// ScheduledActions_VirtualMachinesExecuteCreate + /// + /// + /// Default Api Version + /// 2025-05-01 + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The location name. + /// The request body. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// , or is null. + public static Response VirtualMachinesExecuteCreateScheduledAction(this SubscriptionResource subscriptionResource, string locationparameter, ExecuteCreateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableComputeScheduleSubscriptionResource(subscriptionResource).VirtualMachinesExecuteCreateScheduledAction(locationparameter, content, cancellationToken); + } + + /// + /// VirtualMachinesExecuteDelete: Execute delete operation for a batch of virtual machines, this operation is triggered as soon as Computeschedule receives it. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteDelete + /// + /// + /// Operation Id + /// ScheduledActions_VirtualMachinesExecuteDelete + /// + /// + /// Default Api Version + /// 2025-05-01 + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The location name. + /// The request body. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// , or is null. + public static async Task> VirtualMachinesExecuteDeleteScheduledActionAsync(this SubscriptionResource subscriptionResource, string locationparameter, ExecuteDeleteContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return await GetMockableComputeScheduleSubscriptionResource(subscriptionResource).VirtualMachinesExecuteDeleteScheduledActionAsync(locationparameter, content, cancellationToken).ConfigureAwait(false); + } + + /// + /// VirtualMachinesExecuteDelete: Execute delete operation for a batch of virtual machines, this operation is triggered as soon as Computeschedule receives it. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteDelete + /// + /// + /// Operation Id + /// ScheduledActions_VirtualMachinesExecuteDelete + /// + /// + /// Default Api Version + /// 2025-05-01 + /// + /// + /// + /// Mocking + /// To mock this method, please mock instead. + /// + /// + /// The instance the method will execute against. + /// The location name. + /// The request body. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// , or is null. + public static Response VirtualMachinesExecuteDeleteScheduledAction(this SubscriptionResource subscriptionResource, string locationparameter, ExecuteDeleteContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(subscriptionResource, nameof(subscriptionResource)); + + return GetMockableComputeScheduleSubscriptionResource(subscriptionResource).VirtualMachinesExecuteDeleteScheduledAction(locationparameter, content, cancellationToken); + } + /// /// VirtualMachinesGetOperationStatus: Polling endpoint to read status of operations performed on virtual machines /// @@ -443,7 +579,7 @@ public static Response ExecuteVirtualMachineStart( /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -477,7 +613,7 @@ public static async Task> GetVirtualMachineOp /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -511,7 +647,7 @@ public static Response GetVirtualMachineOperationStatu /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -545,7 +681,7 @@ public static async Task> CancelVirtualMachineO /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -579,7 +715,7 @@ public static Response CancelVirtualMachineOperations(th /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -613,7 +749,7 @@ public static async Task> GetVirtualMachineOp /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// diff --git a/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Extensions/MockableComputeScheduleSubscriptionResource.cs b/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Extensions/MockableComputeScheduleSubscriptionResource.cs index e25fb1608042..a29245c62dfa 100644 --- a/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Extensions/MockableComputeScheduleSubscriptionResource.cs +++ b/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Extensions/MockableComputeScheduleSubscriptionResource.cs @@ -54,7 +54,7 @@ private string GetApiVersionOrNull(ResourceType resourceType) /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -95,7 +95,7 @@ public virtual async Task> SubmitVir /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -136,7 +136,7 @@ public virtual Response SubmitVirtualMachineD /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -177,7 +177,7 @@ public virtual async Task> SubmitVirt /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -218,7 +218,7 @@ public virtual Response SubmitVirtualMachineHi /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -259,7 +259,7 @@ public virtual async Task> SubmitVirtualM /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -300,7 +300,7 @@ public virtual Response SubmitVirtualMachineStart( /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -341,7 +341,7 @@ public virtual async Task> ExecuteVi /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -382,7 +382,7 @@ public virtual Response ExecuteVirtualMachine /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -423,7 +423,7 @@ public virtual async Task> ExecuteVir /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -464,7 +464,7 @@ public virtual Response ExecuteVirtualMachineH /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -505,7 +505,7 @@ public virtual async Task> ExecuteVirtual /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -533,6 +533,170 @@ public virtual Response ExecuteVirtualMachineStart } } + /// + /// VirtualMachinesExecuteCreate: Execute create operation for a batch of virtual machines, this operation is triggered as soon as Computeschedule receives it. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteCreate + /// + /// + /// Operation Id + /// ScheduledActions_VirtualMachinesExecuteCreate + /// + /// + /// Default Api Version + /// 2025-05-01 + /// + /// + /// + /// The location name. + /// The request body. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> VirtualMachinesExecuteCreateScheduledActionAsync(string locationparameter, ExecuteCreateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(locationparameter, nameof(locationparameter)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ScheduledActionsClientDiagnostics.CreateScope("MockableComputeScheduleSubscriptionResource.VirtualMachinesExecuteCreateScheduledAction"); + scope.Start(); + try + { + var response = await ScheduledActionsRestClient.VirtualMachinesExecuteCreateAsync(Id.SubscriptionId, locationparameter, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// VirtualMachinesExecuteCreate: Execute create operation for a batch of virtual machines, this operation is triggered as soon as Computeschedule receives it. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteCreate + /// + /// + /// Operation Id + /// ScheduledActions_VirtualMachinesExecuteCreate + /// + /// + /// Default Api Version + /// 2025-05-01 + /// + /// + /// + /// The location name. + /// The request body. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual Response VirtualMachinesExecuteCreateScheduledAction(string locationparameter, ExecuteCreateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(locationparameter, nameof(locationparameter)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ScheduledActionsClientDiagnostics.CreateScope("MockableComputeScheduleSubscriptionResource.VirtualMachinesExecuteCreateScheduledAction"); + scope.Start(); + try + { + var response = ScheduledActionsRestClient.VirtualMachinesExecuteCreate(Id.SubscriptionId, locationparameter, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// VirtualMachinesExecuteDelete: Execute delete operation for a batch of virtual machines, this operation is triggered as soon as Computeschedule receives it. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteDelete + /// + /// + /// Operation Id + /// ScheduledActions_VirtualMachinesExecuteDelete + /// + /// + /// Default Api Version + /// 2025-05-01 + /// + /// + /// + /// The location name. + /// The request body. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual async Task> VirtualMachinesExecuteDeleteScheduledActionAsync(string locationparameter, ExecuteDeleteContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(locationparameter, nameof(locationparameter)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ScheduledActionsClientDiagnostics.CreateScope("MockableComputeScheduleSubscriptionResource.VirtualMachinesExecuteDeleteScheduledAction"); + scope.Start(); + try + { + var response = await ScheduledActionsRestClient.VirtualMachinesExecuteDeleteAsync(Id.SubscriptionId, locationparameter, content, cancellationToken).ConfigureAwait(false); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// VirtualMachinesExecuteDelete: Execute delete operation for a batch of virtual machines, this operation is triggered as soon as Computeschedule receives it. + /// + /// + /// Request Path + /// /subscriptions/{subscriptionId}/providers/Microsoft.ComputeSchedule/locations/{locationparameter}/virtualMachinesExecuteDelete + /// + /// + /// Operation Id + /// ScheduledActions_VirtualMachinesExecuteDelete + /// + /// + /// Default Api Version + /// 2025-05-01 + /// + /// + /// + /// The location name. + /// The request body. + /// The cancellation token to use. + /// is an empty string, and was expected to be non-empty. + /// or is null. + public virtual Response VirtualMachinesExecuteDeleteScheduledAction(string locationparameter, ExecuteDeleteContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(locationparameter, nameof(locationparameter)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ScheduledActionsClientDiagnostics.CreateScope("MockableComputeScheduleSubscriptionResource.VirtualMachinesExecuteDeleteScheduledAction"); + scope.Start(); + try + { + var response = ScheduledActionsRestClient.VirtualMachinesExecuteDelete(Id.SubscriptionId, locationparameter, content, cancellationToken); + return response; + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + /// /// VirtualMachinesGetOperationStatus: Polling endpoint to read status of operations performed on virtual machines /// @@ -546,7 +710,7 @@ public virtual Response ExecuteVirtualMachineStart /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -587,7 +751,7 @@ public virtual async Task> GetVirtualMachineO /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -628,7 +792,7 @@ public virtual Response GetVirtualMachineOperationStat /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -669,7 +833,7 @@ public virtual async Task> CancelVirtualMachine /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -710,7 +874,7 @@ public virtual Response CancelVirtualMachineOperations(s /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// @@ -751,7 +915,7 @@ public virtual async Task> GetVirtualMachineO /// /// /// Default Api Version - /// 2024-10-01 + /// 2025-05-01 /// /// /// diff --git a/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Models/CreateResourceOperationResponse.Serialization.cs b/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Models/CreateResourceOperationResponse.Serialization.cs new file mode 100644 index 000000000000..42e94a2fde7e --- /dev/null +++ b/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Models/CreateResourceOperationResponse.Serialization.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ComputeSchedule.Models +{ + public partial class CreateResourceOperationResponse : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CreateResourceOperationResponse)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + if (Optional.IsCollectionDefined(Results)) + { + writer.WritePropertyName("results"u8); + writer.WriteStartArray(); + foreach (var item in Results) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CreateResourceOperationResponse IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CreateResourceOperationResponse)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCreateResourceOperationResponse(document.RootElement, options); + } + + internal static CreateResourceOperationResponse DeserializeCreateResourceOperationResponse(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string description = default; + string type = default; + AzureLocation location = default; + IReadOnlyList results = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("results"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ResourceOperationResult.DeserializeResourceOperationResult(item, options)); + } + results = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CreateResourceOperationResponse(description, type, location, results ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerComputeScheduleContext.Default); + default: + throw new FormatException($"The model {nameof(CreateResourceOperationResponse)} does not support writing '{options.Format}' format."); + } + } + + CreateResourceOperationResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCreateResourceOperationResponse(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CreateResourceOperationResponse)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Models/CreateResourceOperationResponse.cs b/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Models/CreateResourceOperationResponse.cs new file mode 100644 index 000000000000..40116e07a07b --- /dev/null +++ b/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Models/CreateResourceOperationResponse.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ComputeSchedule.Models +{ + /// The response from a create request. + public partial class CreateResourceOperationResponse + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The description of the operation response. + /// The type of resources used in the create request eg virtual machines. + /// The location of the start request eg westus. + /// or is null. + internal CreateResourceOperationResponse(string description, string type, AzureLocation location) + { + Argument.AssertNotNull(description, nameof(description)); + Argument.AssertNotNull(type, nameof(type)); + + Description = description; + Type = type; + Location = location; + Results = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The description of the operation response. + /// The type of resources used in the create request eg virtual machines. + /// The location of the start request eg westus. + /// The results from the start request if no errors exist. + /// Keeps track of any properties unknown to the library. + internal CreateResourceOperationResponse(string description, string type, AzureLocation location, IReadOnlyList results, IDictionary serializedAdditionalRawData) + { + Description = description; + Type = type; + Location = location; + Results = results; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CreateResourceOperationResponse() + { + } + + /// The description of the operation response. + public string Description { get; } + /// The type of resources used in the create request eg virtual machines. + public string Type { get; } + /// The location of the start request eg westus. + public AzureLocation Location { get; } + /// The results from the start request if no errors exist. + public IReadOnlyList Results { get; } + } +} diff --git a/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Models/DeleteResourceOperationResponse.Serialization.cs b/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Models/DeleteResourceOperationResponse.Serialization.cs new file mode 100644 index 000000000000..262ac41f930b --- /dev/null +++ b/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Models/DeleteResourceOperationResponse.Serialization.cs @@ -0,0 +1,167 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ComputeSchedule.Models +{ + public partial class DeleteResourceOperationResponse : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DeleteResourceOperationResponse)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("description"u8); + writer.WriteStringValue(Description); + writer.WritePropertyName("type"u8); + writer.WriteStringValue(Type); + writer.WritePropertyName("location"u8); + writer.WriteStringValue(Location); + if (Optional.IsCollectionDefined(Results)) + { + writer.WritePropertyName("results"u8); + writer.WriteStartArray(); + foreach (var item in Results) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + DeleteResourceOperationResponse IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DeleteResourceOperationResponse)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDeleteResourceOperationResponse(document.RootElement, options); + } + + internal static DeleteResourceOperationResponse DeserializeDeleteResourceOperationResponse(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string description = default; + string type = default; + AzureLocation location = default; + IReadOnlyList results = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("description"u8)) + { + description = property.Value.GetString(); + continue; + } + if (property.NameEquals("type"u8)) + { + type = property.Value.GetString(); + continue; + } + if (property.NameEquals("location"u8)) + { + location = new AzureLocation(property.Value.GetString()); + continue; + } + if (property.NameEquals("results"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ResourceOperationResult.DeserializeResourceOperationResult(item, options)); + } + results = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DeleteResourceOperationResponse(description, type, location, results ?? new ChangeTrackingList(), serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerComputeScheduleContext.Default); + default: + throw new FormatException($"The model {nameof(DeleteResourceOperationResponse)} does not support writing '{options.Format}' format."); + } + } + + DeleteResourceOperationResponse IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDeleteResourceOperationResponse(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DeleteResourceOperationResponse)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Models/DeleteResourceOperationResponse.cs b/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Models/DeleteResourceOperationResponse.cs new file mode 100644 index 000000000000..d6baeb12254b --- /dev/null +++ b/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Models/DeleteResourceOperationResponse.cs @@ -0,0 +1,94 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ComputeSchedule.Models +{ + /// The response from a delete request. + public partial class DeleteResourceOperationResponse + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The description of the operation response. + /// The type of resources used in the delete request eg virtual machines. + /// The location of the start request eg westus. + /// or is null. + internal DeleteResourceOperationResponse(string description, string type, AzureLocation location) + { + Argument.AssertNotNull(description, nameof(description)); + Argument.AssertNotNull(type, nameof(type)); + + Description = description; + Type = type; + Location = location; + Results = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The description of the operation response. + /// The type of resources used in the delete request eg virtual machines. + /// The location of the start request eg westus. + /// The results from the start request if no errors exist. + /// Keeps track of any properties unknown to the library. + internal DeleteResourceOperationResponse(string description, string type, AzureLocation location, IReadOnlyList results, IDictionary serializedAdditionalRawData) + { + Description = description; + Type = type; + Location = location; + Results = results; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal DeleteResourceOperationResponse() + { + } + + /// The description of the operation response. + public string Description { get; } + /// The type of resources used in the delete request eg virtual machines. + public string Type { get; } + /// The location of the start request eg westus. + public AzureLocation Location { get; } + /// The results from the start request if no errors exist. + public IReadOnlyList Results { get; } + } +} diff --git a/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Models/ExecuteCreateContent.Serialization.cs b/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Models/ExecuteCreateContent.Serialization.cs new file mode 100644 index 000000000000..4202a5d8c820 --- /dev/null +++ b/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Models/ExecuteCreateContent.Serialization.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ComputeSchedule.Models +{ + public partial class ExecuteCreateContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExecuteCreateContent)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("resourceConfigParameters"u8); + writer.WriteObjectValue(ResourceConfigParameters, options); + writer.WritePropertyName("executionParameters"u8); + writer.WriteObjectValue(ExecutionParameters, options); + if (Optional.IsDefined(Correlationid)) + { + writer.WritePropertyName("correlationid"u8); + writer.WriteStringValue(Correlationid); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ExecuteCreateContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExecuteCreateContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeExecuteCreateContent(document.RootElement, options); + } + + internal static ExecuteCreateContent DeserializeExecuteCreateContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ResourceProvisionPayload resourceConfigParameters = default; + ScheduledActionExecutionParameterDetail executionParameters = default; + string correlationid = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("resourceConfigParameters"u8)) + { + resourceConfigParameters = ResourceProvisionPayload.DeserializeResourceProvisionPayload(property.Value, options); + continue; + } + if (property.NameEquals("executionParameters"u8)) + { + executionParameters = ScheduledActionExecutionParameterDetail.DeserializeScheduledActionExecutionParameterDetail(property.Value, options); + continue; + } + if (property.NameEquals("correlationid"u8)) + { + correlationid = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ExecuteCreateContent(resourceConfigParameters, executionParameters, correlationid, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerComputeScheduleContext.Default); + default: + throw new FormatException($"The model {nameof(ExecuteCreateContent)} does not support writing '{options.Format}' format."); + } + } + + ExecuteCreateContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeExecuteCreateContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ExecuteCreateContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Models/ExecuteCreateContent.cs b/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Models/ExecuteCreateContent.cs new file mode 100644 index 000000000000..0a93b41900f6 --- /dev/null +++ b/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Models/ExecuteCreateContent.cs @@ -0,0 +1,86 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ComputeSchedule.Models +{ + /// The ExecuteCreateRequest request for create operations. + public partial class ExecuteCreateContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// resource creation payload. + /// The execution parameters for the request. + /// or is null. + public ExecuteCreateContent(ResourceProvisionPayload resourceConfigParameters, ScheduledActionExecutionParameterDetail executionParameters) + { + Argument.AssertNotNull(resourceConfigParameters, nameof(resourceConfigParameters)); + Argument.AssertNotNull(executionParameters, nameof(executionParameters)); + + ResourceConfigParameters = resourceConfigParameters; + ExecutionParameters = executionParameters; + } + + /// Initializes a new instance of . + /// resource creation payload. + /// The execution parameters for the request. + /// CorrelationId item. + /// Keeps track of any properties unknown to the library. + internal ExecuteCreateContent(ResourceProvisionPayload resourceConfigParameters, ScheduledActionExecutionParameterDetail executionParameters, string correlationid, IDictionary serializedAdditionalRawData) + { + ResourceConfigParameters = resourceConfigParameters; + ExecutionParameters = executionParameters; + Correlationid = correlationid; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ExecuteCreateContent() + { + } + + /// resource creation payload. + public ResourceProvisionPayload ResourceConfigParameters { get; } + /// The execution parameters for the request. + public ScheduledActionExecutionParameterDetail ExecutionParameters { get; } + /// CorrelationId item. + public string Correlationid { get; set; } + } +} diff --git a/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Models/ExecuteDeleteContent.Serialization.cs b/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Models/ExecuteDeleteContent.Serialization.cs new file mode 100644 index 000000000000..a74dfb659658 --- /dev/null +++ b/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Models/ExecuteDeleteContent.Serialization.cs @@ -0,0 +1,160 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ComputeSchedule.Models +{ + public partial class ExecuteDeleteContent : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExecuteDeleteContent)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("executionParameters"u8); + writer.WriteObjectValue(ExecutionParameters, options); + writer.WritePropertyName("resources"u8); + writer.WriteObjectValue(Resources, options); + if (Optional.IsDefined(Correlationid)) + { + writer.WritePropertyName("correlationid"u8); + writer.WriteStringValue(Correlationid); + } + if (Optional.IsDefined(ForceDeletion)) + { + writer.WritePropertyName("forceDeletion"u8); + writer.WriteBooleanValue(ForceDeletion.Value); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ExecuteDeleteContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExecuteDeleteContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeExecuteDeleteContent(document.RootElement, options); + } + + internal static ExecuteDeleteContent DeserializeExecuteDeleteContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ScheduledActionExecutionParameterDetail executionParameters = default; + UserRequestResources resources = default; + string correlationid = default; + bool? forceDeletion = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("executionParameters"u8)) + { + executionParameters = ScheduledActionExecutionParameterDetail.DeserializeScheduledActionExecutionParameterDetail(property.Value, options); + continue; + } + if (property.NameEquals("resources"u8)) + { + resources = UserRequestResources.DeserializeUserRequestResources(property.Value, options); + continue; + } + if (property.NameEquals("correlationid"u8)) + { + correlationid = property.Value.GetString(); + continue; + } + if (property.NameEquals("forceDeletion"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + forceDeletion = property.Value.GetBoolean(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ExecuteDeleteContent(executionParameters, resources, correlationid, forceDeletion, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerComputeScheduleContext.Default); + default: + throw new FormatException($"The model {nameof(ExecuteDeleteContent)} does not support writing '{options.Format}' format."); + } + } + + ExecuteDeleteContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeExecuteDeleteContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ExecuteDeleteContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Models/ExecuteDeleteContent.cs b/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Models/ExecuteDeleteContent.cs new file mode 100644 index 000000000000..ee74c1e3a193 --- /dev/null +++ b/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Models/ExecuteDeleteContent.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using Azure.Core; + +namespace Azure.ResourceManager.ComputeSchedule.Models +{ + /// The ExecuteDeleteRequest request for delete operations. + public partial class ExecuteDeleteContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The execution parameters for the request. + /// The resources for the request. + /// or is null. + public ExecuteDeleteContent(ScheduledActionExecutionParameterDetail executionParameters, UserRequestResources resources) + { + Argument.AssertNotNull(executionParameters, nameof(executionParameters)); + Argument.AssertNotNull(resources, nameof(resources)); + + ExecutionParameters = executionParameters; + Resources = resources; + } + + /// Initializes a new instance of . + /// The execution parameters for the request. + /// The resources for the request. + /// CorrelationId item. + /// Forced delete resource item. + /// Keeps track of any properties unknown to the library. + internal ExecuteDeleteContent(ScheduledActionExecutionParameterDetail executionParameters, UserRequestResources resources, string correlationid, bool? forceDeletion, IDictionary serializedAdditionalRawData) + { + ExecutionParameters = executionParameters; + Resources = resources; + Correlationid = correlationid; + ForceDeletion = forceDeletion; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ExecuteDeleteContent() + { + } + + /// The execution parameters for the request. + public ScheduledActionExecutionParameterDetail ExecutionParameters { get; } + /// The resources for the request. + internal UserRequestResources Resources { get; } + /// The resource ids used for the request. + public IList ResourcesIds + { + get => Resources?.Ids; + } + + /// CorrelationId item. + public string Correlationid { get; set; } + /// Forced delete resource item. + public bool? ForceDeletion { get; set; } + } +} diff --git a/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Models/ResourceProvisionPayload.Serialization.cs b/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Models/ResourceProvisionPayload.Serialization.cs new file mode 100644 index 000000000000..0e8fe372b330 --- /dev/null +++ b/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Models/ResourceProvisionPayload.Serialization.cs @@ -0,0 +1,177 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.ResourceManager.ComputeSchedule.Models +{ + public partial class ResourceProvisionPayload : IUtf8JsonSerializable, IJsonModel + { + void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); + + void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ResourceProvisionPayload)} does not support writing '{format}' format."); + } + + if (Optional.IsDefined(BaseProfile)) + { + writer.WritePropertyName("baseProfile"u8); + writer.WriteBase64StringValue(BaseProfile, "D"); + } + if (Optional.IsCollectionDefined(ResourceOverrides)) + { + writer.WritePropertyName("resourceOverrides"u8); + writer.WriteStartArray(); + foreach (var item in ResourceOverrides) + { + writer.WriteBase64StringValue(item, "D"); + } + writer.WriteEndArray(); + } + writer.WritePropertyName("resourceCount"u8); + writer.WriteNumberValue(ResourceCount); + if (Optional.IsDefined(ResourcePrefix)) + { + writer.WritePropertyName("resourcePrefix"u8); + writer.WriteStringValue(ResourcePrefix); + } + if (options.Format != "W" && _serializedAdditionalRawData != null) + { + foreach (var item in _serializedAdditionalRawData) + { + writer.WritePropertyName(item.Key); +#if NET6_0_OR_GREATER + writer.WriteRawValue(item.Value); +#else + using (JsonDocument document = JsonDocument.Parse(item.Value, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ResourceProvisionPayload IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ResourceProvisionPayload)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeResourceProvisionPayload(document.RootElement, options); + } + + internal static ResourceProvisionPayload DeserializeResourceProvisionPayload(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + byte[] baseProfile = default; + IList resourceOverrides = default; + int resourceCount = default; + string resourcePrefix = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("baseProfile"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + baseProfile = property.Value.GetBytesFromBase64("D"); + continue; + } + if (property.NameEquals("resourceOverrides"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetBytesFromBase64("D")); + } + resourceOverrides = array; + continue; + } + if (property.NameEquals("resourceCount"u8)) + { + resourceCount = property.Value.GetInt32(); + continue; + } + if (property.NameEquals("resourcePrefix"u8)) + { + resourcePrefix = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ResourceProvisionPayload(baseProfile, resourceOverrides ?? new ChangeTrackingList(), resourceCount, resourcePrefix, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options, AzureResourceManagerComputeScheduleContext.Default); + default: + throw new FormatException($"The model {nameof(ResourceProvisionPayload)} does not support writing '{options.Format}' format."); + } + } + + ResourceProvisionPayload IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeResourceProvisionPayload(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ResourceProvisionPayload)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + } +} diff --git a/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Models/ResourceProvisionPayload.cs b/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Models/ResourceProvisionPayload.cs new file mode 100644 index 000000000000..e3f2086e18ff --- /dev/null +++ b/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/Models/ResourceProvisionPayload.cs @@ -0,0 +1,85 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.ResourceManager.ComputeSchedule.Models +{ + /// Resource creation data model. + public partial class ResourceProvisionPayload + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Number of resources to be created. + public ResourceProvisionPayload(int resourceCount) + { + ResourceOverrides = new ChangeTrackingList(); + ResourceCount = resourceCount; + } + + /// Initializes a new instance of . + /// baseProfile, Resource properties that common across all resources. + /// resourceOverrides, properties per resource that needs to be overwritted from baseProfile. + /// Number of resources to be created. + /// if resourceOverrides doesn't contain "name", service will create name based of prefix and ResourceCount e.g. resourceprefix-0,resourceprefix-1.. + /// Keeps track of any properties unknown to the library. + internal ResourceProvisionPayload(byte[] baseProfile, IList resourceOverrides, int resourceCount, string resourcePrefix, IDictionary serializedAdditionalRawData) + { + BaseProfile = baseProfile; + ResourceOverrides = resourceOverrides; + ResourceCount = resourceCount; + ResourcePrefix = resourcePrefix; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ResourceProvisionPayload() + { + } + + /// baseProfile, Resource properties that common across all resources. + public byte[] BaseProfile { get; set; } + /// resourceOverrides, properties per resource that needs to be overwritted from baseProfile. + public IList ResourceOverrides { get; } + /// Number of resources to be created. + public int ResourceCount { get; } + /// if resourceOverrides doesn't contain "name", service will create name based of prefix and ResourceCount e.g. resourceprefix-0,resourceprefix-1.. + public string ResourcePrefix { get; set; } + } +} diff --git a/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/RestOperations/ScheduledActionsRestOperations.cs b/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/RestOperations/ScheduledActionsRestOperations.cs index f97f477230fb..7c3ed991000c 100644 --- a/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/RestOperations/ScheduledActionsRestOperations.cs +++ b/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/src/Generated/RestOperations/ScheduledActionsRestOperations.cs @@ -32,7 +32,7 @@ public ScheduledActionsRestOperations(HttpPipeline pipeline, string applicationI { _pipeline = pipeline ?? throw new ArgumentNullException(nameof(pipeline)); _endpoint = endpoint ?? new Uri("https://management.azure.com"); - _apiVersion = apiVersion ?? "2024-10-01"; + _apiVersion = apiVersion ?? "2025-05-01"; _userAgent = new TelemetryDetails(GetType().Assembly, applicationId); } @@ -600,6 +600,194 @@ public Response ExecuteVirtualMachineStart(string } } + internal RequestUriBuilder CreateVirtualMachinesExecuteCreateRequestUri(string subscriptionId, string locationparameter, ExecuteCreateContent content) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.ComputeSchedule/locations/", false); + uri.AppendPath(locationparameter, true); + uri.AppendPath("/virtualMachinesExecuteCreate", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateVirtualMachinesExecuteCreateRequest(string subscriptionId, string locationparameter, ExecuteCreateContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.ComputeSchedule/locations/", false); + uri.AppendPath(locationparameter, true); + uri.AppendPath("/virtualMachinesExecuteCreate", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// VirtualMachinesExecuteCreate: Execute create operation for a batch of virtual machines, this operation is triggered as soon as Computeschedule receives it. + /// The ID of the target subscription. The value must be an UUID. + /// The location name. + /// The request body. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> VirtualMachinesExecuteCreateAsync(string subscriptionId, string locationparameter, ExecuteCreateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(locationparameter, nameof(locationparameter)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateVirtualMachinesExecuteCreateRequest(subscriptionId, locationparameter, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + CreateResourceOperationResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = CreateResourceOperationResponse.DeserializeCreateResourceOperationResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// VirtualMachinesExecuteCreate: Execute create operation for a batch of virtual machines, this operation is triggered as soon as Computeschedule receives it. + /// The ID of the target subscription. The value must be an UUID. + /// The location name. + /// The request body. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response VirtualMachinesExecuteCreate(string subscriptionId, string locationparameter, ExecuteCreateContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(locationparameter, nameof(locationparameter)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateVirtualMachinesExecuteCreateRequest(subscriptionId, locationparameter, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + CreateResourceOperationResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = CreateResourceOperationResponse.DeserializeCreateResourceOperationResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + internal RequestUriBuilder CreateVirtualMachinesExecuteDeleteRequestUri(string subscriptionId, string locationparameter, ExecuteDeleteContent content) + { + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.ComputeSchedule/locations/", false); + uri.AppendPath(locationparameter, true); + uri.AppendPath("/virtualMachinesExecuteDelete", false); + uri.AppendQuery("api-version", _apiVersion, true); + return uri; + } + + internal HttpMessage CreateVirtualMachinesExecuteDeleteRequest(string subscriptionId, string locationparameter, ExecuteDeleteContent content) + { + var message = _pipeline.CreateMessage(); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/subscriptions/", false); + uri.AppendPath(subscriptionId, true); + uri.AppendPath("/providers/Microsoft.ComputeSchedule/locations/", false); + uri.AppendPath(locationparameter, true); + uri.AppendPath("/virtualMachinesExecuteDelete", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + var content0 = new Utf8JsonRequestContent(); + content0.JsonWriter.WriteObjectValue(content, ModelSerializationExtensions.WireOptions); + request.Content = content0; + _userAgent.Apply(message); + return message; + } + + /// VirtualMachinesExecuteDelete: Execute delete operation for a batch of virtual machines, this operation is triggered as soon as Computeschedule receives it. + /// The ID of the target subscription. The value must be an UUID. + /// The location name. + /// The request body. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public async Task> VirtualMachinesExecuteDeleteAsync(string subscriptionId, string locationparameter, ExecuteDeleteContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(locationparameter, nameof(locationparameter)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateVirtualMachinesExecuteDeleteRequest(subscriptionId, locationparameter, content); + await _pipeline.SendAsync(message, cancellationToken).ConfigureAwait(false); + switch (message.Response.Status) + { + case 200: + { + DeleteResourceOperationResponse value = default; + using var document = await JsonDocument.ParseAsync(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions, cancellationToken).ConfigureAwait(false); + value = DeleteResourceOperationResponse.DeserializeDeleteResourceOperationResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + + /// VirtualMachinesExecuteDelete: Execute delete operation for a batch of virtual machines, this operation is triggered as soon as Computeschedule receives it. + /// The ID of the target subscription. The value must be an UUID. + /// The location name. + /// The request body. + /// The cancellation token to use. + /// , or is null. + /// or is an empty string, and was expected to be non-empty. + public Response VirtualMachinesExecuteDelete(string subscriptionId, string locationparameter, ExecuteDeleteContent content, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(subscriptionId, nameof(subscriptionId)); + Argument.AssertNotNullOrEmpty(locationparameter, nameof(locationparameter)); + Argument.AssertNotNull(content, nameof(content)); + + using var message = CreateVirtualMachinesExecuteDeleteRequest(subscriptionId, locationparameter, content); + _pipeline.Send(message, cancellationToken); + switch (message.Response.Status) + { + case 200: + { + DeleteResourceOperationResponse value = default; + using var document = JsonDocument.Parse(message.Response.ContentStream, ModelSerializationExtensions.JsonDocumentOptions); + value = DeleteResourceOperationResponse.DeserializeDeleteResourceOperationResponse(document.RootElement); + return Response.FromValue(value, message.Response); + } + default: + throw new RequestFailedException(message.Response); + } + } + internal RequestUriBuilder CreateGetVirtualMachineOperationStatusRequestUri(string subscriptionId, string locationparameter, GetOperationStatusContent content) { var uri = new RawRequestUriBuilder(); diff --git a/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/tsp-location.yaml b/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/tsp-location.yaml index a1e8be2a82fb..78aba01d2fec 100644 --- a/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/tsp-location.yaml +++ b/sdk/computeschedule/Azure.ResourceManager.ComputeSchedule/tsp-location.yaml @@ -1,3 +1,4 @@ directory: specification/computeschedule/ComputeSchedule.Management -commit: 462574dbd02088c209bb1da3eef0d93f699e8de2 -repo: Azure/azure-rest-api-specs \ No newline at end of file +commit: 88d4bd5b8ba24d0a1ea4c1fdd0e19820201d242a +repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/storage/ci.yml b/sdk/storage/ci.yml index 2ca0501b60bd..4e749e6b85b1 100644 --- a/sdk/storage/ci.yml +++ b/sdk/storage/ci.yml @@ -12,6 +12,8 @@ trigger: - sdk/storage/Azure.Storage.DataMovement/ - sdk/storage/Azure.Storage.DataMovement.Blobs/ - sdk/storage/Azure.Storage.DataMovement.Files/ + exclude: + - sdk/storage/Azure.ResourceManager.Storage/ - sdk/storage/Azure.Storage.DataMovement.Blobs.Files.Shares/ exclude: - sdk/storage/Azure.ResourceManager.Storage/